/* ==========================================================================
   THIEN HA THU THANH - AI GRAPHIC UI SYSTEM (5 LAYERS)
   Khong ve de len icon <img> co san. Khong dung SVG gia lap khung.
   ========================================================================== */
:root {
  --thq-gold: #D9A441;
  --thq-gold-hi: #FFD36A;
  --thq-bronze: #59331E;
  --thq-ink: #11131B;
  --thq-navy: #1B2436;
  --thq-crimson: #A52D24;
  --thq-ivory: #E8D8B7;
  --thq-ivory-hi: #FFF2D2;
  --thq-muted: #A99E89;
}

/* LOP 1: NEN CHE MODAL (Tich hop hinh nen AI khi file da co trong assets/ui/background/) */
#thq-drawer, #thq-guide-modal, #thq-stage-modal,
#km-modal, #vc-modal, #dg-modal, #acc-modal,
#pb-modal, #dl-modal, #eco-modal, #war-modal,
#evo-modal, #pvp-modal, #ret-modal, .pvp-res-ov {
  background: rgba(8, 10, 16, 0.84) !important;
}

body.thq-ai-bg-std #thq-drawer,
body.thq-ai-bg-std #acc-modal,
body.thq-ai-bg-std #ret-modal,
body.thq-ai-bg-std #dl-modal {
  background:
    linear-gradient(180deg, rgba(10, 13, 22, 0.72), rgba(8, 10, 16, 0.86)),
    url("../ui/background/bg-fortress-wuxia.jpg") center / cover no-repeat !important;
}

body.thq-ai-bg-pvp #pvp-modal,
body.thq-ai-bg-pvp #war-modal {
  background:
    linear-gradient(180deg, rgba(16, 10, 14, 0.72), rgba(8, 10, 16, 0.88)),
    url("../ui/background/bg-pvp-siege.jpg") center / cover no-repeat !important;
}

/* LOP 2: KHUNG CUA SO (Dung anh khung AI border-image 9-slice khi da tai ve) */
.thq-d-box, .thq-g-box, .stnav-box, .km-box, .vc-box, .dg-box,
.acc-box, .pb-box, .dl-box, .eco-box, .war-box, .evo-box,
.pvp-box, .pvp-res-box, .ret-box {
  color: var(--thq-ivory) !important;
  background: #141926 !important;
  border: 1.5px solid rgba(217, 164, 65, 0.60) !important;
  border-radius: 12px !important;
  box-shadow: 0 20px 54px rgba(0, 0, 0, 0.84) !important;
  contain: layout style;
  box-sizing: border-box !important;
}

body.thq-ai-frame-std .thq-d-box,
body.thq-ai-frame-std .thq-g-box,
body.thq-ai-frame-std .stnav-box,
body.thq-ai-frame-std .km-box,
body.thq-ai-frame-std .vc-box,
body.thq-ai-frame-std .dg-box,
body.thq-ai-frame-std .acc-box,
body.thq-ai-frame-std .pb-box,
body.thq-ai-frame-std .dl-box,
body.thq-ai-frame-std .eco-box,
body.thq-ai-frame-std .evo-box,
body.thq-ai-frame-std .ret-box {
  border: 14px solid transparent !important;
  border-image-source: url("../ui/frames/frame-modal-imperial.png") !important;
  border-image-slice: 17% 14% fill !important;
  border-image-repeat: stretch !important;
  border-radius: 0 !important;
  background-color: #11131B !important;
}

body.thq-ai-frame-pvp .pvp-box,
body.thq-ai-frame-pvp .pvp-res-box,
body.thq-ai-frame-pvp .war-box {
  border: 14px solid transparent !important;
  border-image-source: url("../ui/frames/frame-pvp-war.png") !important;
  border-image-slice: 17% 14% fill !important;
  border-image-repeat: stretch !important;
  border-radius: 0 !important;
  background-color: #11131B !important;
}

/* LOP 3: KHUNG O VAT PHAM / TRANG BI AI */
body.thq-ai-frame-slot .pb-slot,
body.thq-ai-frame-slot .pb-bitem,
body.thq-ai-frame-slot .ret-day,
body.thq-ai-frame-slot .thq-tile {
  background: url("../ui/frames/frame-item-slot.png") center / 100% 100% no-repeat !important;
}

/* Tieu de & Header: sach, khong bao gio bi goc che chu */
.thq-d-head, .thq-g-head, .stnav-head, .km-head, .vc-head, .dg-head,
.acc-head, .pb-head, .dl-head, .eco-head, .war-head, .evo-head,
.pvp-head, .ret-head {
  padding-bottom: 9px !important;
  margin-bottom: 10px !important;
  border-bottom: 1px solid rgba(217, 164, 65, 0.28) !important;
}
.thq-d-title, .thq-g-title, .stnav-ttl, .km-title, .vc-title, .dg-title,
.acc-title, .pb-title, .dl-title, .eco-title, .war-title, .evo-title,
.pvp-title, .pvp-res-ttl, .ret-title {
  color: var(--thq-gold-hi) !important;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.78) !important;
}

/* Icon anh AI (tu hoa tron nen den sach se truoc khi tach alpha PNG) */
.thq-ai-ic {
  display: inline-block;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.65));
  pointer-events: none;
}
#thq-m-pvp {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 4px !important;
  min-width: 34px !important;
  padding: 0 7px !important;
  color: #FFE7C2 !important;
}
#thq-m-pvp img.thq-ai-ic {
  width: 18px !important;
  height: 18px !important;
}

/* LOP 4: TAB & NUT HANH DONG CHUAN */
.pvp-tabs button.on, .acc-tabs button.on, .pb-tabs button.on,
.dg-tabs button.on, .war-tabs button.on, .thq-g-tab.on {
  border-color: var(--thq-gold-hi) !important;
  background: #59331E !important;
  color: var(--thq-gold-hi) !important;
}
.pvp-btn.pri, .acc-submit, .pb-btn.hi, .pb-forge-btn,
.dl-go-btn, .ret-btn.pri, .stnav-pri-btn {
  border-color: var(--thq-gold-hi) !important;
  background: #8C5718 !important;
  color: #FFF7E0 !important;
}
.pvp-rev-btn, .pb-btn.warn, .acc-btn.warn, .dl-exit-btn {
  border-color: #E05344 !important;
  background: var(--thq-crimson) !important;
  color: #FFF0EC !important;
}

/* LOP 5: TOI UU MOBILE DOC/NGANG, DESKTOP & HIEU NANG 3D */
#thq-drawer button, #thq-guide-modal button, #thq-stage-modal button,
#km-modal button, #vc-modal button, #dg-modal button, #acc-modal button,
#pb-modal button, #dl-modal button, #eco-modal button, #war-modal button,
#evo-modal button, #pvp-modal button, #ret-modal button {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
@media (min-width: 960px) {
  .thq-d-box { width: min(640px, 90vw) !important; }
  .pvp-box   { width: min(720px, 92vw) !important; }
  .acc-box   { width: min(660px, 92vw) !important; }
  .ret-box   { width: min(620px, 92vw) !important; }
  .pb-box    { width: min(880px, 94vw) !important; }
  .dg-box    { width: min(860px, 94vw) !important; }
}
@media (max-width: 640px) {
  .thq-d-box, .thq-g-box, .km-box, .vc-box, .dg-box, .acc-box,
  .pb-box, .dl-box, .eco-box, .war-box, .evo-box, .pvp-box, .ret-box {
    width: 100% !important;
    max-width: 100% !important;
    max-height: calc(100dvh - 20px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) !important;
    -webkit-overflow-scrolling: touch;
  }
  .pvp-my-strip, .acc-stats { grid-template-columns: repeat(2, 1fr) !important; }
  .pvp-tc-stats, .pvp-withdraw-grid { grid-template-columns: 1fr !important; }
  .pvp-tc-acts { flex-direction: column !important; }
  .pvp-tc-acts .pvp-btn, .pvp-daily-btn { width: 100% !important; min-height: 36px !important; }
  .ret-days { grid-template-columns: repeat(4, 1fr) !important; }
  .ret-day.big { grid-column: span 2 !important; }
}
@media (max-width: 900px), (pointer: coarse) {
  #thq-drawer, #thq-guide-modal, #thq-stage-modal, #km-modal, #vc-modal,
  #dg-modal, #acc-modal, #pb-modal, #dl-modal, #eco-modal, #war-modal,
  #evo-modal, #pvp-modal, #ret-modal, .pvp-res-ov, #thq-stage-bar {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
}

/* === AI FRAME MOBILE SLICE TUNING === */
@media (max-width: 640px) {
  body.thq-ai-frame-std .thq-d-box, body.thq-ai-frame-std .acc-box, body.thq-ai-frame-std .pb-box,
  body.thq-ai-frame-std .ret-box, body.thq-ai-frame-std .km-box, body.thq-ai-frame-std .dl-box,
  body.thq-ai-frame-std .eco-box, body.thq-ai-frame-std .dg-box, body.thq-ai-frame-std .vc-box,
  body.thq-ai-frame-std .evo-box, body.thq-ai-frame-std .thq-g-box, body.thq-ai-frame-std .stnav-box,
  body.thq-ai-frame-pvp .pvp-box, body.thq-ai-frame-pvp .pvp-res-box, body.thq-ai-frame-pvp .war-box {
    border-width: 10px !important;
  }
}

/* === FIX FONT VIETNAMESE, DO GIAM CANVAS & ITEM SLOT START === */

/* 1. Dong bo font Be Vietnam Pro toan game -> het lech dau tieng Viet tren iOS/Android/PC */
:root {
  --vl-font: "Be Vietnam Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
  --vl-font-lg: "Be Vietnam Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
  --vl-title-font: "Be Vietnam Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
}
html, body, button, input, select, textarea,
#thq-hud-root, #thq-drawer, #thq-guide-root, #thq-stage-root,
#km-root, #vc-root, #dg-root, #acc-root, #pb-root, #dl-root,
#eco-root, #war-root, #evo-root, #pvp-root, #ret-root {
  font-family: var(--vl-font) !important;
  font-feature-settings: "kern" 1;
  -webkit-font-smoothing: antialiased;
}
.thq-d-title, .thq-g-title, .stnav-ttl, .km-title, .vc-title, .dg-title,
.acc-title, .pb-title, .dl-title, .eco-title, .war-title, .evo-title,
.pvp-title, .pvp-res-ttl, .ret-title {
  font-family: var(--vl-title-font) !important;
  font-weight: 800 !important;
  letter-spacing: 0.015em !important;
}

/* 2. Sua dut diem Tan Hoa Do Giam: #dg-canvas khong bi position:fixed keo len de danh sach quai */
html body #dg-modal .dg-stage {
  position: relative !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: 228px !important;
  padding: 10px 8px 9px !important;
  background: radial-gradient(circle at 50% 56%, rgba(36, 46, 72, 0.92) 0%, rgba(12, 15, 24, 0.98) 76%) !important;
  border: 1.5px solid rgba(217, 164, 65, 0.52) !important;
  border-radius: 10px !important;
  box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.65), 0 4px 14px rgba(0, 0, 0, 0.42) !important;
  overflow: hidden !important;
  flex-shrink: 0 !important;
}
html body #dg-canvas {
  position: relative !important;
  left: auto !important;
  top: auto !important;
  right: auto !important;
  bottom: auto !important;
  width: 220px !important;
  height: 175px !important;
  max-width: 100% !important;
  margin: 0 auto !important;
  display: block !important;
  pointer-events: none !important;
  z-index: 1 !important;
}
html body #dg-modal .dg-ctrls {
  position: relative !important;
  z-index: 2 !important;
  width: 100% !important;
  margin-top: 6px !important;
  padding-top: 6px !important;
  border-top: 1px solid rgba(217, 164, 65, 0.20) !important;
}
html body #dg-modal .dg-list {
  position: relative !important;
  z-index: 2 !important;
}
@media (max-width: 640px) {
  html body #dg-modal .dg-stage { min-height: 204px !important; }
  html body #dg-canvas { width: 196px !important; height: 152px !important; }
  html body #dg-modal .dg-list { max-height: 138px !important; }
}

/* 3. Sua khung o vat pham / Hanh Trang dung border-image 9-slice -> chu nam gon trong long den, khong bi de vien */
body.thq-ai-frame-slot .pb-slot,
body.thq-ai-frame-slot .pb-bitem,
body.thq-ai-frame-slot .ret-day,
body.thq-ai-frame-slot .thq-tile {
  background: #10131d !important;
  border: 9px solid transparent !important;
  border-image-source: url("../ui/frames/frame-item-slot.png") !important;
  border-image-slice: 23% fill !important;
  border-image-repeat: stretch !important;
  border-radius: 0 !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45) !important;
}
body.thq-ai-frame-slot .thq-tile {
  padding: 6px 4px !important;
  min-height: 82px !important;
  justify-content: center !important;
  gap: 3px !important;
}
body.thq-ai-frame-slot .thq-tile b {
  font-size: 11.5px !important;
  line-height: 1.2 !important;
}
body.thq-ai-frame-slot .thq-tile small {
  font-size: 9.5px !important;
  line-height: 1.2 !important;
  color: #cfc4ad !important;
}
body.thq-ai-frame-slot .thq-tile.hi small {
  color: #6fe3c1 !important;
}
body.thq-ai-frame-slot .thq-tile.hi {
  filter: drop-shadow(0 0 6px rgba(255, 211, 106, 0.32));
}

/* 4. Can vien khung cua so chinh sac net hon tren Mobile/Desktop */
@media (max-width: 640px) {
  body.thq-ai-frame-std .thq-d-box, body.thq-ai-frame-std .acc-box, body.thq-ai-frame-std .pb-box,
  body.thq-ai-frame-std .ret-box, body.thq-ai-frame-std .km-box, body.thq-ai-frame-std .dl-box,
  body.thq-ai-frame-std .eco-box, body.thq-ai-frame-std .dg-box, body.thq-ai-frame-std .vc-box,
  body.thq-ai-frame-std .evo-box, body.thq-ai-frame-std .thq-g-box, body.thq-ai-frame-std .stnav-box,
  body.thq-ai-frame-pvp .pvp-box, body.thq-ai-frame-pvp .pvp-res-box, body.thq-ai-frame-pvp .war-box {
    border-width: 12px !important;
  }
}
/* === FIX FONT VIETNAMESE, DO GIAM CANVAS & ITEM SLOT END === */

/* === FIX AUTH SCREEN, PVP TITLE & MOBILE ARC TEXT START === */
/* 1. Man hinh Dang Nhap luon co nen thanh tri co dai ngay lap tuc, khong lo ban do 3D & an sach toast */
#acc-modal {
  background:
    linear-gradient(180deg, rgba(10, 13, 22, 0.70), rgba(8, 10, 16, 0.88)),
    url("../ui/background/bg-fortress-wuxia.jpg") center / cover no-repeat,
    #080a10 !important;
}
#acc-root:has(#acc-modal.open) {
  z-index: 96 !important;
}
body.thq-auth-open #km-toast,
body.thq-auth-open #vc-banner,
body.thq-auth-open #dg-toast,
body.thq-auth-open #evo-toast,
body.thq-auth-open #pb-toast,
body.thq-auth-open #dl-toast,
body.thq-auth-open #eco-toast,
body.thq-auth-open #war-toast,
body.thq-auth-open #pvp-toast,
body.thq-auth-open #ret-toast,
body.thq-auth-open #thq-wave-mut-pill,
body.thq-auth-open #ret-resume-bar,
body.thq-auth-open #thq-top-bar,
body.thq-auth-open #eco-bar,
body.thq-auth-open #vc-bar {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* 2. Can lai co chu tieu de PvP tren mobile de khong bi rot dong lech */
@media (max-width: 640px) {
  html body .pvp-title {
    font-size: 14px !important;
    line-height: 1.25 !important;
  }
}

/* 3. Can chinh chu nut "Xay Nha" & cac nut tron tren vong cung mobile -> khong bi cat mep */
body.thq-mob #eco-bar button:not(.war-fl):not([data-vl-act="flag"]) {
  padding: 2px 1px !important;
  font-size: 7.5px !important;
  line-height: 1.05 !important;
  letter-spacing: -0.02em !important;
  white-space: nowrap !important;
}
/* === FIX AUTH SCREEN, PVP TITLE & MOBILE ARC TEXT END === */

/* === AI ASSETS BATCH 2: BUTTONS, CAMP BG & REWARD VFX START === */
body.thq-ai-bg-camp #war-modal,
body.thq-ai-bg-camp #eco-modal {
  background:
    linear-gradient(180deg, rgba(12, 14, 22, 0.72), rgba(8, 10, 16, 0.88)),
    url("../ui/background/bg-army-camp.jpg") center / cover no-repeat !important;
}
body.thq-ai-btn-gold .pvp-btn.pri,
body.thq-ai-btn-gold .acc-submit,
body.thq-ai-btn-gold .pb-btn.hi,
body.thq-ai-btn-gold .pb-forge-btn,
body.thq-ai-btn-gold .dl-go-btn,
body.thq-ai-btn-gold .ret-btn.pri,
body.thq-ai-btn-gold .stnav-pri-btn,
body.thq-ai-btn-gold .war-age-btn:not(:disabled),
body.thq-ai-btn-gold .dg-claim-all:not(:disabled) {
  border: 6px solid transparent !important;
  border-image-source: url("../ui/buttons/btn-gold-primary.png") !important;
  border-image-slice: 24% 12% fill !important;
  border-image-repeat: stretch !important;
  border-radius: 4px !important;
  background-color: transparent !important;
  color: #FFF8E6 !important;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.88) !important;
}
body.thq-ai-btn-crimson .pvp-rev-btn,
body.thq-ai-btn-crimson .pb-btn.warn,
body.thq-ai-btn-crimson .acc-btn.warn,
body.thq-ai-btn-crimson .dl-exit-btn {
  border: 6px solid transparent !important;
  border-image-source: url("../ui/buttons/btn-crimson-war.png") !important;
  border-image-slice: 24% 12% fill !important;
  border-image-repeat: stretch !important;
  border-radius: 4px !important;
  background-color: transparent !important;
  color: #FFF2EE !important;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.88) !important;
}
body.thq-ai-fx-burst .pvp-res-box.win::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -12px;
  width: 220px;
  height: 220px;
  transform: translateX(-50%);
  background: url("../ui/effects/fx-golden-burst.png") center / contain no-repeat;
  mix-blend-mode: screen;
  opacity: 0.48;
  pointer-events: none;
  z-index: 0;
}
body.thq-ai-fx-burst .pvp-res-box.win > * {
  position: relative;
  z-index: 1;
}
/* === AI ASSETS BATCH 2: BUTTONS, CAMP BG & REWARD VFX END === */

/* === AI PANEL ICONS (PVP, QUAN DOAN, KINH TE) START === */
img.thq-ai-inline {
  display: inline-block !important;
  width: 1.32em !important;
  height: 1.32em !important;
  vertical-align: -0.24em !important;
  margin-right: 0.22em !important;
  object-fit: contain !important;
  pointer-events: none !important;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.78)) !important;
}

/* Tieu de & Tab 3 bang */
#pvp-modal .pvp-title img.thq-ai-inline,
#war-modal .war-title img.thq-ai-inline,
#eco-modal .eco-title img.thq-ai-inline {
  width: 22px !important;
  height: 22px !important;
  vertical-align: -4px !important;
  margin-right: 6px !important;
}
#pvp-modal .pvp-tabs img.thq-ai-inline,
#war-modal .war-tabs img.thq-ai-inline {
  width: 17px !important;
  height: 17px !important;
  vertical-align: -3px !important;
  margin-right: 4px !important;
}

/* O bieu tuong lon: Man hinh khach PvP, Xuong Bay Tran Thu Thanh, The linh Quan Doan, Kho tai nguyen */
#pvp-modal .pvp-g-ic img.thq-ai-inline {
  width: 52px !important;
  height: 52px !important;
  margin: 0 auto !important;
  vertical-align: middle !important;
}
#pvp-modal .pvp-slot-btn img.thq-ai-inline,
#pvp-modal .pvp-loot-card img.thq-ai-inline,
#war-modal .war-h-ic img.thq-ai-inline,
#war-modal .war-sol-ic img.thq-ai-inline {
  width: 26px !important;
  height: 26px !important;
  margin: 0 3px 0 0 !important;
  vertical-align: middle !important;
}
#pvp-modal .pvp-rk-ic img.thq-ai-inline {
  width: 28px !important;
  height: 28px !important;
  margin: 0 !important;
  vertical-align: middle !important;
}
#pvp-modal .pvp-my-strip img.thq-ai-inline,
#war-modal .war-res img.thq-ai-inline,
#eco-modal .eco-res img.thq-ai-inline {
  width: 18px !important;
  height: 18px !important;
  vertical-align: -3px !important;
  margin-right: 4px !important;
}
#war-modal .war-c-top img.thq-ai-inline,
#eco-modal .eco-c-top img.thq-ai-inline,
#eco-modal .eco-qbtn img.thq-ai-inline {
  width: 20px !important;
  height: 20px !important;
  vertical-align: -4px !important;
  margin-right: 5px !important;
}
/* === AI PANEL ICONS (PVP, QUAN DOAN, KINH TE) END === */

/* === AI ASSETS BATCH 3: TOAST/POPUP FRAMES, CITY/WALL BGS & FIRE/MAGIC FX START === */
/* 1. Hinh nen Thanh Pho Co & Khu Vuc Phong Thu */
body.thq-ai-bg-city #dg-modal,
body.thq-ai-bg-city #pb-modal,
body.thq-ai-bg-city #km-modal,
body.thq-ai-bg-city #vc-modal {
  background:
    linear-gradient(180deg, rgba(10, 14, 24, 0.72), rgba(8, 10, 16, 0.88)),
    url("../ui/background/bg-ancient-city.jpg") center / cover no-repeat !important;
}
body.thq-ai-bg-wall #dl-modal,
body.thq-ai-bg-wall #evo-modal,
body.thq-ai-bg-wall #thq-stage-modal,
body.thq-ai-bg-wall #thq-guide-modal {
  background:
    linear-gradient(180deg, rgba(10, 13, 22, 0.72), rgba(8, 10, 16, 0.88)),
    url("../ui/background/bg-defense-wall.jpg") center / cover no-repeat !important;
}

/* 2. Khung Popup Nho / Xac Nhan / Trang Thai Ai */
body.thq-ai-frame-popup .stnav-box,
body.thq-ai-frame-popup .evo-box,
body.thq-ai-frame-popup .thq-g-box,
body.thq-ai-frame-popup .vc-box-sm {
  border: 13px solid transparent !important;
  border-image-source: url("../ui/frames/frame-popup-confirm.png") !important;
  border-image-slice: 16% 14% fill !important;
  border-image-repeat: stretch !important;
  border-radius: 0 !important;
  background-color: #11131B !important;
}

/* 3. Khung Thong Bao Toast & Nhan Bien The Dot Quai */
body.thq-ai-frame-toast #km-toast,
body.thq-ai-frame-toast #vc-banner,
body.thq-ai-frame-toast #dg-toast,
body.thq-ai-frame-toast #acc-toast,
body.thq-ai-frame-toast #evo-toast,
body.thq-ai-frame-toast #pb-toast,
body.thq-ai-frame-toast #dl-toast,
body.thq-ai-frame-toast #eco-toast,
body.thq-ai-frame-toast #war-toast,
body.thq-ai-frame-toast #pvp-toast,
body.thq-ai-frame-toast #ret-toast,
body.thq-ai-frame-toast #thq-wave-mut-pill {
  border: 7px solid transparent !important;
  border-image-source: url("../ui/frames/frame-toast-banner.png") !important;
  border-image-slice: 24% 12% fill !important;
  border-image-repeat: stretch !important;
  border-radius: 2px !important;
  background-color: transparent !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.72) !important;
}

/* 4. Hieu ung Lua Chien Truong nhe o chan khung PvP (pointer-events: none, khong anh huong FPS) */
body.thq-ai-fx-fire .pvp-box {
  position: relative;
  overflow: hidden;
}
body.thq-ai-fx-fire .pvp-box::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 110px;
  background: url("../ui/effects/fx-battle-fire.png") center bottom / cover no-repeat;
  mix-blend-mode: screen;
  opacity: 0.24;
  pointer-events: none;
  z-index: 0;
}
body.thq-ai-fx-fire .pvp-box > * {
  position: relative;
  z-index: 1;
}

/* 5. Hieu ung Tran Phap Linh Khi o san khau Do Giam & Lo Ren Phap Bao */
body.thq-ai-fx-magic #dg-modal .dg-stage::before,
body.thq-ai-fx-magic #pb-modal .pb-forge-box::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 210px;
  height: 210px;
  transform: translate(-50%, -50%);
  background: url("../ui/effects/fx-magic-aura.png") center / contain no-repeat;
  mix-blend-mode: screen;
  opacity: 0.26;
  pointer-events: none;
  z-index: 0;
}
body.thq-ai-fx-magic #pb-modal .pb-forge-box {
  position: relative;
  overflow: hidden;
}
body.thq-ai-fx-magic #pb-modal .pb-forge-box > * {
  position: relative;
  z-index: 1;
}

/* Can co icon trong cac bang Phap Bao, Linh Mach, Diem Danh, Ai Ngay */
#pb-modal .pb-title img.thq-ai-inline,
#km-modal .km-title img.thq-ai-inline,
#vc-modal .vc-title img.thq-ai-inline,
#ret-modal .ret-title img.thq-ai-inline,
#dl-modal .dl-title img.thq-ai-inline {
  width: 20px !important;
  height: 20px !important;
  vertical-align: -4px !important;
  margin-right: 5px !important;
}
#ret-modal .ret-d-ic img.thq-ai-inline {
  width: 24px !important;
  height: 24px !important;
  margin: 0 auto !important;
  vertical-align: middle !important;
}
/* === AI ASSETS BATCH 3: TOAST/POPUP FRAMES, CITY/WALL BGS & FIRE/MAGIC FX END === */

/* === FIX 5: PVP SCROLL & CLICK, HEADER FIT, TEXT WRAP & FULL AI FRAMES/BUTTONS START === */
/* 1. Mo khoa cuon muot & bam duoc moi nut trong #pvp-modal tren iOS/Android/PC */
#pvp-modal,
#pvp-modal .pvp-box {
  touch-action: pan-y !important;
  overscroll-behavior: contain !important;
  -webkit-overflow-scrolling: touch !important;
}
body.thq-ai-fx-fire .pvp-box,
#pvp-modal .pvp-box {
  contain: none !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding-bottom: 24px !important;
}
#pvp-modal .pvp-btn,
#pvp-modal .pvp-daily-btn,
#pvp-modal .pvp-tabs button,
#pvp-modal .pvp-close {
  position: relative;
  z-index: 3;
  touch-action: manipulation !important;
}

/* 2. Day tieu de PvP xuong duoi hoa tiet dau rong & chong gay chu le / cat ... */
body.thq-ai-frame-pvp .pvp-box {
  border-width: 10px !important;
  padding: 28px 14px 24px !important;
}
@media (max-width: 640px) {
  html body #pvp-modal .pvp-title {
    font-size: 12px !important;
    line-height: 1.28 !important;
    white-space: normal !important;
    text-wrap: balance;
  }
  html body #pvp-modal .pvp-title img.thq-ai-inline {
    width: 16px !important;
    height: 16px !important;
    margin-right: 4px !important;
  }
  #pvp-modal .pvp-tabs button,
  #pb-modal .pb-tabs button {
    font-size: 10.5px !important;
    line-height: 1.18 !important;
    padding: 6px 4px !important;
    text-wrap: balance;
  }
  .acc-lb-nm small {
    display: block !important;
    font-size: 10.5px !important;
    line-height: 1.2 !important;
    margin-top: 1px !important;
  }
  .pvp-lb-nm small {
    font-size: 10px !important;
  }
}

/* 3. Khung the noi dung, khoi PvP, BXH & o thong so bang anh AI 9-slice */
body.thq-ai-frame-card .pvp-panel,
body.thq-ai-frame-card .pvp-rank-bar,
body.thq-ai-frame-card .pvp-target-card,
body.thq-ai-frame-card .pvp-guest,
body.thq-ai-frame-card .pb-sum,
body.thq-ai-frame-card .eco-res,
body.thq-ai-frame-card .war-res {
  background-color: #101420 !important;
  border: 5px solid transparent !important;
  border-image-source: url("../ui/frames/frame-card-panel.png") !important;
  border-image-slice: 20% 10% fill !important;
  border-image-repeat: stretch !important;
  border-radius: 2px !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45) !important;
}
body.thq-ai-frame-card .pvp-my-strip > div,
body.thq-ai-frame-card .pvp-tc-stats > div,
body.thq-ai-frame-card .pvp-log-row,
body.thq-ai-frame-card .pvp-lb-row,
body.thq-ai-frame-card .acc-lb-row {
  background-color: #101420 !important;
  border: 4px solid transparent !important;
  border-image-source: url("../ui/frames/frame-card-panel.png") !important;
  border-image-slice: 20% 10% fill !important;
  border-image-repeat: stretch !important;
  border-radius: 2px !important;
}

/* 4. Bo sung nut Bong Loc vao nhom nut vang AI + Tab & Nut phu AI 9-slice */
body.thq-ai-btn-gold .pvp-daily-btn.on {
  border: 6px solid transparent !important;
  border-image-source: url("../ui/buttons/btn-gold-primary.png") !important;
  border-image-slice: 24% 12% fill !important;
  border-image-repeat: stretch !important;
  border-radius: 4px !important;
  background-color: transparent !important;
  color: #FFF8E6 !important;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.88) !important;
}
body.thq-ai-btn-steel .pvp-tabs button,
body.thq-ai-btn-steel .acc-tabs button,
body.thq-ai-btn-steel .pb-tabs button,
body.thq-ai-btn-steel .dg-tabs button,
body.thq-ai-btn-steel .war-tabs button,
body.thq-ai-btn-steel .pvp-btn:not(.pri):not(.pvp-rev-btn),
body.thq-ai-btn-steel .pb-mini-btn {
  border: 5px solid transparent !important;
  border-image-source: url("../ui/buttons/btn-steel-secondary.png") !important;
  border-image-slice: 24% 12% fill !important;
  border-image-repeat: stretch !important;
  border-radius: 3px !important;
  background-color: transparent !important;
  color: #DFD2B8 !important;
}
body.thq-ai-tab-gold .pvp-tabs button.on,
body.thq-ai-tab-gold .acc-tabs button.on,
body.thq-ai-tab-gold .pb-tabs button.on,
body.thq-ai-tab-gold .dg-tabs button.on,
body.thq-ai-tab-gold .war-tabs button.on {
  border: 5px solid transparent !important;
  border-image-source: url("../ui/buttons/tab-gold-active.png") !important;
  border-image-slice: 24% 12% fill !important;
  border-image-repeat: stretch !important;
  border-radius: 3px !important;
  background-color: transparent !important;
  color: #FFF4CC !important;
}

/* 5. Nut dong "x" bang khung anh AI */
body.thq-ai-btn-close .thq-d-close,
body.thq-ai-btn-close .thq-g-close,
body.thq-ai-btn-close .stnav-x,
body.thq-ai-btn-close .km-close,
body.thq-ai-btn-close .vc-close,
body.thq-ai-btn-close .dg-close,
body.thq-ai-btn-close .acc-close,
body.thq-ai-btn-close .pb-close,
body.thq-ai-btn-close .dl-close,
body.thq-ai-btn-close .eco-close,
body.thq-ai-btn-close .war-close,
body.thq-ai-btn-close .evo-close,
body.thq-ai-btn-close .pvp-close,
body.thq-ai-btn-close .ret-close {
  border: 4px solid transparent !important;
  border-image-source: url("../ui/buttons/btn-close-frame.png") !important;
  border-image-slice: 24% fill !important;
  border-image-repeat: stretch !important;
  border-radius: 3px !important;
  background-color: #161214 !important;
  color: #FFF0D2 !important;
}
/* === FIX 5: PVP SCROLL & CLICK, HEADER FIT, TEXT WRAP & FULL AI FRAMES/BUTTONS END === */

/* === FIX 6: GUIDE/PVP FRAME CLEARANCE, 2-LINE LEADERBOARD & FULL PNG ARENA ICONS START === */
/* 1. Tach hoa tiet dinh khung PvP & Huong Dan Tan Thu khoi vung cuon chu -> het de len khung */
body.thq-ai-frame-pvp .pvp-box {
  border-width: 20px 10px 12px 10px !important;
  border-image-slice: 16% 12% fill !important;
  padding: 12px 12px 24px !important;
}
body.thq-ai-frame-popup .thq-g-box,
body.thq-ai-frame-popup .stnav-box,
body.thq-ai-frame-popup .evo-box {
  border-width: 18px 11px 12px 11px !important;
  border-image-slice: 16% 14% fill !important;
  padding: 14px 14px 18px !important;
}
html body .thq-g-title {
  font-size: 13.5px !important;
  line-height: 1.28 !important;
  text-wrap: balance;
}
body.thq-ai-btn-steel .thq-g-tab {
  border: 5px solid transparent !important;
  border-image-source: url("../ui/buttons/btn-steel-secondary.png") !important;
  border-image-slice: 24% 12% fill !important;
  border-image-repeat: stretch !important;
  border-radius: 3px !important;
  background-color: transparent !important;
  color: #DFD2B8 !important;
}
body.thq-ai-tab-gold .thq-g-tab.on {
  border: 5px solid transparent !important;
  border-image-source: url("../ui/buttons/tab-gold-active.png") !important;
  border-image-slice: 24% 12% fill !important;
  border-image-repeat: stretch !important;
  border-radius: 3px !important;
  background-color: transparent !important;
  color: #FFF4CC !important;
}

/* 2. BXH PvP gon chuan 2 dong, khong bao gio bi rot 3-4 dong le chu */
#pvp-modal .pvp-lb-row {
  grid-template-columns: 28px minmax(0, 1fr) 44px 58px !important;
  gap: 5px !important;
  padding: 6px 8px !important;
  align-items: center !important;
}
#pvp-modal .pvp-lb-rk {
  font-size: 12px !important;
  white-space: nowrap !important;
}
#pvp-modal .pvp-lb-nm {
  display: flex !important;
  flex-direction: column !important;
  gap: 3px !important;
  min-width: 0 !important;
}
#pvp-modal .pvp-lb-top {
  display: flex !important;
  align-items: center !important;
  gap: 4px !important;
  min-width: 0 !important;
}
#pvp-modal .pvp-lb-top b {
  font-size: 12.5px !important;
  line-height: 1.2 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  min-width: 0 !important;
}
#pvp-modal .pvp-lb-top em {
  font-style: normal !important;
  font-size: 10px !important;
  color: #a99e89 !important;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
}
#pvp-modal .pvp-lb-bot {
  display: flex !important;
  align-items: center !important;
  gap: 5px !important;
  min-width: 0 !important;
  flex-wrap: nowrap !important;
}
#pvp-modal .pvp-lb-bot .pvp-title-tag {
  font-size: 9.5px !important;
  line-height: 1.15 !important;
  padding: 1px 5px !important;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
}
#pvp-modal .pvp-lb-bot small {
  font-size: 10px !important;
  color: #b8ae99 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}
#pvp-modal .pvp-lb-wl {
  font-size: 10.5px !important;
  text-align: center !important;
  white-space: nowrap !important;
  color: #cfc4ad !important;
}
#pvp-modal .pvp-lb-rt {
  font-size: 12px !important;
  white-space: nowrap !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 2px !important;
}
#pvp-modal .pvp-lb-top img.thq-ai-inline,
#pvp-modal .pvp-lb-rt img.thq-ai-inline {
  width: 15px !important;
  height: 15px !important;
  margin: 0 !important;
  flex-shrink: 0 !important;
}

/* Can gon thong tin the doi thu PvP & BXH Ho So */
#pvp-modal .pvp-tc-sub {
  font-size: 11px !important;
  line-height: 1.35 !important;
}
#pvp-modal .pvp-tc-av img.thq-ai-inline {
  width: 28px !important;
  height: 28px !important;
  margin: 0 !important;
  vertical-align: middle !important;
}
#acc-modal .acc-lb-nm img.thq-ai-inline {
  width: 16px !important;
  height: 16px !important;
  vertical-align: -3px !important;
  margin-right: 4px !important;
}

/* 3. Can kich thuoc icon PNG sac net ben trong tran PvP 3D (#pvp-arena) */
#pvp-arena .pvp3-arc-btn .pvp3-ic {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}
#pvp-arena .pvp3-arc-btn .pvp3-ic img.thq-ai-inline {
  margin: 0 !important;
  vertical-align: middle !important;
}
#pvp-arena .pvp3-arc-btn.ult .pvp3-ic img.thq-ai-inline { width: 28px !important; height: 28px !important; }
#pvp-arena .pvp3-arc-btn.sk  .pvp3-ic img.thq-ai-inline { width: 23px !important; height: 23px !important; }
#pvp-arena .pvp3-arc-btn.u   .pvp3-ic img.thq-ai-inline,
#pvp-arena .pvp3-arc-btn.cam .pvp3-ic img.thq-ai-inline { width: 20px !important; height: 20px !important; }
body.thq-mob #pvp-arena .pvp3-arc-btn.ult .pvp3-ic img.thq-ai-inline { width: 25px !important; height: 25px !important; }
body.thq-mob #pvp-arena .pvp3-arc-btn.sk  .pvp3-ic img.thq-ai-inline { width: 21px !important; height: 21px !important; }
body.thq-mob #pvp-arena .pvp3-arc-btn.u   .pvp3-ic img.thq-ai-inline,
body.thq-mob #pvp-arena .pvp3-arc-btn.cam .pvp3-ic img.thq-ai-inline { width: 18px !important; height: 18px !important; }

#pvp-arena .pvp3-who img.thq-ai-inline { width: 15px !important; height: 15px !important; vertical-align: -3px !important; margin-right: 3px !important; }
#pvp-arena .pvp3-vbadge img.thq-ai-inline { width: 14px !important; height: 14px !important; vertical-align: -2px !important; margin: 0 1px !important; }
#pvp-arena .pvp3-pop img.thq-ai-inline { width: 14px !important; height: 14px !important; vertical-align: -2px !important; margin-right: 3px !important; }
/* === FIX 6: GUIDE/PVP FRAME CLEARANCE, 2-LINE LEADERBOARD & FULL PNG ARENA ICONS END === */

/* === ARC CONTROL NEW 3D ICONS START === */
#eco-bar img.thq-arc-ic,
#vc-bar img.thq-arc-ic {
  object-fit: contain !important;
  pointer-events: none !important;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.85)) !important;
}
body.thq-mob #eco-bar button:not(.war-fl):not([data-vl-act="flag"]) img.thq-arc-ic {
  width: 21px !important;
  height: 21px !important;
  margin-bottom: 1px !important;
}
body.thq-mob #eco-bar button.war-fl img.thq-arc-ic,
body.thq-mob #eco-bar button[data-vl-act="flag"] img.thq-arc-ic {
  width: 28px !important;
  height: 28px !important;
}
body.thq-mob #vc-bar button img.thq-arc-ic {
  width: 28px !important;
  height: 28px !important;
}
/* === ARC CONTROL NEW 3D ICONS END === */

/* === FIX 7: PVP HEADER CLEARANCE, ROUND ARC ICONS & SLIM TOASTS START === */
/* 1. Tach toan bo dau rong khung PvP len phia tren vung noi dung -> het de chu */
body.thq-ai-frame-pvp .pvp-box {
  border-width: 32px 10px 14px 10px !important;
  border-image-slice: 23% 12% 14% 12% fill !important;
  padding: 6px 12px 22px !important;
}
html body #pvp-modal .pvp-title {
  font-size: 14px !important;
  line-height: 1.25 !important;
}

/* 2. Bo tron 100% icon 3 Tuyet Chieu trong vom cung mobile -> het vien vuong */
body.thq-mob #vc-bar .vc-sk {
  padding: 0 !important;
  border-radius: 50% !important;
  overflow: hidden !important;
}
body.thq-mob #vc-bar .vc-sk .vc-ic,
body.thq-mob #vc-bar .vc-sk .vl-sk-ic,
body.thq-mob #vc-bar .vc-sk img {
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  object-fit: cover !important;
  border-radius: 50% !important;
  margin: 0 !important;
  display: block !important;
  filter: none !important;
}

/* Bo tron icon & bo cat lem chu (Xay Nha, Ban Go...) o 5 nut vong ngoai + nut Co */
body.thq-mob #eco-bar button:not(.war-fl):not([data-vl-act="flag"]) {
  width: 42px !important;
  height: 42px !important;
  padding: 2px 0 3px 0 !important;
  overflow: visible !important;
  font-size: 8px !important;
  font-weight: 600 !important;
  line-height: 1 !important;
  letter-spacing: -0.01em !important;
  white-space: nowrap !important;
  text-shadow: 0 1px 2px #000, 0 0 4px #000 !important;
}
body.thq-xs #eco-bar button:not(.war-fl):not([data-vl-act="flag"]),
body.thq-land #eco-bar button:not(.war-fl):not([data-vl-act="flag"]) {
  width: 38px !important;
  height: 38px !important;
  font-size: 7.5px !important;
}
body.thq-mob #eco-bar button:not(.war-fl):not([data-vl-act="flag"]) img {
  width: 23px !important;
  height: 23px !important;
  border-radius: 50% !important;
  object-fit: cover !important;
  margin: -1px 0 1px 0 !important;
}
body.thq-mob #eco-bar button.war-fl img,
body.thq-mob #eco-bar button[data-vl-act="flag"] img {
  width: 30px !important;
  height: 30px !important;
  border-radius: 50% !important;
  object-fit: cover !important;
}

/* 3. Thu nho & lam thanh manh toan bo thanh thong bao phia tren (chu thuong, khong in hoa) */
html body #thq-notify-stack {
  width: auto !important;
  max-width: min(280px, 82vw) !important;
  gap: 4px !important;
}
html body.thq-ai-frame-toast #km-toast,
html body.thq-ai-frame-toast #vc-banner,
html body.thq-ai-frame-toast #dg-toast,
html body.thq-ai-frame-toast #acc-toast,
html body.thq-ai-frame-toast #evo-toast,
html body.thq-ai-frame-toast #pb-toast,
html body.thq-ai-frame-toast #dl-toast,
html body.thq-ai-frame-toast #eco-toast,
html body.thq-ai-frame-toast #war-toast,
html body.thq-ai-frame-toast #pvp-toast,
html body.thq-ai-frame-toast #ret-toast,
html body.thq-ai-frame-toast #thq-wave-mut-pill,
html body #thq-notify-stack > .thq-toast-item {
  border: 1px solid rgba(217, 164, 65, 0.44) !important;
  border-image: none !important;
  border-radius: 999px !important;
  background: rgba(11, 14, 24, 0.86) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.55) !important;
  padding: 3px 10px !important;
  font-family: var(--vl-font) !important;
  font-size: 10.5px !important;
  font-weight: 400 !important;
  line-height: 1.3 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  color: #efe4cd !important;
  max-width: min(275px, 82vw) !important;
}
html body.thq-mob #thq-notify-stack > .thq-toast-item {
  font-size: 9.8px !important;
  padding: 2.5px 9px !important;
}
html body #thq-notify-stack img.thq-ai-inline {
  width: 13px !important;
  height: 13px !important;
  vertical-align: -2px !important;
  margin-right: 4px !important;
}
/* === FIX 7: PVP HEADER CLEARANCE, ROUND ARC ICONS & SLIM TOASTS END === */

/* === TOP HUD V2 (CHAR CARD, RIGHT RESOURCES & AVATAR PICKER) START === */
#thq-top-hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 49;
  font-family: var(--vl-font);
}
body.pvp-3d-active #thq-top-hud,
body.thq-modal-open #thq-top-hud,
body.thq-auth-open #thq-top-hud,
body.thq-booting #thq-top-hud {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* An 2 o go & dan cu ben trai tren Mobile vi da dua len cum ben phai */
body.thq-mob #eco-bar .eco-pill {
  display: none !important;
}

/* Cum ben trai: The Nhan Vat (Avatar + Cap + HP Dai Tuong + EXP) */
#thq-hud-left {
  pointer-events: auto;
  position: fixed;
  top: max(6px, env(safe-area-inset-top, 6px));
  left: max(8px, env(safe-area-inset-left, 8px));
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px 5px 7px;
  min-width: 198px;
  max-width: min(236px, 48vw);
  border-radius: 12px;
  background: rgba(15, 19, 30, 0.92);
  border: 1.5px solid rgba(217, 164, 65, 0.52);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.62), inset 0 1px 0 rgba(255, 224, 150, 0.16);
  box-sizing: border-box;
}
.thq-av-btn-wrap {
  position: relative;
  width: 42px;
  height: 42px;
  padding: 2px;
  flex-shrink: 0;
  border-radius: 10px;
  border: 1.5px solid rgba(217, 164, 65, 0.68);
  background: radial-gradient(circle at 50% 45%, #232b42, #0d101a);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.thq-av-btn-wrap:active {
  transform: scale(0.94);
}
.thq-av-img {
  width: 100%;
  height: 100%;
  border-radius: 7px;
  object-fit: cover;
  display: block;
  pointer-events: none;
}
.thq-av-lv {
  position: absolute;
  left: -5px;
  bottom: -5px;
  min-width: 18px;
  height: 18px;
  padding: 0 3px;
  border-radius: 999px;
  background: linear-gradient(135deg, #9d4dff, #6b24d6);
  border: 1.5px solid #121624;
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.65);
  pointer-events: none;
}

.thq-char-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  cursor: pointer;
}
.thq-char-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
}
.thq-char-nm {
  font-size: 12px;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.thq-char-lv {
  font-size: 9.5px;
  font-weight: 600;
  color: #c2b8a3;
  white-space: nowrap;
  flex-shrink: 0;
}
.thq-bar-row {
  display: flex;
  align-items: center;
  gap: 5px;
}
.thq-bar-lbl {
  width: 22px;
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
  flex-shrink: 0;
}
.thq-bar-lbl.hp  { color: #3de59a; }
.thq-bar-lbl.exp { color: #c77dff; }
.thq-bar-trk {
  position: relative;
  flex: 1;
  height: 12px;
  border-radius: 999px;
  background: rgba(6, 8, 14, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.14);
  overflow: hidden;
  box-sizing: border-box;
}
.thq-bar-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  transition: width 0.2s ease;
}
.thq-bar-fill.hp {
  background: linear-gradient(90deg, #1ea85a, #54ed8a);
}
.thq-bar-fill.hp.mid {
  background: linear-gradient(90deg, #d9821f, #f5c049);
}
.thq-bar-fill.hp.low {
  background: linear-gradient(90deg, #b82924, #ff5e4d);
}
.thq-bar-fill.exp {
  background: linear-gradient(90deg, #8b3dff, #e066ff);
}
.thq-bar-txt {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 0.5px;
  font-style: normal;
  font-size: 8.8px;
  font-weight: 700;
  line-height: 1;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.95);
  pointer-events: none;
  white-space: nowrap;
}

/* Cum ben phai: (Mau Thanh, Vang, Giet quai) | (Go, Dan, Linh) */
#thq-hud-right {
  pointer-events: auto;
  position: fixed;
  top: max(6px, env(safe-area-inset-top, 6px));
  right: max(8px, env(safe-area-inset-right, 8px));
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  border-radius: 12px;
  background: rgba(15, 19, 30, 0.92);
  border: 1.5px solid rgba(217, 164, 65, 0.48);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.62), inset 0 1px 0 rgba(255, 224, 150, 0.14);
  box-sizing: border-box;
}
.thq-hr-grp {
  display: flex;
  align-items: center;
  gap: 8px;
}
.thq-hr-it {
  display: inline-flex;
  align-items: center;
  gap: 3.5px;
  white-space: nowrap;
}
.thq-hr-ic {
  width: 15px;
  height: 15px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.85));
}
.thq-hr-v {
  font-size: 11.8px;
  font-weight: 700;
  color: #f3e8d2;
  line-height: 1;
}
.thq-v-castle { color: #ffab76; }
.thq-v-castle.low { color: #ff5a4a; }
.thq-v-gold { color: #ffe28a; }
.thq-v-wood { color: #e2caa0; }
.thq-v-pop  { color: #8cf2c2; }
.thq-v-army { color: #94d2ff; }
.thq-hr-sep {
  width: 1px;
  height: 16px;
  background: rgba(255, 255, 255, 0.18);
  flex-shrink: 0;
}

/* Mobile: 3 chi so hang tren (Mau Thanh, Vang, Giet) + 3 chi so hang duoi (Go, Dan, Linh) */
@media (max-width: 760px) {
  #thq-hud-left {
    left: max(6px, env(safe-area-inset-left, 6px));
    min-width: 0;
    width: min(184px, 46.5vw);
    gap: 6px;
    padding: 4px 7px 4px 6px;
    border-radius: 10px;
  }
  .thq-av-btn-wrap {
    width: 36px;
    height: 36px;
    border-radius: 8px;
  }
  .thq-av-lv {
    min-width: 16px;
    height: 16px;
    font-size: 9px;
    left: -4px;
    bottom: -4px;
  }
  .thq-char-nm { font-size: 11px; }
  .thq-char-lv { font-size: 8.6px; }
  .thq-bar-lbl { width: 19px; font-size: 8px; }
  .thq-bar-trk { height: 11px; }
  .thq-bar-txt { font-size: 8px; padding-top: 0.5px; }

  #thq-hud-right {
    right: max(6px, env(safe-area-inset-right, 6px));
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    gap: 4px;
    padding: 5px 7px;
    max-width: min(198px, 49vw);
    min-height: 50px;
    border-radius: 10px;
  }
  .thq-hr-grp {
    justify-content: space-between;
    gap: 5px;
  }
  .thq-hr-it {
    gap: 2.5px;
  }
  .thq-hr-sep {
    width: 100%;
    height: 1px;
    background: rgba(255, 255, 255, 0.12);
  }
  .thq-hr-ic { width: 12.5px; height: 12.5px; }
  .thq-hr-v  { font-size: 10px; }
}

/* Dam bao #thq-top-bar (Hanh Trang / Bao Dien / PvP) luon nam duoi The Nhan Vat */
body:not(.thq-mob) #thq-top-bar {
  top: calc(var(--hud-top-l, 64px) + 6px) !important;
  left: max(8px, env(safe-area-inset-left, 8px)) !important;
  right: auto !important;
}

/* Bang chon / doi Avatar */
#thq-av-modal {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 14px;
  background: rgba(6, 9, 16, 0.82);
  pointer-events: auto;
  font-family: var(--vl-font);
}
#thq-av-modal.open {
  display: flex;
}
.thq-av-box {
  width: min(440px, 94vw);
  max-height: 84dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
  border-radius: 12px;
  background: #131826;
  border: 1.5px solid rgba(217, 164, 65, 0.65);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.85);
  color: #efe4cd;
  box-sizing: border-box;
}
body.thq-ai-frame-popup .thq-av-box {
  border: 14px solid transparent;
  border-image-source: url("../ui/frames/frame-popup-confirm.png");
  border-image-slice: 16% 14% fill;
  border-image-repeat: stretch;
  border-radius: 0;
  background-color: #11131B;
}
.thq-av-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(217, 164, 65, 0.25);
}
.thq-av-title {
  font-size: 15px;
  font-weight: 800;
  color: #ffd36a;
}
.thq-av-sub {
  font-size: 11.5px;
  color: #b8ae99;
  margin-top: 2px;
}
.thq-av-close {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1.5px solid #6b563a;
  background: #1b2030;
  color: #fff0d2;
  font-size: 15px;
  cursor: pointer;
  flex-shrink: 0;
}
.thq-av-cur {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  margin-bottom: 12px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(217, 164, 65, 0.24);
}
.thq-av-preview {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  border: 2px solid #ffd36a;
  object-fit: cover;
  background: #0d101a;
  flex-shrink: 0;
}
.thq-av-cur-acts {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  flex: 1;
}
.thq-av-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 11px;
  border-radius: 7px;
  border: 1.5px solid #5e4f3b;
  background: rgba(28, 33, 48, 0.95);
  color: #efe4cd;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}
.thq-av-btn.pri {
  border-color: #ffd36a;
  background: #7c4d18;
  color: #fff6dc;
}
.thq-av-btn:disabled {
  opacity: 0.48;
  cursor: default;
}
.thq-av-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
}
@media (max-width: 460px) {
  .thq-av-grid { grid-template-columns: repeat(3, 1fr); }
}
.thq-av-opt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 7px 4px;
  border-radius: 8px;
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  background: rgba(20, 25, 38, 0.92);
  color: #d7ccb6;
  cursor: pointer;
  touch-action: manipulation;
}
.thq-av-opt.on {
  border-color: #ffd36a;
  background: rgba(217, 164, 65, 0.18);
  color: #fff2cc;
  box-shadow: 0 0 10px rgba(255, 211, 106, 0.25);
}
.thq-av-opt img {
  width: 40px;
  height: 40px;
  border-radius: 7px;
  object-fit: cover;
  pointer-events: none;
}
.thq-av-opt span {
  font-size: 10px;
  font-weight: 600;
  line-height: 1.15;
  text-align: center;
}
/* === TOP HUD V2 (CHAR CARD, RIGHT RESOURCES & AVATAR PICKER) END === */

/* === FIX AVATAR PICKER FRAME & REMOVE AVATAR LV BADGE START === */
.thq-av-lv {
  display: none !important;
}
body.thq-ai-frame-popup .thq-av-box {
  border-style: solid !important;
  border-color: transparent !important;
  border-width: 28px 14px 18px 14px !important;
  border-image-source: url("../ui/frames/frame-popup-confirm.png") !important;
  border-image-slice: 21% 14% 16% 14% fill !important;
  border-image-repeat: stretch !important;
  border-radius: 0 !important;
  background-color: #11131B !important;
  padding: 12px 14px 16px !important;
}
body.thq-ai-btn-close .thq-av-close {
  border: 4px solid transparent !important;
  border-image-source: url("../ui/buttons/btn-close-frame.png") !important;
  border-image-slice: 24% fill !important;
  border-image-repeat: stretch !important;
  border-radius: 3px !important;
  background-color: #161214 !important;
  color: #FFF0D2 !important;
}
/* === FIX AVATAR PICKER FRAME & REMOVE AVATAR LV BADGE END === */

/* === FULL PNG ICONS ON PILLS, BARS & BGM START === */
#bgm-bar .bgm-btn img.thq-ai-inline {
  width: 15px !important;
  height: 15px !important;
  margin: 0 !important;
  vertical-align: middle !important;
}
#dl-mode-pill img.thq-ai-inline,
#thq-wave-mut-pill img.thq-ai-inline,
#evo-bar img.thq-ai-inline,
#ret-resume-bar img.thq-ai-inline,
#thq-stage-bar img.thq-ai-inline {
  width: 14px !important;
  height: 14px !important;
  vertical-align: -2.5px !important;
  margin-right: 4px !important;
}
/* === FULL PNG ICONS ON PILLS, BARS & BGM END === */

/* === FIX 8: DRAWER ICONS, PHAP BAO TAP/SELECT FX, DAILY AI FRAMES & GUIDE HEADER CLEARANCE START === */
/* 1. Hanh Trang: icon 3D sac net, bo o vuong tho xung quanh icon */
#thq-drawer .thq-t-ic {
  width: 44px !important;
  height: 44px !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}
#thq-drawer .thq-t-ic img.thq-drawer-3d-ic {
  width: 38px !important;
  height: 38px !important;
  object-fit: contain !important;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.85)) !important;
}

/* 2. Kho Phap Bao & Tang Kiep Nan: hieu ung bam ro rang + khung vang phat sang cho o dang chon */
#pb-modal .pb-slot,
#pb-modal .pb-bitem {
  position: relative !important;
  transition: transform 0.12s ease, filter 0.16s ease, box-shadow 0.16s ease !important;
  -webkit-tap-highlight-color: transparent;
}
#pb-modal .pb-slot.empty {
  opacity: 0.62 !important;
}
#pb-modal .pb-slot:not(.empty):active,
#pb-modal .pb-bitem:active {
  transform: scale(0.95) !important;
  filter: brightness(1.18) !important;
}
body.thq-ai-frame-slot #pb-modal .pb-slot.sel,
body.thq-ai-frame-slot #pb-modal .pb-bitem.sel,
#pb-modal .pb-slot.sel,
#pb-modal .pb-bitem.sel {
  background-color: #241d11 !important;
  outline: 2px solid #ffd86b !important;
  outline-offset: -3px !important;
  box-shadow: 0 0 14px rgba(255, 212, 90, 0.55), inset 0 0 18px rgba(255, 212, 90, 0.24) !important;
  filter: brightness(1.12) !important;
  z-index: 2 !important;
}
#pb-modal .pb-slot.sel::after,
#pb-modal .pb-bitem.sel::after {
  content: "";
  position: absolute;
  top: 5px;
  right: 5px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ffe078;
  box-shadow: 0 0 8px #ffd25a, 0 0 2px #fff;
  pointer-events: none;
}
@keyframes thqPbDetFlash {
  0%   { box-shadow: 0 0 0 2px rgba(255, 216, 107, 0.9), 0 0 22px rgba(255, 210, 90, 0.5); }
  100% { box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45); }
}
#pb-modal .pb-right.pb-det-flash {
  animation: thqPbDetFlash 0.55s ease-out;
}
body.thq-ai-frame-card #pb-modal .pb-right {
  background-color: #101420 !important;
  border: 5px solid transparent !important;
  border-image-source: url("../ui/frames/frame-card-panel.png") !important;
  border-image-slice: 20% 10% fill !important;
  border-image-repeat: stretch !important;
  border-radius: 2px !important;
}

/* 3. Ai Thu Thach Hang Ngay: thay sach vien CSS phang sang khung/nut AI & sap xep chu thoang mat */
#dl-modal .dl-title {
  font-size: 14.5px !important;
  line-height: 1.25 !important;
}
#dl-modal .dl-hsub {
  font-size: 11.5px !important;
  color: #b8ae99 !important;
  margin-top: 3px !important;
}
body.thq-ai-frame-card #dl-modal .dl-hero {
  background: linear-gradient(180deg, rgba(20, 25, 40, 0.94), rgba(13, 16, 26, 0.98)) !important;
  border: 6px solid transparent !important;
  border-image-source: url("../ui/frames/frame-card-panel.png") !important;
  border-image-slice: 20% 10% fill !important;
  border-image-repeat: stretch !important;
  border-radius: 2px !important;
  padding: 12px 13px !important;
  gap: 10px !important;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.52) !important;
}
#dl-modal .dl-h-top {
  align-items: center !important;
  gap: 8px !important;
  padding-bottom: 8px !important;
  border-bottom: 1px solid rgba(217, 164, 65, 0.18) !important;
}
#dl-modal .dl-biome {
  font-size: 12px !important;
  color: #d6ccb6 !important;
  line-height: 1.3 !important;
  margin-bottom: 4px !important;
}
#dl-modal .dl-biome b {
  color: #fff2cc !important;
}
#dl-modal .dl-mut {
  font-size: 13.5px !important;
  line-height: 1.3 !important;
  color: #ffe094 !important;
  font-weight: 700 !important;
}
#dl-modal .dl-mut b {
  color: #7ee3ff !important;
}
#dl-modal .dl-streak {
  padding: 4px 9px !important;
  font-size: 11px !important;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
  border-radius: 999px !important;
  border: 1px solid rgba(255, 166, 92, 0.45) !important;
  background: rgba(58, 28, 18, 0.72) !important;
  color: #ffd3a8 !important;
}
#dl-modal .dl-mut-desc {
  font-size: 12px !important;
  line-height: 1.45 !important;
  color: #d6ccb8 !important;
}
#dl-modal .dl-tags {
  display: grid !important;
  grid-template-columns: 1fr !important;
  gap: 5px !important;
}
#dl-modal .dl-tag {
  font-size: 11px !important;
  line-height: 1.35 !important;
  padding: 5px 9px !important;
  border-radius: 6px !important;
  background: rgba(255, 255, 255, 0.04) !important;
  border: 1px solid rgba(255, 255, 255, 0.09) !important;
  color: #e4dac5 !important;
}
#dl-modal .dl-tag.ok {
  background: rgba(54, 158, 114, 0.14) !important;
  border-color: rgba(111, 227, 193, 0.3) !important;
  color: #9bf5d0 !important;
}
#dl-modal .dl-tag.ban {
  background: rgba(210, 68, 54, 0.14) !important;
  border-color: rgba(240, 108, 92, 0.32) !important;
  color: #ffb8ae !important;
}
body.thq-ai-frame-card #dl-modal .dl-ms {
  background-color: #101420 !important;
  border: 5px solid transparent !important;
  border-image-source: url("../ui/frames/frame-card-panel.png") !important;
  border-image-slice: 20% 10% fill !important;
  border-image-repeat: stretch !important;
  border-radius: 2px !important;
  padding: 9px 10px !important;
}
body.thq-ai-btn-steel #dl-modal .dl-ms-btn:not(.ready) {
  border: 4px solid transparent !important;
  border-image-source: url("../ui/buttons/btn-steel-secondary.png") !important;
  border-image-slice: 24% 12% fill !important;
  border-image-repeat: stretch !important;
  border-radius: 3px !important;
  background-color: transparent !important;
  color: #b7ad9a !important;
  font-size: 11px !important;
  padding: 6px 10px !important;
}
body.thq-ai-btn-gold #dl-modal .dl-ms-btn.ready {
  border: 5px solid transparent !important;
  border-image-source: url("../ui/buttons/btn-gold-primary.png") !important;
  border-image-slice: 24% 12% fill !important;
  border-image-repeat: stretch !important;
  border-radius: 3px !important;
  background-color: transparent !important;
  color: #fff6dc !important;
}
#dl-modal img.thq-ai-inline {
  width: 14px !important;
  height: 14px !important;
  vertical-align: -2.5px !important;
  margin-right: 3px !important;
}
@media (max-width: 640px) {
  #dl-modal .dl-hotkey { display: none !important; }
  #dl-modal .dl-title { font-size: 13.5px !important; }
}

/* 4. Huong Dan Tan Thu: day tieu de xuong han duoi thanh hoa van dinh khung (het de chu 100%) */
html body.thq-ai-frame-popup .thq-g-box,
html body.thq-ai-frame-popup .stnav-box,
html body.thq-ai-frame-popup .evo-box {
  border-style: solid !important;
  border-color: transparent !important;
  border-width: 30px 14px 18px 14px !important;
  border-image-source: url("../ui/frames/frame-popup-confirm.png") !important;
  border-image-slice: 22% 14% 16% 14% fill !important;
  border-image-repeat: stretch !important;
  border-radius: 0 !important;
  background-color: #11131B !important;
  padding: 10px 14px 16px !important;
}
html body.thq-mob.thq-ai-frame-popup .thq-g-box {
  padding: 10px 12px 14px !important;
}
html body #thq-guide-modal .thq-g-title {
  font-size: 13px !important;
  line-height: 1.28 !important;
}
body.thq-ai-frame-card #thq-guide-modal .thq-g-card {
  background-color: #101420 !important;
  border: 5px solid transparent !important;
  border-image-source: url("../ui/frames/frame-card-panel.png") !important;
  border-image-slice: 20% 10% fill !important;
  border-image-repeat: stretch !important;
  border-radius: 2px !important;
}
body.thq-ai-btn-steel #thq-guide-modal .thq-g-btn:not(.pri) {
  border: 5px solid transparent !important;
  border-image-source: url("../ui/buttons/btn-steel-secondary.png") !important;
  border-image-slice: 24% 12% fill !important;
  border-image-repeat: stretch !important;
  border-radius: 3px !important;
  background-color: transparent !important;
  color: #dfd2b8 !important;
}
body.thq-ai-btn-gold #thq-guide-modal .thq-g-btn.pri {
  border: 5px solid transparent !important;
  border-image-source: url("../ui/buttons/btn-gold-primary.png") !important;
  border-image-slice: 24% 12% fill !important;
  border-image-repeat: stretch !important;
  border-radius: 3px !important;
  background-color: transparent !important;
  color: #fff6dc !important;
}
/* === FIX 8: DRAWER ICONS, PHAP BAO TAP/SELECT FX, DAILY AI FRAMES & GUIDE HEADER CLEARANCE END === */

/* === FIX 9: BIGGER DRAWER ICONS, ACCOUNT HEADER CLEARANCE & AI SECT CARDS START === */
/* 1. Phong to & can deu 6 icon Hanh Trang cho can doi voi khung */
html body #thq-drawer .thq-tile .thq-t-ic {
  width: 52px !important;
  height: 52px !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}
html body #thq-drawer .thq-tile .thq-t-ic img {
  width: 48px !important;
  height: 48px !important;
  max-width: none !important;
  max-height: none !important;
  object-fit: contain !important;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.88)) !important;
}
#thq-drawer .thq-util-btn img {
  width: 18px !important;
  height: 18px !important;
  object-fit: contain !important;
}

/* 2. Bang Tai Khoan: day tieu de xuong duoi vien vang dinh khung (het de chu) */
html body.thq-ai-frame-std .acc-box {
  border-width: 18px 12px 14px 12px !important;
  padding: 16px 14px 18px !important;
}
html body.thq-mob.thq-ai-frame-std .acc-box {
  border-width: 16px 10px 14px 10px !important;
  padding: 15px 12px 18px !important;
}
#acc-modal .acc-head {
  padding-top: 2px !important;
}
#acc-modal .acc-title {
  font-size: 16px !important;
  line-height: 1.25 !important;
}

/* 3. O Chon Tong Mon Gia Nhap dung khung the anh AI 9-slice + hieu ung chon vang kim */
body.thq-ai-frame-card #acc-modal .acc-sect-card,
body.thq-ai-frame-card #acc-modal [data-sect] {
  position: relative !important;
  background: linear-gradient(180deg, rgba(20, 25, 40, 0.94), rgba(12, 16, 26, 0.98)) !important;
  border: 5px solid transparent !important;
  border-image-source: url("../ui/frames/frame-card-panel.png") !important;
  border-image-slice: 20% 10% fill !important;
  border-image-repeat: stretch !important;
  border-radius: 2px !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5) !important;
  transition: transform 0.12s ease, filter 0.15s ease, box-shadow 0.15s ease !important;
  -webkit-tap-highlight-color: transparent;
}
#acc-modal .acc-sect-card:active,
#acc-modal [data-sect]:active {
  transform: scale(0.97) !important;
}
body.thq-ai-frame-card #acc-modal .acc-sect-card.on,
body.thq-ai-frame-card #acc-modal .acc-sect-card.on,
body.thq-ai-frame-card #acc-modal .acc-sect-card.sel,
body.thq-ai-frame-card #acc-modal .acc-sect-card.active,
body.thq-ai-frame-card #acc-modal [data-sect].on,
body.thq-ai-frame-card #acc-modal [data-sect].on,
body.thq-ai-frame-card #acc-modal [data-sect].sel,
body.thq-ai-frame-card #acc-modal [data-sect].active {
  background: linear-gradient(180deg, rgba(46, 33, 18, 0.96), rgba(24, 18, 12, 0.98)) !important;
  outline: 1.5px solid #ffd56b !important;
  outline-offset: -3px !important;
  box-shadow: 0 0 14px rgba(255, 206, 86, 0.45), inset 0 0 18px rgba(255, 198, 76, 0.2) !important;
  filter: brightness(1.08) !important;
}
#acc-modal .acc-sect-card img.thq-ai-inline,
#acc-modal [data-sect] img.thq-ai-inline {
  width: 22px !important;
  height: 22px !important;
  object-fit: contain !important;
  vertical-align: middle !important;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.85)) !important;
}
/* === FIX 9: BIGGER DRAWER ICONS, ACCOUNT HEADER CLEARANCE & AI SECT CARDS END === */

/* === SECT SKILL ARC ICONS TUNING START === */
body.thq-mob #vc-bar .vc-sk {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  border-radius: 50% !important;
  overflow: hidden !important;
}
body.thq-mob #vc-bar .vc-sk img.thq-sect-sk-ic {
  width: 84% !important;
  height: 84% !important;
  object-fit: contain !important;
  border-radius: 50% !important;
  margin: 0 !important;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.88)) !important;
}
body:not(.thq-mob) #vc-bar .vc-sk img.thq-sect-sk-ic {
  width: 32px !important;
  height: 32px !important;
  object-fit: contain !important;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.85)) !important;
}
/* === SECT SKILL ARC ICONS TUNING END === */

/* === FIX 11: CENTER 3 SECT SKILL CIRCLES, BAODIEN SIZE & TU VI FEE CONFIRM START === */
/* 1. Can giua tuyet doi 3 icon ky nang mon phai trong vong tron (Mobile & PC & PvP 3D) */
html body.thq-mob #vc-bar .vc-sk {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  gap: 0 !important;
  border-radius: 50% !important;
  overflow: hidden !important;
}
html body.thq-mob #vc-bar .vc-sk .vc-ic {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 0 !important;
  font-size: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  pointer-events: none !important;
}
html body.thq-mob #vc-bar .vc-sk .vc-ic img,
html body.thq-mob #vc-bar .vc-sk img.thq-sect-sk-ic {
  display: block !important;
  width: 82% !important;
  height: 82% !important;
  max-width: 82% !important;
  max-height: 82% !important;
  object-fit: contain !important;
  object-position: center center !important;
  border-radius: 50% !important;
  margin: 0 !important;
  padding: 0 !important;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.88)) !important;
}
html body:not(.thq-mob) #vc-bar .vc-sk .vc-ic {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 0 !important;
}
html body:not(.thq-mob) #vc-bar .vc-sk img.thq-sect-sk-ic {
  display: block !important;
  width: 32px !important;
  height: 32px !important;
  object-fit: contain !important;
  object-position: center center !important;
  margin: 0 !important;
}
#pvp-arena .pvp3-arc-btn.sk .pvp3-ic {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 0 !important;
}
#pvp-arena .pvp3-arc-btn.sk .pvp3-ic img.thq-sect-sk-ic {
  display: block !important;
  width: 26px !important;
  height: 26px !important;
  object-fit: contain !important;
  object-position: center center !important;
  margin: 0 !important;
}
body.thq-mob #pvp-arena .pvp3-arc-btn.sk .pvp3-ic img.thq-sect-sk-ic {
  width: 24px !important;
  height: 24px !important;
}

/* 2. Can kich thuoc icon Bao Dien (hinh ngang) cho can doi voi 6 o Hanh Trang con lai */
html body #thq-drawer .thq-tile[data-open="vc"] .thq-t-ic img {
  width: 52px !important;
  height: 52px !important;
  transform: scale(1.12);
}

/* 3. Hien thi phi Tu Vi & hop xac nhan 2 buoc trong bang Tai Khoan */
#acc-modal .acc-fee-tag {
  color: #d89eff;
  font-weight: 700;
  font-size: 11px;
  text-transform: none;
}
#acc-modal .acc-box {
  position: relative !important;
}
#acc-modal .acc-cfm-wrap {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(6, 9, 16, 0.8);
}
#acc-modal .acc-cfm-box {
  width: min(360px, 92vw);
  padding: 16px;
  border-radius: 10px;
  background: #141928;
  border: 1.5px solid rgba(217, 164, 65, 0.72);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.88);
  text-align: center;
}
#acc-modal .acc-cfm-ttl {
  font-size: 14px;
  font-weight: 800;
  color: #ffd36a;
  margin-bottom: 8px;
}
#acc-modal .acc-cfm-msg {
  font-size: 12.5px;
  line-height: 1.5;
  color: #e6dcc6;
  margin-bottom: 14px;
}
#acc-modal .acc-cfm-cost {
  color: #d89eff;
}
#acc-modal .acc-cfm-acts {
  display: flex;
  justify-content: center;
  gap: 10px;
}
#acc-modal .acc-cfm-ok {
  border-color: #ffd36a !important;
  background: #8c5718 !important;
  color: #fff7e0 !important;
}
/* === FIX 11: CENTER 3 SECT SKILL CIRCLES, BAODIEN SIZE & TU VI FEE CONFIRM END === */

/* === PERF2: MOBILE GPU COMPOSITOR OPT START === */
@media (max-width: 960px), (pointer: coarse) {
  #km-modal, #vc-modal, #dg-modal, #acc-modal, #evo-modal,
  #pb-modal, #dl-modal, #eco-modal, #war-modal, #pvp-modal,
  #ret-modal, .pvp-res-ov, #ret-resume-bar, #thq-guide-ov,
  .pvp-hud-bar, .pvp-skill-bar, #thq-drawer, #thq-drawer-backdrop {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
}
/* === PERF2: MOBILE GPU COMPOSITOR OPT END === */

/* === FIX WAR TITLE CLEARANCE & PVP BURST TRANSPARENT START === */
/* 1. Day vien dau rong khung Quan Doan (.war-box) len tren giong .pvp-box -> het de tieu de */
body.thq-ai-frame-pvp .war-box {
  border-width: 32px 10px 14px 10px !important;
  border-image-slice: 23% 12% 14% 12% fill !important;
  padding: 6px 12px 22px !important;
}
html body #war-modal .war-head {
  padding-top: 2px !important;
  align-items: flex-start !important;
}
html body #war-modal .war-title {
  font-size: 14px !important;
  line-height: 1.25 !important;
}
@media (max-width: 640px) {
  body.thq-ai-frame-pvp .war-box {
    border-width: 30px 10px 12px 10px !important;
    border-image-slice: 23% 12% 14% 12% fill !important;
    padding: 6px 10px 18px !important;
  }
  html body #war-modal .war-title {
    font-size: 12.5px !important;
    line-height: 1.26 !important;
    white-space: normal !important;
    text-wrap: balance;
  }
  html body #war-modal .war-sub {
    font-size: 10.5px !important;
    line-height: 1.3 !important;
  }
}

/* 2. Hao quang thang PvP: anh da tach alpha + pha cache + mat na toa tron khong lo vien den */
body.thq-ai-fx-burst .pvp-res-box.win {
  position: relative !important;
  overflow: hidden !important;
  contain: none !important;
}
body.thq-ai-fx-burst .pvp-res-box.win::before {
  top: -16px !important;
  width: 240px !important;
  height: 240px !important;
  background: url("../ui/effects/fx-golden-burst.png?v=uifix_1129184857") center / contain no-repeat !important;
  mix-blend-mode: screen !important;
  opacity: 0.72 !important;
  -webkit-mask-image: radial-gradient(circle, #000 44%, transparent 72%) !important;
  mask-image: radial-gradient(circle, #000 44%, transparent 72%) !important;
}
/* === FIX WAR TITLE CLEARANCE & PVP BURST TRANSPARENT END === */

/* === SLIM COMPACT NOTIFICATIONS V2 START === */
html body #thq-notify-stack {
  top: calc(var(--hud-top, 46px) + 2px) !important;
  width: auto !important;
  max-width: min(320px, 78vw) !important;
  gap: 3px !important;
}
html body #thq-notify-stack > .thq-toast-item.show,
html body #thq-notify-stack > .thq-toast-item.open,
html body #thq-notify-stack > .thq-toast-item.active,
html body #thq-notify-stack > .thq-toast-item.on,
html body #thq-notify-stack > .thq-toast-item.thq-vis {
  display: inline-block !important;
  vertical-align: middle !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  max-width: min(312px, 76vw) !important;
  padding: 2.5px 10px !important;
  font-size: 10.2px !important;
  line-height: 1.32 !important;
  border-radius: 999px !important;
  background: rgba(10, 13, 22, 0.78) !important;
  border: 1px solid rgba(217, 164, 65, 0.36) !important;
  box-shadow: 0 3px 9px rgba(0, 0, 0, 0.45) !important;
}
html body #thq-notify-stack > .thq-toast-item.thq-toast-capped {
  display: none !important;
}
html body.thq-mob #thq-notify-stack {
  max-width: min(264px, 74vw) !important;
}
html body.thq-mob #thq-notify-stack > .thq-toast-item.show,
html body.thq-mob #thq-notify-stack > .thq-toast-item.open,
html body.thq-mob #thq-notify-stack > .thq-toast-item.active,
html body.thq-mob #thq-notify-stack > .thq-toast-item.on,
html body.thq-mob #thq-notify-stack > .thq-toast-item.thq-vis {
  max-width: min(258px, 74vw) !important;
  padding: 2px 8px !important;
  font-size: 9.5px !important;
  line-height: 1.3 !important;
}
html body #thq-notify-stack img.thq-ai-inline {
  width: 12px !important;
  height: 12px !important;
  vertical-align: -2px !important;
  margin-right: 3px !important;
}
html body #thq-wave-mut-pill {
  padding: 2.5px 10px !important;
  font-size: 9.8px !important;
  line-height: 1.3 !important;
  max-width: min(280px, 76vw) !important;
  border-radius: 999px !important;
  gap: 5px !important;
  flex-direction: row !important;
  align-items: center !important;
  background: rgba(10, 13, 22, 0.80) !important;
}
html body #thq-wave-mut-pill b {
  white-space: nowrap !important;
  flex-shrink: 0 !important;
}
html body #thq-wave-mut-pill span {
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  font-size: 9.2px !important;
  opacity: 0.88;
}
/* === SLIM COMPACT NOTIFICATIONS V2 END === */

/* === FIX DRAWER ICON OPTICAL BALANCE START === */
/* Bao Dien: anh da cat vien thua -> can chuan bang Do Giam & Ai Ngay */
html body #thq-drawer .thq-tile[data-open="vc"] .thq-t-ic img {
  width: 52px !important;
  height: 52px !important;
  transform: scale(1.10) !important;
}
/* Hop qua Diem Danh & NV: giam nhe kich thuoc khoi vuong de deu mat voi cac o khac */
html body #thq-drawer .thq-tile[data-open="ret"] .thq-t-ic img {
  width: 38px !important;
  height: 38px !important;
  transform: none !important;
}
/* === FIX DRAWER ICON OPTICAL BALANCE END === */

/* === PC ICON-ONLY MENU BTN START === */
html body #thq-top-bar #thq-m-menu {
  width: 32px !important;
  min-width: 32px !important;
  max-width: 32px !important;
  height: 32px !important;
  min-height: 32px !important;
  max-height: 32px !important;
  padding: 0 !important;
  gap: 0 !important;
  justify-content: center !important;
}
html body #thq-top-bar #thq-m-menu .thq-m-lbl,
html body #thq-top-bar #thq-m-menu .thq-m-lv {
  display: none !important;
}
html body #thq-top-bar #thq-m-menu img.vl-ui-ic {
  width: 17px !important;
  height: 17px !important;
  max-width: 17px !important;
  max-height: 17px !important;
  object-fit: contain !important;
  margin: 0 !important;
  display: block !important;
}
html body.thq-mob #thq-top-bar #thq-m-menu,
html body.thq-narrow #thq-top-bar #thq-m-menu,
html body.thq-land #thq-top-bar #thq-m-menu {
  width: 30px !important;
  min-width: 30px !important;
  max-width: 30px !important;
  height: 30px !important;
  min-height: 30px !important;
  max-height: 30px !important;
}
html body.thq-mob #thq-top-bar #thq-m-menu img.vl-ui-ic,
html body.thq-narrow #thq-top-bar #thq-m-menu img.vl-ui-ic,
html body.thq-land #thq-top-bar #thq-m-menu img.vl-ui-ic {
  width: 15px !important;
  height: 15px !important;
  max-width: 15px !important;
  max-height: 15px !important;
}
/* === PC ICON-ONLY MENU BTN END === */
