/* ======================================================================
   Giao diện theo giờ: html[data-theme="morning|noon|evening|night"] (js/theme.js đặt;
   script nhỏ trong <head> chọn sẵn trước khi tải CSS). html[data-tone="light|dark"] = nền sáng / tối.
   - Sáng (05–11h) & Trưa (11–16h): nền sáng, chữ xanh đậm.  Chiều tối (16–19h) & Đêm (19–05h): nền tối, chữ sáng.
   - HUD trong trận, thẻ Săn Boss, toast luôn là kính tối (nhuộm màu theo giờ) để dễ đọc trên mọi bản đồ.
   Token màu:
     --text / --text-rgb / --text-strong   chữ chính
     --accent / --accent-rgb                tiêu đề, số nổi bật (vàng trên nền tối, xanh / hổ phách đậm trên nền sáng)
     --hi-rgb                               viền / nền nhạt (trắng trên nền tối, xanh navy trên nền sáng)
     --shade-rgb × --shade-k                ô nền chìm bên trong thẻ (đen trên nền tối, xanh nhạt trên nền sáng)
     --shadow-rgb × --shadow-k              đổ bóng
     --good / --bad / --warn / --learn ...  màu trạng thái đọc được trên nền của theme
   ====================================================================== */
/* --- Mặc định = Chiều tối (hoàng hôn): giá trị kính tối của HUD --- */
:root {
  --hud-panel-rgb: 30 17 50;
  --hud-panel-a: .8;
  --hud-border: rgba(255, 196, 150, .35);
  --hud-text: #fff4e6;
  --hud-text-rgb: 255 244 230;
  --option-bg: #241638;

  /* chỉ dùng cho các màn phủ (menu...) */
  --page-bg: #0f0a1f;
  --backdrop: radial-gradient(ellipse at center, rgba(25, 12, 45, .35), rgba(10, 5, 25, .8));
  --logo-grad: linear-gradient(180deg, #fff3c4, #ffb347 55%, #ff6b6b);
  --logo-shadow: drop-shadow(0 4px 0 rgba(60, 20, 50, .8));
  --title-shadow: 0 4px 0 rgba(0, 0, 0, .4);
  --btn-primary-bg: linear-gradient(180deg, #ffb347, #ff6b6b);
  --btn-primary-border: #ffd39a;
  --btn-primary-text: #3a1028;
  --card-blur: none;
}

/* --- Bộ màu kính tối: cả trang (theme tối) và các vùng luôn tối (HUD, Săn Boss, toast) --- */
:root, #hud, #dhud, #toast, .boss-card, #over.boss-over .menu-card, .room-bosses {
  color-scheme: dark;
  --text: var(--hud-text);
  --text-rgb: var(--hud-text-rgb);
  --text-strong: #fff;
  --accent: #ffd36b;
  --accent-rgb: 255 211 107;
  --accent-2: #9fe8ff;
  --hi-rgb: 255 255 255;
  --shade-rgb: 0 0 0;
  --shade-k: 1;
  --shadow-rgb: 0 0 0;
  --shadow-k: 1;
  --good: #6ee7a0;
  --good-rgb: 110 231 160;
  --bad: #ff8a95;
  --bad-rgb: 255 138 149;
  --bad-soft: #ffb0a0;
  --bad-pale: #ffd0d5;
  --warn: #ffd39a;
  --warn-strong: #ffb36b;
  --warn-rgb: 255 179 71;
  --learn: #8ff0c0;
  --learn-rgb: 127 240 190;
  --learn-bg-rgb: 40 120 90;
  --skill: #c5a6ff;
  --ult: #ffb347;
  --info: #9fe8ff;
  --usdt: #6ee7c0;
  --me-text: #fff3c4;
  --panel-rgb: var(--hud-panel-rgb);
  --panel: rgb(var(--hud-panel-rgb) / var(--hud-panel-a));
  --panel-border: var(--hud-border);
  --card-bg: rgb(var(--hud-panel-rgb) / .84);
  --card-border: var(--hud-border);
  --card-shadow: 0 20px 60px rgba(0, 0, 0, .5);
  --field-bg: rgba(0, 0, 0, .35);
  --field-border: rgba(255, 255, 255, .18);
  --placeholder: rgb(var(--text-rgb) / .35);
  --btn-bg: rgba(255, 255, 255, .08);
  --btn-hover: rgba(255, 255, 255, .16);
  --btn-border: rgba(255, 255, 255, .25);
  --tab-active: rgba(255, 255, 255, .14);
  --tab-active-shadow: none;
  --scroll-thumb: rgba(255, 255, 255, .22);
  scrollbar-color: var(--scroll-thumb) transparent;
}
#hud, #dhud, #toast, .boss-card, #over.boss-over .menu-card, .room-bosses { color: var(--text); }

/* --- Đêm: xanh navy / chàm, sao li ti, điểm nhấn xanh + vàng --- */
html[data-theme="night"] {
  --hud-panel-rgb: 10 18 44;
  --hud-panel-a: .82;
  --hud-border: rgba(130, 170, 255, .38);
  --hud-text: #e9f1ff;
  --hud-text-rgb: 233 241 255;
  --option-bg: #101a38;
  --page-bg: #040917;
  --backdrop:
    radial-gradient(1.4px 1.4px at 24px 36px, rgba(255, 255, 255, .85), transparent) 0 0 / 190px 170px,
    radial-gradient(1px 1px at 120px 96px, rgba(190, 215, 255, .8), transparent) 0 0 / 230px 200px,
    radial-gradient(1.2px 1.2px at 70px 150px, rgba(255, 236, 180, .7), transparent) 0 0 / 270px 240px,
    radial-gradient(ellipse 70% 55% at 50% 0%, rgba(60, 90, 200, .25), transparent 70%),
    radial-gradient(ellipse at center, rgba(8, 16, 48, .45), rgba(2, 6, 20, .86));
  --logo-grad: linear-gradient(180deg, #ffffff, #bcd7ff 50%, #7f9dff);
  --logo-shadow: drop-shadow(0 4px 0 rgba(10, 18, 60, .85)) drop-shadow(0 0 18px rgba(120, 160, 255, .35));
  --btn-primary-bg: linear-gradient(180deg, #5aa2ff, #2f5fd6);
  --btn-primary-border: #a8d2ff;
  --btn-primary-text: #fff;
  --accent-2: #7cc4ff;
  --me-text: #dbe9ff;
}

/* --- Sáng: trời xanh nhạt buổi sớm, thẻ kính trắng, chữ navy, nút xanh --- */
html[data-theme="morning"] {
  color-scheme: light;
  --hud-panel-rgb: 12 38 82;
  --hud-panel-a: .8;
  --hud-border: rgba(150, 205, 255, .5);
  --hud-text: #f2f8ff;
  --hud-text-rgb: 242 248 255;
  --option-bg: #ffffff;
  --page-bg: #cfe7fb;
  --backdrop:
    radial-gradient(ellipse 60% 45% at 15% 0%, rgba(255, 255, 255, .55), transparent 70%),
    linear-gradient(180deg, rgba(140, 200, 255, .42), rgba(222, 240, 255, .72));
  --logo-grad: linear-gradient(180deg, #6cc0ff, #2a7de6 55%, #0d3f99);
  --logo-shadow: drop-shadow(0 3px 0 rgba(255, 255, 255, .95)) drop-shadow(0 4px 8px rgba(13, 63, 153, .3));
  --title-shadow: 0 2px 0 rgba(255, 255, 255, .9), 0 4px 14px rgba(30, 90, 170, .2);
  --btn-primary-bg: linear-gradient(180deg, #3d98f5, #1a5fd0);
  --btn-primary-border: #9fd0ff;
  --btn-primary-text: #fff;
  --card-blur: blur(10px) saturate(1.2);

  --text: #13294b;
  --text-rgb: 19 41 75;
  --text-strong: #0b1d3a;
  --accent: #0d5fbd;
  --accent-rgb: 40 130 230;
  --accent-2: #a35f00;
  --hi-rgb: 25 70 140;
  --shade-rgb: 40 110 200;
  --shade-k: .3;
  --shadow-rgb: 25 70 140;
  --shadow-k: .4;
  --good: #0c7442;
  --good-rgb: 30 170 100;
  --bad: #c02238;
  --bad-rgb: 230 70 90;
  --bad-soft: #b0283a;
  --bad-pale: #a3192f;
  --warn: #8f5200;
  --warn-strong: #a34f00;
  --warn-rgb: 245 160 40;
  --learn: #0b7350;
  --learn-rgb: 30 170 120;
  --learn-bg-rgb: 60 190 140;
  --skill: #6236c4;
  --ult: #9c4700;
  --info: #0b66a8;
  --usdt: #08765d;
  --me-text: #0d4f9e;
  --card-bg: rgba(255, 255, 255, .8);
  --card-border: rgba(110, 170, 235, .6);
  --card-shadow: 0 20px 50px rgba(30, 80, 150, .22), inset 0 1px 0 rgba(255, 255, 255, .9);
  --field-bg: rgba(255, 255, 255, .92);
  --field-border: rgba(40, 100, 180, .3);
  --btn-bg: rgba(255, 255, 255, .85);
  --btn-hover: #ffffff;
  --btn-border: rgba(40, 100, 180, .32);
  --tab-active: #ffffff;
  --tab-active-shadow: 0 2px 6px rgba(25, 70, 140, .18);
  --scroll-thumb: rgba(40, 100, 180, .35);
}

/* --- Trưa: trời xanh biếc / cyan rực, điểm nhấn vàng nắng --- */
html[data-theme="noon"] {
  color-scheme: light;
  --hud-panel-rgb: 6 50 92;
  --hud-panel-a: .8;
  --hud-border: rgba(255, 214, 110, .55);
  --hud-text: #f4faff;
  --hud-text-rgb: 244 250 255;
  --option-bg: #ffffff;
  --page-bg: #a9e4ff;
  --backdrop:
    radial-gradient(ellipse 50% 40% at 88% 0%, rgba(255, 238, 150, .6), transparent 70%),
    linear-gradient(180deg, rgba(70, 190, 255, .42), rgba(214, 246, 255, .66) 70%, rgba(255, 246, 214, .7));
  --logo-grad: linear-gradient(180deg, #ffd84a, #ff9f1a 55%, #e2570a);
  --logo-shadow: drop-shadow(0 3px 0 #9a4300) drop-shadow(0 5px 10px rgba(160, 80, 0, .3));
  --title-shadow: 0 2px 0 rgba(255, 255, 255, .9), 0 4px 14px rgba(200, 120, 0, .22);
  --btn-primary-bg: linear-gradient(180deg, #ffe066, #ffad1f);
  --btn-primary-border: #fff0b0;
  --btn-primary-text: #3d2600;
  --card-blur: blur(10px) saturate(1.25);

  --text: #0f2a44;
  --text-rgb: 15 42 68;
  --text-strong: #081c30;
  --accent: #9a5300;
  --accent-rgb: 255 184 28;
  --accent-2: #0a6fb0;
  --hi-rgb: 0 80 130;
  --shade-rgb: 0 130 200;
  --shade-k: .28;
  --shadow-rgb: 0 70 120;
  --shadow-k: .38;
  --good: #0c7442;
  --good-rgb: 30 170 100;
  --bad: #c02238;
  --bad-rgb: 230 70 90;
  --bad-soft: #b0283a;
  --bad-pale: #a3192f;
  --warn: #8f5200;
  --warn-strong: #a34f00;
  --warn-rgb: 245 160 40;
  --learn: #0b7350;
  --learn-rgb: 30 170 120;
  --learn-bg-rgb: 60 190 140;
  --skill: #6236c4;
  --ult: #9c4700;
  --info: #0b66a8;
  --usdt: #08765d;
  --me-text: #8a4a00;
  --card-bg: rgba(255, 255, 255, .84);
  --card-border: rgba(255, 190, 60, .65);
  --card-shadow: 0 20px 50px rgba(0, 90, 150, .22), inset 0 1px 0 rgba(255, 255, 255, .9);
  --field-bg: rgba(255, 255, 255, .94);
  --field-border: rgba(0, 110, 170, .3);
  --btn-bg: rgba(255, 255, 255, .86);
  --btn-hover: #ffffff;
  --btn-border: rgba(0, 110, 170, .32);
  --tab-active: #ffffff;
  --tab-active-shadow: 0 2px 6px rgba(0, 80, 130, .18);
  --scroll-thumb: rgba(0, 110, 170, .35);
}

/* đổi theme: màu chuyển mượt (js/theme.js gắn lớp này trong ~1 giây) */
html.theme-fade, html.theme-fade *, html.theme-fade *::before, html.theme-fade *::after {
  transition: background-color .8s ease, color .8s ease, border-color .8s ease, box-shadow .8s ease, fill .8s ease, stroke .8s ease !important;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--page-bg);
  color: var(--text);
  font-family: 'Baloo 2', system-ui, sans-serif;
  user-select: none;
  -webkit-user-select: none;
}

#game { position: fixed; inset: 0; }

/* ---------- Stage: lớp HTML phủ lên canvas, kích thước logic 1280x720 ---------- */
#stage {
  position: fixed;
  left: 0; top: 0;
  width: 1280px; height: 720px;
  transform-origin: 0 0;
  pointer-events: none;
}
.hidden { display: none !important; }

/* ---------- Thẻ người chơi ---------- */
.pcard {
  position: absolute;
  top: 14px;
  width: 300px;
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px 12px;
  background: var(--panel);
  border: 2px solid var(--panel-border);
  border-radius: 16px;
  box-shadow: 0 6px 18px rgb(var(--shadow-rgb) / calc(.35 * var(--shadow-k)));
  transition: transform .25s, box-shadow .25s, border-color .25s;
}
.pcard.left { left: 16px; }
.pcard.right { right: 16px; flex-direction: row-reverse; text-align: right; }
.pcard.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(var(--accent-rgb) / .3), 0 6px 18px rgb(var(--shadow-rgb) / calc(.35 * var(--shadow-k)));
  transform: translateY(2px) scale(1.03);
}
.pcard.dead { filter: grayscale(1); opacity: .6; }
.avatar {
  width: 54px; height: 54px;
  flex: none;
  border-radius: 12px;
  background-repeat: no-repeat;
  background-position: center 60%;
  background-size: 88%;
  border: 2px solid rgb(var(--hi-rgb) / .2);
}
.pcard .avatar { background-color: color-mix(in srgb, var(--c-main, #888) 30%, transparent); }
.pcard.right .avatar { transform: scaleX(-1); }
.info { flex: 1; min-width: 0; }
.pname { font-weight: 800; font-size: 19px; line-height: 1.15; margin-bottom: 3px; color: var(--c-text, #fff); }
.hpbar {
  position: relative;
  height: 18px;
  border-radius: 9px;
  background: rgb(var(--shade-rgb) / calc(.45 * var(--shade-k)));
  border: 1px solid rgb(var(--hi-rgb) / .15);
  overflow: hidden;
}
.hpfill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #46e08a, #b6f36b);
  transition: width .45s ease;
}
.pcard.right .hpfill { margin-left: auto; background: linear-gradient(270deg, #46e08a, #b6f36b); }
.hpfill.low { background: linear-gradient(90deg, #ff5d6c, #ffb36b) !important; }
.hptext {
  position: absolute; inset: 0;
  font-size: 12px; font-weight: 800;
  text-align: center; line-height: 17px;
  text-shadow: 0 1px 2px #000;
}

/* ---------- Gió + đồng hồ ---------- */
#topcenter {
  position: absolute;
  top: 10px; left: 50%;
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
#windbox {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 14px;
  background: var(--panel);
  border: 2px solid var(--panel-border);
  border-radius: 14px;
  box-shadow: 0 6px 18px rgb(var(--shadow-rgb) / calc(.35 * var(--shadow-k)));
}
.wind-side { display: flex; gap: 3px; }
.chev {
  display: block;
  width: 11px; height: 18px;
  background: rgb(var(--hi-rgb) / .12);
  transition: background .2s;
}
.wind-side.left .chev { clip-path: polygon(100% 0, 55% 50%, 100% 100%, 45% 100%, 0 50%, 45% 0); }
.wind-side.right .chev { clip-path: polygon(0 0, 55% 0, 100% 50%, 55% 100%, 0 100%, 45% 50%); }
.chev.on { background: linear-gradient(#bff0ff, #4fb6ff); animation: windblink 1s infinite; }
@keyframes windblink { 50% { filter: brightness(1.4); } }
.wind-mid { text-align: center; min-width: 44px; }
.wind-label { font-size: 10px; letter-spacing: 3px; opacity: .7; line-height: 1; margin-top: 3px; }
.wind-val { font-weight: 800; font-size: 24px; color: var(--accent); line-height: 1.1; }
#timer {
  width: 46px; height: 46px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 800; font-size: 22px;
  background: var(--panel);
  border: 2px solid var(--panel-border);
}
#timer.warn { color: var(--red); border-color: var(--red); animation: pulse .5s infinite alternate; }
@keyframes pulse { to { transform: scale(1.12); } }

/* ---------- Banner lượt chơi ---------- */
#banner {
  position: absolute;
  top: 36%; left: 0; right: 0;
  text-align: center;
  font-size: 54px; font-weight: 800;
  opacity: 0;
  text-shadow: 0 4px 0 rgb(var(--shadow-rgb) / calc(.4 * var(--shadow-k))), 0 0 28px rgba(255, 170, 110, .65);
}
#banner.show { animation: banner 1.7s ease forwards; }
@keyframes banner {
  0% { opacity: 0; transform: scale(.6); }
  14% { opacity: 1; transform: scale(1.08); }
  24% { transform: scale(1); }
  78% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-24px); }
}

/* ---------- Thanh dưới ---------- */
#bottombar {
  position: absolute;
  left: 16px; right: 16px; bottom: 12px;
  height: 100px;
  display: flex; gap: 16px; align-items: center;
  padding: 8px 14px;
  background: var(--panel);
  border: 2px solid var(--panel-border);
  border-radius: 18px;
  box-shadow: 0 -4px 18px rgb(var(--shadow-rgb) / calc(.3 * var(--shadow-k)));
  pointer-events: auto;
}

#angledial {
  position: relative;
  width: 84px; height: 84px; flex: none;
}
.dial-face {
  position: absolute; inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgb(var(--panel-rgb) / 1) 55%, transparent 56%),
    repeating-conic-gradient(rgb(var(--hi-rgb) / .35) 0 2deg, transparent 2deg 15deg),
    rgb(var(--shade-rgb) / calc(.35 * var(--shade-k)));
  border: 2px solid rgb(var(--hi-rgb) / .2);
}
#needle {
  position: absolute;
  left: 50%; top: 50%;
  width: 38px; height: 4px;
  margin-top: -2px;
  border-radius: 2px;
  background: linear-gradient(90deg, #ffb347, var(--accent));
  transform-origin: 0 50%;
  box-shadow: 0 0 8px rgb(var(--accent-rgb) / .7);
}
.dial-hub {
  position: absolute; left: 50%; top: 50%;
  width: 10px; height: 10px; margin: -5px 0 0 -5px;
  border-radius: 50%; background: var(--accent);
}
#angleval {
  position: absolute; left: 0; right: 0; bottom: 6px;
  text-align: center; font-weight: 800; font-size: 15px;
}

#weapons { display: flex; gap: 8px; }
.wslot {
  position: relative;
  width: 112px; height: 78px;
  border-radius: 12px;
  background: rgb(var(--hi-rgb) / .06);
  border: 2px solid rgb(var(--hi-rgb) / .12);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: pointer;
  transition: transform .15s, border-color .15s, background .15s;
}
.wslot:hover { transform: translateY(-2px); }
.wslot.sel { border-color: var(--accent); background: rgb(var(--accent-rgb) / .16); }
.wslot.empty { cursor: not-allowed; }
.wslot.empty .wicon, .wslot.empty .wname { opacity: .3; filter: grayscale(.8); }
.wkey { position: absolute; top: 2px; left: 7px; font-size: 11px; opacity: .65; font-weight: 700; }
.wtag { position: absolute; top: 3px; right: 8px; font-size: 9px; letter-spacing: 1px; font-weight: 800; color: var(--accent); opacity: .8; }
.wslot.skill .wtag { color: var(--skill); }
.wslot.ult .wtag { color: var(--ult); }
.wult { position: absolute; left: 10px; right: 10px; bottom: 5px; height: 3px; border-radius: 2px; background: rgb(var(--shade-rgb) / calc(.45 * var(--shade-k))); overflow: hidden; }
.wult i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #ff7a3d, #ffd36b); transition: width .3s; }
.wslot.ult.ready { border-color: #ffb347; animation: ultReady 1.2s ease-in-out infinite; }
.wslot.ult.ready.sel { border-color: var(--accent); background: rgba(255, 160, 60, .22); }
@keyframes ultReady {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 179, 71, 0); }
  50% { box-shadow: 0 0 14px 2px rgba(255, 179, 71, .75); }
}
.ultbar { height: 4px; margin-top: 3px; border-radius: 2px; background: rgb(var(--shade-rgb) / calc(.4 * var(--shade-k))); overflow: hidden; }
.ultfill { height: 100%; width: 0; background: linear-gradient(90deg, #ff7a3d, #ffd36b); transition: width .3s; }
.ultfill.full { animation: ultFull 0.9s ease-in-out infinite; }
.pcard.right .ultfill { margin-left: auto; background: linear-gradient(270deg, #ff7a3d, #ffd36b); }
@keyframes ultFull { 50% { filter: brightness(1.6); } }
.wcd { position: absolute; left: 0; right: 0; top: 34%; text-align: center; font-size: 13px; font-weight: 800; color: var(--bad); text-shadow: 0 1px 3px #000; }
.wicon { width: 34px; height: 34px; display: block; margin-top: 6px; }
.wname { font-size: 11px; line-height: 1; margin-top: 6px; white-space: nowrap; font-weight: 700; }

#powerwrap { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.row-label { display: flex; justify-content: space-between; font-size: 12px; font-weight: 800; letter-spacing: 1.5px; opacity: .85; line-height: 1; }
.row-label.small { font-size: 10px; opacity: .6; }
#powerval { color: var(--accent); font-size: 14px; }
#powerbar {
  position: relative;
  height: 24px;
  border-radius: 12px;
  background: rgb(var(--shade-rgb) / calc(.5 * var(--shade-k)));
  border: 2px solid rgb(var(--hi-rgb) / .18);
  overflow: hidden;
}
#powerfill {
  height: 100%; width: 0;
  background: linear-gradient(90deg, #ffe066, #ff9a3d 60%, #ff4d5e);
  box-shadow: 0 0 12px rgba(255, 154, 61, .7);
}
.ticks {
  position: absolute; inset: 0;
  background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 1px), rgb(var(--hi-rgb) / .28) calc(10% - 1px) 10%);
}
#powerlast {
  position: absolute; top: 0; bottom: 0;
  width: 3px; margin-left: -1px;
  background: #fff;
  box-shadow: 0 0 6px #fff;
}
#stamina { height: 7px; border-radius: 4px; background: rgb(var(--shade-rgb) / calc(.45 * var(--shade-k))); overflow: hidden; }
#staminafill { height: 100%; width: 100%; background: linear-gradient(90deg, #6ee7c8, #4fa8ff); }
.hint { font-size: 11.5px; opacity: .65; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }

#minimap {
  width: 200px; height: 84px; flex: none;
  border-radius: 10px;
  border: 2px solid rgb(var(--hi-rgb) / .18);
  cursor: grab;
  touch-action: none; /* kéo trên điện thoại không cuộn trang */
}
#minimap.dragging { cursor: grabbing; border-color: rgb(var(--accent-rgb) / .7); }

/* ---------- Overlay menu / kết thúc ---------- */
.overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--backdrop);
  pointer-events: auto;
}
.menu-card {
  min-width: 520px;
  padding: 34px 44px 30px;
  text-align: center;
  background: var(--card-bg);
  border: 2px solid var(--card-border);
  border-radius: 26px;
  box-shadow: var(--card-shadow);
  -webkit-backdrop-filter: var(--card-blur);
  backdrop-filter: var(--card-blur);
  animation: pop .45s cubic-bezier(.2, 1.4, .4, 1);
}
@keyframes pop { from { transform: scale(.85); opacity: 0; } }
.logo {
  font-size: 72px; font-weight: 800; line-height: .95;
  letter-spacing: 2px;
  background: var(--logo-grad);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  filter: var(--logo-shadow);
}
.logo span { display: block; font-size: 40px; letter-spacing: 14px; }
.sub { margin: 8px 0 22px; opacity: .8; font-size: 18px; }
.btns { display: flex; gap: 14px; justify-content: center; }
.btn {
  font-family: inherit; font-size: 19px; font-weight: 800;
  color: var(--text);
  padding: 12px 26px;
  border-radius: 14px;
  border: 2px solid var(--btn-border);
  background: var(--btn-bg);
  cursor: pointer;
  transition: transform .15s, background .15s;
}
.btn:hover { transform: translateY(-2px); background: var(--btn-hover); }
.btn.primary { background: var(--btn-primary-bg); border-color: var(--btn-primary-border); color: var(--btn-primary-text); }
.controls {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px 22px;
  margin-top: 24px;
  font-size: 15px; text-align: left;
}
kbd {
  display: inline-block;
  min-width: 26px; padding: 0 6px; margin-right: 4px;
  border-radius: 6px;
  background: rgb(var(--hi-rgb) / .12);
  border: 1px solid rgb(var(--hi-rgb) / .3);
  border-bottom-width: 3px;
  font-family: inherit; font-weight: 800; font-size: 13px; text-align: center;
}
.tip { margin-top: 18px; font-size: 13px; opacity: .6; max-width: 480px; margin-inline: auto; }
.over-title { font-size: 60px; font-weight: 800; margin-bottom: 22px; color: var(--title-c, var(--text)); text-shadow: var(--title-shadow); }

/* ---------- Tài khoản: loading, đăng nhập, đặt tên ---------- */
.spinner {
  width: 54px; height: 54px;
  border-radius: 50%;
  border: 5px solid rgb(var(--hi-rgb) / .15);
  border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.logo.small { font-size: 52px; }
.logo.small span { font-size: 28px; letter-spacing: 10px; }
.auth-card { width: 460px; min-width: 0; text-align: left; }
.auth-card .logo, .auth-card .card-title, .auth-card .sub { text-align: center; }
.card-title { margin: 0 0 4px; font-size: 34px; font-weight: 800; color: var(--accent); text-align: center; }

.tabs {
  display: flex;
  margin: 20px 0 18px;
  padding: 4px;
  border-radius: 14px;
  background: rgb(var(--shade-rgb) / calc(.3 * var(--shade-k)));
}
.tab {
  flex: 1;
  font: inherit; font-size: 17px; font-weight: 800;
  color: var(--text);
  padding: 8px;
  border: 0; border-radius: 10px;
  background: transparent;
  opacity: .6;
  cursor: pointer;
  transition: background .2s, opacity .2s;
}
.tab.active { background: var(--tab-active); box-shadow: var(--tab-active-shadow); opacity: 1; }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 14px; font-weight: 700; opacity: .8; margin-bottom: 5px; }
.field input {
  width: 100%;
  font: inherit; font-size: 18px;
  color: var(--text);
  padding: 10px 14px;
  border-radius: 12px;
  border: 2px solid var(--field-border);
  background: var(--field-bg);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  user-select: text;
}
.field input::placeholder, .join-form input::placeholder, .chat-form input::placeholder { color: var(--placeholder); }
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgb(var(--accent-rgb) / .2); }
.field-error { display: block; min-height: 0; margin-top: 4px; font-size: 13px; font-weight: 700; line-height: 1.3; color: var(--bad); text-align: left; }
.field-error:empty { display: none; }
.field.invalid input { border-color: var(--bad); }
.field.invalid input:focus { border-color: var(--bad); box-shadow: 0 0 0 3px rgb(var(--bad-rgb) / .22); }
.only-register { display: none; }
#auth.is-register .only-register { display: block; }

.form-error { min-height: 22px; margin: 2px 0 10px; color: var(--bad); font-weight: 700; font-size: 15px; text-align: center; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .6; cursor: progress; transform: none; }
.btn.loading::after {
  content: '';
  display: inline-block;
  width: 14px; height: 14px; margin-left: 10px;
  vertical-align: -2px;
  border-radius: 50%;
  border: 3px solid currentColor;
  border-right-color: transparent;
  animation: spin .7s linear infinite;
}

/* ---------- Chọn nhân vật ---------- */
.char-screen { width: 980px; }
.char-layout { display: flex; gap: 22px; margin: 18px 0 8px; }
.char-grid { flex: 1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.char-card {
  position: relative;
  display: flex; flex-direction: column; align-items: center;
  padding: 10px 6px 8px;
  font: inherit; color: var(--text);
  border-radius: 16px;
  border: 3px solid rgb(var(--hi-rgb) / .12);
  background:
    radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--c-main) 35%, transparent), transparent 70%),
    rgb(var(--shade-rgb) / calc(.25 * var(--shade-k)));
  cursor: pointer;
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
.char-card:hover { transform: translateY(-3px); }
.char-card img { width: 96px; height: 104px; image-rendering: auto; }
.char-card .cname { font-weight: 800; font-size: 16px; color: var(--c-text); }
.char-card.sel {
  border-color: var(--c-main);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--c-main) 30%, transparent), 0 10px 24px rgb(var(--shadow-rgb) / calc(.35 * var(--shadow-k)));
}
.char-card.sel img { animation: hop .7s ease-in-out infinite alternate; }
@keyframes hop { to { transform: translateY(-5px); } }

.char-detail {
  width: 330px; flex: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 16px;
  border-radius: 18px;
  border: 2px solid color-mix(in srgb, var(--c-main) 60%, transparent);
  background:
    radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--c-main) 40%, transparent), transparent 65%),
    rgb(var(--shade-rgb) / calc(.3 * var(--shade-k)));
}
.char-detail img { width: 176px; height: 192px; filter: drop-shadow(0 8px 10px rgb(var(--shadow-rgb) / calc(.4 * var(--shadow-k)))); }
.char-name { font-size: 28px; font-weight: 800; color: var(--c-text); margin-top: 4px; }
.char-desc { font-size: 15px; opacity: .8; text-align: center; line-height: 1.3; }

/* ---------- Hồ sơ trên menu ---------- */
.profile {
  display: flex; align-items: center; gap: 14px;
  margin: 18px 0 20px;
  padding: 10px 16px 10px 10px;
  border-radius: 18px;
  text-align: left;
  border: 2px solid color-mix(in srgb, var(--c-main) 55%, transparent);
  background: linear-gradient(90deg, color-mix(in srgb, var(--c-main) 30%, transparent), rgb(var(--shade-rgb) / calc(.2 * var(--shade-k))));
}
.profile img { width: 66px; height: 72px; }
.profile-info { flex: 1; min-width: 0; }
.profile-name { font-size: 24px; font-weight: 800; line-height: 1.1; color: var(--c-text); }
.profile-char { font-size: 15px; font-weight: 700; opacity: .85; }
.profile-email { font-size: 13px; opacity: .55; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-actions { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.link {
  font: inherit; font-size: 14px; font-weight: 700;
  color: var(--accent);
  background: none; border: 0; padding: 2px 4px;
  cursor: pointer;
}
.link:hover { text-decoration: underline; }

/* ======================================================================
   Mobile / cảm ứng
   body.touch : thiết bị cảm ứng  ·  body.short : màn hình logic thấp (< 640)
   ====================================================================== */
html, body {
  touch-action: none;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}
.field input { touch-action: manipulation; }
.touch-only { display: none; }
body.touch .touch-only { display: inline-block; }

/* Nút toàn màn hình (chỉ trên cảm ứng) */
.fsbtn {
  display: none;
  width: 46px; height: 46px;
  padding: 10px;
  color: var(--text);
  border-radius: 50%;
  border: 2px solid var(--panel-border);
  background: var(--panel);
  pointer-events: auto;
  cursor: pointer;
}
.fsbtn svg { width: 100%; height: 100%; display: block; }
body.touch .fsbtn { display: block; }

/* Cụm điều khiển cảm ứng */
#touch { display: none; }
body.touch #touch { display: block; }
#touch.idle .dpad, #touch.idle .firebtn { opacity: .35; }

.dpad {
  position: absolute;
  left: 18px; bottom: 16px;
  width: 204px; height: 204px;
  display: grid;
  grid-template: repeat(3, 1fr) / repeat(3, 1fr);
  gap: 4px;
  pointer-events: auto;
  transition: opacity .2s;
}
.tbtn {
  position: relative;
  border: 2px solid rgb(var(--hi-rgb) / .25);
  border-radius: 18px;
  background: rgb(var(--panel-rgb) / .62);
  box-shadow: 0 4px 0 rgb(var(--shadow-rgb) / calc(.35 * var(--shadow-k)));
  touch-action: none;
  cursor: pointer;
}
.tbtn i {
  position: absolute; left: 50%; top: 50%;
  width: 0; height: 0;
  border: 14px solid transparent;
  transform: translate(-50%, -50%);
}
.tbtn.up { grid-area: 1 / 2; }
.tbtn.left { grid-area: 2 / 1; }
.tbtn.right { grid-area: 2 / 3; }
.tbtn.down { grid-area: 3 / 2; }
.tbtn.up i { border-bottom: 18px solid var(--accent); border-top-width: 0; }
.tbtn.down i { border-top: 18px solid var(--accent); border-bottom-width: 0; }
.tbtn.left i { border-right: 18px solid #9fe8ff; border-left-width: 0; }
.tbtn.right i { border-left: 18px solid #9fe8ff; border-right-width: 0; }
.tbtn.on { transform: translateY(3px); box-shadow: 0 1px 0 rgb(var(--shadow-rgb) / calc(.35 * var(--shadow-k))); background: rgb(var(--accent-rgb) / .3); }
.dpad-center {
  grid-area: 2 / 2;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-radius: 50%;
  background: rgb(var(--panel-rgb) / .8);
  border: 2px solid rgb(var(--accent-rgb) / .5);
  line-height: 1;
}
.dpad-center small { font-size: 10px; letter-spacing: 2px; opacity: .7; }
.dpad-center span { font-size: 20px; font-weight: 800; color: var(--accent); }

.firebtn {
  --p: 0;
  position: absolute;
  right: 22px; bottom: 22px;
  width: 156px; height: 156px;
  border-radius: 50%;
  border: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font: inherit; color: #3a1028;
  background:
    radial-gradient(circle, #ffb347 0 58%, transparent 59%),
    conic-gradient(#ff4d5e calc(var(--p) * 1%), rgb(var(--panel-rgb) / .8) 0);
  box-shadow: 0 0 0 4px rgb(var(--hi-rgb) / .25), 0 8px 0 rgb(var(--shadow-rgb) / calc(.35 * var(--shadow-k)));
  pointer-events: auto;
  touch-action: none;
  cursor: pointer;
  transition: opacity .2s;
}
.firebtn span { font-size: 30px; font-weight: 800; line-height: 1; }
.firebtn small { font-size: 12px; font-weight: 700; opacity: .7; }
.firebtn.on {
  transform: translateY(4px) scale(.97);
  box-shadow: 0 0 0 4px rgb(var(--accent-rgb) / .7), 0 0 30px rgba(255, 120, 80, .7), 0 4px 0 rgb(var(--shadow-rgb) / calc(.35 * var(--shadow-k)));
}

/* HUD gọn lại trên cảm ứng: chừa 2 góc dưới cho D-pad và nút BẮN */
body.touch #bottombar { left: 238px; right: 196px; height: 84px; gap: 10px; padding: 6px 10px; }
body.touch #angledial, body.touch .hint { display: none; }
body.touch .wslot { width: 84px; height: 68px; }
body.touch .wicon { width: 28px; height: 28px; }
body.touch .wname { font-size: 10px; }
body.touch #minimap { width: 150px; height: 63px; }
body.touch #weapons { gap: 6px; }
body.touch .menu-card .controls, body.touch .menu-card .tip { display: none; }

/* Màn hình thấp: thu gọn thẻ người chơi, gió nằm ngang hàng với đồng hồ */
body.short .pcard { width: 250px; padding: 6px 10px; top: 10px; }
body.short .avatar { width: 44px; height: 44px; }
body.short .pname { font-size: 16px; }
body.short #topcenter { flex-direction: row; top: 8px; }
body.short #banner { font-size: 44px; top: 30%; }
body.short .menu-card { padding: 22px 32px 20px; }
body.short .logo { font-size: 56px; }
body.short .logo span { font-size: 30px; }
body.short .logo.small { font-size: 40px; }
body.short .logo.small span { font-size: 22px; }
body.short .tabs { margin: 12px 0 12px; }
body.short .field { margin-bottom: 8px; }
body.short .field input { padding: 7px 12px; font-size: 17px; }
body.short .field-error { margin-top: 2px; font-size: 12px; }
body.short .form-error { margin: 0 0 6px; }
body.short .profile { margin: 12px 0 14px; }
body.short .char-layout { margin: 10px 0 4px; }
body.short .char-card img { width: 80px; height: 87px; }
body.short .char-detail img { width: 140px; height: 152px; }
body.short .card-title { font-size: 28px; }

/* ---------- Màn hình hẹp / dọc (body.narrow: chiều rộng logic < 1000) ---------- */
body.narrow .pcard { width: calc(50% - 22px); top: 8px; gap: 8px; padding: 6px 8px; }
body.narrow .pcard.active { transform: none; }
body.narrow .avatar { width: 40px; height: 40px; border-radius: 10px; }
body.narrow .pname { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.narrow .hpbar { height: 15px; }
body.narrow .hptext { font-size: 11px; line-height: 14px; }
body.narrow #topcenter { top: 74px; flex-direction: row; }
body.narrow #banner { font-size: 38px; top: 30%; }

/* thanh dưới xuống 2 hàng: [góc · vũ khí · bản đồ] / [lực bắn] */
body.narrow #bottombar {
  left: 12px; right: 12px;
  height: auto;
  flex-wrap: wrap; justify-content: center;
  gap: 8px 10px; padding: 8px 10px;
}
body.narrow #angledial { width: 60px; height: 60px; }
body.narrow #needle { width: 26px; }
body.narrow #angleval { font-size: 12px; bottom: 2px; }
body.narrow #weapons { gap: 6px; }
body.narrow .wslot { width: 90px; height: 66px; }
body.narrow .wicon { width: 28px; height: 28px; }
body.narrow .wname { font-size: 10px; }
body.narrow #minimap { width: 150px; height: 63px; }
body.narrow #powerwrap { order: 5; flex-basis: 100%; }
body.narrow .hint { display: none; }

/* cảm ứng + hẹp (điện thoại dọc): D-pad và nút BẮN ở đáy, thanh HUD nằm ngay trên */
body.touch.narrow #bottombar { bottom: 214px; }
body.touch.narrow .dpad { left: 14px; bottom: 14px; width: 186px; height: 186px; }
body.touch.narrow .firebtn { right: 18px; bottom: 22px; width: 150px; height: 150px; }

/* các màn menu trên màn hình hẹp */
body.narrow .menu-card { min-width: 0; max-width: calc(100% - 24px); padding: 24px 20px 20px; }
body.narrow .btns { flex-wrap: wrap; }
body.narrow .logo { font-size: 60px; }
body.narrow .logo span { font-size: 32px; }
body.narrow .controls { grid-template-columns: 1fr; }
body.narrow .profile { flex-wrap: wrap; }
body.narrow .profile-actions { flex-direction: row; flex-wrap: wrap; width: 100%; justify-content: flex-end; }
body.narrow .char-screen { width: calc(100% - 24px); }
body.narrow .char-layout { flex-direction: column; }
body.narrow .char-card img { width: 80px; height: 87px; }
body.narrow .char-detail {
  width: auto;
  display: grid; grid-template-columns: 96px 1fr; column-gap: 14px;
  padding: 10px 14px;
}
body.narrow .char-detail > img { grid-row: span 2; width: 96px; height: 104px; }
body.narrow .char-name { align-self: end; margin: 0; }
body.narrow .char-desc { align-self: start; text-align: left; }

/* ---------- Nút tạm dừng + bảng tạm dừng ---------- */
.roundbtn {
  width: 46px; height: 46px;
  padding: 11px;
  color: var(--text);
  border-radius: 50%;
  border: 2px solid var(--panel-border);
  background: var(--panel);
  pointer-events: auto;
  cursor: pointer;
  transition: transform .15s, border-color .15s;
}
.roundbtn:hover { border-color: var(--accent); transform: scale(1.06); }
.roundbtn svg { width: 100%; height: 100%; display: block; }
#pause { z-index: 5; }
.pause-card { min-width: 340px; }
.pause-card .over-title { margin-bottom: 18px; }
.pause-btns { display: flex; flex-direction: column; gap: 12px; }
.pause-btns .btn { width: 100%; }
body.narrow .pause-card { min-width: 0; width: 320px; }

/* ---------- Trạng thái trên thẻ người chơi ---------- */
.pstatus { position: absolute; left: 76px; bottom: -13px; display: flex; gap: 4px; }
.pcard.right .pstatus { left: auto; right: 76px; }
.chip {
  font-size: 11px; font-weight: 800; line-height: 1;
  padding: 4px 8px; border-radius: 10px;
  box-shadow: 0 2px 6px rgb(var(--shadow-rgb) / calc(.35 * var(--shadow-k)));
}
.chip.burn { background: #ff8a3d; color: #3a1028; }
.chip.ice { background: #bfe9ff; color: #16365e; }
body.narrow .pstatus { left: 56px; }
body.narrow .pcard.right .pstatus { right: 56px; }

/* ---------- Bộ kỹ năng ở màn chọn nhân vật ---------- */
.char-detail img#charBig { width: 112px; height: 122px; }
.char-desc { font-size: 14px; }
.kit { display: flex; flex-direction: column; gap: 5px; margin-top: 6px; width: 100%; }
.kit-row {
  display: flex; gap: 8px; align-items: flex-start;
  padding: 6px 8px;
  border-radius: 10px;
  background: rgb(var(--shade-rgb) / calc(.3 * var(--shade-k)));
  text-align: left;
}
.kit-row img { width: 30px; height: 30px; flex: none; }
.kit-row b { font-size: 14px; }
.kit-row small { font-size: 10px; font-weight: 800; letter-spacing: 1px; color: var(--accent); margin-left: 4px; }
.kit-row.skill small { color: var(--skill); }
.kit-row.ult small { color: var(--ult); }
.kit-row p { margin: 1px 0 0; font-size: 12px; line-height: 1.25; opacity: .8; }
body.short .char-detail img#charBig { width: 84px; height: 91px; }
body.short .char-name { font-size: 22px; }
body.short .char-desc { display: none; }
body.short .kit { margin-top: 4px; gap: 4px; }
body.short .kit-row p { font-size: 11px; }
body.short .kit-row { padding: 4px 8px; }
body.short .kit-row img { width: 26px; height: 26px; }
/* màn thấp: nội dung cao hơn màn hình thì cuộn được (margin auto giữ khung ở giữa khi còn đủ chỗ) */
#charScreen, #auth, #gearScreen, #rankScreen { overflow-y: auto; align-items: flex-start; }
#charScreen > *, #auth > *, #gearScreen > *, #rankScreen > * { margin-top: auto; margin-bottom: auto; }
body.narrow .char-detail img#charBig { width: 96px; height: 104px; }
body.narrow .kit { grid-column: 1 / -1; }

/* ---------- Chọn nhân vật theo trận ---------- */
.char-sub { margin: 0; font-size: 15px; }
.char-card.taken { opacity: .35; filter: grayscale(.9); cursor: not-allowed; transform: none; }
.char-card.taken::after {
  content: 'Người 1';
  position: absolute; top: 6px; right: 6px;
  font-size: 10px; font-weight: 800;
  padding: 2px 6px; border-radius: 8px;
  background: rgba(0, 0, 0, .6); color: #fff;
}
body.short .char-sub { font-size: 13px; }

/* ---------- Chọn bản đồ ở menu ---------- */
.map-pick { margin: 0 0 18px; text-align: left; }
.map-label { font-size: 14px; font-weight: 700; opacity: .85; margin-bottom: 6px; }
.map-label b { color: var(--accent); }
/* đủ rộng thì 7 bản đồ nằm 1 hàng (menu thấp hơn), hẹp thì tự xuống hàng */
.map-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(76px, 1fr)); gap: 8px; }
.map-card {
  position: relative;
  display: flex; flex-direction: column; align-items: stretch;
  padding: 0;
  font: inherit; color: var(--text);
  border-radius: 10px;
  border: 2px solid rgb(var(--hi-rgb) / .14);
  background: rgb(var(--shade-rgb) / calc(.3 * var(--shade-k)));
  overflow: hidden;
  cursor: pointer;
  transition: transform .15s, border-color .15s;
}
.map-card:hover { transform: translateY(-2px); }
.map-card img { width: 100%; aspect-ratio: 192 / 84; display: block; }
.map-card .q {
  display: grid; place-items: center;
  aspect-ratio: 192 / 84;
  font-size: 28px; font-weight: 800;
  background: linear-gradient(135deg, #ff8a95, #ffd36b 35%, #7cc4ff 70%, #c5a6ff);
  color: #fff; text-shadow: 0 2px 4px rgba(0, 0, 0, .4);
}
.map-card .mname { font-size: 11px; font-weight: 700; padding: 3px 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.map-card.sel { border-color: var(--accent); box-shadow: 0 0 0 3px rgb(var(--accent-rgb) / .3); }
body.short .menu-card .logo:not(.small) { font-size: 44px; }
body.short .menu-card .logo:not(.small) span { font-size: 22px; letter-spacing: 10px; }
body.short .map-pick { margin-bottom: 12px; }
body.short .map-grid { gap: 6px; }

/* ======================================================================
   Chơi online: sảnh, tạo phòng, phòng chờ
   ====================================================================== */
.online-btn { background: linear-gradient(180deg, #6fd3ff, #4f7bff); border-color: #bfe9ff; color: #10204a; }
.btn.small { font-size: 14px; padding: 6px 14px; border-radius: 10px; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.lobby-card { width: 640px; }
.lobby-top { display: flex; gap: 12px; justify-content: space-between; margin: 14px 0 12px; }
.quick-row { display: flex; gap: 10px; margin-top: 14px; }
.quick-row .btn { flex: 1; }
.quick-row + .lobby-top { margin-top: 10px; }
.ranked-btn { background: linear-gradient(180deg, #ffe08a, #f2a93a); border-color: #fff0c0; color: #3a2008; }
.ranked-tag {
  display: inline-block; margin-right: 6px; padding: 1px 6px; border-radius: 6px;
  font-style: normal; font-size: 10px; font-weight: 800; letter-spacing: 1px;
  background: linear-gradient(180deg, #ffe08a, #f2a93a); color: #3a2008; vertical-align: 1px;
}
.room-meta.ranked { color: var(--accent); }
.mini-rank, .slot .slot-info .mini-rank { width: 20px; height: 20px; vertical-align: -4px; margin-right: 4px; filter: none; }
.join-form { display: flex; gap: 8px; }
.join-form input, .select {
  font: inherit; font-size: 17px; font-weight: 700;
  color: var(--text);
  padding: 8px 12px;
  border-radius: 12px;
  border: 2px solid var(--field-border);
  background: var(--field-bg);
  outline: none;
}
.join-form input { width: 150px; text-transform: uppercase; letter-spacing: 3px; user-select: text; }
.join-form input:focus, .select:focus { border-color: var(--accent); }
.select option { color: var(--text); background: var(--option-bg); }
.room-list {
  display: flex; flex-direction: column; gap: 8px;
  max-height: 290px; overflow-y: auto;
  padding: 2px;
  margin-bottom: 6px;
  text-align: left;
}
.room-empty { padding: 30px 10px; text-align: center; opacity: .6; }
.room-row {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgb(var(--hi-rgb) / .06);
  border: 1px solid rgb(var(--hi-rgb) / .1);
}
.room-row.playing { opacity: .55; }
.rcode { font-size: 18px; letter-spacing: 2px; color: var(--accent); min-width: 74px; }
.rinfo { flex: 1; display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.rinfo small { opacity: .7; font-size: 13px; }
.rcount { font-weight: 800; }

.create-card { width: 520px; text-align: left; }
.create-card .card-title { margin-bottom: 14px; }
.opt-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.opt-row > span { font-weight: 700; opacity: .85; }
.seg { display: flex; border-radius: 12px; background: rgb(var(--shade-rgb) / calc(.3 * var(--shade-k))); padding: 3px; gap: 3px; }
.seg button {
  font: inherit; font-weight: 800; font-size: 15px;
  min-width: 42px; padding: 6px 12px;
  border: 0; border-radius: 9px;
  color: var(--text); background: transparent;
  opacity: .65; cursor: pointer;
}
.seg button.on { background: rgb(var(--accent-rgb) / .25); color: var(--accent); opacity: 1; }
.seg button:disabled { opacity: .25; cursor: not-allowed; }
.opt-hint { font-size: 13px; opacity: .65; margin: 4px 0 6px; }

.room-card { width: 820px; }
.room-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.room-head .card-title { margin: 0; text-align: left; }
.room-code { letter-spacing: 4px; color: var(--text-strong); background: rgb(var(--shade-rgb) / calc(.35 * var(--shade-k))); padding: 0 10px; border-radius: 10px; user-select: text; }
.room-meta { opacity: .8; font-weight: 700; }
.room-settings {
  display: flex; flex-wrap: wrap; gap: 6px 22px;
  margin: 12px 0 0; padding: 10px 12px 0;
  border-radius: 12px; background: rgb(var(--shade-rgb) / calc(.2 * var(--shade-k)));
}
.room-settings .opt-row { margin-bottom: 10px; }
.room-slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0 8px; }
.room-slots.teams { grid-template-columns: 1fr 1fr; gap: 14px; }
.team-col { display: flex; flex-direction: column; gap: 8px; padding: 8px; border-radius: 14px; border: 2px solid color-mix(in srgb, var(--team) 60%, transparent); background: color-mix(in srgb, var(--team) 12%, transparent); }
.team-name { font-weight: 800; color: var(--team); text-align: left; }
.slot {
  display: flex; align-items: center; gap: 10px;
  min-height: 64px;
  padding: 6px 10px;
  border-radius: 12px;
  text-align: left;
  border: 2px solid color-mix(in srgb, var(--c-main, #888) 50%, transparent);
  background: linear-gradient(90deg, color-mix(in srgb, var(--c-main, #888) 25%, transparent), rgb(var(--shade-rgb) / calc(.25 * var(--shade-k))));
}
.slot.me { box-shadow: 0 0 0 2px var(--accent); }
.slot img { width: 44px; height: 48px; flex: none; }
.slot-info { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.slot-info b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot-info small { color: var(--c-text); font-weight: 700; }
.slot.empty { justify-content: center; border-style: dashed; border-color: rgb(var(--hi-rgb) / .18); background: rgb(var(--shade-rgb) / calc(.15 * var(--shade-k))); opacity: .6; font-size: 14px; }
.badge { font-style: normal; font-size: 11px; font-weight: 800; margin-top: 2px; }
.badge.host { color: var(--accent); }
.badge.ready { color: var(--good); }
.badge.wait { color: var(--bad); opacity: .85; }
.room-status { min-height: 20px; font-weight: 700; opacity: .85; }
.room-btns { flex-wrap: wrap; margin-top: 4px; }
.room-btns .btn { font-size: 16px; padding: 10px 18px; }

body.short .room-slots { margin: 8px 0 4px; }
body.short .slot { min-height: 52px; }
body.short .slot img { width: 36px; height: 39px; }
body.short .room-list { max-height: 220px; }
body.narrow .lobby-card, body.narrow .room-card, body.narrow .create-card { width: calc(100% - 24px); }
body.narrow .lobby-top { flex-direction: column; }
body.narrow .join-form input { flex: 1; }
body.narrow .room-slots { grid-template-columns: 1fr 1fr; }
body.narrow .room-slots.teams { grid-template-columns: 1fr; }
body.narrow .room-settings { flex-direction: column; }

/* Thông báo ngắn */
#toast {
  position: absolute; left: 50%; top: 16px; z-index: 20;
  transform: translateX(-50%);
  max-width: 80%;
  padding: 10px 18px;
  border-radius: 12px;
  background: rgb(var(--panel-rgb) / .94);
  border: 2px solid var(--panel-border);
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
}
#toast.show { animation: toast 3.2s ease forwards; }
@keyframes toast { 0% { opacity: 0; transform: translate(-50%, -10px); } 8%, 85% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; } }

/* Thẻ người chơi khi có 3-6 người: danh sách gọn bên trái */
#pcards.list {
  position: absolute; left: 12px; top: 10px;
  display: flex; flex-direction: column; gap: 5px;
}
#pcards.list .pcard {
  position: relative; top: auto; left: auto; right: auto;
  width: 220px;
  padding: 4px 8px; gap: 8px;
  border-radius: 12px;
  border-left: 5px solid var(--c-main);
}
#pcards.list .pcard.active { transform: translateX(6px); }
#pcards.list .avatar { width: 30px; height: 30px; border-radius: 8px; }
#pcards.list .pname { font-size: 13px; margin-bottom: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#pcards.list .hpbar { height: 11px; }
#pcards.list .hptext { font-size: 9px; line-height: 10px; }
#pcards.list .pstatus { position: static; display: flex; flex-direction: column; gap: 2px; }
#pcards.list .chip { font-size: 9px; padding: 2px 5px; }
.pcard.me .pname { text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; }
body.narrow #hud.multi #topcenter { top: 8px; left: auto; right: 12px; transform: none; }
body.narrow #pcards.list { top: 64px; }
body.narrow #pcards.list .pcard { width: 180px; }
.over-sub { margin: -14px 0 18px; }

/* ======================================================================
   Đấu hạng: huy hiệu, hồ sơ, bảng xếp hạng, kết quả cuối trận
   ====================================================================== */
.pname { display: flex; align-items: center; gap: 5px; min-width: 0; }
.pname span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcard.right .pname { flex-direction: row-reverse; }
.prank { width: 22px; height: 22px; flex: none; }
#pcards.list .prank { width: 16px; height: 16px; }

/* hồ sơ trên menu */
.profile .profile-rank img { width: 24px; height: 24px; }
.profile-rank {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  margin-top: 4px; padding: 3px 10px 3px 4px;
  font: inherit; font-size: 14px; color: var(--text);
  border-radius: 10px; border: 1px solid rgb(var(--accent-rgb) / .35);
  background: rgb(var(--shade-rgb) / calc(.25 * var(--shade-k))); cursor: pointer;
  transition: border-color .15s, background .15s;
}
.profile-rank:hover { border-color: var(--accent); background: rgb(var(--accent-rgb) / .12); }
.profile-rank span { opacity: .85; }
.profile-rank .rank-none { opacity: .7; padding-left: 6px; }
.profile-rank .rank-go { color: var(--accent); font-weight: 800; opacity: 1; margin-left: 4px; }

/* màn bảng xếp hạng */
.rank-card { width: 640px; min-width: 0; }
.rank-me {
  display: flex; align-items: center; gap: 14px; margin: 14px 0 0; padding: 10px 14px;
  text-align: left; border-radius: 16px; background: rgb(var(--shade-rgb) / calc(.28 * var(--shade-k))); border: 1px solid rgb(var(--hi-rgb) / .12);
}
.rank-me > img { width: 64px; height: 64px; flex: none; }
.rank-me > img.dim { opacity: .35; filter: grayscale(1); }
.rank-me-info { flex: 1; min-width: 0; font-size: 17px; }
.rank-me-info small { display: block; font-size: 13px; opacity: .75; margin-top: 3px; line-height: 1.3; }
.rank-progress { height: 8px; margin-top: 6px; border-radius: 4px; background: rgb(var(--hi-rgb) / .12); overflow: hidden; }
.rank-progress i { display: block; height: 100%; border-radius: 4px; }
.rank-tabs { margin: 14px 0 10px; }
.rank-tabs .tab { font-size: 15px; }
.rank-panel { max-height: 330px; overflow-y: auto; text-align: left; padding-right: 4px; }
.rank-empty { padding: 30px 0; text-align: center; opacity: .7; }
.rank-row {
  display: flex; align-items: center; gap: 10px; padding: 6px 10px; margin-bottom: 4px;
  border-radius: 12px; background: rgb(var(--hi-rgb) / .05);
}
.rank-row.me { background: rgb(var(--accent-rgb) / .16); outline: 1px solid rgb(var(--accent-rgb) / .5); }
.rank-pos {
  width: 34px; height: 34px; flex: none; display: flex; align-items: center; justify-content: center;
  border-radius: 50%; font-weight: 800; font-size: 15px; background: rgb(var(--shade-rgb) / calc(.3 * var(--shade-k)));
}
.rank-pos.top1 { background: linear-gradient(180deg, #ffe08a, #e0a020); color: #3a2008; }
.rank-pos.top2 { background: linear-gradient(180deg, #f4f7fb, #a9b6c6); color: #26303d; }
.rank-pos.top3 { background: linear-gradient(180deg, #f2c48c, #b06a2c); color: #3a1c08; }
.rank-ava { width: 34px; height: 37px; flex: none; }
.rank-name { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.rank-name b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-name small { font-size: 12px; font-weight: 800; }
.rank-badge { width: 34px; height: 34px; flex: none; }
.rank-pts { width: 86px; flex: none; text-align: right; display: flex; flex-direction: column; line-height: 1.2; }
.rank-pts b { font-size: 18px; color: var(--accent); }
.rank-pts small { font-size: 11px; opacity: .65; }
.rank-gap { text-align: center; opacity: .5; line-height: 1; margin: 2px 0 6px; }
.tier-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.tier {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px;
  padding: 8px 4px; border-radius: 12px; background: rgb(var(--hi-rgb) / .05);
}
.tier img { width: 46px; height: 46px; }
.tier b { font-size: 13px; line-height: 1.15; }
.tier small { font-size: 11px; opacity: .65; }
.rank-rules { margin: 12px 0 0; padding-left: 20px; font-size: 13px; line-height: 1.45; opacity: .9; }
.rank-rules li { margin-bottom: 4px; }
.up { color: var(--good); }
.down { color: var(--bad); }

/* ======================================================================
   Trang bị & ghép đồ
   ====================================================================== */
.profile-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.profile-chips .profile-rank { margin-top: 0; }
.profile .gear-chip img { width: 22px; height: 22px; }
.gear-chip span:not(.rank-go) { font-size: 13px; }

.gear-card { width: 900px; min-width: 0; }
.gear-layout { display: flex; gap: 18px; margin-top: 14px; text-align: left; }
.gear-side { width: 260px; flex: none; display: flex; flex-direction: column; gap: 12px; }
.gear-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.gear-tabs { margin: 0 0 10px; }
.gear-tabs .tab { font-size: 15px; }

.gear-slots { display: flex; flex-direction: column; gap: 6px; }
.gslot {
  display: flex; align-items: center; gap: 10px; min-height: 58px; padding: 5px 10px 5px 6px;
  font: inherit; color: var(--text); text-align: left;
  border-radius: 12px; border: 2px solid rgb(var(--hi-rgb) / .12); background: rgb(var(--shade-rgb) / calc(.28 * var(--shade-k))); cursor: pointer;
}
.gslot img { width: 46px; height: 46px; flex: none; }
.gslot.sel { border-color: var(--accent); }
.gslot.empty { cursor: default; border-style: dashed; justify-content: center; }
.gslot-ph { opacity: .45; font-weight: 700; font-size: 14px; }
.gslot-info { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.gslot-info small { font-size: 11px; opacity: .6; font-weight: 700; }
.gslot-info b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.gear-total { padding: 10px 12px; border-radius: 12px; background: rgb(var(--shade-rgb) / calc(.28 * var(--shade-k))); font-size: 14px; }
.gear-total-title { font-weight: 800; color: var(--accent); margin-bottom: 4px; }
.gear-total div:not(.gear-total-title) { display: flex; align-items: baseline; gap: 6px; padding: 2px 0; }
.gear-total span { flex: 1; opacity: .8; }
.gear-total b { font-size: 16px; }
.gear-total small { font-size: 11px; opacity: .6; }

.gear-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(60px, 1fr)); gap: 8px;
  max-height: 252px; overflow-y: auto; padding: 2px 4px 2px 2px; align-content: start;
}
.gitem {
  position: relative; aspect-ratio: 1; padding: 2px; border-radius: 12px; cursor: pointer;
  border: 2px solid transparent; background: transparent; transition: transform .12s, border-color .12s;
}
.gitem img { width: 100%; height: 100%; display: block; }
.gitem:hover:not(:disabled) { transform: translateY(-2px); }
.gitem.sel { border-color: var(--accent); background: rgb(var(--accent-rgb) / .14); }
.gitem:disabled { opacity: .28; cursor: not-allowed; }
.gitem i {
  position: absolute; left: 50%; bottom: -2px; transform: translateX(-50%); white-space: nowrap;
  font-style: normal; font-size: 9px; font-weight: 800; padding: 1px 5px; border-radius: 6px;
  background: var(--accent); color: #3a2008;
}
.gear-count { grid-column: 1 / -1; text-align: right; font-size: 12px; opacity: .5; }
.gear-empty { grid-column: 1 / -1; padding: 30px 0; text-align: center; opacity: .65; }

.gear-detail {
  display: flex; align-items: center; gap: 12px; margin-top: 10px; padding: 10px 12px; min-height: 76px;
  border-radius: 12px; background: rgb(var(--shade-rgb) / calc(.28 * var(--shade-k)));
}
.gd-icon { width: 60px; height: 60px; flex: none; }
.gd-info { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.gd-info b { font-size: 17px; }
.gd-info small { font-size: 12px; opacity: .65; font-weight: 700; }
.gd-stats { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 3px; font-size: 14px; font-weight: 800; color: var(--good); }
.gd-info p { margin: 3px 0 0; font-size: 12px; opacity: .7; }
.gear-hint { opacity: .65; font-size: 14px; }

.gear-forge { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 10px; padding: 12px; border-radius: 12px; background: rgb(var(--shade-rgb) / calc(.28 * var(--shade-k))); text-align: center; }
.forge-row { display: flex; align-items: center; gap: 8px; }
.fslot {
  width: 62px; height: 62px; padding: 2px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  border: 2px solid rgb(var(--hi-rgb) / .2); background: rgb(var(--hi-rgb) / .05); cursor: pointer;
  font: inherit; font-size: 26px; color: rgb(var(--hi-rgb) / .35);
}
.fslot img { width: 100%; height: 100%; }
.fslot.empty { border-style: dashed; cursor: default; }
.fslot.result { cursor: default; border-color: var(--accent); }
.fslot img.ghost { opacity: .45; filter: saturate(.7); }
.forge-arrow { font-size: 26px; color: var(--accent); font-weight: 800; }
.forge-info { font-size: 15px; }
.forge-note { font-size: 12px; opacity: .55; max-width: 460px; }
.forge-result { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-radius: 12px; text-align: left; animation: pop .45s cubic-bezier(.2, 1.4, .4, 1); }
.forge-result img { width: 56px; height: 56px; }
.forge-result div { display: flex; flex-direction: column; line-height: 1.3; }
.forge-result small { font-size: 12px; opacity: .75; }
.forge-result.ok { background: rgb(var(--good-rgb) / .14); border: 1px solid rgb(var(--good-rgb) / .5); }
.forge-result.ok b { color: var(--good); }
.forge-result.fail { background: rgb(var(--bad-rgb) / .12); border: 1px solid rgb(var(--bad-rgb) / .45); }
.forge-result.fail b { color: var(--bad); }
#gearError.ok { color: var(--good); }

/* đồ nhận được cuối trận online */
.over-drops { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 14px; margin: -6px auto 18px; max-width: 520px; }
.drops-title { width: 100%; font-size: 13px; font-weight: 800; letter-spacing: 1px; opacity: .7; }
.drop { display: flex; align-items: center; gap: 6px; text-align: left; }
.drop img { width: 40px; height: 40px; }
.drop span { display: flex; flex-direction: column; line-height: 1.15; }
.drop small { font-size: 11px; opacity: .65; }

body.short .gear-grid { max-height: 150px; }
body.short .gslot { min-height: 46px; }
body.short .gslot img { width: 36px; height: 36px; }
body.short .gear-total { font-size: 13px; padding: 6px 10px; }
body.narrow .gear-card { width: calc(100% - 24px); padding-left: 16px; padding-right: 16px; }
body.narrow .gear-layout { flex-direction: column; }
body.narrow .gear-side { width: auto; }
body.narrow .gear-slots { display: grid; grid-template-columns: 1fr 1fr; }

/* ======================================================================
   Chat trong phòng online
   ====================================================================== */
.chat-log {
  overflow-y: auto; padding: 6px 10px; text-align: left; font-size: 14px; line-height: 1.35;
  border-radius: 12px; background: rgb(var(--shade-rgb) / calc(.3 * var(--shade-k))); overflow-wrap: anywhere;
}
.chat-line { padding: 1px 0; }
.chat-line time { font-size: 11px; opacity: .45; margin-right: 6px; font-variant-numeric: tabular-nums; }
.chat-line b { font-weight: 800; }
.chat-line.me span { color: var(--me-text); }
.chat-line.system { opacity: .6; font-style: italic; font-size: 13px; }
.chat-empty { opacity: .5; font-size: 13px; text-align: center; padding: 10px 0; }
.chat-form { display: flex; gap: 8px; margin-top: 6px; }
.chat-form input {
  flex: 1; min-width: 0; font: inherit; font-size: 15px; color: var(--text);
  padding: 7px 12px; border-radius: 10px; border: 2px solid var(--field-border);
  background: var(--field-bg); outline: none; user-select: text;
}
.chat-form input:focus { border-color: var(--accent); }
.chat-error { min-height: 0; font-size: 12px; font-weight: 700; color: var(--bad); text-align: left; }
.chat-error:empty { display: none; }

.room-chat { margin: 4px 0 8px; }
.room-chat .chat-log { height: 116px; }
body.short .room-chat .chat-log { height: 70px; }

.chat-btn { position: relative; }
.chat-badge {
  position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 4px;
  border-radius: 9px; background: #ff5d6c; color: #fff; font-style: normal; font-size: 11px; font-weight: 800;
  line-height: 18px; text-align: center; box-shadow: 0 0 0 2px rgb(var(--panel-rgb) / .9);
}
.game-chat {
  position: absolute; top: 112px; right: 16px; width: 340px; z-index: 4;
  padding: 8px 10px 10px; border-radius: 16px; pointer-events: auto;
  background: var(--panel); border: 2px solid var(--panel-border);
  box-shadow: 0 10px 30px rgb(var(--shadow-rgb) / calc(.4 * var(--shadow-k)));
}
.game-chat-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.game-chat-head b { color: var(--accent); }
.game-chat-head small { flex: 1; font-size: 11px; opacity: .55; }
.chat-close { font: inherit; font-size: 22px; line-height: 1; color: var(--text); background: none; border: 0; cursor: pointer; opacity: .7; padding: 0 4px; }
.chat-close:hover { opacity: 1; }
.game-chat .chat-log { max-height: 190px; min-height: 60px; }
body.short .game-chat { top: 64px; }
body.short .game-chat .chat-log { max-height: 110px; }
body.narrow .game-chat { left: 12px; right: 12px; width: auto; top: 128px; }

/* nhãn tự động bắn */
.auto-chip {
  align-self: center; padding: 3px 8px; border-radius: 8px; white-space: nowrap;
  font-size: 11px; font-weight: 800; letter-spacing: 1px; font-style: normal;
  background: linear-gradient(180deg, #6fd3ff, #4f7bff); color: #10204a; box-shadow: 0 2px 8px rgb(var(--shadow-rgb) / calc(.35 * var(--shadow-k)));
}
.d-stats .auto-chip { margin-top: 2px; font-size: 10px; padding: 2px 6px; opacity: 1; }

/* kết quả hạng cuối trận online */
.over-rank {
  display: flex; align-items: center; gap: 12px; margin: -6px auto 18px; padding: 8px 14px;
  width: fit-content; max-width: 100%; text-align: left;
  border-radius: 14px; background: rgb(var(--shade-rgb) / calc(.3 * var(--shade-k))); border: 1px solid rgb(var(--accent-rgb) / .35);
}
.over-rank img { width: 52px; height: 52px; flex: none; }
.over-rank-info { font-size: 17px; }
.over-rank-info small { display: block; font-size: 13px; opacity: .75; }
.rank-delta { font-weight: 800; margin-left: 4px; }
.rank-delta.up { color: var(--good); }
.rank-delta.down { color: var(--bad); }
.rank-change { font-weight: 800; font-size: 15px; margin-top: 2px; }

body.short .rank-me { margin-top: 8px; padding: 6px 10px; }
body.short .rank-me > img { width: 48px; height: 48px; }
body.short .rank-panel { max-height: 210px; }
body.short .tier img { width: 36px; height: 36px; }
body.narrow .rank-card { width: calc(100% - 24px); padding-left: 16px; padding-right: 16px; }
body.narrow .tier-grid { grid-template-columns: repeat(3, 1fr); }
body.narrow .rank-ava { display: none; }
body.narrow .rank-pts { width: 70px; }
body.narrow .quick-row { flex-direction: column; }

/* ======================================================================
   Thủ thành
   ====================================================================== */
.menu-card .btns { flex-wrap: wrap; gap: 10px; }
/* 6 chế độ: nút gọn để vẫn nằm 1 hàng trên màn rộng; thẻ không bao giờ rộng hơn màn hình (dư thì xuống hàng) */
.menu-card .btns .btn { padding: 12px 16px; font-size: 18px; }
.menu-card { max-width: calc(100% - 32px); }
.defense-btn { background: linear-gradient(180deg, #9be37c, #3fa65a); border-color: #d6ffc8; color: #10301a; }

#dhud { position: absolute; inset: 0; pointer-events: none; }
#dhud .d-top {
  position: absolute; top: 10px; left: 14px; right: 14px;
  display: flex; align-items: center; gap: 16px;
  padding: 7px 10px 7px 14px; border-radius: 18px;
  background: linear-gradient(180deg, rgb(var(--hud-panel-rgb) / .92), rgb(var(--hud-panel-rgb) / .76));
  border: 1.5px solid var(--panel-border);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .12);
}
.d-top .roundbtn { pointer-events: auto; flex: none; }

/* máu tường: thanh chia 10 đốt, đổi màu theo mức hư hại, vệt trắng trễ cho thấy vừa mất bao nhiêu */
.d-wall { flex: 1.5; min-width: 0; }
.d-wall-head { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; font-size: 12px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; }
.d-wall-head span { opacity: .8; }
.d-wall-head b { margin-left: auto; font-size: 13px; font-variant-numeric: tabular-nums; letter-spacing: 0; }
.d-wall-ico { width: 18px; height: 18px; flex: none; color: #e8c27a; }
.d-wallbar, .d-bossbar {
  position: relative; height: 16px; border-radius: 9px; overflow: hidden;
  background: rgba(0, 0, 0, .5); box-shadow: inset 0 1px 3px rgba(0, 0, 0, .6), 0 0 0 1.5px rgba(255, 255, 255, .12);
}
.d-wallbar i, .d-bossbar i, .d-bossbar u { position: absolute; inset: 0 auto 0 0; width: 100%; }
.d-wallbar .lag, .d-bossbar .lag { background: #fff6dc; opacity: .8; transition: width .6s ease .25s; }
.d-wallbar .fill { background: linear-gradient(180deg, #ffe9a8, #e8a83a 55%, #b8741c); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5); transition: width .15s; }
.d-wallbar[data-lv="mid"] .fill { background: linear-gradient(180deg, #ffc89a, #ff8a3d 55%, #c4521a); }
.d-wallbar[data-lv="low"] .fill { background: linear-gradient(180deg, #ffa4a4, #ff4d5e 55%, #a81e2e); animation: dLow .8s ease-in-out infinite; }
.d-wallbar s, .d-bossbar s { position: absolute; inset: 0; pointer-events: none; text-decoration: none;
  background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 2px), rgba(0, 0, 0, .38) calc(10% - 2px) 10%); }
.d-wallbar[data-lv="low"] { box-shadow: inset 0 1px 3px rgba(0, 0, 0, .6), 0 0 0 1.5px rgba(255, 90, 100, .7), 0 0 12px rgba(255, 60, 70, .6); }
@keyframes dLow { 50% { filter: brightness(1.5); } }

/* đợt: huy hiệu hình khiên + số quái còn lại + tiến độ đợt */
.d-wave { display: flex; align-items: center; gap: 10px; flex: none; }
.d-wave-badge {
  width: 56px; height: 54px; flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1;
  color: #3a1408; padding-bottom: 4px;
  background: linear-gradient(180deg, #fff0b0, #ffc547 45%, #e0892a);
  clip-path: polygon(50% 0, 100% 16%, 100% 66%, 50% 100%, 0 66%, 0 16%);
}
.d-wave-badge small { font-size: 9px; font-weight: 800; letter-spacing: 1.5px; opacity: .75; }
.d-wave-badge b { font-size: 25px; }
#dhud.has-boss .d-wave-badge { background: linear-gradient(180deg, #ffc4b8, #ff5d5d 45%, #a81e2e); color: #2a0408; }
.d-wave-info { display: flex; flex-direction: column; gap: 5px; min-width: 104px; }
.d-wave-info span { font-size: 13px; font-weight: 700; opacity: .9; white-space: nowrap; min-height: 16px; }
.d-wave-prog { height: 6px; border-radius: 4px; background: rgba(0, 0, 0, .5); overflow: hidden; box-shadow: 0 0 0 1px rgba(255, 255, 255, .08); }
.d-wave-prog i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #9fe8ff, #6ee7a0); transition: width .3s; }

.d-stats { display: flex; flex-direction: column; align-items: flex-end; flex: 1; min-width: 0; line-height: 1.2; gap: 2px; }
.d-stats > span:not(.d-coins) { font-size: 13px; opacity: .85; font-variant-numeric: tabular-nums; }
.d-stats small { font-size: 11px; opacity: .6; }
.d-coins { display: inline-flex; align-items: center; gap: 5px; font-weight: 800; color: var(--accent); font-size: 18px; }
#dhud .d-coins {
  font-size: 19px; padding: 2px 12px 2px 4px; border-radius: 20px; font-variant-numeric: tabular-nums;
  background: rgba(0, 0, 0, .32); box-shadow: inset 0 0 0 1px rgba(255, 211, 107, .32);
}
#dhud .d-coins .d-coin-ico { width: 20px; height: 20px; }
#dhud .d-coins.bump { animation: dBump .28s ease; }
@keyframes dBump { 40% { transform: scale(1.18); filter: brightness(1.35); } }
.d-coin-ico {
  display: inline-block; width: 16px; height: 16px; border-radius: 50%; flex: none; vertical-align: -2px;
  background: radial-gradient(circle at 40% 35%, #fff3b0, #ffc23d 60%, #c98a12); box-shadow: inset 0 0 0 1.5px #8a5a0c;
}

/* máu trùm */
.d-boss {
  position: absolute; top: 86px; left: 50%; transform: translateX(-50%); width: min(640px, calc(100% - 28px));
  display: flex; align-items: center; gap: 10px; padding: 6px 12px 8px 6px; border-radius: 16px;
  background: linear-gradient(180deg, rgba(46, 8, 18, .9), rgba(20, 4, 10, .84));
  border: 1.5px solid color-mix(in srgb, var(--boss, #ff8a95) 65%, transparent);
  box-shadow: 0 0 26px color-mix(in srgb, var(--boss, #ff8a95) 35%, transparent), 0 6px 18px rgba(0, 0, 0, .4);
  animation: dBossIn .5s cubic-bezier(.2, .9, .3, 1.3);
}
@keyframes dBossIn { from { opacity: 0; transform: translate(-50%, -16px) scale(.9); } }
.d-boss img { width: 46px; height: 50px; flex: none; border-radius: 12px; background: rgba(0, 0, 0, .4); box-shadow: inset 0 0 0 1.5px var(--boss, #ff8a95); }
.d-boss-main { flex: 1; min-width: 0; }
.d-boss-name { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; white-space: nowrap; min-width: 0; }
.d-boss-name b { font-size: 17px; color: var(--boss, #ff8a95); text-shadow: 0 2px 0 rgba(0, 0, 0, .55); flex: none; }
.d-boss-name small { font-size: 11px; opacity: .7; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.d-boss-name span { margin-left: auto; font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums; flex: none; }
.d-bossbar { height: 14px; }
.d-bossbar .fill { background: linear-gradient(180deg, #ffa49a, #e0303c 55%, #8a1020); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .4); transition: width .12s; }
.d-bossbar u { width: 0; text-decoration: none; background: linear-gradient(180deg, rgba(230, 250, 255, .95), rgba(120, 210, 255, .85)); transition: width .2s; }
.d-bossbar s { background: repeating-linear-gradient(90deg, transparent 0 calc(25% - 2px), rgba(0, 0, 0, .45) calc(25% - 2px) 25%); }

/* băng rôn giữa màn hình */
#dBanner {
  position: absolute; top: 26%; left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: 6px;
  opacity: 0; pointer-events: none; text-align: center; padding: 0 12px;
}
#dBanner small {
  display: none; font-size: 13px; font-weight: 800; letter-spacing: 4px; text-transform: uppercase; color: #fff3c4;
  padding: 3px 16px; border-radius: 20px; background: rgba(0, 0, 0, .4); box-shadow: inset 0 0 0 1px rgba(255, 243, 196, .35);
}
#dBanner.has-place small { display: block; }
#dBanner b {
  font-size: 58px; line-height: 1; font-weight: 800; color: var(--bn, #ffd36b); letter-spacing: 1px;
  text-shadow: 0 4px 0 #2a0d1e, 2px 0 0 #2a0d1e, -2px 0 0 #2a0d1e, 0 -2px 0 #2a0d1e, 0 8px 18px rgba(0, 0, 0, .5), 0 0 34px color-mix(in srgb, var(--bn, #ffd36b) 60%, transparent);
}
#dBanner span:empty { display: none; }
#dBanner span {
  font-size: 19px; font-weight: 800; color: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, .65);
  padding: 4px 34px; background: linear-gradient(90deg, transparent, rgba(10, 4, 20, .55) 20%, rgba(10, 4, 20, .55) 80%, transparent);
}
#dBanner.boss { --bn: #ff6a6a; }
#dBanner.boss b { font-size: 62px; }
#dBanner.clear { --bn: #7ee0ad; }
#dBanner.show { animation: dBanner 2.3s ease forwards; }
@keyframes dBanner {
  0% { opacity: 0; transform: scale(1.5); }
  9% { opacity: 1; transform: scale(.96); }
  15% { transform: scale(1); }
  80% { opacity: 1; transform: none; }
  100% { opacity: 0; transform: translateY(-24px); }
}

/* màn giới thiệu trùm */
.d-intro { position: absolute; inset: 0; display: flex; align-items: center; pointer-events: none; }
.d-intro::before { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse at center, rgba(60, 0, 16, .2), rgba(10, 0, 6, .72)); animation: dIntroFade 2.9s ease forwards; }
.d-intro-band {
  position: relative; width: 100%; display: flex; align-items: center; justify-content: center; gap: 20px; padding: 10px 20px;
  background: linear-gradient(90deg, transparent, rgba(24, 2, 10, .92) 16%, rgba(24, 2, 10, .92) 84%, transparent);
  border-top: 2px solid color-mix(in srgb, var(--boss) 70%, transparent); border-bottom: 2px solid color-mix(in srgb, var(--boss) 70%, transparent);
  animation: dIntroBand 2.9s cubic-bezier(.2, .8, .2, 1) forwards;
}
.d-intro img { height: 190px; filter: drop-shadow(0 0 18px color-mix(in srgb, var(--boss) 70%, transparent)); animation: dIntroImg 2.9s ease forwards; }
.d-intro-text { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; animation: dIntroTxt 2.9s ease forwards; }
.d-intro-text small { font-size: 13px; font-weight: 800; letter-spacing: 6px; color: #ff8a95; }
.d-intro-text b { font-size: 50px; line-height: 1; color: var(--boss); text-shadow: 0 4px 0 #1a0408, 0 0 28px color-mix(in srgb, var(--boss) 70%, transparent); }
.d-intro-text > span { font-size: 16px; opacity: .9; font-style: italic; }
.d-intro-skills { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.d-intro-skills span { font-size: 12px; font-weight: 800; padding: 3px 10px; border-radius: 20px; background: rgba(255, 255, 255, .1); border: 1px solid color-mix(in srgb, var(--boss) 60%, transparent); }
@keyframes dIntroFade { 0% { opacity: 0; } 10% { opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; } }
@keyframes dIntroBand { 0% { opacity: 0; transform: scaleY(0); } 8% { opacity: 1; transform: none; } 84% { opacity: 1; } 100% { opacity: 0; transform: scaleY(.5); } }
@keyframes dIntroImg { 0% { opacity: 0; transform: translateX(-80px) scale(.9); } 14% { opacity: 1; transform: none; } 84% { opacity: 1; } 100% { opacity: 0; } }
@keyframes dIntroTxt { 0%, 8% { opacity: 0; transform: translateX(60px); } 20% { opacity: 1; transform: none; } 84% { opacity: 1; } 100% { opacity: 0; } }

/* chuỗi hạ gục */
.d-combo {
  position: absolute; right: 24px; top: 38%; display: flex; flex-direction: column; align-items: center; line-height: .9;
  opacity: 0; transform: translateX(30px) scale(.8); transition: opacity .25s, transform .25s; pointer-events: none;
}
.d-combo.on { opacity: 1; transform: none; }
.d-combo b { font-size: 46px; font-weight: 800; font-style: italic; color: #ffd36b; text-shadow: 0 4px 0 #2a0d1e, 2px 0 0 #2a0d1e, -2px 0 0 #2a0d1e, 0 -2px 0 #2a0d1e; }
.d-combo small { font-size: 13px; font-weight: 800; letter-spacing: 5px; color: #fff; text-shadow: 0 2px 0 #2a0d1e; }
.d-combo.hot b { color: #ff7a3d; text-shadow: 0 4px 0 #2a0d1e, 2px 0 0 #2a0d1e, -2px 0 0 #2a0d1e, 0 -2px 0 #2a0d1e, 0 0 22px rgba(255, 120, 60, .85); }
.d-combo.pop b { animation: dPop .25s ease; }
@keyframes dPop { 0% { transform: scale(1.55); } 100% { transform: none; } }

/* tường sắp vỡ: viền đỏ nhấp nháy */
.d-danger { position: absolute; inset: 0; opacity: 0; transition: opacity .4s; background: radial-gradient(ellipse at center, transparent 52%, rgba(255, 30, 45, .5) 100%); }
#dhud.danger .d-danger { opacity: 1; animation: dDanger 1.1s ease-in-out infinite; }
@keyframes dDanger { 50% { opacity: .35; } }

/* thanh kỹ năng dưới cùng */
.d-bottom {
  position: absolute; left: 14px; right: 14px; bottom: 10px; height: 74px;
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 20px;
  background: linear-gradient(180deg, rgb(var(--hud-panel-rgb) / .76), rgb(var(--hud-panel-rgb) / .92));
  border: 1.5px solid var(--panel-border); box-shadow: 0 -2px 20px rgba(0, 0, 0, .3), inset 0 1px 0 rgba(255, 255, 255, .1);
}
.d-weapon, .d-skill { display: flex; align-items: center; gap: 10px; min-width: 0; text-align: left; }
.d-slot {
  position: relative; width: 52px; height: 52px; flex: none; border-radius: 15px; display: grid; place-items: center; overflow: hidden;
  background: radial-gradient(circle at 50% 30%, rgba(255, 255, 255, .16), rgba(0, 0, 0, .38));
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .16), inset 0 -3px 0 rgba(0, 0, 0, .28);
}
.d-slot img { width: 44px; height: 44px; }
.d-slot kbd {
  position: absolute; right: 3px; bottom: 3px; font: 800 10px/1 inherit; padding: 2px 4px; border-radius: 5px;
  background: rgba(0, 0, 0, .65); color: #fff; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25);
}
.d-lbl { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.d-lbl small { font-size: 10px; font-weight: 800; letter-spacing: 1.5px; color: var(--accent); opacity: .9; }
.d-lbl b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.d-skill {
  position: relative; pointer-events: auto; cursor: pointer; font: inherit; color: var(--text);
  padding: 5px 16px 5px 5px; border-radius: 19px; border: 1.5px solid rgba(255, 255, 255, .14);
  background: linear-gradient(180deg, rgba(255, 255, 255, .1), rgba(255, 255, 255, .03)); transition: transform .12s, border-color .2s;
}
.d-skill:hover { border-color: var(--accent); }
.d-skill:active { transform: scale(.96); }
.d-skill .d-slot > i {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-style: normal; font-size: 21px; font-weight: 800;
  color: #fff; text-shadow: 0 2px 0 #000; opacity: 0; background: conic-gradient(rgba(8, 4, 20, .74) var(--cd, 0%), transparent 0);
}
.d-skill.cooling .d-slot > i { opacity: 1; }
.d-skill.cooling { cursor: not-allowed; }
.d-skill.cooling img { filter: grayscale(.6) brightness(.85); }
.d-skill:not(.cooling):not(.ult) .d-slot { box-shadow: inset 0 0 0 1.5px rgba(197, 166, 255, .75), 0 0 12px rgba(197, 166, 255, .4); }
.d-skill.ult small { color: var(--ult); }
.d-skill.ult .d-slot::after { content: ""; position: absolute; inset: 0; background: conic-gradient(transparent var(--fill, 0%), rgba(8, 4, 20, .62) 0); }
.d-skill.ult.ready .d-slot::after { display: none; }
.d-skill.ult::before {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: 3px; height: 3px; border-radius: 2px;
  background: linear-gradient(90deg, #ff7a3d, #ffd36b) 0 0 / var(--fill, 0%) 100% no-repeat, rgba(0, 0, 0, .45);
}
.d-skill.ult .d-lbl i { font-style: normal; font-size: 11px; font-weight: 800; color: var(--ult); font-variant-numeric: tabular-nums; }
.d-skill.ult:not(.ready) { cursor: not-allowed; }
.d-skill.ult:not(.ready) img { filter: grayscale(.7); opacity: .75; }
.d-skill.ult.ready { border-color: #ffb347; animation: ultReady 1.2s ease-in-out infinite; }
.d-skill.ult.ready .d-slot { box-shadow: inset 0 0 0 2px #ffb347, 0 0 16px rgba(255, 170, 70, .75); }
.d-hint { flex: 1; text-align: right; font-size: 12px; opacity: .55; min-width: 0; }
.d-move {
  pointer-events: auto; width: 64px; height: 56px; flex: none; font-size: 24px; color: var(--text);
  border-radius: 16px; border: 1.5px solid rgb(var(--hi-rgb) / .2); background: linear-gradient(180deg, rgb(var(--hi-rgb) / .12), rgb(var(--hi-rgb) / .04)); touch-action: none;
}
.d-move.on { background: rgb(var(--accent-rgb) / .3); border-color: var(--accent); }
body.touch .d-hint { display: none; }
body.touch .d-move { display: block; }

/* cửa hàng giữa các đợt */
.d-shop-card { width: 740px; min-width: 0; position: relative; padding-top: 38px; overflow: visible; }
.d-shop-crest, .d-over-crest {
  position: absolute; top: -30px; left: 50%; transform: translateX(-50%); width: 62px; height: 62px; border-radius: 50%;
  display: grid; place-items: center; color: #2f8a4a;
  background: radial-gradient(circle at 40% 30%, #fff6d0, #ffc23d 58%, #c98a12);
  box-shadow: 0 6px 16px rgba(0, 0, 0, .35), inset 0 -3px 0 rgba(0, 0, 0, .2), 0 0 0 4px var(--card-bg);
}
.d-shop-crest svg { width: 34px; height: 34px; }
.d-shop-title { font-size: 40px; margin-bottom: 6px; color: var(--good); }
.d-shop-reward {
  display: inline-flex; align-items: center; gap: 6px; font-weight: 800; font-size: 17px; color: var(--accent);
  padding: 4px 14px; border-radius: 20px; background: rgb(var(--accent-rgb) / .12); border: 1px solid rgb(var(--accent-rgb) / .35);
}
.d-shop-drop { min-height: 30px; margin: 8px 0 4px; display: flex; justify-content: center; }
.d-drop {
  display: flex; align-items: center; gap: 12px; padding: 8px 16px; border-radius: 14px; text-align: left;
  background: rgb(var(--shade-rgb) / calc(.3 * var(--shade-k))); border: 1px solid color-mix(in srgb, var(--tier, #ffd36b) 55%, transparent);
  box-shadow: 0 0 18px color-mix(in srgb, var(--tier, #ffd36b) 30%, transparent); animation: dBump .5s ease;
}
.d-drop img { width: 52px; height: 52px; }
.d-drop div { display: flex; flex-direction: column; line-height: 1.25; }
.d-drop small { font-size: 12px; font-weight: 800; color: var(--good); }
.d-drop span { font-size: 12px; opacity: .75; }
.d-drop-wait, .d-drop-none { font-size: 14px; opacity: .6; align-self: center; }
.d-shop-head { display: flex; align-items: center; gap: 14px; margin: 12px 0 8px; text-align: left; }
.d-shop-head > b { font-size: 17px; flex: none; }
.d-shop-wall { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.d-shop-wall > span:first-child { font-size: 12px; opacity: .75; }
.d-shop-wallbar { display: block; height: 7px; border-radius: 4px; overflow: hidden; background: rgb(var(--shade-rgb) / calc(.35 * var(--shade-k))); }
.d-shop-wallbar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #e8a83a, #ffe39a); transition: width .3s; }
.d-shop-wallbar[data-lv="mid"] i { background: linear-gradient(90deg, #c4521a, #ffb36b); }
.d-shop-wallbar[data-lv="low"] i { background: linear-gradient(90deg, #a81e2e, #ff7a7a); }
.d-shop-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 10px; }
.d-up {
  display: grid; grid-template-columns: 40px 1fr; gap: 0 10px; align-items: start; text-align: left; padding: 10px 12px;
  font: inherit; color: var(--text); cursor: pointer; border-radius: 16px;
  background: linear-gradient(180deg, rgb(var(--hi-rgb) / .09), rgb(var(--hi-rgb) / .03)); border: 1.5px solid rgb(var(--hi-rgb) / .14);
  transition: transform .12s, border-color .2s, box-shadow .2s;
}
.d-up:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--accent); box-shadow: 0 6px 16px rgb(var(--shadow-rgb) / calc(.22 * var(--shadow-k))); }
.d-up:disabled { opacity: .5; cursor: not-allowed; }
.d-up.maxed { opacity: .7; }
.d-up-ico { grid-row: 1 / 3; width: 40px; height: 40px; padding: 8px; border-radius: 12px; color: var(--accent); background: rgb(var(--accent-rgb) / .14); box-shadow: inset 0 0 0 1px rgb(var(--accent-rgb) / .35); }
.d-up-main { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.d-up b { font-size: 15px; }
.d-up small { font-size: 11px; opacity: .6; font-weight: 700; }
.d-up-main > span { font-size: 12px; opacity: .78; }
.d-pips { display: flex; gap: 2px; margin-top: 5px; }
.d-pips i { flex: 1; height: 4px; border-radius: 2px; background: rgb(var(--hi-rgb) / .16); }
.d-pips i.on { background: var(--accent); }
.d-up > i {
  grid-column: 2; justify-self: start; margin-top: 6px; font-style: normal; font-weight: 800; color: var(--accent);
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 12px; background: rgb(var(--shade-rgb) / calc(.25 * var(--shade-k)));
}
.d-shop-next { font-size: 13px; font-weight: 800; opacity: .8; margin-bottom: 12px; }
.d-shop-next.boss { color: var(--bad); opacity: 1; }

/* hết lượt */
.d-over-card { width: 560px; min-width: 0; position: relative; padding-top: 44px; overflow: visible; }
.d-over-crest { width: 76px; height: 76px; top: -38px; color: #6e677c; background: radial-gradient(circle at 40% 30%, #ffd0c4, #ff6a6a 58%, #a81e2e); }
.d-over-crest svg { width: 52px; height: 40px; }
.d-over-card .over-title { color: var(--bad); font-size: 46px; margin-bottom: 14px; line-height: 1.1; }
.d-over-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 4px 0 10px; }
.d-over-stats div {
  display: flex; flex-direction: column; align-items: center; line-height: 1.1; padding: 10px 6px; border-radius: 14px;
  background: rgb(var(--shade-rgb) / calc(.25 * var(--shade-k))); border: 1px solid rgb(var(--hi-rgb) / .1);
}
.d-over-stats small { font-size: 12px; opacity: .65; font-weight: 800; }
.d-over-stats b { font-size: 32px; color: var(--accent); }
.d-over-stats span { font-size: 12px; opacity: .65; }
.d-over-best { min-height: 22px; font-weight: 800; color: var(--good); margin-bottom: 8px; }
.d-over-best.new { color: var(--accent); animation: dBump .6s ease 3; }
.d-over-items { margin: 0 auto 16px; }

body.short #dhud .d-top { top: 6px; padding: 5px 10px; }
body.short .d-bottom { height: 62px; bottom: 6px; }
body.short .d-slot { width: 44px; height: 44px; }
body.short .d-slot img { width: 36px; height: 36px; }
body.short .d-wave-badge { width: 48px; height: 46px; }
body.short .d-wave-badge b { font-size: 21px; }
body.short .d-boss { top: 72px; }
body.short #dBanner b { font-size: 46px; }
body.short .d-intro img { height: 140px; }
body.short .d-shop-title { font-size: 32px; }
body.narrow #dhud .d-top { flex-wrap: wrap; gap: 6px 10px; }
body.narrow .d-wall { flex-basis: 100%; order: 3; }
body.narrow .d-bottom { height: auto; flex-wrap: wrap; justify-content: center; bottom: 8px; }
body.narrow .d-weapon, body.narrow .d-hint { display: none; }
body.narrow .d-skill { padding-right: 12px; }
body.narrow .d-boss { top: 136px; }
body.narrow #dBanner { top: 30%; }
body.narrow #dBanner b { font-size: 42px; }
body.narrow #dBanner.boss b { font-size: 40px; }
body.narrow #dBanner span { font-size: 16px; padding: 4px 20px; }
body.narrow .d-intro-band { flex-direction: column; gap: 6px; }
body.narrow .d-intro-text { align-items: center; text-align: center; }
body.narrow .d-intro img { height: 170px; }
body.narrow .d-intro-text b { font-size: 36px; }
body.narrow .d-intro-skills { justify-content: center; }
body.narrow .d-combo { right: 12px; top: 44%; }
body.narrow .d-combo b { font-size: 36px; }
body.narrow .d-shop-card, body.narrow .d-over-card { width: calc(100% - 24px); padding-left: 16px; padding-right: 16px; }
body.narrow .d-over-card .over-title, body.narrow .d-shop-title { font-size: 34px; }
body.narrow .d-shop-list { grid-template-columns: 1fr 1fr; }
body.narrow .d-shop-head { flex-wrap: wrap; }
body.narrow .d-shop-wall { order: 3; flex-basis: 100%; }
body.narrow .d-up { grid-template-columns: 1fr; padding: 10px; }
body.narrow .d-up-ico { grid-row: auto; width: 34px; height: 34px; padding: 6px; margin-bottom: 6px; }
body.narrow .d-up > i { grid-column: 1; }
#dshop, #dover { overflow-y: auto; align-items: flex-start; }
#dshop > *, #dover > * { margin-top: auto; margin-bottom: auto; }

/* ---------- Chọn ngôn ngữ ---------- */
.lang-select {
  font: inherit; font-size: 13px; font-weight: 700;
  color: var(--text);
  padding: 3px 8px;
  border-radius: 9px;
  border: 1px solid var(--btn-border);
  background: var(--field-bg);
  cursor: pointer;
}
.lang-select option { color: var(--text); background: var(--option-bg); }
.auth-card { position: relative; }
.auth-prefs { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: -16px -14px 4px; }

/* ======================================================================
   Năng lượng: chip trên menu, màn nạp USDT, nhân vật phải mua
   ====================================================================== */
.nl-ico { width: 20px; height: 20px; flex: none; display: inline-block; vertical-align: -4px; }
.lock-ico { width: 12px; height: 12px; flex: none; }
.profile .energy-chip .nl-ico { width: 22px; height: 22px; }
.energy-chip b { color: var(--accent); }
.energy-chip span:not(.rank-go) { font-size: 13px; }

/* ---------- màn nạp ---------- */
#topupScreen { padding: 10px 0; }
.topup-card { width: 760px; min-width: 0; max-height: 100%; display: flex; flex-direction: column; padding-bottom: 22px; }
.topup-card > * { flex: none; }
.tu-balance {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; margin-top: 10px; padding: 8px 14px;
  text-align: left; border-radius: 14px; background: rgb(var(--shade-rgb) / calc(.28 * var(--shade-k))); border: 1px solid rgb(var(--accent-rgb) / .3);
}
.tu-balance-ico { display: flex; }
.tu-balance .nl-ico { width: 28px; height: 28px; }
.tu-balance-label { opacity: .75; font-weight: 700; }
.tu-balance b { font-size: 24px; line-height: 1; color: var(--accent); }
.tu-balance-unit { font-weight: 700; }
.tu-rate { margin-left: auto; font-size: 14px; font-weight: 700; opacity: .75; }
.topup-tabs { margin: 12px 0 10px; }
.topup-tabs .tab { font-size: 15px; }
.topup-card > .topup-body { flex: 1 1 auto; min-height: 120px; overflow-y: auto; padding: 2px 6px 2px 2px; text-align: left; }
.topup-card .form-error { margin: 6px 0 8px; }
.tu-empty { padding: 24px 0; text-align: center; opacity: .65; }
.tu-dim { opacity: .6; }
.tu-label { margin: 12px 0 6px; font-size: 14px; font-weight: 800; color: var(--accent); }
.tu-label:first-child { margin-top: 0; }
.tu-closed {
  display: flex; flex-direction: column; align-items: center; gap: 6px; margin-bottom: 10px; padding: 26px 12px; text-align: center;
  border-radius: 14px; background: rgb(var(--shade-rgb) / calc(.25 * var(--shade-k))); border: 1px dashed rgb(var(--hi-rgb) / .22);
}
.tu-closed b { font-size: 20px; }
.tu-closed span { opacity: .7; }

.tu-nets { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; }
.tu-net {
  display: flex; flex-direction: column; align-items: flex-start; padding: 8px 12px;
  font: inherit; color: var(--text); text-align: left; line-height: 1.25;
  border-radius: 12px; border: 2px solid rgb(var(--hi-rgb) / .14); background: rgb(var(--shade-rgb) / calc(.28 * var(--shade-k)));
  cursor: pointer; transition: border-color .15s, background .15s;
}
.tu-net b { font-size: 16px; }
.tu-net small { font-size: 12px; font-weight: 700; opacity: .7; }
.tu-net .tu-fee { color: var(--info); opacity: .9; }
.tu-net:hover { border-color: rgb(var(--accent-rgb) / .5); }
.tu-net.sel { border-color: var(--accent); background: rgb(var(--accent-rgb) / .12); box-shadow: 0 0 0 3px rgb(var(--accent-rgb) / .18); }

.tu-amount-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; }
.tu-amount {
  display: flex; align-items: center; flex: 0 1 220px; min-width: 160px; padding-right: 12px;
  border-radius: 12px; border: 2px solid var(--field-border); background: var(--field-bg);
}
.tu-amount:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgb(var(--accent-rgb) / .2); }
.tu-amount input {
  flex: 1; width: 100%; min-width: 0; padding: 6px 12px;
  font: inherit; font-size: 22px; font-weight: 800; color: var(--text);
  background: none; border: 0; outline: none; user-select: text; -webkit-user-select: text;
}
.tu-amount span { font-weight: 800; opacity: .7; }
.tu-quicks { display: flex; flex-wrap: wrap; gap: 6px; }
.tu-quick {
  min-width: 52px; padding: 6px 10px; font: inherit; font-size: 15px; font-weight: 800; color: var(--text);
  border-radius: 10px; border: 1px solid rgb(var(--hi-rgb) / .2); background: rgb(var(--hi-rgb) / .07); cursor: pointer;
}
.tu-quick:hover { border-color: var(--accent); background: rgb(var(--accent-rgb) / .12); }
.tu-limits { margin-top: 4px; font-size: 12px; opacity: .6; }
.tu-preview {
  margin: 10px 0 8px; padding: 8px 12px; font-size: 15px;
  border-radius: 12px; background: rgb(var(--good-rgb) / .1); border: 1px solid rgb(var(--good-rgb) / .35);
}
.tu-preview b { color: var(--good); }
.tu-preview.bad { color: var(--bad); font-weight: 700; background: rgb(var(--bad-rgb) / .1); border-color: rgb(var(--bad-rgb) / .45); }
.tu-warn {
  position: relative; margin: 8px 0; padding: 8px 12px 8px 36px; font-size: 13px; line-height: 1.35;
  border-radius: 12px; background: rgb(var(--warn-rgb) / .12); border: 1px solid rgb(var(--warn-rgb) / .5);
}
.tu-warn::before {
  content: '!'; position: absolute; left: 10px; top: 8px; width: 18px; height: 18px; border-radius: 50%;
  font-size: 13px; font-weight: 800; line-height: 18px; text-align: center; background: #ffb347; color: #3a1028;
}
.tu-warn b { color: var(--warn); }
.tu-form .btn.wide { margin-top: 4px; }

/* danh sách đơn / biến động Năng lượng */
.tu-list { display: flex; flex-direction: column; gap: 6px; }
.tu-orow {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 12px;
  font: inherit; color: var(--text); text-align: left;
  border-radius: 12px; border: 1px solid rgb(var(--hi-rgb) / .1); background: rgb(var(--hi-rgb) / .05); cursor: pointer;
}
.tu-orow:hover { border-color: rgb(var(--accent-rgb) / .5); background: rgb(var(--accent-rgb) / .08); }
.tu-orow-main, .tu-orow-amt, .tu-hrow-main, .tu-hrow-amt { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.tu-orow-main, .tu-hrow-main { flex: 1; }
.tu-orow-main b { letter-spacing: 1px; }
.tu-orow-main small, .tu-hrow-main small { font-size: 12px; opacity: .6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tu-orow-amt, .tu-hrow-amt { align-items: flex-end; text-align: right; white-space: nowrap; }
.tu-orow-amt small { font-size: 12px; font-weight: 800; }
.tu-hrow-amt small { font-size: 12px; opacity: .6; }
.tu-orow .rank-go { color: var(--accent); font-weight: 800; }
.tu-tag { flex: none; padding: 2px 8px; font-style: normal; font-size: 11px; font-weight: 800; white-space: nowrap; border-radius: 8px; background: rgb(var(--hi-rgb) / .15); }
.tu-tag.pending { background: #ffd36b; color: #3a2008; }
.tu-tag.completed { background: #6ee7a0; color: #0f3020; }
.tu-tag.expired { background: rgb(var(--hi-rgb) / .18); color: var(--warn); }
.tu-tag.cancelled { background: rgb(var(--hi-rgb) / .1); color: rgb(var(--text-rgb) / .6); }
.tu-hrow { display: flex; align-items: center; gap: 10px; padding: 6px 12px; border-radius: 12px; background: rgb(var(--hi-rgb) / .04); }
.tu-hrow-main b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tu-hrow-amt b { font-size: 16px; }

/* xem một đơn */
.tu-ohead { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.tu-ohead > div { display: flex; flex-direction: column; line-height: 1.1; }
.tu-ohead small { font-size: 12px; font-weight: 700; opacity: .6; }
.tu-ohead b { font-size: 20px; letter-spacing: 1.5px; }
.tu-ohead-date { flex: 1; font-size: 13px; text-align: right; opacity: .6; }
.tu-pay {
  display: flex; align-items: flex-start; gap: 14px; padding: 12px 14px;
  border-radius: 14px; background: rgb(var(--shade-rgb) / calc(.3 * var(--shade-k))); border: 1px solid rgb(var(--hi-rgb) / .12);
}
.tu-pay-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tu-cap { margin-top: 8px; font-size: 12px; font-weight: 800; letter-spacing: .5px; opacity: .65; }
.tu-cap:first-child { margin-top: 0; }
.tu-big { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; }
.tu-big b { font-size: 36px; line-height: 1.1; color: var(--accent); font-variant-numeric: tabular-nums; user-select: text; -webkit-user-select: text; }
.tu-big span { font-size: 18px; font-weight: 800; }
.tu-big .btn, .tu-addr .btn { align-self: center; }
.tu-note { margin: 2px 0 0; font-size: 13px; line-height: 1.35; opacity: .85; }
.tu-note b { color: var(--warn); }
.tu-netname { font-size: 16px; font-weight: 800; }
.tu-addr { display: flex; align-items: center; gap: 8px; }
.tu-addr code {
  flex: 1; min-width: 0; padding: 6px 10px; font-family: ui-monospace, Consolas, monospace; font-size: 14px; word-break: break-all;
  border-radius: 10px; background: rgb(var(--shade-rgb) / calc(.35 * var(--shade-k))); user-select: text; -webkit-user-select: text;
}
.tu-get { margin-top: 8px; font-weight: 800; color: var(--good); }
.tu-qr { flex: none; width: 168px; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.tu-qr img { width: 168px; height: 168px; padding: 6px; border-radius: 12px; background: #fff; image-rendering: pixelated; }
.tu-qr small { font-size: 11px; opacity: .6; }
.btn.small.ok { border-color: var(--good); color: var(--good); }
.tu-wait { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; margin: 8px 0; font-size: 14px; font-weight: 700; }
.tu-wait b { margin-left: auto; color: var(--accent); font-variant-numeric: tabular-nums; }
.tu-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: #ffd36b; animation: tuPulse 1.2s ease-in-out infinite; }
@keyframes tuPulse { 50% { opacity: .25; transform: scale(.7); } }
.tu-claim { display: block; padding: 10px 12px; border-radius: 14px; background: rgb(var(--hi-rgb) / .05); border: 1px solid rgb(var(--hi-rgb) / .12); }
.tu-claim > b { font-size: 15px; }
.tu-claim p { margin: 2px 0 6px; font-size: 12.5px; line-height: 1.35; opacity: .75; }
.tu-claim input { font-family: ui-monospace, Consolas, monospace; font-size: 14px; }
.tu-claim-status { margin-top: 6px; font-size: 13px; }
.tu-claim-status:empty { display: none; }
.tu-claim-status code { font-family: ui-monospace, Consolas, monospace; opacity: .85; }
.tu-claim-status small { display: block; font-size: 12px; opacity: .55; }
.tu-claim-err { font-weight: 700; color: var(--warn-strong); }
.tu-cancel { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 8px; font-size: 13px; }
.tu-cancel:empty { display: none; }
.tu-cancel-link { font-size: 13px; color: var(--bad); }
.btn.danger { background: rgb(var(--bad-rgb) / .2); border-color: var(--bad); color: var(--bad-pale); }
.tu-done {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 22px 12px; text-align: center; border-radius: 16px;
  background: radial-gradient(circle at 50% 20%, rgb(var(--good-rgb) / .25), transparent 70%), rgb(var(--shade-rgb) / calc(.25 * var(--shade-k)));
  border: 1px solid rgb(var(--good-rgb) / .45);
}
.tu-done .nl-ico { width: 64px; height: 64px; animation: pop .5s cubic-bezier(.2, 1.4, .4, 1); }
.tu-done-n { font-size: 34px; line-height: 1.1; color: var(--good); }
.tu-done small { opacity: .6; }

body.short .topup-card { padding-top: 16px; padding-bottom: 14px; }
body.short .tu-balance { margin-top: 6px; padding: 5px 12px; }
body.short .topup-tabs { margin: 8px 0 6px; }
body.short .topup-card .form-error { min-height: 0; margin: 4px 0; }
body.short .tu-big b { font-size: 30px; }
body.short .tu-qr { width: 132px; }
body.short .tu-qr img { width: 132px; height: 132px; }
body.narrow .topup-card { width: calc(100% - 24px); padding-left: 14px; padding-right: 14px; }
body.narrow .tu-rate { width: 100%; margin-left: 0; }
body.narrow .tu-pay { flex-direction: column; align-items: stretch; }
body.narrow .tu-qr { align-self: center; }
body.narrow .tu-ohead-date { display: none; }
body.narrow .tu-amount { flex-basis: 100%; }

/* ---------- chọn nhân vật: nhân vật phải mua ---------- */
.char-tag {
  position: absolute; top: 6px; left: 6px; display: flex; align-items: center; gap: 3px; padding: 1px 7px;
  font-size: 11px; font-weight: 800; line-height: 1.4; border-radius: 8px; background: rgba(0, 0, 0, .7); color: #ffd36b;
  pointer-events: none;
}
.char-tag:empty { display: none; }
.char-tag.owned { color: var(--good); }
.char-card.locked img { filter: grayscale(.8) brightness(.7); }
.char-card.locked .cname { opacity: .7; }
.char-card.locked.sel img { animation: none; }
.char-buy {
  width: 100%; display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 8px 0 2px; padding: 8px 10px;
  text-align: center; border-radius: 12px; background: rgb(var(--shade-rgb) / calc(.4 * var(--shade-k))); border: 1px solid rgb(var(--accent-rgb) / .45);
}
.buy-head { display: flex; align-items: center; gap: 6px; width: 100%; font-size: 14px; font-weight: 800; color: var(--warn); }
.buy-head .lock-ico { width: 14px; height: 14px; }
.buy-price { display: flex; align-items: center; gap: 4px; margin-left: auto; font-size: 18px; color: var(--accent); }
.buy-q { font-size: 14px; font-weight: 700; }
.buy-btns { display: flex; gap: 8px; }
.buy-need { font-size: 12px; font-weight: 700; color: var(--bad); }
.buy-foot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 2px 8px; width: 100%; font-size: 12px; opacity: .9; }
.buy-foot .link { padding: 0; font-size: 13px; }
body.short .char-buy { margin: 4px 0 0; padding: 6px 8px; gap: 4px; }
body.narrow .char-buy { grid-column: 1 / -1; }
/* ======================================================================
   Săn Boss: nút menu, màn giới thiệu, phòng chờ, thẻ boss, màn ra mắt, kết quả
   ====================================================================== */
.boss-skull, .boss-crown {
  display: inline-block; flex: none;
  width: 22px; height: 22px; vertical-align: -4px;
  background: center / contain no-repeat;
}
.boss-skull {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23ffd36b' fill-rule='evenodd' d='M12 2C6.5 2 3 5.6 3 10.2c0 2.6 1.2 4.4 3 5.5V19a1 1 0 0 0 1 1h1.5v-2.2h1.6V20h3.8v-2.2h1.6V20H17a1 1 0 0 0 1-1v-3.3c1.8-1.1 3-2.9 3-5.5C21 5.6 17.5 2 12 2zM8.6 13.6a2.1 2.1 0 1 1 0-4.2 2.1 2.1 0 0 1 0 4.2zm6.8 0a2.1 2.1 0 1 1 0-4.2 2.1 2.1 0 0 1 0 4.2zM12 13.9l1.3 2.3h-2.6z'/%3E%3C/svg%3E");
}
.boss-crown {
  width: 18px; height: 18px; vertical-align: -3px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23ffd36b' stroke='%233a0a10' stroke-width='1.4' stroke-linejoin='round' d='M3 19h18l-1.4-11-4.6 4.2L12 4.5 9 12.2 4.4 8z'/%3E%3C/svg%3E");
}

/* nút ở menu chính */
.boss-btn {
  position: relative;
  display: inline-flex; align-items: center; gap: 8px;
  background: linear-gradient(180deg, #8a1a24, #3d0910 70%, #24050a);
  border-color: #ffc94d; color: #ffe39a;
  text-shadow: 0 2px 0 #2a0508, 0 0 12px rgba(255, 170, 60, .55);
  box-shadow: 0 0 0 2px rgba(255, 201, 77, .25), 0 0 18px rgba(255, 70, 50, .45), inset 0 1px 0 rgba(255, 230, 160, .35);
  overflow: hidden;
}
.boss-btn::after {
  content: ''; position: absolute; inset: -40% auto -40% -60%; width: 40%;
  background: linear-gradient(90deg, transparent, rgba(255, 220, 140, .35), transparent);
  transform: skewX(-20deg);
  animation: bossShine 3.2s ease-in-out infinite;
  pointer-events: none;
}
@keyframes bossShine { 0%, 55% { left: -60%; } 100% { left: 130%; } }
.boss-btn:hover { background: linear-gradient(180deg, #a3222e, #4d0c15 70%, #2b060c); }

/* ----- màn Săn Boss ----- */
#bossScreen { overflow-y: auto; align-items: flex-start; }
#bossScreen > * { margin-top: auto; margin-bottom: auto; }
.boss-card {
  width: 920px; padding: 22px 30px 20px;
  background:
    radial-gradient(ellipse at 50% -10%, rgba(255, 90, 60, .28), transparent 60%),
    linear-gradient(180deg, rgba(48, 10, 20, .94), rgba(22, 8, 26, .94));
  border-color: rgba(255, 201, 77, .55);
  box-shadow: 0 0 0 2px rgba(120, 20, 30, .6), 0 20px 60px rgb(var(--shadow-rgb) / calc(.6 * var(--shadow-k))), 0 0 40px rgba(255, 60, 40, .2);
}
.boss-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.boss-title {
  margin: 0; display: flex; align-items: center; gap: 10px;
  font-size: 40px; letter-spacing: 1px;
  background: linear-gradient(180deg, #fff1b8, #ffc94d 50%, #ff6a3d);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 0 rgba(40, 5, 10, .9));
}
.boss-title .boss-skull { width: 34px; height: 34px; filter: drop-shadow(0 0 6px rgba(255, 120, 60, .7)); }
.boss-level { text-align: right; line-height: 1.1; }
.boss-level small { display: block; font-size: 11px; letter-spacing: 2px; text-transform: uppercase; opacity: .7; }
.boss-level b { font-size: 24px; color: #ff8a6a; text-shadow: 0 0 12px rgba(255, 80, 60, .6); }
.boss-roster { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 12px 0 10px; }
.boss-face {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 4px 6px; font: inherit; color: var(--b-text, #fff); cursor: pointer;
  border-radius: 14px; border: 2px solid color-mix(in srgb, var(--b-main) 45%, transparent);
  background: radial-gradient(ellipse at 50% 70%, color-mix(in srgb, var(--b-glow) 30%, transparent), rgb(var(--shade-rgb) / calc(.35 * var(--shade-k))) 70%);
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
.boss-face:hover { transform: translateY(-2px); }
.boss-face.sel { border-color: var(--b-glow); box-shadow: 0 0 0 2px color-mix(in srgb, var(--b-glow) 40%, transparent), 0 0 18px color-mix(in srgb, var(--b-main) 60%, transparent); }
.boss-face img { width: 96px; height: 96px; object-fit: contain; filter: drop-shadow(0 4px 6px rgb(var(--shadow-rgb) / calc(.6 * var(--shadow-k)))); }
.boss-face span { font-size: 13px; font-weight: 800; line-height: 1.1; text-shadow: 0 1px 2px #000; }
.boss-detail {
  display: grid; grid-template-columns: 1.15fr 1fr; gap: 12px; text-align: left;
  padding: 10px 12px; border-radius: 14px;
  background: rgb(var(--shade-rgb) / calc(.3 * var(--shade-k))); border: 1px solid color-mix(in srgb, var(--b-main) 40%, transparent);
}
.bd-head { display: flex; gap: 10px; align-items: flex-start; }
.bd-head > img { width: 84px; height: 84px; object-fit: contain; flex: none; }
.bd-name { display: block; font-size: 22px; line-height: 1.1; color: var(--b-text); }
.bd-title { display: block; font-size: 13px; font-weight: 700; opacity: .85; }
.bd-desc { margin: 4px 0 6px; font-size: 13px; line-height: 1.3; opacity: .8; }
.bd-passive { display: block; font-size: 13px; line-height: 1.3; }
.bd-passive i {
  font-style: normal; font-size: 10px; font-weight: 800; letter-spacing: 1px; margin-right: 6px;
  padding: 1px 6px; border-radius: 6px; background: var(--b-main); color: #1a0710;
}
.bd-passive b { color: var(--b-text); }
.bd-kit { margin: 0; }
.boss-closed {
  margin: 10px 0 0; padding: 10px; border-radius: 12px; font-weight: 800;
  background: rgba(255, 80, 80, .15); border: 1px solid rgba(255, 120, 120, .5); color: var(--bad-soft);
}
.boss-info-row { display: flex; gap: 10px; margin: 10px 0 8px; }
.boss-buffs, .boss-today { flex: 1; padding: 6px 10px; border-radius: 12px; background: rgb(var(--shade-rgb) / calc(.3 * var(--shade-k))); text-align: left; line-height: 1.2; }
.boss-buffs small, .boss-today small { display: block; font-size: 11px; letter-spacing: 1px; opacity: .65; text-transform: uppercase; }
.boss-buffs b { color: #7ee0ad; }
.boss-today b { color: var(--accent); }
.boss-today em { display: block; font-style: normal; font-size: 12px; opacity: .7; }
.br-title { font-size: 13px; font-weight: 700; opacity: .8; margin-bottom: 4px; text-align: left; }
.boss-table { width: 100%; border-collapse: separate; border-spacing: 3px; font-size: 14px; }
.boss-table th, .boss-table td { padding: 4px 6px; border-radius: 8px; text-align: center; }
.boss-table thead th { font-size: 12px; opacity: .75; }
.boss-table tbody th { font-size: 12px; opacity: .75; text-align: left; white-space: nowrap; }
.boss-table td { background: rgb(var(--hi-rgb) / .06); font-weight: 800; color: var(--accent); }
.boss-table td.na { color: rgb(var(--hi-rgb) / .3); background: rgb(var(--shade-rgb) / calc(.2 * var(--shade-k))); }
.boss-table .cur { box-shadow: inset 0 0 0 1px rgba(255, 201, 77, .35); }
.boss-table td.solo { background: rgba(255, 201, 77, .2); box-shadow: inset 0 0 0 2px var(--accent); }
.boss-loading { padding: 18px; opacity: .6; }
.boss-actions { margin-top: 8px; }
.boss-actions .opt-row { justify-content: center; margin-bottom: 8px; }
.boss-btns { margin-bottom: 8px; }
.boss-btns .btn { min-width: 200px; }
.boss-team-btn { background: linear-gradient(180deg, #8a1a24, #4d0c15); border-color: #ffc94d; color: #ffe39a; }
.boss-join { justify-content: center; }
.boss-hint { text-align: center; }
.boss-card .form-error { min-height: 18px; }

/* ----- lobby / phòng chờ ----- */
.boss-tag {
  display: inline-block; margin-right: 6px; padding: 1px 6px; border-radius: 6px;
  font-style: normal; font-size: 10px; font-weight: 800; letter-spacing: 1px;
  background: linear-gradient(180deg, #a3222e, #4d0c15); color: #ffe39a; vertical-align: 1px;
}
.room-bosses {
  margin: 0 0 8px; padding: 8px 12px; border-radius: 14px; text-align: left;
  background: linear-gradient(90deg, rgba(120, 20, 30, .45), rgba(30, 8, 20, .45));
  border: 2px solid rgba(255, 201, 77, .4);
}
.rb-head { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.rb-head b { color: #ffc94d; }
.rb-head span { opacity: .85; font-weight: 700; }
.rb-body { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 4px; flex-wrap: wrap; }
.rb-slots { display: flex; gap: 6px; }
.rb-slot {
  width: 46px; height: 46px; display: grid; place-items: center; border-radius: 10px;
  background: rgb(var(--shade-rgb) / calc(.45 * var(--shade-k))); border: 2px solid rgba(255, 90, 70, .6);
  box-shadow: inset 0 0 12px rgba(255, 60, 40, .4);
}
.rb-slot b { font-size: 24px; color: #ff8a6a; text-shadow: 0 0 8px rgba(255, 80, 60, .8); }
.rb-pool { display: flex; gap: 2px; }
.rb-pool img { width: 42px; height: 42px; object-fit: contain; filter: brightness(.35) saturate(.4) drop-shadow(0 0 3px rgba(255, 80, 60, .6)); }
#room.boss-room .room-card { border-color: rgba(255, 201, 77, .5); }

/* ----- thẻ boss trong trận ----- */
.pcard.boss {
  border-color: #9a2230;
  background: linear-gradient(90deg, rgba(70, 10, 18, .9), rgba(30, 8, 20, .88));
  box-shadow: 0 0 0 1px rgba(255, 201, 77, .25), 0 6px 18px rgb(var(--shadow-rgb) / calc(.45 * var(--shadow-k)));
}
.pcard.boss.active { border-color: #ffc94d; box-shadow: 0 0 0 3px rgba(255, 90, 60, .45), 0 0 18px rgba(255, 60, 40, .45); }
.pcard.boss .avatar { background-color: rgb(var(--shade-rgb) / calc(.45 * var(--shade-k))); border-color: rgba(255, 201, 77, .5); background-size: 100%; background-position: center 80%; }
.pcard.boss.right .avatar { transform: none; }
.pcard.boss .pname span { color: var(--c-text); }
.pcard.boss .hpfill { background: linear-gradient(90deg, #c81e3a, #ff6a3d); }
.pcard.boss.right .hpfill { background: linear-gradient(270deg, #c81e3a, #ff6a3d); }
#pcards.list .pcard.boss { border-left-color: #ffc94d; }
#pcards.list .boss-crown { width: 13px; height: 13px; }
#hud.boss-turn #banner { text-shadow: 0 4px 0 rgb(var(--shadow-rgb) / calc(.5 * var(--shadow-k))), 0 0 30px rgba(255, 60, 40, .8); }

/* ----- màn ra mắt boss ----- */
#bossIntro {
  position: absolute; inset: 0; z-index: 5; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 35%, rgba(10, 0, 5, .75) 100%);
  opacity: 0; transition: opacity .5s;
}
#bossIntro.on { opacity: 1; }
.bi-card {
  position: absolute; left: 0; right: 0; bottom: 22%;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  opacity: 0;
}
.bi-card.show { animation: biCard 1.45s cubic-bezier(.2, .9, .3, 1) forwards; }
@keyframes biCard {
  0% { opacity: 0; transform: scale(1.6); filter: blur(6px); }
  14% { opacity: 1; transform: scale(1); filter: blur(0); }
  82% { opacity: 1; transform: scale(1.03); }
  100% { opacity: 0; transform: scale(1.05) translateY(-10px); }
}
.bi-tag {
  font-size: 13px; font-weight: 800; letter-spacing: 6px; color: #ffc94d;
  padding: 2px 14px; border-radius: 8px; background: rgba(120, 10, 20, .75); border: 1px solid rgba(255, 201, 77, .6);
}
.bi-name {
  font-size: 76px; line-height: 1; margin-top: 6px; color: var(--b-text);
  text-shadow: 0 5px 0 rgba(20, 0, 5, .85), 0 0 30px var(--b-glow), 0 0 60px var(--b-main);
  letter-spacing: 1px;
}
.bi-title { font-size: 24px; font-weight: 800; color: #fff4e6; text-shadow: 0 2px 4px #000; margin-top: 4px; }
.bi-passive {
  margin-top: 8px; padding: 4px 14px; border-radius: 12px; font-size: 15px; font-weight: 700;
  background: rgb(var(--shade-rgb) / calc(.55 * var(--shade-k))); border: 1px solid color-mix(in srgb, var(--b-main) 70%, transparent);
}
.bi-passive i { display: inline-block; width: 9px; height: 9px; margin-right: 8px; border-radius: 50%; background: var(--b-glow); box-shadow: 0 0 8px var(--b-glow); }

/* ----- kết quả ----- */
#over.boss-over .menu-card {
  background: linear-gradient(180deg, rgba(48, 10, 20, .92), rgba(22, 8, 26, .92));
  border-color: rgba(255, 201, 77, .6);
}
#over.boss-over .over-title { text-shadow: 0 4px 0 rgb(var(--shadow-rgb) / calc(.5 * var(--shadow-k))), 0 0 26px rgba(255, 200, 80, .6); }
#over.boss-over.lost .over-title { text-shadow: 0 4px 0 rgb(var(--shadow-rgb) / calc(.5 * var(--shadow-k))), 0 0 26px rgba(255, 60, 60, .6); }
.over-boss { margin: -6px auto 14px; max-width: 560px; }
.bo-faces { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.bo-boss { position: relative; display: flex; flex-direction: column; align-items: center; width: 92px; }
.bo-boss img { width: 72px; height: 72px; object-fit: contain; filter: drop-shadow(0 0 8px color-mix(in srgb, var(--c-main) 70%, transparent)); }
.bo-boss small { font-size: 12px; font-weight: 700; line-height: 1.1; }
.bo-boss.dead img { filter: grayscale(1) brightness(.6); }
.bo-boss.dead::after {
  content: ''; position: absolute; top: 6px; left: 50%; width: 56px; height: 56px; margin-left: -28px;
  background:
    linear-gradient(45deg, transparent 45%, #ff4d4d 45%, #ff4d4d 55%, transparent 55%),
    linear-gradient(-45deg, transparent 45%, #ff4d4d 45%, #ff4d4d 55%, transparent 55%);
  opacity: .85;
}
.bo-format { margin-top: 8px; font-weight: 700; opacity: .85; }
.boss-reward { margin-top: 10px; padding: 8px 14px; border-radius: 14px; font-weight: 800; display: inline-flex; align-items: center; gap: 8px; }
.boss-reward.got { font-size: 24px; color: var(--accent); background: rgba(255, 201, 77, .14); border: 2px solid rgba(255, 201, 77, .6); animation: rewardPop .6s cubic-bezier(.2, 1.6, .4, 1); }
.boss-reward.got .nl-ico { width: 28px; height: 28px; }
.boss-reward.none { font-size: 15px; color: var(--bad-soft); background: rgb(var(--shade-rgb) / calc(.3 * var(--shade-k))); }
@keyframes rewardPop { from { transform: scale(.4); opacity: 0; } }

/* ----- màn nhỏ ----- */
body.short .boss-card { padding: 14px 20px 12px; }
body.short .boss-title { font-size: 30px; }
body.short .boss-roster { margin: 6px 0; }
body.short .boss-face img { width: 64px; height: 64px; }
body.short .bd-desc { display: none; }
body.short .boss-table { font-size: 12px; }
body.short .boss-table th, body.short .boss-table td { padding: 2px 4px; }
body.short .bi-name { font-size: 56px; }
body.narrow .boss-card { width: calc(100% - 24px); padding-left: 14px; padding-right: 14px; }
body.narrow .boss-head { flex-wrap: wrap; }
body.narrow .boss-title { font-size: 30px; }
body.narrow .boss-roster { grid-template-columns: repeat(5, 1fr); gap: 4px; }
body.narrow .boss-face img { width: 54px; height: 54px; }
body.narrow .boss-face span { font-size: 10px; }
body.narrow .boss-detail { grid-template-columns: 1fr; }
body.narrow .boss-info-row { flex-direction: column; }
body.narrow .boss-btns .btn { min-width: 0; flex: 1; }
body.narrow .bi-name { font-size: 46px; }
body.narrow .bi-title { font-size: 18px; }
body.narrow .bi-passive { font-size: 13px; margin-left: 12px; margin-right: 12px; }
body.narrow .rb-pool { display: none; }

/* ======================================================================
   Ví USDT: chip số dư, đầu màn ví, đổi Năng lượng, rút tiền; phí / thưởng USDT của Săn Boss
   ====================================================================== */
.usdt-ico { width: 20px; height: 20px; flex: none; display: inline-block; vertical-align: -4px; }
.profile .energy-chip .usdt-ico { width: 22px; height: 22px; }
.energy-chip .chip-sep { font-style: normal; font-weight: 800; opacity: .5; }

/* đầu màn ví: 2 số dư */
.tu-balance { gap: 4px 16px; }
.tu-bal-item { display: inline-flex; align-items: center; gap: 6px; }
.tu-balance .usdt-ico { width: 28px; height: 28px; }
#topupUsdt { color: var(--usdt); font-variant-numeric: tabular-nums; }
.topup-tabs .tab { padding: 8px 4px; line-height: 1.15; }
.tu-foot { margin: 10px 2px 0; font-size: 12.5px; line-height: 1.35; opacity: .65; }

/* đổi Năng lượng */
.tu-ok {
  display: flex; align-items: center; gap: 12px; margin-bottom: 10px; padding: 10px 14px; border-radius: 14px;
  background: rgb(var(--good-rgb) / .12); border: 1px solid rgb(var(--good-rgb) / .45); animation: rewardPop .5s cubic-bezier(.2, 1.4, .4, 1);
}
.tu-ok .nl-ico { width: 40px; height: 40px; }
.tu-ok > div { display: flex; flex-direction: column; line-height: 1.2; }
.tu-ok b { font-size: 22px; color: var(--good); }
.tu-ok span { font-size: 13px; opacity: .8; }

/* rút tiền */
.tu-net .tu-has { color: var(--good); opacity: 1; }
.tu-net .tu-no { color: var(--warn); opacity: .85; }
.tu-field-err { min-height: 0; margin-top: 4px; font-size: 13px; font-weight: 700; color: var(--bad); }
.tu-field-err:empty { display: none; }
#adInput { font-family: ui-monospace, Consolas, monospace; font-size: 14px; }
.tu-confirm {
  display: flex; flex-direction: column; gap: 8px; margin-top: 10px; padding: 12px 14px; border-radius: 14px;
  background: rgb(var(--accent-rgb) / .08); border: 2px solid rgb(var(--accent-rgb) / .55);
}
.tu-confirm > b { font-size: 16px; color: var(--accent); }
.tu-confirm > code, .tu-sum code {
  padding: 6px 10px; font-family: ui-monospace, Consolas, monospace; font-size: 15px; word-break: break-all;
  border-radius: 10px; background: rgb(var(--shade-rgb) / calc(.4 * var(--shade-k))); user-select: text; -webkit-user-select: text;
}
.tu-sum code { display: block; padding: 4px 8px; font-size: 13px; }
.tu-confirm p { margin: 0; font-size: 13px; line-height: 1.35; opacity: .85; }
.tu-confirm p b { color: var(--warn); }
.tu-confirm-btns { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.tu-sum { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 0; font-size: 14px; }
.tu-sum dt { font-weight: 700; opacity: .65; }
.tu-sum dd { margin: 0; min-width: 0; font-weight: 800; }
.tu-sum dd b { color: var(--good); font-size: 17px; }
.tu-done-sm { margin-top: 10px; padding: 14px 12px; }
.tu-done .usdt-ico { width: 56px; height: 56px; animation: pop .5s cubic-bezier(.2, 1.4, .4, 1); }
.tu-done-btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.tu-done-sm .tu-done-n { font-size: 24px; }
.tu-wrow { display: flex; flex-direction: column; gap: 2px; padding: 7px 12px; border-radius: 12px; border: 1px solid rgb(var(--hi-rgb) / .1); background: rgb(var(--hi-rgb) / .05); }
.tu-wrow-top { display: flex; align-items: center; gap: 10px; }
.tu-wrow-addr { font-size: 12px; opacity: .6; }
.tu-wrow-addr code { font-family: ui-monospace, Consolas, monospace; }
.tu-wrow-reason { font-size: 13px; color: var(--bad-soft); }
.tu-wrow-reason span { color: var(--text); }
.tu-wrow .link { align-self: flex-start; font-size: 13px; }
.tu-wrow .tu-cancel { margin-top: 2px; }
.tu-tag.wd-pending { background: #ffd36b; color: #3a2008; }
.tu-tag.wd-approved { background: #6ee7a0; color: #0f3020; }
.tu-tag.wd-rejected { background: #ff8a95; color: #3a1018; }

/* Săn Boss: phí vào / thưởng tối đa */
.promo-badge {
  display: inline-block; padding: 2px 10px; border-radius: 10px; font-size: 13px; font-weight: 800;
  background: linear-gradient(180deg, #6ee7a0, #2fb57a); color: #0b2a1a; box-shadow: 0 0 12px rgb(var(--good-rgb) / .45);
}
.bf-line { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 14px; }
.bf-fee b { color: var(--accent); }
.bf-max b { color: var(--usdt); }
.bf-sum {
  display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; padding: 8px 12px; border-radius: 14px;
  background: rgb(var(--shade-rgb) / calc(.3 * var(--shade-k))); border: 1px solid rgba(255, 201, 77, .45);
}
.bf-sum.short { border-color: rgb(var(--bad-rgb) / .7); }
.bf-head { font-size: 11px; letter-spacing: 1px; text-transform: uppercase; opacity: .65; }
.bf-sum .bf-line { justify-content: flex-start; font-size: 16px; font-weight: 700; }
.bf-bal { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 13px; }
.bf-bal span { opacity: .8; }
.bf-bal .link { font-size: 13px; }
.bf-warn {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; padding: 6px 10px; border-radius: 10px;
  font-size: 13px; font-weight: 700; color: var(--bad-pale); background: rgb(var(--bad-rgb) / .16); border: 1px solid rgb(var(--bad-rgb) / .5);
}
.boss-table td { line-height: 1.1; }
.boss-table .bt-max { display: block; }
.boss-table .bt-fee { display: block; font-size: 11px; font-weight: 700; color: var(--text); opacity: .7; }
.boss-table .bt-fee.free { color: var(--good); opacity: 1; }
.rb-fee { margin-top: 6px; font-size: 14px; font-weight: 700; }
.rb-fee:empty { display: none; }
.rb-fee .bf-line { justify-content: flex-start; }
.rb-fee .bf-bal { margin-top: 2px; }
.rb-fee .bf-bal.short span { color: var(--bad); opacity: 1; }
.boss-reward.got .usdt-ico { width: 28px; height: 28px; }

body.short .tu-foot { margin-top: 6px; }
body.short .bf-sum { padding: 5px 10px; margin-bottom: 6px; }
body.short .bf-sum .bf-line { font-size: 14px; }
body.narrow .topup-tabs .tab { font-size: 13px; }
body.narrow .tu-sum { grid-template-columns: 1fr; gap: 0; }
body.narrow .tu-sum dd { margin-bottom: 4px; }
body.narrow .tu-wrow-top { flex-wrap: wrap; }
body.narrow .boss-table .bt-fee { font-size: 10px; }
body.narrow .bf-sum .bf-line { font-size: 14px; }

/* ---------- Mọi màn hình phủ (menu, sảnh, phòng, ví, Săn Boss, kết thúc...) ----------
   Nội dung cao hơn cửa sổ (màn hình laptop thấp, phóng to trình duyệt) thì cuộn dọc được;
   còn đủ chỗ thì vẫn nằm giữa nhờ margin auto (căn giữa bằng align-items: center sẽ cắt mất phần trên). */
.overlay {
  overflow-y: auto;
  overscroll-behavior: contain;
  align-items: flex-start;
  padding: 16px 0;
}
.overlay > * { margin-top: auto; margin-bottom: auto; flex-shrink: 0; }

/* ---------- Chế độ chơi miễn phí (admin bật): ẩn mọi phần tiền tệ ---------- */
body.free-play #btnEnergy,
body.free-play #bossToday,
body.free-play #bossRewards,
body.free-play #rbFee,
body.free-play #charBuy,
body.free-play .boss-reward { display: none !important; }

/* ======================================================================
   Chế độ học tập: chọn môn / cấp độ, bảng câu hỏi trong trận, khung xem người khác trả lời
   ====================================================================== */
.learn-tag, .qz-tag, .ol-tag {
  display: inline-block; margin-right: 6px; padding: 1px 6px; border-radius: 6px;
  font-style: normal; font-size: 10px; font-weight: 800; letter-spacing: 1px; white-space: nowrap;
  background: linear-gradient(180deg, #8ff0c0, #3fbf8a); color: #0d3324; vertical-align: 1px;
}

/* đấu với máy: khung chọn chế độ trên màn chọn nhân vật */
.learn-pick {
  margin: 12px 0 0; padding: 8px 12px; border-radius: 14px; text-align: left;
  background: rgb(var(--shade-rgb) / calc(.22 * var(--shade-k))); border: 1px solid rgb(var(--hi-rgb) / .1);
}
.learn-pick.on { border-color: rgb(var(--learn-rgb) / .45); background: rgb(var(--learn-bg-rgb) / .16); }
.lp-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.lp-title { font-weight: 800; opacity: .85; }
.lp-subjects { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 8px; }
.lp-subj {
  display: flex; align-items: center; gap: 6px;
  font: inherit; font-size: 15px; color: var(--text);
  padding: 4px 10px; border-radius: 10px; cursor: pointer;
  border: 2px solid rgb(var(--hi-rgb) / .14); background: rgb(var(--hi-rgb) / .06);
  transition: transform .15s, border-color .15s, background .15s;
}
.lp-subj:hover { transform: translateY(-1px); }
.lp-subj:disabled { opacity: .35; cursor: not-allowed; transform: none; }
.lp-subj i { width: 10px; height: 10px; border-radius: 50%; background: var(--s-color); box-shadow: 0 0 6px var(--s-color); flex: none; }
.lp-subj small { font-size: 11px; opacity: .6; }
.lp-subj.sel { border-color: var(--s-color); background: color-mix(in srgb, var(--s-color) 22%, transparent); }
.lp-levels { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.lp-levels > span { font-weight: 700; opacity: .85; }
.lp-levels .seg button small, .learn-cfg .seg button small { margin-left: 5px; font-size: 11px; opacity: .65; }
.lp-note { margin-top: 6px; font-size: 13px; opacity: .7; line-height: 1.3; }
.lp-head + .lp-note { margin-top: 8px; }

/* phòng online: chọn môn + cấp độ */
.learn-cfg { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: -4px 0 10px; }
.learn-cfg .select { font-size: 15px; padding: 5px 10px; max-width: 220px; }
.learn-hint { color: var(--learn); opacity: .85; }
.room-settings .learn-cfg { margin: 0 0 10px; }
.room-settings .learn-hint { flex-basis: 100%; margin: -4px 0 8px; }
.room-learn {
  display: flex; align-items: baseline; gap: 4px 8px; flex-wrap: wrap; text-align: left;
  margin: 10px 0 0; padding: 6px 12px; border-radius: 12px;
  background: rgb(var(--learn-bg-rgb) / .2); border: 1px solid rgb(var(--learn-rgb) / .35);
}
.room-learn small { flex-basis: 100%; font-size: 12px; opacity: .7; }

/* nhãn trong trận */
.learn-chip {
  display: flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 9px; white-space: nowrap;
  font-size: 12px; font-weight: 700; background: var(--panel); border: 1px solid rgb(var(--learn-rgb) / .45);
}
.learn-chip b { color: var(--learn); font-size: 10px; letter-spacing: 1px; }

/* bảng câu hỏi */
#quiz, #quizWatch {
  position: absolute; left: 50%; top: 150px; transform: translateX(-50%);
  width: 760px; max-width: calc(100% - 24px);
  pointer-events: auto;
}
#quizWatch { width: 560px; }
.qz-card, .qw-card {
  padding: 12px 16px 12px; border-radius: 18px; text-align: left;
  background: rgb(var(--panel-rgb) / .94); border: 2px solid rgb(var(--learn-rgb) / .5);
  box-shadow: 0 14px 40px rgb(var(--shadow-rgb) / calc(.55 * var(--shadow-k)));
  animation: pop .35s cubic-bezier(.2, 1.4, .4, 1);
}
.qz-top, .qw-head { display: flex; align-items: center; gap: 8px; }
.qz-subj { flex: 1; min-width: 0; font-size: 15px; color: var(--learn); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qz-time b, .qw-sec { font-size: 18px; font-weight: 800; color: var(--accent); white-space: nowrap; }
.qw-head > span:not(.qz-tag) { flex: 1; min-width: 0; }
.qz-bar { height: 6px; margin: 6px 0 8px; border-radius: 3px; background: rgb(var(--shade-rgb) / calc(.45 * var(--shade-k))); overflow: hidden; }
.qz-bar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #3fbf8a, #8ff0c0); transition: width .1s linear; }
.qz-bar.warn i { background: linear-gradient(90deg, #ff5d6c, #ffb347); }
.qz-loading, .qz-verdict.wait { display: flex; align-items: center; gap: 10px; padding: 18px 4px; font-weight: 700; opacity: .85; }
.qz-verdict.wait { padding: 6px 4px 0; }
.qz-spin {
  width: 22px; height: 22px; flex: none; border-radius: 50%;
  border: 3px solid rgb(var(--hi-rgb) / .15); border-top-color: var(--learn); animation: spin .8s linear infinite;
}
.qz-q { font-size: 21px; font-weight: 700; line-height: 1.3; margin: 2px 2px 10px; user-select: text; white-space: pre-wrap; overflow-wrap: anywhere; }
.qz-q.small { font-size: 16px; margin: 6px 2px 8px; }
.qz-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.qz-opts.many { grid-template-columns: 1fr 1fr 1fr; }
.qz-opt {
  display: flex; align-items: center; gap: 10px; min-height: 48px; text-align: left;
  font: inherit; font-size: 17px; font-weight: 700; color: var(--text);
  padding: 6px 12px; border-radius: 12px; cursor: pointer;
  border: 2px solid rgb(var(--hi-rgb) / .16); background: rgb(var(--hi-rgb) / .07);
  transition: transform .12s, border-color .12s, background .12s;
}
.qz-opt span { min-width: 0; overflow-wrap: anywhere; line-height: 1.2; }
.qz-opt kbd { flex: none; margin: 0; color: var(--accent); }
button.qz-opt:not(:disabled):hover { transform: translateY(-2px); border-color: var(--accent); background: rgb(var(--accent-rgb) / .14); }
.qz-opt:disabled { cursor: default; }
.qz-opt.picked { border-color: var(--accent); background: rgb(var(--accent-rgb) / .2); }
.qz-opt.right { border-color: var(--good); background: rgba(60, 200, 130, .3); }
.qz-opt.right kbd { color: var(--good); }
.qz-opt.wrong { border-color: #ff5d6c; background: rgba(255, 80, 100, .28); }
.qz-opt.wrong kbd { color: var(--bad); }
.qz-opt.dim { opacity: .45; }
.qz-opts.small .qz-opt { min-height: 36px; font-size: 14px; padding: 4px 10px; }
.qz-verdict { display: flex; align-items: baseline; gap: 6px 12px; flex-wrap: wrap; margin-top: 10px; }
.qz-verdict b { font-size: 22px; }
.qz-verdict.ok b { color: var(--good); }
.qz-verdict.ok span { font-weight: 700; color: var(--accent); }
.qz-verdict.bad b { color: var(--bad); }
.qz-expl { margin-top: 6px; font-size: 14px; opacity: .8; line-height: 1.3; user-select: text; overflow-wrap: anywhere; }
.qz-foot { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.qz-bonus { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.15; }
.qz-bonus small { font-size: 11px; opacity: .65; }
.qz-bonus b { font-size: 15px; color: var(--accent); white-space: nowrap; }
.qz-bbar { height: 4px; margin-top: 4px; border-radius: 2px; background: rgb(var(--shade-rgb) / calc(.45 * var(--shade-k))); overflow: hidden; }
.qz-bbar i { display: block; height: 100%; background: linear-gradient(90deg, #ff7a3d, #ffd36b); transition: width .1s linear; }
.qz-weps { display: flex; gap: 6px; }
.qz-w {
  position: relative; display: flex; align-items: center; gap: 6px; width: 150px; text-align: left;
  font: inherit; color: var(--text); padding: 4px 8px 4px 6px; border-radius: 10px; cursor: pointer;
  border: 2px solid rgb(var(--hi-rgb) / .14); background: rgb(var(--hi-rgb) / .06);
}
.qz-w kbd { position: absolute; top: -8px; left: -6px; min-width: 18px; padding: 0 4px; font-size: 11px; }
.qz-w img { width: 30px; height: 30px; flex: none; }
.qz-w span { display: flex; flex-direction: column; min-width: 0; line-height: 1.1; }
.qz-w b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qz-w small { font-size: 10px; font-weight: 800; letter-spacing: .5px; color: var(--accent); opacity: .8; white-space: nowrap; }
.qz-w.skill small { color: var(--skill); }
.qz-w.ult small { color: var(--ult); }
.qz-w.sel { border-color: var(--accent); background: rgb(var(--accent-rgb) / .18); }
.qz-w:disabled { cursor: not-allowed; }
.qz-w:disabled img, .qz-w:disabled b { opacity: .35; filter: grayscale(.8); }
.qz-hint { margin-top: 6px; font-size: 12px; opacity: .55; text-align: center; }
.qw-card.result { border-color: rgb(var(--hi-rgb) / .25); }

/* kết quả cuối trận */
.over-learn {
  display: flex; align-items: baseline; justify-content: center; flex-wrap: wrap; gap: 4px 8px;
  margin: -6px auto 18px; padding: 6px 14px; width: fit-content; max-width: 100%;
  border-radius: 12px; background: rgb(var(--learn-bg-rgb) / .22); border: 1px solid rgb(var(--learn-rgb) / .4);
}
.over-learn b { flex-basis: 100%; font-size: 18px; color: var(--learn); }

body.short #quiz, body.short #quizWatch { top: 66px; }
body.short .qz-card, body.short .qw-card { padding: 8px 12px; }
body.short .qz-q { font-size: 18px; margin-bottom: 6px; }
body.short .qz-opt { min-height: 38px; font-size: 15px; padding: 4px 10px; }
body.short .qz-opts { gap: 6px; }
body.short .qz-hint { display: none; }
body.short .qz-foot { margin-top: 6px; }
body.short .qz-bar { margin: 4px 0 6px; }
body.short .learn-pick { margin-top: 6px; padding: 6px 10px; }
body.short .lp-subjects { margin: 6px 0; }
body.narrow #quiz, body.narrow #quizWatch { top: 132px; width: auto; left: 12px; right: 12px; transform: none; max-width: none; }
body.narrow #hud.multi #quiz, body.narrow #hud.multi #quizWatch { top: 64px; left: 200px; }
body.narrow .qz-opts, body.narrow .qz-opts.many { grid-template-columns: 1fr; gap: 6px; }
body.narrow .qz-opt { min-height: 40px; font-size: 15px; }
body.narrow .qz-q { font-size: 18px; }
body.narrow .qz-foot { flex-direction: column; align-items: stretch; }
body.narrow .qz-weps { justify-content: space-between; }
body.narrow .qz-w { width: auto; flex: 1; }
body.narrow .qz-hint { display: none; }
body.narrow .learn-cfg .select { max-width: 100%; }

/* ======================================================================
   Giao diện theo giờ: ô chọn theme + chỉnh riêng cho nền sáng (Sáng / Trưa)
   ====================================================================== */
.theme-pick { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.theme-ico {
  width: 18px; height: 18px; flex: none; display: inline-block; background: var(--accent);
  -webkit-mask: var(--theme-ico) center / contain no-repeat; mask: var(--theme-ico) center / contain no-repeat;
}
[data-theme-select] { max-width: 170px; }
:root, html[data-theme="evening"] {
  --theme-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 17a6 6 0 0 1 12 0z'/%3E%3Cpath d='M2 20.5h20M12 2.5v6.5M8.8 6.2 12 9.4l3.2-3.2' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
html[data-theme="morning"] {
  --theme-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 17a7 7 0 0 1 14 0z'/%3E%3Cpath d='M2 20.5h20M12 2.5v4M4.3 8.3l2.3 2.3M19.7 8.3l-2.3 2.3' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E");
  --gold-text: #8f5200;
}
html[data-theme="noon"] {
  --theme-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='4.6'/%3E%3Cpath d='M12 1.8v3M12 19.2v3M1.8 12h3M19.2 12h3M4.8 4.8l2.1 2.1M17.1 17.1l2.1 2.1M4.8 19.2l2.1-2.1M17.1 6.9l2.1-2.1' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E");
  --gold-text: #8f4c00;
}
html[data-theme="night"] {
  --theme-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M20.5 14.6A8.8 8.8 0 1 1 9.4 3.5a7 7 0 0 0 11.1 11.1z'/%3E%3Cpath d='M17.5 3.2l.8 1.7 1.7.8-1.7.8-.8 1.7-.8-1.7-1.7-.8 1.7-.8z'/%3E%3C/svg%3E");
}

/* nền sáng: chữ màu theo nhân vật / đội pha đậm lại để đọc được trên nền trắng */
html[data-tone="light"] :is(.char-card .cname, .char-name, .profile-name, .slot-info small) { color: color-mix(in oklab, var(--c-text) 48%, #0a1830); }
html[data-tone="light"] .team-name { color: color-mix(in oklab, var(--team) 58%, #0a1830); }
html[data-tone="light"] .team-col { background: color-mix(in srgb, var(--team) 9%, transparent); }
/* chữ tô màu sẵn bằng JS (bậc hạng, độ hiếm đồ, tên trong chat...) — màu pastel cho nền tối: làm đậm lại */
html[data-tone="light"] .overlay:not(#bossScreen):not(.boss-over) :is(b, span, small, i, em)[style*="color"] { filter: brightness(.5) saturate(1.6); }
html[data-tone="light"] #over:not(.boss-over) .over-title { color: color-mix(in oklab, var(--title-c, var(--text)) 50%, #0a1830); }
/* số tiền / xu / năng lượng: vàng đậm thay cho xanh nhấn */
html[data-tone="light"] :is(.energy-chip b, .tu-balance b, .tu-big b, .buy-price, .d-shop-reward, .d-up i, .overlay .d-coins) { color: var(--gold-text); }
/* nút / thẻ nổi nhẹ trên nền sáng */
html[data-tone="light"] .overlay .btn:not(:disabled) { box-shadow: 0 2px 6px rgb(var(--shadow-rgb) / .12); }
html[data-tone="light"] .room-bosses { background: linear-gradient(90deg, #5e121c, #24081a); }
html[data-tone="light"] .boss-btn { box-shadow: 0 0 0 2px rgba(255, 201, 77, .4), 0 4px 14px rgba(160, 30, 30, .35), inset 0 1px 0 rgba(255, 230, 160, .35); }
html[data-tone="light"] .map-card.sel { box-shadow: 0 0 0 3px rgb(var(--accent-rgb) / .35), 0 6px 16px rgb(var(--shadow-rgb) / .15); }
/* chữ phụ rất mờ (opacity ≤ .6) trên nền sáng: đậm hơn chút để đủ tương phản */
html[data-tone="light"] .overlay :is(.gear-count, .gslot-ph, .gslot-info small, .gear-total small, .forge-note, .chat-line time, .chat-empty,
  .rank-gap, .rank-pts small, .tier small, .tu-limits, .tu-hrow-amt small, .tu-orow-main small, .tu-hrow-main small, .tu-wrow-addr, .tu-qr small,
  .tu-claim-status small, .tu-ohead small, .tu-ohead-date, .tu-cap, .tu-foot, .drops-title, .drop small, .gd-info small, .opt-hint, .profile-email,
  .d-up small, .d-over-stats small, .d-over-stats span, .d-drop-wait, .d-drop-none, .lp-subj small, .room-empty, .rinfo small, .tab:not(.active)) { opacity: .78; }
html[data-tone="light"] .spinner { border-color: rgb(var(--hi-rgb) / .15); border-top-color: var(--accent); }

/* ---------- Gợi ý ngắm bắn (sau khi bắn trượt liên tiếp — aimHint.js) ---------- */
/* ô gợi ý nằm ngay trên thanh dưới (theo thanh dưới ở mọi bố cục: máy tính / cảm ứng / màn dọc) */
.hint-chip {
  position: absolute; left: 12px; bottom: calc(100% + 8px);
  display: flex; align-items: center; gap: 8px;
  max-width: calc(100% - 24px);
  padding: 4px 5px 4px 9px; border-radius: 12px;
  font-size: 14px; font-weight: 700; line-height: 1.2; white-space: nowrap;
  background: var(--panel);
  border: 2px solid rgba(255, 201, 64, .75);
  box-shadow: 0 4px 14px rgb(var(--shadow-rgb) / calc(.35 * var(--shadow-k))), 0 0 14px rgba(255, 201, 64, .22);
  pointer-events: auto;
  animation: hintIn .35s ease-out;
}
@keyframes hintIn { from { opacity: 0; transform: translateY(6px); } }
.hint-chip .hc-ico {
  flex: none; width: 16px; height: 16px; border-radius: 50%;
  background: radial-gradient(circle, #ffc940 0 2.5px, transparent 3px),
    radial-gradient(circle, transparent 0 4.5px, #ffc940 5px 6.5px, transparent 7px);
  animation: hintIco 1.4s ease-in-out infinite;
}
@keyframes hintIco { 50% { transform: scale(1.18); filter: brightness(1.25); } }
.hint-chip .hc-text { overflow: hidden; text-overflow: ellipsis; }
.hint-chip .hc-tag { color: #ffc940; }
.hint-chip .hc-num { color: var(--text-strong); transition: color .15s; }
.hint-chip .hc-num.ok { color: var(--good); text-shadow: 0 0 8px rgb(110 231 160 / .55); }
.hint-chip .hc-flip { font-style: normal; color: var(--accent-2); margin-left: 2px; }
.hint-chip .hc-busy { opacity: .7; }
.hint-chip .hc-toggle {
  flex: none; font: inherit; font-size: 11px; font-weight: 700; color: inherit;
  padding: 2px 8px; border-radius: 8px; cursor: pointer;
  background: rgb(var(--hi-rgb) / .08); border: 1px solid rgb(var(--hi-rgb) / .25);
}
.hint-chip .hc-toggle:hover { background: rgb(var(--hi-rgb) / .16); }
/* đã ẩn: chỉ còn nút "Hiện gợi ý" nhỏ */
.hint-chip.off { padding: 3px; gap: 0; border-color: rgb(var(--hi-rgb) / .2); box-shadow: none; opacity: .85; }
.hint-chip.off .hc-ico, .hint-chip.off .hc-text { display: none; }

/* kim góc gợi ý (mờ, nét đứt) trên mặt đồng hồ góc */
#hintNeedle {
  position: absolute; left: 50%; top: 50%;
  width: 40px; height: 0; margin-top: -1.5px;
  border-top: 3px dashed #ffc940;
  transform-origin: 0 50%;
  opacity: .8;
  filter: drop-shadow(0 0 3px rgba(255, 201, 64, .85));
}
body.narrow #hintNeedle { width: 28px; }

/* vạch lực gợi ý: vàng viền sẫm (khác vạch trắng "lực lần trước") */
#hintPow {
  position: absolute; top: 0; bottom: 0;
  width: 6px; margin-left: -3px;
  background: #ffc940;
  border-left: 1px solid #5a3300; border-right: 1px solid #5a3300;
  box-shadow: 0 0 8px rgba(255, 201, 64, .9);
}
#hintPow.ok { background: #7dffb0; box-shadow: 0 0 12px rgba(125, 255, 176, 1); }

/* báo một lần khi vừa bật gợi ý */
#hintToast {
  position: absolute; left: 50%; top: 176px; z-index: 3;
  width: max-content;
  transform: translateX(-50%);
  max-width: calc(100% - 24px);
  padding: 8px 16px; border-radius: 12px;
  font-size: 16px; font-weight: 800; text-align: center;
  background: rgb(var(--panel-rgb) / .94);
  border: 2px solid rgba(255, 201, 64, .75);
  box-shadow: 0 8px 24px rgb(var(--shadow-rgb) / calc(.4 * var(--shadow-k)));
  opacity: 0; pointer-events: none;
}
#hintToast.show { animation: toast 4.2s ease forwards; }
body.short #hintToast { top: 66px; font-size: 14px; }
body.narrow #hintToast { top: 128px; font-size: 14px; }
body.narrow .hint-chip { left: 8px; font-size: 13px; }

/* ======================================================================
   Chơi tự do (đấu đội thời gian thực): nút menu, chọn thể thức, hàng chờ, HUD trong trận, kết quả
   ====================================================================== */
.arena-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: linear-gradient(180deg, #ffb36b, #ff5d6c);
  border-color: #ffe0c0; color: #3a0d18;
}
.arena-btn:hover { background: linear-gradient(180deg, #ffc285, #ff6f7c); }
.arena-ico {
  display: inline-block; width: 22px; height: 22px; flex: none;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M4 4L14 14M11 17L17 11M15 15L19 19M20 4L10 14M7 11L13 17M9 15L5 19'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M4 4L14 14M11 17L17 11M15 15L19 19M20 4L10 14M7 11L13 17M9 15L5 19'/%3E%3C/svg%3E") center / contain no-repeat;
}
.card-title .arena-ico { width: 30px; height: 30px; margin-right: 10px; vertical-align: -4px; }

/* ---------- Chọn thể thức ---------- */
.arena-card { width: 640px; }
.arena-sub { margin: 4px 0 10px; font-size: 16px; }
.arena-rules {
  margin: 0 0 14px; padding: 10px 14px 10px 30px;
  text-align: left; font-size: 14px; line-height: 1.4;
  border-radius: 14px;
  background: rgb(var(--shade-rgb) / calc(.25 * var(--shade-k)));
}
.arena-rules li { margin: 2px 0; }
.arena-rules b { color: var(--accent); }
.arena-char {
  display: flex; align-items: center; gap: 12px;
  margin: 0 0 14px; padding: 6px 12px 6px 8px;
  border-radius: 14px; text-align: left;
  border: 2px solid color-mix(in srgb, var(--c-main, #888) 55%, transparent);
  background: linear-gradient(90deg, color-mix(in srgb, var(--c-main, #888) 28%, transparent), rgb(var(--shade-rgb) / calc(.2 * var(--shade-k))));
}
.arena-char img { width: 48px; height: 52px; flex: none; }
.arena-char span { flex: 1; display: flex; flex-direction: column; line-height: 1.15; }
.arena-char small { font-size: 12px; opacity: .7; font-weight: 700; }
.arena-char b { font-size: 20px; color: var(--c-text); }
.arena-sizes { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 6px; }
.arena-size {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 14px 10px;
  background: linear-gradient(180deg, color-mix(in srgb, #ff8a5c 40%, var(--btn-bg)), var(--btn-bg));
  border-color: color-mix(in srgb, #ff8a5c 60%, var(--btn-border));
}
.arena-size b { font-size: 30px; line-height: 1; }
.arena-size small { font-size: 13px; font-weight: 700; opacity: .75; }

/* ---------- Hàng chờ ---------- */
.arena-queue-card { width: 760px; }
.aq-count { font-size: 18px; font-weight: 700; min-height: 28px; margin: 2px 0 10px; }
.aq-count b { color: var(--accent); font-size: 26px; }
.aq-search { display: inline-flex; align-items: center; gap: 10px; }
.aq-search i {
  width: 18px; height: 18px; border-radius: 50%;
  border: 3px solid rgb(var(--hi-rgb) / .2); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
.aq-teams { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: start; margin-bottom: 8px; }
.aq-vs { align-self: center; font-size: 26px; font-weight: 800; color: var(--accent); opacity: .8; }
.aq-team {
  display: flex; flex-direction: column; gap: 6px; padding: 8px;
  border-radius: 14px;
  border: 2px solid color-mix(in srgb, var(--team) 60%, transparent);
  background: color-mix(in srgb, var(--team) 12%, transparent);
}
.aq-team-name { display: flex; justify-content: space-between; align-items: baseline; font-weight: 800; color: var(--team); }
.aq-team-name small { font-size: 12px; opacity: .8; color: var(--text); }
.aq-slot {
  display: flex; align-items: center; gap: 8px;
  min-height: 46px; padding: 4px 8px;
  border-radius: 10px; text-align: left;
  border: 2px solid color-mix(in srgb, var(--c-main, #888) 50%, transparent);
  background: linear-gradient(90deg, color-mix(in srgb, var(--c-main, #888) 25%, transparent), rgb(var(--shade-rgb) / calc(.2 * var(--shade-k))));
}
.aq-slot.me { box-shadow: 0 0 0 2px var(--accent); }
.aq-slot img { width: 34px; height: 37px; flex: none; }
.aq-slot span { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.aq-slot b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.aq-slot small { font-size: 12px; font-weight: 700; color: var(--c-text, var(--text)); opacity: .85; }
.aq-slot.bot { border-style: dashed; border-color: rgb(var(--hi-rgb) / .18); background: rgb(var(--shade-rgb) / calc(.15 * var(--shade-k))); opacity: .7; }
.aq-bot {
  width: 34px; height: 34px; flex: none; border-radius: 10px;
  background: rgb(var(--hi-rgb) / .1) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23a8b0cc'%3E%3Cpath d='M11 2h2v3h4a3 3 0 0 1 3 3v8a3 3 0 0 1-3 3H7a3 3 0 0 1-3-3V8a3 3 0 0 1 3-3h4V2zm-2 8a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3zm6 0a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3zM8 20h8v2H8z'/%3E%3C/svg%3E") center / 70% no-repeat;
}

/* ---------- HUD trong trận ---------- */
#arenaClock, #arenaTeams, #killFeed, .arena-hint { display: none; }
#hud.arena-mode #arenaClock, #hud.arena-mode #arenaTeams { display: block; }
#hud.arena-mode #killFeed { display: flex; }
#hud.arena-mode .arena-hint { display: block; }
#hud.arena-mode #pcards, #hud.arena-mode #timer, #hud.arena-mode .hint:not(.arena-hint),
#hud.arena-mode #hintChip, #hud.arena-mode #hintNeedle, #hud.arena-mode #hintPow { display: none !important; }
#arenaClock {
  min-width: 74px; padding: 4px 14px;
  border-radius: 14px;
  font-weight: 800; font-size: 22px; line-height: 1.2; text-align: center;
  font-variant-numeric: tabular-nums;
  background: var(--panel);
  border: 2px solid var(--panel-border);
}
#arenaClock.warn { color: var(--red); border-color: var(--red); }

.at-team {
  position: absolute; top: 12px; left: 16px;
  width: 214px; padding: 6px 8px 7px;
  background: var(--panel);
  border: 2px solid color-mix(in srgb, var(--team) 70%, transparent);
  border-radius: 14px;
  box-shadow: 0 6px 18px rgb(var(--shadow-rgb) / calc(.35 * var(--shadow-k)));
}
.at-team.right { left: auto; right: 16px; }
.at-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 3px; }
.at-head b { color: var(--team-text); font-size: 15px; }
.at-alive { font-weight: 800; font-size: 15px; color: var(--team-text); }
.at-row { display: grid; grid-template-columns: 18px 1fr 52px; gap: 5px; align-items: center; height: 19px; }
.at-row img { width: 18px; height: 19px; }
.at-name { font-size: 12.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.at-row.bot .at-name { opacity: .75; font-weight: 600; }
.at-row.me .at-name { color: var(--accent); font-weight: 800; }
.at-hp { height: 6px; border-radius: 3px; overflow: hidden; background: rgb(var(--shade-rgb) / calc(.5 * var(--shade-k))); }
.at-hp i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #46e08a, #b6f36b); transition: width .3s; }
.at-hp i.low { background: linear-gradient(90deg, #ff5d6c, #ffb36b); }
.at-row.dead { opacity: .4; filter: grayscale(1); }
.at-row.dead .at-name { text-decoration: line-through; }

/* trong trận chơi tự do: gió · đồng hồ · nút xếp một hàng, bảng hạ gục ngay bên dưới */
#hud.arena-mode #topcenter { flex-direction: row; align-items: center; }
#killFeed {
  position: absolute; top: 74px; left: 50%; transform: translateX(-50%);
  width: 440px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.kf-line {
  padding: 3px 12px; border-radius: 10px;
  font-size: 14px; font-weight: 700; white-space: nowrap;
  background: rgb(var(--panel-rgb) / .72);
  border: 1px solid rgb(var(--hi-rgb) / .14);
  transition: opacity .7s;
  animation: kfIn .25s ease-out;
}
.kf-line.mine { border-color: rgb(var(--accent-rgb) / .7); }
.kf-line.fade { opacity: 0; }
@keyframes kfIn { from { transform: translateY(-6px); opacity: 0; } }
#arenaSpec {
  position: absolute; top: 24%; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center;
  padding: 8px 20px; border-radius: 16px;
  font-size: 19px; font-weight: 800; white-space: nowrap;
  background: var(--panel); border: 2px solid var(--panel-border);
  pointer-events: none;
}
#arenaSpec b { color: var(--accent); }
#arenaSpec small { font-size: 12px; opacity: .7; font-weight: 700; }

/* hồi đòn: lớp phủ tối quét theo thời gian còn lại trên ô vũ khí, thanh HỒI ĐÒN, nút BẮN cảm ứng */
.wslot.cooling::after {
  content: ''; position: absolute; inset: 0; border-radius: 10px; pointer-events: none;
  background: conic-gradient(rgb(var(--shadow-rgb) / .55) calc(var(--cd, 0) * 1%), transparent 0);
}
#staminafill.cooling { background: linear-gradient(90deg, #ff7a5c, #ffd36b); }
.firebtn.cooling { filter: saturate(.35) brightness(.85); }
.firebtn.nudge { animation: nudge .3s; }
@keyframes nudge { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

body.short #killFeed { top: 62px; }
body.short .at-team { top: 8px; width: 196px; padding: 4px 7px 5px; }
body.short .at-row { height: 16px; }
body.short .at-row img { height: 16px; width: 15px; }
body.short .at-name { font-size: 11.5px; }
body.short #arenaClock { font-size: 18px; padding: 2px 10px; min-width: 60px; }
body.narrow .at-team { width: calc(50% - 22px); top: 8px; }
body.narrow #hud.arena-mode #topcenter { top: 150px; }
body.narrow #killFeed { top: 210px; width: 92%; }
body.narrow .kf-line { white-space: normal; text-align: center; }

/* ---------- Kết quả ---------- */
.arena-over-card { width: 720px; }
.arena-over-card .over-title { margin-bottom: 4px; }
.ao-me { display: flex; justify-content: center; gap: 12px; margin: 6px 0 12px; }
.ao-me span {
  display: flex; flex-direction: column; min-width: 120px; padding: 6px 12px;
  border-radius: 12px; font-size: 13px; font-weight: 700;
  background: rgb(var(--shade-rgb) / calc(.25 * var(--shade-k)));
}
.ao-me b { font-size: 26px; color: var(--accent); line-height: 1.1; }
.ao-teams { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.ao-team {
  padding: 6px 8px; border-radius: 12px; text-align: left;
  border: 2px solid color-mix(in srgb, var(--team) 60%, transparent);
  background: color-mix(in srgb, var(--team) 10%, transparent);
}
.ao-head, .ao-row { display: grid; grid-template-columns: 1fr 34px 46px; gap: 6px; align-items: center; }
.ao-head { font-size: 12px; font-weight: 800; opacity: .8; margin-bottom: 2px; }
.ao-head b { color: var(--team); font-size: 15px; }
.ao-head span, .ao-num { text-align: right; }
.ao-row { grid-template-columns: 20px 1fr 34px 46px; font-size: 13.5px; height: 22px; }
.ao-row img { width: 20px; height: 22px; }
.ao-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 700; }
.ao-num { font-weight: 800; font-variant-numeric: tabular-nums; }
.ao-row.me .ao-name { color: var(--accent); }
.ao-row.dead { opacity: .55; }

body.short .arena-rules { font-size: 13px; padding: 6px 10px 6px 26px; margin-bottom: 8px; }
body.short .arena-size { padding: 8px 10px; }
body.short .aq-slot { min-height: 38px; }
body.short .aq-slot img { width: 28px; height: 30px; }
body.short .ao-row { height: 19px; }
body.narrow .arena-card, body.narrow .arena-queue-card, body.narrow .arena-over-card { width: calc(100% - 24px); }
body.narrow .aq-teams { grid-template-columns: 1fr; }
body.narrow .aq-vs { display: none; }
body.narrow .ao-teams { grid-template-columns: 1fr; }
#arenaScreen, #arenaQueue, #arenaOver { overflow-y: auto; align-items: flex-start; }
#arenaScreen > *, #arenaQueue > *, #arenaOver > * { margin-top: auto; margin-bottom: auto; }
body.touch #hud.arena-mode .arena-hint { display: none; }
