/* ================================================================
   Thức Tỉnh — giao diện kiểu "cửa sổ hệ thống"
   --accent đổi theo class của nhân vật (đặt từ JS)
   ================================================================ */
@font-face { font-family: 'Be Vietnam Pro'; font-weight: 400; font-display: swap;
  src: url(/fonts/be-vietnam-pro-vietnamese-400-normal.woff2) format('woff2'); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: 'Be Vietnam Pro'; font-weight: 400; font-display: swap; src: url(/fonts/be-vietnam-pro-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Be Vietnam Pro'; font-weight: 600; font-display: swap;
  src: url(/fonts/be-vietnam-pro-vietnamese-600-normal.woff2) format('woff2'); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: 'Be Vietnam Pro'; font-weight: 600; font-display: swap; src: url(/fonts/be-vietnam-pro-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Be Vietnam Pro'; font-weight: 800; font-display: swap;
  src: url(/fonts/be-vietnam-pro-vietnamese-800-normal.woff2) format('woff2'); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: 'Be Vietnam Pro'; font-weight: 800; font-display: swap; src: url(/fonts/be-vietnam-pro-latin-800-normal.woff2) format('woff2'); }

:root {
  --accent: #3fd0ff;
  --sys: #3fd0ff;
  --bg: #060a18;
  --line: rgba(63, 208, 255, 0.28);
  --line-2: rgba(63, 208, 255, 0.55);
  --text: #e6f1ff;
  --muted: #8aa0c0;
  --gold: #ffd166;
  --hp: #ff4d6d;
  --mp: #3fa9ff;
  --exp: #b57bff;
  --ok: #5cf2a5;
  --bad: #ff7a8a;
  --q1: #d8e2f0;
  --q2: #5cb8ff;
  --q3: #c58bff;
  --q4: #ffcc3d;
  --glow: 0 0 0 1px var(--line), 0 0 18px rgba(63, 208, 255, 0.18), inset 0 0 22px rgba(63, 208, 255, 0.06);
}
* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; background: var(--bg); color: var(--text); overflow: hidden;
  font: 14px/1.45 'Be Vietnam Pro', 'Segoe UI', system-ui, sans-serif;
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; cursor: pointer; }
input { font: inherit; }
.hidden { display: none !important; }
.sys-tag {
  display: inline-block; padding: 2px 10px; border: 1px solid var(--line-2); border-radius: 4px;
  font-size: 11px; font-weight: 600; letter-spacing: 3px; color: var(--sys); background: rgba(63, 208, 255, 0.08);
}

/* ---------- Đăng nhập / tải ---------- */
.screen {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; flex-direction: column;
  background:
    radial-gradient(ellipse 40% 55% at 50% 42%, rgba(63, 208, 255, 0.22), transparent 70%),
    radial-gradient(ellipse 70% 50% at 50% 110%, rgba(181, 123, 255, 0.25), transparent 70%),
    linear-gradient(180deg, #050816 0%, #0b1030 60%, #1a1240 100%);
}
.screen::before {
  content: ''; position: absolute; left: 50%; top: 42%; width: min(420px, 80vw); aspect-ratio: 0.62; transform: translate(-50%, -50%);
  border-radius: 50%; border: 3px solid rgba(127, 227, 255, 0.55);
  box-shadow: 0 0 40px rgba(63, 208, 255, 0.45), inset 0 0 60px rgba(63, 208, 255, 0.35);
  animation: gate 4s ease-in-out infinite; pointer-events: none;
}
@keyframes gate { 50% { box-shadow: 0 0 70px rgba(63, 208, 255, 0.6), inset 0 0 90px rgba(63, 208, 255, 0.5); } }
.login-box {
  position: relative; width: min(370px, calc(100vw - 32px)); padding: 26px 26px 20px; text-align: center;
  background: linear-gradient(180deg, rgba(14, 26, 58, 0.9), rgba(6, 11, 26, 0.94));
  border: 1px solid var(--line-2); border-radius: 12px; box-shadow: var(--glow), 0 20px 60px rgba(0, 0, 0, 0.55);
}
.login-box h1 {
  margin: 10px 0 0; font-size: 38px; font-weight: 800; letter-spacing: 6px; color: #fff;
  text-shadow: 0 0 14px rgba(63, 208, 255, 0.9), 0 0 32px rgba(63, 208, 255, 0.5);
}
.login-box .sub { margin: 4px 0 20px; color: var(--muted); font-size: 13px; }
.login-box input {
  width: 100%; margin-bottom: 10px; padding: 11px 12px; border-radius: 8px; border: 1px solid var(--line);
  background: rgba(3, 7, 18, 0.8); color: var(--text); outline: none; -webkit-user-select: text; user-select: text;
}
.login-box input:focus { border-color: var(--sys); box-shadow: 0 0 0 3px rgba(63, 208, 255, 0.15); }
.error { color: var(--bad); min-height: 1.2em; margin: 10px 0 0; }
.note { color: var(--muted); font-size: 12px; margin: 6px 0 0; }
.spinner { width: 38px; height: 38px; border: 3px solid var(--line); border-top-color: var(--sys); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#loading p { color: var(--muted); letter-spacing: 2px; }
#loading { z-index: 40; transition: opacity 0.25s; }
.load-bar { width: min(260px, 60vw); height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; margin-top: 4px; }
.load-bar i { display: block; height: 100%; width: 0; background: var(--sys); box-shadow: 0 0 8px var(--sys); transition: width 0.2s ease-out; }
/* Nút trong bảng đang chờ server trả lời: mờ đi và không bấm lại được */
.btn.busy, [data-act].busy { opacity: 0.6; pointer-events: none; cursor: progress; }

/* ---------- Khung game ---------- */
#game-wrap { position: fixed; inset: 0; }
#game { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: #000; }
#game canvas { image-rendering: auto; }
#hud { position: absolute; inset: 0; pointer-events: none; }
#hud button, #hud .sk { pointer-events: auto; }

/* Cột trái: thẻ nhân vật rồi tới ô thú, xếp sát nhau */
#hud-left {
  position: absolute; left: 10px; top: 10px; width: 250px;
  display: flex; flex-direction: column; gap: 6px;
}
/* Thẻ nhân vật */
#hud-char {
  position: relative; width: 100%; padding: 9px 11px 8px;
  background: linear-gradient(180deg, rgba(14, 26, 58, 0.82), rgba(6, 11, 26, 0.78));
  border: 1px solid var(--line-2); border-radius: 10px; box-shadow: var(--glow);
}
/* Ô thú: cùng kiểu thẻ với nhân vật, có ảnh thú */
#hud-pet {
  position: relative; width: 100%; max-height: 42vh; overflow-y: auto; padding: 8px 11px;
  background: linear-gradient(180deg, rgba(14, 26, 58, 0.82), rgba(6, 11, 26, 0.8));
  border: 1px solid rgba(92, 242, 165, 0.55); border-radius: 10px; box-shadow: 0 0 14px rgba(92, 242, 165, 0.12);
}
.pet-hud-unit { display: flex; gap: 9px; align-items: center; padding-bottom: 6px; margin-bottom: 6px; border-bottom: 1px solid rgba(255,255,255,.08); }
.pet-hud-unit:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
/* Ô thú: cùng kiểu thẻ với nhân vật, có ảnh thú trong khung tròn */
#hud-pet .pet-ava {
  flex: none; width: 54px; height: 54px; border-radius: 50%; overflow: hidden;
  background-color: rgba(0,0,0,.4); background-repeat: no-repeat; background-position: center;
  border: 2px solid rgba(92, 242, 165, 0.75); box-shadow: 0 0 10px rgba(92, 242, 165, 0.3);
}
#hud-pet .pet-bars { flex: 1; min-width: 0; }
#hud-pet .bar { height: 11px; margin-top: 3px; }
#hud-pet .bar:first-child { margin-top: 0; }
#hud-pet .bar span { font-size: 9px; line-height: 10px; }
#hud-pet .bar.sta { height: 10px; }
.hud-top { display: flex; gap: 9px; align-items: center; margin-bottom: 5px; }
.hud-ava {
  position: relative; flex: none; width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 20px;
  background: radial-gradient(circle at 50% 35%, rgba(255, 255, 255, 0.15), rgba(0, 0, 0, 0.4));
  border: 2px solid var(--accent); box-shadow: 0 0 12px var(--accent);
}
.level-badge {
  position: absolute; top: -7px; right: -7px; width: 21px; height: 21px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; color: #1d1710; background: #f0c879;
  border: 1px solid rgba(255,255,255,.8); font-size: 10px; line-height: 1; font-weight: 800; box-shadow: 0 2px 7px rgba(0,0,0,.5);
}
.rank {
  position: absolute; right: -6px; bottom: -4px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 4px;
  background: #0a0f22; border: 1px solid var(--accent); color: var(--accent); font-size: 11px; line-height: 16px; text-align: center;
}
.hud-id { min-width: 0; }
.hud-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-name { display: flex; align-items: center; gap: 6px; }
.hud-school { font-size: 11.5px; color: var(--muted); }
.bar { position: relative; height: 13px; background: rgba(0, 0, 0, 0.55); border-radius: 3px; margin-top: 4px; overflow: hidden; border: 1px solid rgba(255, 255, 255, 0.06); }
.bar > div { height: 100%; transition: width 0.15s; position: relative; }
.bar > div::after { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 40%; background: rgba(255, 255, 255, 0.25); }
.bar.hp > div { background: linear-gradient(90deg, #a3123a, var(--hp)); box-shadow: 0 0 8px rgba(255, 77, 109, 0.6); }
.bar.mp > div { background: linear-gradient(90deg, #1450a8, var(--mp)); box-shadow: 0 0 8px rgba(63, 169, 255, 0.6); }
.bar.exp { height: 7px; }
.bar.exp > div { background: linear-gradient(90deg, #6a2fd0, var(--exp)); }
.bar span { position: absolute; inset: 0; font-size: 10px; line-height: 12px; text-align: center; text-shadow: 0 1px 2px #000; font-weight: 600; }
.bar.exp span { display: none; }
.hud-gold { margin-top: 5px; font-size: 12.5px; color: var(--gold); font-weight: 600; }

#hud-right { position: absolute; right: 10px; top: 10px; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; max-width: calc(var(--gw, 100vw) - 20px); }
/* Hàng trên: thanh hiệu ứng + nút. Màn hẹp thì thanh hiệu ứng xuống hàng dưới (vẫn trong cột phải, không đè thanh máu). */
.hud-row { display: flex; gap: 6px; align-items: center; justify-content: flex-end; flex-wrap: wrap-reverse; max-width: 100%; }
.menu { display: flex; gap: 6px; align-items: center; flex: none; }
.menu button {
  position: relative; width: 40px; height: 40px; border-radius: 9px; padding: 0; font-size: 18px;
  background: linear-gradient(180deg, rgba(20, 34, 72, 0.85), rgba(6, 11, 26, 0.85));
  border: 1px solid var(--line-2); box-shadow: 0 0 10px rgba(63, 208, 255, 0.12);
}
.menu button:hover { border-color: var(--sys); box-shadow: 0 0 14px rgba(63, 208, 255, 0.4); }
.menu button i { position: absolute; right: 3px; bottom: 0; font-size: 9px; font-style: normal; color: var(--muted); }
.badge {
  position: absolute; top: -5px; right: -5px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
  background: var(--hp); font-size: 10px; line-height: 17px; font-weight: 700; box-shadow: 0 0 8px var(--hp);
}
#quest-track {
  width: max-content; max-width: min(250px, calc(var(--gw, 100vw) * .3)); padding: 6px 10px; border-radius: 8px; font-size: 12px; line-height: 1.4;
  background: rgba(6, 11, 26, 0.72); border: 1px solid var(--line); border-left: 3px solid var(--sys);
}
#quest-track:empty { display: none; }
#quest-track .done { color: var(--ok); }

#log {
  position: absolute; left: 10px; bottom: 84px; width: min(440px, calc(var(--gw, 100vw) * 0.5)); display: flex; flex-direction: column; gap: 3px;
  font-size: 12.5px; text-shadow: 0 1px 2px #000, 0 0 4px #000;
}
#log div { transition: opacity 1s; padding-left: 8px; border-left: 2px solid rgba(63, 208, 255, 0.5); }
#log div.old { opacity: 0; }

/* Thanh kỹ năng (máy tính) */
#skillbar { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); display: flex; gap: 7px; }
.sk {
  position: relative; width: 54px; height: 54px; border-radius: 10px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, rgba(20, 34, 72, 0.88), rgba(6, 11, 26, 0.9));
  border: 1px solid var(--line-2); box-shadow: 0 0 10px rgba(63, 208, 255, 0.15);
}
.sk[data-k="atk"] { border-color: var(--accent); box-shadow: 0 0 12px var(--accent); }
.sk .ico { font-size: 20px; text-align: center; line-height: 1.05; padding: 0 2px; }
.sk .ico small { display: block; font-size: 9px; color: var(--muted); }
.sk .key { position: absolute; left: 4px; top: 1px; font-size: 10px; color: var(--muted); }
.sk .cnt { position: absolute; right: 4px; bottom: 1px; font-size: 11px; font-weight: 700; }
.sk .cd { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: rgba(0, 0, 0, 0.65); }
.sk.nomp .ico { opacity: 0.35; }
.sk.empty .ico { opacity: 0.25; }
#hint {
  position: absolute; left: 50%; bottom: 78px; transform: translateX(-50%); padding: 4px 14px; border-radius: 6px; font-size: 13px;
  background: rgba(6, 11, 26, 0.8); border: 1px solid var(--line);
}
#hint:empty { display: none; }

/* Thanh hiệu ứng đang dùng (buff kỹ năng): nằm cùng hàng với nút bản đồ / chat / menu,
   nên màn hình hẹp cũng không đè lên thanh máu. Biểu tượng + số giây còn lại. */
#buffbar {
  display: flex; gap: 5px; align-items: center; pointer-events: none;
  max-width: 40vw; overflow: hidden;
}
#buffbar.hidden { display: none; }
#buffbar .bf {
  position: relative; width: 38px; height: 38px; border-radius: 9px; overflow: hidden; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, rgba(46, 36, 28, 0.94), rgba(14, 13, 14, 0.95));
  border: 1px solid rgba(231, 182, 107, 0.55);
  box-shadow: 0 0 12px rgba(231, 182, 107, 0.22), inset 0 0 10px rgba(255, 255, 255, 0.05);
}
#buffbar .bf-ic { font-size: 17px; line-height: 1; filter: drop-shadow(0 1px 2px #000); }
#buffbar .bf-t {
  position: absolute; right: 2px; bottom: 1px; font-size: 9.5px; font-weight: 800; color: #fff;
  text-shadow: 0 1px 2px #000, 0 0 4px #000;
}
#buffbar .bf-p {
  position: absolute; left: 0; bottom: 0; height: 3px; width: 100%;
  background: linear-gradient(90deg, #f1d49b, #d7a45b); box-shadow: 0 0 6px rgba(241, 212, 155, 0.6);
}
/* Sắp hết: viền đỏ nhấp nháy để người chơi kịp dùng lại */
#buffbar .bf.soon { border-color: rgba(255, 106, 90, 0.9); animation: bfSoon 0.9s ease-in-out infinite; }
#buffbar .bf.soon .bf-p { background: linear-gradient(90deg, #ff9a7a, #e04a3a); }
#buffbar .bf.soon .bf-t { color: #ffb3a3; }
@keyframes bfSoon { 0%, 100% { box-shadow: 0 0 10px rgba(224, 74, 58, 0.3); } 50% { box-shadow: 0 0 18px rgba(224, 74, 58, 0.75); } }

/* Thông báo hệ thống giữa màn hình */
#banner {
  position: absolute; left: 50%; top: 20%; transform: translateX(-50%); padding: 10px 34px 12px; text-align: center;
  background: linear-gradient(180deg, rgba(14, 26, 58, 0.92), rgba(6, 11, 26, 0.92));
  border: 1px solid var(--line-2); border-radius: 8px; box-shadow: var(--glow), 0 0 40px rgba(63, 208, 255, 0.25);
  font-size: 22px; font-weight: 800; letter-spacing: 1px; color: #fff; text-shadow: 0 0 12px rgba(63, 208, 255, 0.8);
  white-space: nowrap; pointer-events: none; animation: bannerIn 0.35s ease-out;
}
#banner::before { content: '◆ HỆ THỐNG'; display: block; font-size: 10px; letter-spacing: 3px; color: var(--sys); font-weight: 600; text-shadow: none; margin-bottom: 2px; }
#banner[data-kind="quest"] { border-color: rgba(165, 214, 167, 0.6); box-shadow: 0 0 30px rgba(165, 214, 167, 0.22); font-size: 17px; }
#banner[data-kind="quest"]::before { content: '◆ NHIỆM VỤ'; color: #a5d6a7; }
@keyframes bannerIn { from { transform: translate(-50%, -8px) scale(0.96); } }

/* Bảng chọn chỗ hồi sinh sau khi gục */
#death-overlay {
  position: absolute; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center;
  background: rgba(4, 2, 10, 0.72); pointer-events: auto;
}
.death-card {
  width: min(420px, calc(var(--gw, 100vw) - 32px)); padding: 26px 28px 24px; text-align: center;
  background: linear-gradient(180deg, rgba(30, 12, 26, 0.97), rgba(10, 6, 18, 0.98));
  border: 1px solid rgba(239, 83, 80, 0.55); border-radius: 10px;
  box-shadow: 0 0 48px rgba(239, 83, 80, 0.28), inset 0 0 24px rgba(239, 83, 80, 0.08);
  animation: bannerIn 0.3s ease-out;
}
.death-title { font-size: 22px; font-weight: 800; letter-spacing: 2px; color: #ff8a80; text-shadow: 0 0 14px rgba(239, 83, 80, 0.7); }
.death-sub { margin-top: 8px; font-size: 13px; color: #c8bcd0; }
.death-actions { display: flex; gap: 10px; margin-top: 22px; }
.death-btn {
  flex: 1; padding: 11px 8px; border: 1px solid var(--line-2); border-radius: 6px;
  background: linear-gradient(180deg, rgba(20, 34, 66, 0.9), rgba(8, 14, 30, 0.9));
  font-size: 14px; font-weight: 700; color: #dbe6ff; transition: filter 0.15s, transform 0.1s;
}
.death-btn:hover { filter: brightness(1.25); }
.death-btn:active { transform: translateY(1px); }
.death-btn.primary { border-color: rgba(92, 242, 165, 0.6); color: #a8ffd0; }

/* ---------- Bảng (panel) ---------- */
#panel { position: absolute; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; background: rgba(2, 4, 12, 0.55); }
.panel-box {
  width: min(780px, calc(var(--gw, 100vw) - 20px)); max-height: calc(var(--gh, 100vh) - 20px); display: flex; flex-direction: column;
  background: linear-gradient(180deg, rgba(14, 26, 58, 0.96), rgba(6, 11, 26, 0.97));
  border: 1px solid var(--line-2); border-radius: 12px; box-shadow: var(--glow), 0 24px 70px rgba(0, 0, 0, 0.65);
  animation: panelIn 0.18s ease-out;
}
@keyframes panelIn { from { transform: scale(0.97); } }
.panel-head { display: flex; align-items: center; padding: 9px 14px; border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 0; font-size: 16px; font-weight: 700; flex: 1; color: #fff; letter-spacing: 0.5px; }
.panel-head h2::before { content: '◆ '; color: var(--sys); }
#panel-close { width: 34px; height: 34px; border: 1px solid transparent; border-radius: 8px; background: transparent; font-size: 16px; color: var(--muted); }
#panel-close:hover { border-color: var(--line-2); color: #fff; }
#panel-body { padding: 14px; overflow: auto; }
#panel-body h3 { color: #fff; }

.btn {
  padding: 7px 14px; border-radius: 8px; border: 1px solid var(--line-2); color: var(--text);
  background: linear-gradient(180deg, rgba(30, 50, 100, 0.6), rgba(12, 20, 44, 0.8));
}
.btn:hover:not(:disabled) { border-color: var(--sys); box-shadow: 0 0 12px rgba(63, 208, 255, 0.3); }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn.primary {
  border-color: #7fe3ff; color: #031022; font-weight: 700;
  background: linear-gradient(180deg, #7fe3ff, #26a8e0); box-shadow: 0 0 14px rgba(63, 208, 255, 0.45);
}
.btn.big { width: 100%; padding: 12px; font-size: 15px; letter-spacing: 1px; }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--muted); }
.btn.ghost:hover:not(:disabled) { color: var(--text); }
.btn.small { padding: 4px 10px; font-size: 12px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.muted { color: var(--muted); }
.gold { color: var(--gold); }
.okc { color: var(--ok); }
.bad { color: var(--bad); }
.q1 { color: var(--q1); } .q2 { color: var(--q2); } .q3 { color: var(--q3); } .q4 { color: var(--q4); }

/* Túi đồ */
.inv { display: grid; grid-template-columns: 200px 1fr; gap: 14px; }
.inv-detail { grid-column: 1 / -1; }
.inv-detail .detail { margin-top: 0; }
.inv-detail { min-height: 0; overscroll-behavior: contain; }
.equip-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; align-content: start; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 5px; }
.cell {
  position: relative; aspect-ratio: 1; border-radius: 8px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: 22px;
  background: radial-gradient(circle at 50% 40%, rgba(40, 60, 110, 0.5), rgba(4, 8, 20, 0.9));
  border: 1px solid rgba(138, 160, 192, 0.25);
}
.cell.empty { cursor: default; opacity: 0.55; background: rgba(4, 8, 20, 0.6); }
.cell.sel { outline: 2px solid var(--sys); box-shadow: 0 0 12px rgba(63, 208, 255, 0.6); }
.cell .n { position: absolute; right: 3px; bottom: 0; font-size: 11px; font-weight: 700; text-shadow: 0 1px 2px #000; }
.cell .pl { position: absolute; left: 3px; top: 0; font-size: 10px; font-weight: 700; color: var(--gold); }
.cell .lbl { position: absolute; left: 0; right: 0; bottom: 2px; font-size: 8.5px; color: var(--muted); text-align: center; }
.cell.qb2 { border-color: rgba(92, 184, 255, 0.7); box-shadow: inset 0 0 10px rgba(92, 184, 255, 0.2); }
.cell.qb3 { border-color: rgba(197, 139, 255, 0.8); box-shadow: inset 0 0 12px rgba(197, 139, 255, 0.3); }
.cell.qb4 { border-color: rgba(255, 204, 61, 0.9); box-shadow: inset 0 0 14px rgba(255, 204, 61, 0.35), 0 0 8px rgba(255, 204, 61, 0.35); }
.detail { margin-top: 12px; padding: 10px 12px; border-radius: 8px; background: rgba(3, 7, 18, 0.65); border: 1px solid var(--line); min-height: 60px; }
.detail h3 { margin: 0 0 4px; font-size: 15px; }
.detail .stats { margin: 4px 0 6px; }
.affix { margin: 2px 0 6px; color: #d4b8ff; font-size: 13px; }
.perf { font-size: 12.5px; margin-bottom: 4px; }
/* Độ bền trang bị */
.dur { font-size: 11px; font-weight: 700; }
.dur-ok { color: #81c784; } .dur-mid { color: #ffd54f; } .dur-low { color: #ff9800; } .dur-broken { color: #ef5350; }
.dur-row { font-size: 12.5px; margin-bottom: 4px; }
.dur-bar { height: 5px; margin-top: 3px; border-radius: 3px; background: rgba(255,255,255,.12); overflow: hidden; }
.dur-bar i { display: block; height: 100%; }
.dur-bar i.dur-ok { background: #66bb6a; } .dur-bar i.dur-mid { background: #ffca28; } .dur-bar i.dur-low { background: #ff9800; } .dur-bar i.dur-broken { background: #ef5350; }
.eq-slot.broken { border-color: rgba(239,83,80,.7); }
/* Kỳ Nguyên: khối thông tin + bật/tắt trong bảng chi tiết */
.kn-box { margin: 8px 0 4px; padding: 8px 10px; border-radius: 9px; background: rgba(179,136,255,.07); border: 1px solid rgba(179,136,255,.22); }
.kn-fx { font-size: 12.5px; color: #d4b8ff; line-height: 1.5; margin: 4px 0; }
.kn-state { font-size: 12px; margin: 5px 0; }
.kn-toggle { width: 100%; padding: 7px 10px; font-size: 13px; }
.cmp { font-size: 12.5px; margin: 4px 0 6px; line-height: 1.6; }
.cmp .up, .cmp.up { color: var(--ok); }
.cmp .down { color: var(--bad); }
.cmp span { margin-right: 6px; }

/* Nhân vật */
.stat-table { width: 100%; border-collapse: collapse; }
.stat-table td { padding: 5px 4px; border-bottom: 1px solid rgba(63, 208, 255, 0.1); }
.stat-table td:last-child { text-align: right; font-weight: 600; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

/* Danh sách */
.list { display: flex; flex-direction: column; gap: 6px; }
.li { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 8px; background: rgba(3, 7, 18, 0.6); border: 1px solid var(--line); }
.li .ic { font-size: 22px; width: 30px; text-align: center; }
.li .main { flex: 1; min-width: 0; }
.li .main small { display: block; color: var(--muted); }
.li.sel { border-color: var(--sys); box-shadow: 0 0 10px rgba(63, 208, 255, 0.35); }
.li.locked { opacity: 0.5; }

/* Hội thoại */
.dialog { display: flex; gap: 14px; }
.dialog .face {
  width: 64px; height: 64px; border-radius: 10px; flex: none; display: flex; align-items: center; justify-content: center; font-size: 36px;
  background: radial-gradient(circle at 50% 35%, rgba(63, 208, 255, 0.2), rgba(3, 7, 18, 0.8)); border: 1px solid var(--line-2);
}
.dialog .text p { margin: 0 0 8px; }
.dialog .text p.sysline { color: var(--sys); font-weight: 600; }
.dialog .opts { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.dialog .opts .btn { text-align: left; }

.schools { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 10px; }
.school-card { padding: 12px; border-radius: 10px; background: rgba(3, 7, 18, 0.65); border: 1px solid var(--line); cursor: pointer; }
.school-card:hover { border-color: var(--sys); box-shadow: 0 0 14px rgba(63, 208, 255, 0.3); }
.school-card h3 { margin: 0 0 6px; }
.school-card p { margin: 0; font-size: 12.5px; color: var(--muted); }

.rate { font-size: 22px; font-weight: 800; }
.upgrade-fx { animation: pop 0.5s; }
@keyframes pop { 0% { transform: scale(1.4); } 100% { transform: scale(1); } }

#tooltip {
  position: fixed; z-index: 30; max-width: 270px; padding: 8px 10px; border-radius: 8px; pointer-events: none; font-size: 12.5px;
  background: rgba(6, 11, 26, 0.97); border: 1px solid var(--line-2); box-shadow: var(--glow);
}

/* ---------- Điều khiển cảm ứng (điện thoại) ---------- */
#touch { position: absolute; inset: 0; pointer-events: none; }
body.touch, body.touch * { -webkit-touch-callout: none; }
body.touch #game { touch-action: none; }
/* Vùng an toàn (tai thỏ, thanh vuốt) theo khung game. Khung bị xoay (html.rot) thì cạnh trái/phải của game
   nằm ở cạnh trên/dưới của màn hình. */
:root { --sal: env(safe-area-inset-left); --sar: env(safe-area-inset-right); --sab: env(safe-area-inset-bottom); }
html.rot { --sal: env(safe-area-inset-top); --sar: env(safe-area-inset-bottom); --sab: 0px; }
html.rot #game-wrap { inset: auto; left: 0; top: 0; transform-origin: 0 0; }

/* 3 nút mũi tên tròn: trái, xuống, phải */
#arrows {
  position: absolute; left: calc(14px + var(--sal)); bottom: calc(12px + var(--sab)); width: 188px; height: 148px;
  pointer-events: none; touch-action: none;   /* chỉ 3 nút nhận chạm, khoảng trống giữa các nút bỏ qua */
}
.tb-arrow { width: 76px; height: 76px; bottom: 2px; }
.tb-arrow[data-arrow="left"] { left: 0; }
.tb-arrow-up { left: 56px; bottom: 70px; }   /* ▲ nhảy: nằm giữa, phía trên ◀ ▶ (kiểu chữ T ngược) */
.tb-arrow[data-arrow="right"] { left: 112px; }
.tb-arrow svg { width: 46%; height: 46%; fill: none; stroke: #e6f4ff; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.tb-arrow.on svg { stroke: #fff; }
#tbtns { position: absolute; right: var(--sar); bottom: var(--sab); width: 260px; height: 220px; pointer-events: none; }
.tb {
  position: absolute; pointer-events: auto; touch-action: none; border-radius: 50%; padding: 0; overflow: hidden; color: #fff;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 30%, rgba(40, 70, 130, 0.75), rgba(6, 11, 26, 0.75));
  border: 2px solid var(--line-2); box-shadow: 0 0 12px rgba(63, 208, 255, 0.25);
}
.tb.on { border-color: #fff; box-shadow: 0 0 18px rgba(63, 208, 255, 0.8); transform: scale(0.94); }
.tb .ico { position: relative; z-index: 1; line-height: 1; text-align: center; }
.tb .ico small { display: block; font-size: 9px; margin-top: 2px; color: #cfe3ff; }
.tb .cd { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: rgba(0, 0, 0, 0.6); }
.tb.nomp .ico { opacity: 0.35; }
.tb.empty { opacity: 0.45; }
.tb-attack {
  right: 16px; bottom: 16px; width: 88px; height: 88px; font-size: 34px;
  border-color: var(--accent); box-shadow: 0 0 18px var(--accent), inset 0 0 18px rgba(255, 255, 255, 0.08);
}
.tb-skill { width: 58px; height: 58px; font-size: 24px; }
.tb-pot { width: 46px; height: 46px; font-size: 19px; }
.tb-pot b { position: absolute; right: 4px; bottom: 1px; font-size: 11px; text-shadow: 0 1px 2px #000; }
.tb-talk {
  right: calc(16px + var(--sar)); bottom: 204px; width: auto; height: 44px; padding: 0 16px; border-radius: 22px;
  font-size: 15px; font-weight: 700; color: #031022; background: linear-gradient(180deg, #7fe3ff, #26a8e0); border-color: #dff8ff;
  animation: talkpulse 1.2s ease-in-out infinite;
}
@keyframes talkpulse { 50% { transform: scale(1.06); box-shadow: 0 0 22px rgba(63, 208, 255, 0.8); } }

.ios-only { display: none; }
body.standalone [data-act="fullscreen"] { display: none; }   /* đã chạy như ứng dụng thì vốn toàn màn hình */
body.ios .ios-only { display: block; }

/* Gợi ý cài như ứng dụng (iPhone mở bằng Safari) */
#install-tip {
  position: fixed; z-index: 60; left: 50%; transform: translateX(-50%);
  top: calc(8px + env(safe-area-inset-top)); width: min(440px, calc(100vw - 24px)); padding: 10px 40px 10px 14px;
  background: rgba(8, 14, 32, 0.94); border: 1px solid var(--line-2); border-radius: 10px; box-shadow: var(--glow);
  font-size: 13px; line-height: 1.45;
}
#install-tip p { margin: 3px 0 0; color: var(--muted); }
#install-tip p b { color: var(--text); }
#install-close {
  position: absolute; right: 4px; top: 4px; width: 32px; height: 32px; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted); font-size: 15px;
}
.ios-share { width: 14px; height: 16px; vertical-align: -2px; color: var(--sys); }

body.touch #skillbar, body.touch #hint { display: none !important; }
body.touch .menu i, body.touch .sk .key { display: none; }
body.touch .menu button { width: 42px; height: 42px; }
body.touch #btn-full { display: block; }
body.touch #log { left: calc(195px + var(--sal)); bottom: auto; top: 124px; width: calc(var(--gw, 100vw) * 0.32); font-size: 11.5px; }
body.touch #hud-left { left: calc(10px + var(--sal)); }
body.touch #hud-right { right: calc(10px + var(--sar)); }
body.panel-open #touch, body.panel-open #tb-talk { display: none !important; }

/* Màn hình thấp (điện thoại xoay ngang) */
html.compact #hud-left { width: 220px; transform: scale(0.82); transform-origin: top left; }
html.compact #hud-char { padding: 6px 8px; }
html.compact #hud-right { transform: scale(0.82); transform-origin: top right; }
html.compact #quest-track { max-width: 220px; font-size: 11.5px; }
html.compact .panel-box { width: calc(var(--gw, 100vw) - 16px); max-height: calc(var(--gh, 100dvh) - 10px); }
html.compact .panel-head { padding: 6px 10px; }
html.compact #panel-close { width: 40px; height: 40px; font-size: 18px; }
html.compact #panel-body { padding: 10px; }
html.compact .inv { grid-template-columns: 124px 1fr 220px; gap: 10px; }
html.compact .inv { grid-template-columns: 108px minmax(0, 1fr) 176px; gap: 8px; }
html.compact .inv-detail { grid-column: auto; max-height: calc(var(--gh, 100vh) * .58); overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
html.compact .equip-grid { gap: 4px; }
html.compact .equip-grid .cell { font-size: 18px; }
html.compact .grid { grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); }
html.compact .btn { padding: 9px 14px; }
html.compact .btn.small { padding: 7px 11px; font-size: 13px; }
html.compact .li { padding: 6px 8px; }
html.compact .dialog .face { width: 48px; height: 48px; font-size: 28px; }
html.compact .detail { margin-top: 8px; }
html.compact #banner { font-size: 18px; top: 16%; }
html.narrow .inv, html.narrow .cols { grid-template-columns: 1fr; }   /* khung game hẹp (JS bật theo kích thước thật) */
/* Màn hẹp: cụm nút bên phải thu về một cột hẹp (nút một hàng, thanh hiệu ứng xuống hàng dưới),
   nên không đè lên thẻ nhân vật và khung nhiệm vụ. */
html.narrow .hud-row { max-width: 140px; }
html.narrow #quest-track { width: 140px; max-width: 140px; }
html.narrow #hud-left { width: calc(100vw - 160px); }
html.narrow #hud-right { max-width: calc(100vw - 20px); }

/* ================================================================
   Menu có tab, bảng kỹ năng, nhập mật mã, thêm ô kỹ năng
   ================================================================ */
.menu #btn-menu { width: 46px; height: 42px; font-size: 22px; }
.tabs { display: flex; gap: 6px; flex-wrap: nowrap; margin: -2px 0 12px; }
.tabs .tab { padding: 7px 12px; }
.tabs .tab.active { border-color: var(--sys); color: #fff; box-shadow: 0 0 12px rgba(63, 208, 255, 0.45); background: linear-gradient(180deg, rgba(63, 208, 255, 0.28), rgba(12, 20, 44, 0.85)); }
.tabcount { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--hp); color: #fff; font-size: 11px; line-height: 17px; text-align: center; margin-left: 2px; }

.skill-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; }
.sslot {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 64px; padding: 6px 4px;
  border-radius: 8px; border: 1px dashed var(--line-2); background: rgba(3, 7, 18, 0.55); text-align: center;
}
.sslot.ult { border-color: rgba(255, 204, 61, 0.7); }
/* Ô thứ 9 — kỹ năng do trang bị cấp: viền tím để phân biệt với ô học bằng sách */
.sslot.gear { border-color: rgba(179, 136, 255, 0.75); border-style: solid; }
.sslot.gear.filled { background: rgba(60, 40, 100, 0.35); }
.sslot .k { position: absolute; left: 5px; top: 2px; font-size: 10px; color: var(--muted); font-weight: 700; }
.sslot .ic { font-size: 22px; line-height: 1.1; }
.sslot small { font-size: 10.5px; line-height: 1.2; }
.sslot .x { position: absolute; right: 2px; top: 2px; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 5px; background: transparent; color: var(--muted); font-size: 11px; }
.sslot .x:hover { color: var(--bad); }
.skill-li { align-items: flex-start; }
.skill-li .main small { margin-top: 2px; }
.skill-li .lvl { font-size: 12px; color: var(--sys); margin-left: 4px; }
.skill-li.is-ult { border-color: rgba(255, 204, 61, 0.5); }
.skill-act { display: flex; flex-direction: column; align-items: flex-end; flex: none; }
.slotbtn { min-width: 30px; padding: 4px 7px !important; }
.slotbtn.on { border-color: var(--sys); color: var(--sys); opacity: 1 !important; }
.tag-ult { display: inline-block; padding: 0 6px; border-radius: 4px; font-size: 10px; font-weight: 700; color: #1a1200; background: var(--q4); vertical-align: 2px; }
.code-input {
  flex: 1; min-width: 150px; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line-2);
  background: rgba(3, 7, 18, 0.85); color: var(--text); outline: none; letter-spacing: 1px; text-transform: uppercase;
  -webkit-user-select: text; user-select: text;
}
.code-input:focus { border-color: var(--sys); box-shadow: 0 0 0 3px rgba(63, 208, 255, 0.15); }
.sk.sk-ult { border-color: rgba(255, 204, 61, 0.75); box-shadow: 0 0 12px rgba(255, 204, 61, 0.3); }

/* Cụm nút cảm ứng: bố cục vòng cung nằm ở khối body.touch #tbtns phía dưới (một nguồn duy nhất).
   Khối này chỉ giữ kích thước khung và các nút không dùng tới. */
#tbtns { width: 290px; height: 225px; }
.tb-attack { right: 16px; bottom: 16px; }
.tb-talk { bottom: 268px; }

/* Nhiệm vụ hằng ngày trên khung theo dõi */
.daily-track { margin-top: 6px; padding-top: 5px; border-top: 1px dashed var(--line); font-size: 11.5px; color: var(--muted); }
.daily-track .done { color: var(--ok); }

/* Bảng có tab: kích cỡ cố định, nội dung cuộn bên trong */
.panel-box.fixed { width: min(860px, calc(var(--gw, 100vw) - 20px)); height: min(640px, calc(var(--gh, 100vh) - 20px)); }
.panel-box.fixed #panel-body { flex: 1 1 auto; min-height: 0; }
html.compact .panel-box.fixed { width: calc(var(--gw, 100vw) - 16px); height: calc(var(--gh, 100dvh) - 10px); }

/* Cửa hàng: mỗi bộ trang bị gập/mở được */
.shop-set { margin: 6px 0; }
.shop-set > summary {
  cursor: pointer; padding: 7px 10px; border-radius: 7px; font-size: 12.5px; color: var(--muted);
  background: rgba(63, 208, 255, 0.05); border: 1px solid var(--line); list-style-position: inside;
}
.shop-set[open] > summary { color: var(--text); margin-bottom: 6px; }

/* Thanh thể lực (tách riêng với năng lượng) */
:root { --sta: #ffcf3f; }
.bar.sta { height: 9px; }
.bar.sta span { font-size: 8.5px; line-height: 8px; color: #2b2000; text-shadow: none; font-weight: 700; }
.bar.sta.locked span { color: #fff3c4; text-shadow: 0 1px 2px #000; }
.bar.sta > div { background: linear-gradient(90deg, #b8860b, var(--sta)); box-shadow: 0 0 8px rgba(255, 207, 63, 0.5); }
.bar.sta.locked > div { background: linear-gradient(90deg, #6b5a2a, #9c8a55); box-shadow: none; animation: sta-blink 0.6s ease-in-out infinite alternate; }
@keyframes sta-blink { to { opacity: 0.55; } }
.sk.nosta .ico, .tb.nosta .ico { opacity: 0.35; }
.sk.nosta, .tb.nosta { border-color: rgba(255, 202, 40, 0.55) !important; }

/* ================================================================
   Điện thoại nằm ngang (khung game thấp ≤ 500px, ví dụ iPhone 12 Pro Max 926×428):
   thu nhỏ HUD và nút bấm để nhìn thấy nhiều cảnh chơi hơn. Chỉnh --ui để to/nhỏ cả cụm.
   ================================================================ */
html.compact { --ui: 0.74; }
html.compact body.touch #hud-left { transform: scale(0.7); transform-origin: top left; }
html.compact body.touch #hud-right { transform: scale(0.72); }
html.compact body.touch #hud-left, html.compact body.touch #hud-right { top: 6px; }
html.compact body.touch #quest-track { max-width: 230px; font-size: 11px; }
html.compact body.touch #log { left: calc(185px + var(--sal)); top: 108px; width: calc(var(--gw, 100vw) * 0.3); font-size: 10.5px; gap: 1px; }
html.compact body.touch #log div:nth-last-child(n+5) { display: none; }   /* chỉ giữ 4 dòng nhật ký mới nhất */
html.compact body.touch #tbtns, html.compact body.touch #arrows, html.compact body.touch #tb-talk { zoom: var(--ui); }
html.compact body.touch #banner { font-size: 15px; }

/* Bùa nhân đôi kinh nghiệm đang có hiệu lực */
.hud-boost {
  margin-left: 8px; padding: 0 6px; border-radius: 4px; font-size: 10.5px; font-weight: 700; color: #2b2000;
  background: linear-gradient(90deg, #ffd54f, #ffb300); box-shadow: 0 0 8px rgba(255, 213, 79, 0.6);
}
/* Bảng chọn nơi đến của cổng */
.gate-dest.locked { opacity: 0.6; }
.gate-dest.locked .main small { color: #ffb74d; }

/* Toàn trang tắt chọn chữ (chạm giữ không bôi đen), nhưng ô nhập phải gõ/chọn được (iOS chặn gõ nếu thiếu dòng này) */
input, textarea { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }

/* Nút biến hình (thức tỉnh) */
.sk-form, .tb-form { border-color: var(--form, #ffd54f) !important; }
.sk-form .ico, .tb-form .ico { color: var(--form, #ffd54f); }
.sk-form.active, .tb-form.active {
  background: radial-gradient(circle at 50% 40%, var(--form, #ffd54f), rgba(6, 11, 26, 0.85) 75%);
  box-shadow: 0 0 18px var(--form, #ffd54f); animation: formpulse 0.7s ease-in-out infinite alternate;
}
.sk-form.active .ico, .tb-form.active .ico { color: #fff; }
@keyframes formpulse { to { box-shadow: 0 0 6px var(--form, #ffd54f); } }
.tb-form { width: 56px; height: 56px; }
.tb-career { width: 56px; height: 56px; border-color: #c7a2ff !important; color: #e4ceff; }
.tb-aws { width: 50px; height: 50px; border-color: #ffd54f !important; color: #fff3b0; }
.sk-aws { border-color: #ffd54f !important; color: #fff3b0; }
.sk-career { border-color: #c7a2ff !important; color: #e4ceff; }
.sk-career.active, .tb-career.active { box-shadow: 0 0 16px rgba(188, 140, 255, .75); background: linear-gradient(180deg, #7c4db5, #38244e); }

/* Hướng dẫn nhiệm vụ: nhận ở đâu / làm ở đâu / trả cho ai */
.quest-guide { margin: 6px 0 10px; padding: 7px 10px; border-radius: 8px; background: rgba(63, 208, 255, 0.05); border: 1px solid var(--line); font-size: 12.5px; }
.qg-row { display: grid; grid-template-columns: 20px 38px 1fr; gap: 4px; padding: 2px 0; color: var(--muted); }
.qg-row b { color: var(--text); font-weight: 600; }
.qg-row.on, .qg-row.on b { color: var(--sys); }

/* Thú triệu hồi */
.mount-li.locked { opacity: 0.55; }
.mount-li.on { border-color: var(--sys); }
.mount-li .ic { font-size: 26px; }
.pet-sheet { margin: 0 0 12px; padding: 10px; border: 1px solid rgba(92,242,165,.35); border-radius: 8px; background: rgba(92,242,165,.045); }
.pet-sheet > b, .pet-sheet > small { display: block; margin-bottom: 5px; }
.pet-sheet .pet-slot-title { margin-top: 10px; }
.pet-skills { flex-wrap: wrap; gap: 5px; margin: 6px 0; }
.pet-skills .btn { flex: 1 1 28%; min-width: 100px; }
.pet-skills .btn small { display: block; font-size: 9px; opacity: .75; }

/* ---------- Bố cục giao diện mới ---------- */
.screen {
  align-items: flex-end; justify-content: center;
  padding: 32px max(7vw, 36px);
  overflow: hidden;
  background:
    radial-gradient(circle at 31% 43%, rgba(226, 144, 76, .18), transparent 5%),
    radial-gradient(ellipse at 29% 46%, rgba(189, 85, 52, .22), transparent 36%),
    linear-gradient(110deg, rgba(10, 11, 15, .12) 0%, rgba(12, 11, 13, .3) 46%, #111013 64%),
    linear-gradient(180deg, #13141a, #1c1717 62%, #261b17);
}
.screen::before {
  content: ''; position: absolute; top: 50%; left: 30%; width: min(42vw, 590px); aspect-ratio: 1;
  transform: translate(-50%, -50%); border: 0; border-radius: 50%;
  background: radial-gradient(circle at 50% 48%, rgba(243,190,117,.92) 0 4%, rgba(211,132,75,.75) 5% 12%, rgba(177,86,57,.22) 35%, transparent 69%);
  box-shadow: none; animation: none; opacity: .74;
}
.screen::after {
  content: ''; position: absolute; left: 9%; top: 10%; width: 43%; height: 83%; opacity: .26; pointer-events: none;
  background:
    linear-gradient(#171316,#171316) 9% 25% / 82% 3% no-repeat,
    linear-gradient(#171316,#171316) 15% 32% / 70% 2% no-repeat,
    linear-gradient(#171316,#171316) 13% 27% / 5% 73% no-repeat,
    linear-gradient(#171316,#171316) 82% 27% / 5% 73% no-repeat,
    linear-gradient(105deg, transparent 48%, rgba(244,190,115,.34) 49%, transparent 50%) 50% 0 / 100% 100% no-repeat;
  filter: drop-shadow(0 12px 34px rgba(0,0,0,.45));
}
.login-box {
  z-index: 1; width: min(420px, 39vw); margin-right: 7%; padding: 34px 34px 28px; text-align: left;
  background: linear-gradient(145deg, rgba(31,29,30,.96), rgba(18,18,21,.92));
  border: 1px solid rgba(238,194,129,.2); border-radius: 22px;
  box-shadow: 0 28px 90px rgba(0,0,0,.46), inset 0 1px rgba(255,255,255,.06);
  backdrop-filter: blur(18px);
}
.login-box::before { content: 'THỨC TỈNH  /  HÀNH TRÌNH NINJA'; display: block; margin: 0 0 14px; color: #d6a96e; font-size: 10px; font-weight: 700; letter-spacing: 2.4px; }
.login-box h1 { margin: 8px 0 2px; font-size: clamp(34px, 4vw, 48px); line-height: 1.15; letter-spacing: 2px; text-shadow: none; }
.login-box .sub { margin: 8px 0 25px; max-width: 300px; color: #b4aaa0; line-height: 1.75; }
.login-box form { display: grid; gap: 11px; }
.login-box input { margin: 0; height: 48px; padding: 0 15px; background: rgba(9,9,11,.5); border-color: rgba(255,255,255,.12); }
.login-box .btn.big { margin-top: 5px; height: 50px; border-radius: 10px; }
.login-box .error, .login-box .note { margin-bottom: 0; }
.sys-tag { color: #e4b977; border: 0; background: transparent; padding: 0; letter-spacing: 2px; }
#loading { align-items: center; justify-content: center; }

/* HUD dạng dải trạng thái và bảng nhiệm vụ, để mở rộng tầm nhìn khu vực chơi */
#hud-left { left: 20px; top: 18px; width: 360px; gap: 8px; }
#hud-char {
  width: 100%; padding: 12px 14px 11px;
  display: grid; grid-template-columns: auto 1fr; column-gap: 12px; align-items: center;
  background: linear-gradient(120deg, rgba(21,20,22,.92), rgba(21,20,22,.72));
  border: 1px solid rgba(255,255,255,.13); border-radius: 14px; clip-path: none;
}
.hud-top { grid-row: 1 / span 3; margin: 0; gap: 10px; }
.hud-ava { width: 46px; height: 46px; border-width: 1px; }
.hud-name { font-size: 14px; }
.hud-school { margin-top: 2px; font-size: 10px; letter-spacing: .2px; }
#hud-char .bar { grid-column: 2; width: 100%; margin-top: 5px; height: 9px; }
#hud-char .bar.sta { height: 12px; }
#hud-char .bar.sta span { font-size: 9.5px; line-height: 11px; }
#hud-char .bar.exp { height: 4px; margin-top: 7px; }
#hud-char .bar span { font-size: 8px; line-height: 8px; }
.hud-gold { grid-column: 1 / -1; margin: 7px 0 0; padding-top: 7px; border-top: 1px solid rgba(255,255,255,.08); font-size: 11px; }
#hud-right { right: 20px; top: 18px; gap: 10px; }
.menu #btn-menu { width: 42px; height: 42px; font-size: 18px; }
#quest-track { margin-top: 5px; width: 236px; max-width: 236px; padding: 12px 14px; font-size: 11px; line-height: 1.65; }
#quest-track b { font-size: 11px; letter-spacing: .8px; }
#quest-track b::before { display: block; margin-bottom: 3px; font-size: 9px; }
#skillbar { bottom: 18px; gap: 5px; padding: 7px; border: 1px solid rgba(255,255,255,.14); border-radius: 15px; background: rgba(17,16,17,.78); }
.sk { width: 48px; height: 50px; border-radius: 11px; }
.sk .ico { font-size: 18px; }
#hint { bottom: 86px; }
#log { left: 20px; bottom: 88px; width: min(390px, calc(var(--gw, 100vw) * .38)); font-size: 11px; }
#hud-pet { width: 100%; }

/* Bảng nội dung như một lớp riêng trong game */
#panel { background: rgba(8,8,10,.76); backdrop-filter: blur(9px); }
.panel-box, .panel-box.fixed {
  width: min(940px, calc(var(--gw, 100vw) - 48px)); max-height: calc(var(--gh, 100vh) - 48px);
  border-radius: 18px; border: 1px solid rgba(255,255,255,.15);
  background: linear-gradient(145deg, rgba(33,31,32,.99), rgba(19,19,21,.99));
  box-shadow: 0 36px 100px rgba(0,0,0,.65), inset 0 1px rgba(255,255,255,.06);
}
.panel-head { padding: 15px 20px; }
.panel-head h2 { font-size: 18px; }
#panel-body { padding: 20px; }
.tabs { gap: 8px; margin-bottom: 16px; }
.tabs .tab { padding: 8px 14px; border-radius: 9px; }
.li { padding: 10px 12px; }
.cell { border-radius: 10px; }

@media (max-width: 760px) {
  .screen { align-items: center; padding: 18px; }
  .screen::before { left: 50%; top: 24%; width: 82vw; }
  .screen::after { left: 13%; top: 4%; width: 74%; height: 52%; opacity: .2; }
  .login-box { width: min(420px, 100%); margin: auto 0 3vh; padding: 26px 23px 22px; border-radius: 18px; }
  .login-box h1 { font-size: 34px; }
  #hud-left { left: 10px; top: 10px; width: 286px; }
  #hud-char { padding: 9px 10px; column-gap: 9px; }
  .hud-ava { width: 38px; height: 38px; }
  #hud-right { right: 10px; top: 10px; }
  #quest-track { width: min(206px, 45vw); max-width: 206px; padding: 8px 10px; font-size: 10px; }
  #hud-pet { width: 100%; }
  #skillbar { bottom: 8px; max-width: calc(100vw - 16px); }
  .sk { width: clamp(34px, 8.2vw, 46px); height: 44px; }
  #log { left: 10px; bottom: 64px; width: 45vw; font-size: 10px; }
  .panel-box, .panel-box.fixed { width: calc(var(--gw, 100vw) - 16px); max-height: calc(var(--gh, 100vh) - 16px); border-radius: 13px; }
  .panel-head { padding: 9px 12px; }
  #panel-body { padding: 12px; }
}

/* ---------- Chủ đề mới: mực đêm, son đỏ và đồng ---------- */
:root {
  --accent: #e9b96e;
  --sys: #e7b66b;
  --bg: #100f12;
  --line: rgba(231, 182, 107, .18);
  --line-2: rgba(231, 182, 107, .43);
  --text: #f3eee5;
  --muted: #aaa298;
  --gold: #f2c879;
  --glow: 0 0 0 1px var(--line), 0 12px 34px rgba(0, 0, 0, .28);
}
body { background: #100f12; }
.screen {
  background:
    radial-gradient(ellipse 42% 55% at 50% 42%, rgba(160, 65, 43, .18), transparent 72%),
    radial-gradient(ellipse 75% 55% at 50% 110%, rgba(194, 137, 67, .12), transparent 72%),
    linear-gradient(180deg, #111116 0%, #19171a 58%, #241a18 100%);
}
.screen::before {
  width: min(360px, 70vw); aspect-ratio: .72; border: 1px solid rgba(232, 185, 110, .36);
  box-shadow: 0 0 42px rgba(181, 87, 55, .16), inset 0 0 70px rgba(180, 101, 61, .12);
}
@keyframes gate { 50% { box-shadow: 0 0 60px rgba(181, 87, 55, .24), inset 0 0 90px rgba(180, 101, 61, .18); } }
.login-box {
  padding: 30px 28px 24px; background: linear-gradient(155deg, rgba(39, 34, 33, .96), rgba(21, 20, 22, .97));
  border-color: rgba(231, 182, 107, .4); border-radius: 16px; box-shadow: 0 24px 75px rgba(0,0,0,.46), inset 0 1px rgba(255,255,255,.045);
}
.login-box h1 { letter-spacing: 5px; text-shadow: 0 3px 24px rgba(196, 112, 66, .38); }
.sys-tag { border-radius: 999px; color: #f1c37a; background: rgba(231,182,107,.07); letter-spacing: 2px; }
.login-box input, .code-input { background: rgba(10, 10, 12, .62); border-color: rgba(255,255,255,.12); border-radius: 10px; }
.login-box input:focus, .code-input:focus { border-color: var(--sys); box-shadow: 0 0 0 3px rgba(231,182,107,.12); }
.btn { border-color: rgba(231,182,107,.3); background: linear-gradient(180deg, rgba(65,54,45,.8), rgba(35,31,30,.92)); }
.btn:hover:not(:disabled) { border-color: var(--sys); box-shadow: 0 5px 18px rgba(0,0,0,.24); }
.btn.primary {
  color: #251913; border-color: #f0ca85;
  background: linear-gradient(180deg, #f1d49b, #d7a45b); box-shadow: 0 7px 22px rgba(191,132,64,.2);
}
#hud-char, #hud-pet {
  background: linear-gradient(145deg, rgba(27,26,27,.92), rgba(18,17,19,.86));
  border-color: rgba(231,182,107,.32); border-radius: 12px; box-shadow: 0 10px 28px rgba(0,0,0,.24);
  backdrop-filter: blur(8px);
}
#hud-pet { border-color: rgba(118,190,139,.36); box-shadow: 0 10px 28px rgba(0,0,0,.24); }
.hud-ava { background: radial-gradient(circle at 50% 35%, rgba(231,182,107,.18), rgba(0,0,0,.5)); box-shadow: 0 0 12px color-mix(in srgb, var(--accent), transparent 76%); }
.rank { background: #211d1b; }
.bar { border-radius: 99px; background: rgba(0,0,0,.52); }
.bar > div { border-radius: inherit; }
.bar.exp { border: 0; }
#quest-track, #hint {
  color: #f0d09a; background: rgba(24,22,23,.88); border-color: rgba(231,182,107,.24);
  border-radius: 10px; box-shadow: 0 8px 22px rgba(0,0,0,.2); backdrop-filter: blur(8px);
}
#quest-track { border-left: 2px solid var(--sys); }
#quest-track b { color: #f0d09a; }
.menu button {
  background: linear-gradient(145deg, rgba(54,46,40,.94), rgba(28,26,27,.94));
  border-color: rgba(231,182,107,.4); border-radius: 12px; box-shadow: 0 7px 18px rgba(0,0,0,.26);
}
.menu button:hover { border-color: var(--sys); box-shadow: 0 0 16px rgba(231,182,107,.18); }
#log { text-shadow: 0 1px 3px #000, 0 0 8px #000; }
#log div { border-left-color: rgba(231,182,107,.7); }
#skillbar { gap: 8px; padding: 7px; border: 1px solid rgba(231,182,107,.19); border-radius: 15px; background: rgba(17,16,17,.72); box-shadow: 0 10px 32px rgba(0,0,0,.27); backdrop-filter: blur(8px); }
.sk {
  width: 52px; height: 52px; border-radius: 12px; background: linear-gradient(145deg, rgba(55,48,44,.96), rgba(27,25,26,.98));
  border-color: rgba(231,182,107,.32); box-shadow: inset 0 1px rgba(255,255,255,.055), 0 5px 12px rgba(0,0,0,.2);
}
.sk[data-k="atk"] { border-color: var(--accent); box-shadow: inset 0 0 18px rgba(231,182,107,.09), 0 0 12px rgba(231,182,107,.17); }
.sk .key { color: #c5b9a8; }
.sk.sk-ult { border-color: rgba(255,204,61,.65); box-shadow: inset 0 0 16px rgba(255,204,61,.08); }
#banner {
  background: linear-gradient(150deg, rgba(43,35,31,.96), rgba(23,21,22,.97)); border-color: rgba(231,182,107,.52);
  border-radius: 14px; box-shadow: 0 18px 50px rgba(0,0,0,.38); text-shadow: 0 2px 16px rgba(201,119,68,.5);
}
#banner::before { color: #efc77e; }
#panel { background: rgba(6,5,6,.68); backdrop-filter: blur(5px); }
.panel-box {
  background: linear-gradient(155deg, rgba(39,35,34,.985), rgba(23,22,23,.99));
  border-color: rgba(231,182,107,.4); border-radius: 16px; box-shadow: 0 28px 80px rgba(0,0,0,.58), inset 0 1px rgba(255,255,255,.045);
}
.panel-head { padding: 12px 16px; border-bottom-color: rgba(231,182,107,.17); }
.panel-head h2 { letter-spacing: .2px; }
.panel-head h2::before { content: '✦ '; color: var(--sys); }
#panel-close { border-color: rgba(255,255,255,.08); background: rgba(255,255,255,.035); }
#panel-close:hover { border-color: var(--line-2); background: rgba(231,182,107,.08); }
#panel-body { scrollbar-color: rgba(231,182,107,.35) transparent; }
.cell, .li, .school-card, .detail, .sslot, .quest-guide {
  background: linear-gradient(145deg, rgba(17,16,17,.72), rgba(27,25,25,.62)); border-color: rgba(231,182,107,.15); border-radius: 10px;
}
.cell.empty { background: rgba(10,10,11,.38); }
.cell.sel, .li.sel, .mount-li.on { outline-color: var(--sys); border-color: var(--sys); box-shadow: 0 0 14px rgba(231,182,107,.18); }
.school-card:hover { border-color: var(--sys); box-shadow: 0 8px 22px rgba(0,0,0,.24); }
.dialog .face { background: radial-gradient(circle at 50% 35%, rgba(231,182,107,.16), rgba(14,13,14,.85)); border-color: var(--line-2); }
.tabs .tab.active { background: linear-gradient(180deg, rgba(231,182,107,.18), rgba(35,30,28,.88)); box-shadow: inset 0 -2px var(--sys); }
.shop-set > summary { background: rgba(231,182,107,.045); }
#tooltip { background: rgba(28,26,27,.98); border-color: var(--line-2); box-shadow: 0 12px 30px rgba(0,0,0,.38); }
.tb { background: radial-gradient(circle at 50% 30%, rgba(84,66,51,.87), rgba(20,19,20,.88)); border-color: rgba(231,182,107,.4); box-shadow: 0 5px 16px rgba(0,0,0,.3); }
.tb-attack { border-color: var(--accent); box-shadow: 0 0 17px rgba(231,182,107,.28), inset 0 0 18px rgba(255,255,255,.08); }
.tb-talk { color: #251913; background: linear-gradient(180deg, #f1d49b, #d7a45b); border-color: #f1d49b; }
#install-tip { background: rgba(28,26,27,.96); border-color: var(--line-2); box-shadow: 0 12px 30px rgba(0,0,0,.35); }

/* Bảng gọn hơn trên điện thoại; phần mô tả vật phẩm có vùng cuộn riêng để túi đồ đứng yên. */
body.touch .panel-box { width: calc(var(--gw, 100vw) * .92); max-height: calc(var(--gh, 100dvh) * .88); }
body.touch .panel-box.fixed { width: calc(var(--gw, 100vw) * .92); height: calc(var(--gh, 100dvh) * .88); max-height: calc(var(--gh, 100dvh) * .88); }
body.touch #panel-body { min-height: 0; overscroll-behavior: contain; }
body.touch .inv-detail { max-height: calc(var(--gh, 100dvh) * .28); overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; -webkit-overflow-scrolling: touch; }
body.touch .inv-detail .detail { margin-top: 0; }
#tbtns { width: 290px; height: 225px; }
#tbtns .tb-attack { right: 0; bottom: 0; }
/* Các nút xếp vòng cung đồng tâm quanh nút đánh, đóng gói sát nhau: khe 6px, nút gần nhất chạm nút đánh,
   nút xa nhất cách tâm nút đánh 207px. Số dưới đây do .perch/tmp-arc-layout.js giải ra và đã kiểm tra
   không cặp nào đè nhau. Sửa vị trí thì chạy lại script đó, đừng sửa tay. */
#tbtns .tb-s0   { right: 93px;  bottom: 3px; }
#tbtns .tb-s1   { right: 76px;  bottom: 66px; }
#tbtns .tb-s2   { right: 18px;  bottom: 94px; }
#tbtns .tb-s3   { right: 157px; bottom: 0; }
#tbtns .tb-hp   { right: 157px; bottom: 66px; }
#tbtns .tb-mp   { right: 130px; bottom: 114px; }
#tbtns .tb-ult  { right: 72px;  bottom: 143px; }
#tbtns .tb-ult2 { right: 9px;   bottom: 159px; }
#tbtns .tb-s4   { right: 222px; bottom: 2px; }
#tbtns .tb-form { right: 218px; bottom: 63px; }
#tbtns .tb-aws  { right: 197px; bottom: 124px; }
/* Ô kỹ năng thứ 9 (do trang bị cấp): nhỏ hơn nút kỹ năng, đặt ở góc trống trên-trái của cụm.
   Kiểm tra không đè: aws kết thúc ở bottom 174, nút này bắt đầu 176; right 236 > ult2 (kết thúc 67). */
/* Nút chọn mục tiêu: khoảng trống phía trên nút mp (mp kết thúc ở bottom 160), liền trái nút aws (bắt đầu ở right 197). */
#tbtns .tb-target { right: 150px; bottom: 172px; width: 46px; height: 46px; border-color: #ffd54f !important; }
#tbtns .tb-gear { right: 236px; bottom: 176px; width: 46px; height: 46px; font-size: 19px; border-color: #b388ff !important; }
html.compact body.touch #quest-track { width: min(190px, calc(var(--gw, 100vw) * .25)); max-width: 190px; padding: 6px 9px; font-size: 10.5px; line-height: 1.35; }
.inv-wallet { margin: 0 0 8px; padding: 7px 10px; border: 1px solid rgba(231,182,107,.2); border-radius: 8px; color: var(--gold); font-size: 12px; font-weight: 700; }

@media (max-width: 600px) {
  .login-box { padding: 26px 22px 20px; }
  .login-box h1 { font-size: 33px; }
  #skillbar { gap: 5px; padding: 5px; border-radius: 12px; }
  .sk { width: 46px; height: 48px; border-radius: 10px; }
  .panel-box { border-radius: 13px; }
}

/* Túi đồ trên điện thoại nằm ngang (khung thấp): cả bảng không cuộn nữa; 3 cột trang bị / túi / chi tiết cao bằng
   phần còn lại của bảng và mỗi cột tự cuộn riêng → cột chi tiết dùng hết chiều cao, vuốt không bị lẫn với cuộn cả bảng. */
html.compact body.touch .panel-box.fixed {
  width: min(calc(var(--gw, 100vw) * .92), calc(var(--gw, 100vw) - 16px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)));
  height: calc(var(--gh, 100dvh) - 12px - env(safe-area-inset-bottom, 0px)); max-height: calc(var(--gh, 100dvh) - 12px - env(safe-area-inset-bottom, 0px));
}
html.compact #panel-body.inv-mode { display: flex; flex-direction: column; overflow: hidden; }
html.compact #panel-body.inv-mode > .tabs, html.compact #panel-body.inv-mode > .inv-wallet { flex: 0 0 auto; }
html.compact #panel-body.inv-mode > .inv-wallet { margin: 0 0 6px; padding: 5px 10px; }
html.compact #panel-body.inv-mode > .inv {
  flex: 1 1 auto; min-height: 0;
  grid-template-columns: 108px minmax(0, 1fr) minmax(230px, 38%); grid-template-rows: minmax(0, 1fr);
}
html.compact #panel-body.inv-mode > .inv > div {
  min-height: 0; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; -webkit-overflow-scrolling: touch;
}
html.compact #panel-body.inv-mode .inv-detail,
html.compact body.touch #panel-body.inv-mode .inv-detail { max-height: none; }

/* Nút đổi ấn: đặt cùng vòng ngoài với các nút phụ (bố cục chính ở khối body.touch #tbtns phía trên). */

/* Kỹ năng bị khóa theo hình thái (đang ở chức nghiệp 2 thì kỹ năng chức nghiệp 1 khóa, và ngược lại) */
.sk.formlock, .tb.formlock { filter: grayscale(1) brightness(.55); }
.sk.formlock .ico, .tb.formlock .ico { opacity: .45; }

/* Bản đồ thế giới (chỉ xem) */
.wm-scroll { overflow: auto; max-height: min(62vh, 560px); border-radius: 14px; box-shadow: 0 6px 20px rgba(0,0,0,.35); overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.wm-svg { display: block; max-width: none; border-radius: 14px; }
.wm-node { cursor: pointer; }
.wm-node:hover circle:first-of-type { filter: brightness(1.15); }
.wm-lbl { fill: #3b2610; font-weight: 700; paint-order: stroke; stroke: #f3e2b8; stroke-width: 3px; stroke-linejoin: round; pointer-events: none; }
.wm-node.locked .wm-lbl { fill: #6c6454; }
.wm-card { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: rgba(0,0,0,.28); border: 1px solid rgba(231,182,107,.35); }
.wm-title { font-size: 15px; margin-bottom: 6px; }
.wm-st { margin-left: 8px; font-size: 12px; opacity: .85; }
.wm-row { font-size: 13px; line-height: 1.5; } .wm-row span { display: inline-block; min-width: 56px; color: var(--muted); }
.wm-legend { margin-top: 8px; font-size: 12px; color: var(--muted); } .wm-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin: 0 4px 0 8px; vertical-align: -1px; }
.wm { width: min(840px, calc(var(--gw, 100vw) - 60px)); }

/* Icon vật phẩm vẽ bằng code */
img.ico { width: 1.3em; height: 1.3em; vertical-align: -0.3em; pointer-events: none; user-select: none; }
.cell img.ico { width: 78%; height: 78%; vertical-align: middle; }
.li .ic img.ico { width: 30px; height: 30px; }
h3 img.ico { width: 1.5em; height: 1.5em; vertical-align: -0.4em; }

/* ===== Cụm nút bên phải trên cảm ứng: kỹ năng xếp vòng cung quanh nút đánh =====
   Bố cục chi tiết nằm ở khối body.touch #tbtns phía trên (một nguồn duy nhất, tránh hai khối đè nhau).
   Nút nói chuyện nằm trên đỉnh cụm. */
body.touch .tb-talk { bottom: 300px; }


/* ================================================================
   GIAO DIỆN BẢNG MỚI — túi đồ, trang bị, kỹ năng, thú, nhiệm vụ, cấu hình
   Tông mực đêm + đồng son, giữ nguyên bảng màu --sys/--gold ở trên.
   ================================================================ */

/* ---------- Khung chung cho các bảng mới ---------- */
.panel-box.fixed #panel-body { display: flex; flex-direction: column; }
.panel-box.fixed #panel-body > .tabs { flex: 0 0 auto; }

/* Thanh tab: cuộn ngang được khi màn hình hẹp, không xuống dòng lộn xộn */
.tabs {
  display: flex; gap: 6px; flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden;
  padding-bottom: 4px; scrollbar-width: none; -ms-overflow-style: none;
  touch-action: pan-x; -webkit-overflow-scrolling: touch;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs .tab { flex: 0 0 auto; white-space: nowrap; }
.tabs .tab.active { font-weight: 700; }

/* ---------- TÚI ĐỒ ---------- */
.bag-wrap {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(250px, 34%); gap: 14px;
  align-items: start; min-height: 0;
}
.bag-main { min-width: 0; }
.bag-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.bag-wallet.wallet-ngoc { color: #b388ff; background: linear-gradient(180deg, rgba(179,136,255,.14), rgba(179,136,255,.04)); border-color: rgba(179,136,255,.35); }
.ngoc, .bag-side-head small.ngoc { color: #b388ff; }
.warn-line { margin: 0; color: #ff8a80; font-size: 12px; }
.bag-wallet {
  padding: 6px 12px; border-radius: 9px; font-size: 13px; color: var(--gold);
  background: linear-gradient(180deg, rgba(231,182,107,.13), rgba(231,182,107,.04));
  border: 1px solid rgba(231,182,107,.3);
}
.bag-wallet b { font-size: 15px; }
.bag-cap { flex: 1; min-width: 0; }
.bag-cap span { display: block; font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.bag-cap-track { height: 5px; border-radius: 99px; background: rgba(255,255,255,.08); overflow: hidden; }
.bag-cap-track i {
  display: block; height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, var(--sys), #f2c879);
  box-shadow: 0 0 8px rgba(231,182,107,.35); transition: width .2s;
}
.bag-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(54px, 1fr)); gap: 6px;
  align-content: start;
}
.bag-note { margin: 10px 0 0; font-size: 11.5px; }

/* Cột phải: chi tiết + nút chức năng */
.bag-side {
  display: flex; flex-direction: column; gap: 10px; min-height: 0;
  padding: 12px; border-radius: 12px;
  background: linear-gradient(160deg, rgba(20,19,20,.72), rgba(28,26,25,.6));
  border: 1px solid rgba(231,182,107,.18);
}
.bag-side-head { display: flex; gap: 10px; align-items: center; }
.bag-side-ic { font-size: 30px; line-height: 1; flex: none; }
.bag-side-head b { display: block; font-size: 14px; line-height: 1.25; }
.bag-side-head small { display: block; font-size: 11px; color: var(--muted); }
.bag-side-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.bag-side-info { font-size: 12.5px; line-height: 1.5; }
.bag-side-info h3 { font-size: 13.5px; margin: 0 0 4px; }
.bag-side-info .stats, .bag-side-info .affix, .bag-side-info .cmp, .bag-side-info .perf { font-size: 12px; }

/* Nút chức năng của vật phẩm */
.act-btn { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
.act-btn.wide { flex: 1 1 100%; justify-content: center; }
.act-btn.danger { border-color: rgba(255,110,100,.4); color: #ffb4ad; }
.act-btn.danger:hover:not(:disabled) { border-color: #ff8a80; box-shadow: 0 0 12px rgba(255,110,100,.25); }
.act-btn.danger.confirm {
  background: linear-gradient(180deg, rgba(190,60,50,.9), rgba(120,35,30,.95));
  border-color: #ff8a80; color: #fff;
}

.bag-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; padding: 26px 14px; text-align: center; min-height: 150px;
}
.bag-empty span { font-size: 34px; opacity: .5; }
.bag-empty b { font-size: 13.5px; }
.bag-empty small { font-size: 11.5px; color: var(--muted); line-height: 1.5; max-width: 220px; }

/* Khung chi tiết đầy đủ (mở bằng nút Xem chi tiết) */
.detail-modal {
  position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center;
  padding: 16px; background: rgba(4,3,4,.72); backdrop-filter: blur(4px);
}
.detail-modal-box {
  width: min(440px, 100%); max-height: 86%; overflow: auto;
  padding: 14px 16px; border-radius: 14px;
  background: linear-gradient(155deg, rgba(41,37,36,.99), rgba(23,22,23,.99));
  border: 1px solid rgba(231,182,107,.42); box-shadow: 0 26px 70px rgba(0,0,0,.6);
}
.detail-modal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.detail-modal-head b { flex: 1; font-size: 15px; }
.detail-modal-body { font-size: 13px; line-height: 1.55; }
.detail-modal-sub {
  font-size: 11.5px; color: var(--muted); margin-bottom: 8px; padding-bottom: 8px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.detail-modal-foot { margin-top: 12px; }
/* Hàng nút trong khung chi tiết: nút chính giãn hết hàng, nút phụ chia đôi hàng dưới */
.detail-modal-foot .act-btn { flex: 1 1 0; min-width: 0; }
.detail-modal-foot .act-btn.wide { flex: 1 0 100%; }
/* Bảng so sánh từng chỉ số với món đang mặc */
.cmp-block { margin-top: 10px; padding-top: 10px; border-top: 1px solid rgba(255,255,255,.07); }
.cmp-h { font-size: 12px; margin-bottom: 6px; }
.cmp-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.cmp-table th {
  text-align: right; font-weight: 500; color: var(--muted); font-size: 11px;
  padding: 3px 6px; border-bottom: 1px solid rgba(255,255,255,.08);
}
.cmp-table th:first-child, .cmp-table td:first-child { text-align: left; }
.cmp-table td { text-align: right; padding: 4px 6px; border-bottom: 1px solid rgba(255,255,255,.04); }
.cmp-table tr:last-child td { border-bottom: 0; }
.cmp-table td.up { color: #7fd48f; }
.cmp-table td.down { color: #e07a7a; }

/* ---------- TRANG BỊ ---------- */
.eq-wrap {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(180px, 1.15fr) minmax(0, 1fr);
  gap: 10px; align-items: start;
}
.eq-col { display: flex; flex-direction: column; gap: 7px; }
.eq-slot {
  display: flex; align-items: center; gap: 9px; padding: 7px 9px; border-radius: 10px;
  background: linear-gradient(145deg, rgba(17,16,17,.72), rgba(27,25,25,.6));
  border: 1px solid rgba(231,182,107,.15); cursor: pointer; min-height: 46px;
  transition: border-color .15s, box-shadow .15s, transform .12s;
}
.eq-slot:hover { border-color: rgba(231,182,107,.42); transform: translateY(-1px); }
.eq-slot.empty { border-style: dashed; opacity: .72; }
.eq-slot.sel { border-color: var(--sys); box-shadow: 0 0 14px rgba(231,182,107,.22); }
.eq-slot-ic { font-size: 21px; width: 26px; text-align: center; flex: none; }
.eq-slot-ic img.ico { width: 26px; height: 26px; }
.eq-slot-txt { min-width: 0; flex: 1; }
.eq-slot-txt b { display: block; font-size: 12.5px; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.eq-slot-txt small { display: block; font-size: 10.5px; color: var(--muted); }
/* Ô bên trái canh phải để sát nhân vật, ô bên phải canh trái */
.eq-col:first-child .eq-slot { flex-direction: row-reverse; text-align: right; }

/* Cột giữa: hình nhân vật */
.eq-center {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 10px 8px 12px; border-radius: 14px;
  background:
    radial-gradient(ellipse 70% 55% at 50% 38%, rgba(231,182,107,.12), transparent 72%),
    linear-gradient(180deg, rgba(24,22,22,.6), rgba(16,15,16,.8));
  border: 1px solid rgba(231,182,107,.22);
}
.eq-portrait {
  display: flex; align-items: flex-end; justify-content: center;
  width: 100%; height: 168px; overflow: hidden;
}
.eq-portrait img {
  max-height: 100%; max-width: 100%; object-fit: contain;
  image-rendering: auto; filter: drop-shadow(0 8px 16px rgba(0,0,0,.55));
}
.eq-portrait-ph { font-size: 62px; opacity: .45; }
.eq-id { text-align: center; }
.eq-id b { display: block; font-size: 14px; }
.eq-id small { display: block; font-size: 11px; color: var(--muted); }
.eq-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; width: 100%; }
.eq-stats > div {
  display: flex; align-items: center; gap: 5px; padding: 5px 7px; border-radius: 8px;
  background: rgba(0,0,0,.28); border: 1px solid rgba(231,182,107,.12); font-size: 11.5px;
}
.eq-stats span { font-size: 12px; }
.eq-stats b { font-size: 12px; color: #f6e6c8; }
.eq-stats small { color: var(--muted); font-size: 10px; margin-left: auto; }

/* Danh sách Kỳ Nguyên trong bảng Nhân vật */
.kn-list { display: flex; flex-direction: column; gap: 5px; }
.kn-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 9px;
  background: rgba(10,10,11,.4); border: 1px solid rgba(255,255,255,.07); }
.kn-row.on { border-color: rgba(179,136,255,.4); background: rgba(179,136,255,.08); }
.kn-row.locked { opacity: .55; }
.kn-ic { flex: 0 0 30px; display: flex; align-items: center; justify-content: center; }
.kn-ic img { width: 30px; height: 30px; }
.kn-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.kn-main b { font-size: 12.5px; }
.kn-main small { font-size: 10.5px; color: var(--muted); line-height: 1.3; }
.kn-side { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; font-size: 10.5px; }
.eq-detail {
  margin-top: 12px; padding: 11px 13px; border-radius: 11px; font-size: 12.5px;
  background: linear-gradient(160deg, rgba(20,19,20,.72), rgba(28,26,25,.6));
  border: 1px solid rgba(231,182,107,.18);
}
.eq-detail.muted { color: var(--muted); }
.eq-detail h3 { font-size: 13.5px; margin: 0 0 4px; }

/* ---------- NHÂN VẬT ---------- */
.ch-wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.ch-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.ch-head {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 13px;
  background: linear-gradient(150deg, rgba(231,182,107,.1), rgba(20,19,20,.7));
  border: 1px solid rgba(231,182,107,.28);
}
.ch-ava {
  width: 50px; height: 50px; flex: none; display: flex; align-items: center; justify-content: center;
  font-size: 26px; border-radius: 12px;
  background: radial-gradient(circle at 50% 35%, rgba(231,182,107,.2), rgba(0,0,0,.5));
  border: 1px solid rgba(231,182,107,.3);
}
.ch-id { flex: 1; min-width: 0; }
.ch-id > b { display: block; font-size: 16px; }
.ch-id > small { display: block; font-size: 11.5px; color: var(--muted); margin-bottom: 5px; }
.ch-exp { position: relative; height: 14px; border-radius: 99px; background: rgba(0,0,0,.5); overflow: hidden; }
.ch-exp i { display: block; height: 100%; background: linear-gradient(90deg, #d7a45b, #f1d49b); }
.ch-exp span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 9.5px; color: #fff; text-shadow: 0 1px 2px #000; }
.ch-lv { text-align: center; flex: none; }
.ch-lv small { display: block; font-size: 9.5px; color: var(--muted); }
.ch-lv b { font-size: 22px; color: var(--gold); line-height: 1; }

.ch-group { padding: 11px 13px; border-radius: 12px; background: linear-gradient(160deg, rgba(20,19,20,.68), rgba(28,26,25,.55)); border: 1px solid rgba(231,182,107,.15); }
.ch-group-h { font-size: 11px; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.ch-group-h b { color: var(--gold); font-size: 13px; }
.ch-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.ch-stat {
  display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 8px;
  background: rgba(0,0,0,.26); border: 1px solid rgba(255,255,255,.05); font-size: 12px;
}
.ch-stat span { font-size: 13px; }
.ch-stat small { color: var(--muted); font-size: 10.5px; }
.ch-stat b { margin-left: auto; color: #f6e6c8; }
.ch-points { display: flex; flex-direction: column; gap: 6px; }
.ch-point { display: flex; align-items: center; gap: 8px; padding: 7px 9px; border-radius: 9px; background: rgba(0,0,0,.24); border: 1px solid rgba(255,255,255,.05); }
.ch-point-ic { font-size: 16px; width: 20px; text-align: center; }
.ch-point-main { flex: 1; min-width: 0; }
.ch-point-main b { font-size: 12.5px; }
.ch-point-main b em { color: var(--gold); font-style: normal; margin-left: 3px; }
.ch-point-main small { display: block; font-size: 10.5px; color: var(--muted); }
.ch-point-btns { display: flex; gap: 4px; }
.ch-forms { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ch-form-state b { display: block; font-size: 13px; }
.ch-form-state small { font-size: 11px; color: var(--muted); }
.ch-desc { font-size: 11.5px; margin: 0; }

/* ---------- KỸ NĂNG ---------- */
.sk-wrap { display: flex; flex-direction: column; gap: 12px; }
.sk-head { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 13px;
  background: linear-gradient(150deg, rgba(231,182,107,.1), rgba(20,19,20,.7)); border: 1px solid rgba(231,182,107,.26); }
.sk-points { text-align: center; flex: none; padding-right: 12px; border-right: 1px solid rgba(231,182,107,.2); }
.sk-points small { display: block; font-size: 9.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.sk-points b { font-size: 22px; color: var(--gold); line-height: 1.1; }
.sk-head-info { min-width: 0; }
.sk-head-info b { display: block; font-size: 14px; }
.sk-head-info small { display: block; font-size: 11px; color: var(--muted); line-height: 1.45; }

.sk-bar-card { padding: 11px 13px; border-radius: 12px; background: linear-gradient(160deg, rgba(20,19,20,.7), rgba(28,26,25,.55)); border: 1px solid rgba(231,182,107,.16); }
.sk-bar-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.sk-bar-head > b { font-size: 12px; letter-spacing: .4px; text-transform: uppercase; color: var(--muted); }
.sk-bar-cap { margin-left: auto; font-size: 11px; color: var(--muted); }
.sk-bar-cap b { color: #f6e6c8; }
.skill-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 6px; }
.sslot {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1px; padding: 8px 4px 6px; min-height: 62px; border-radius: 10px;
  background: rgba(10,10,11,.5); border: 1px solid rgba(255,255,255,.08); text-align: center;
}
.sslot.filled { background: linear-gradient(160deg, rgba(231,182,107,.1), rgba(20,19,20,.7)); border-color: rgba(231,182,107,.3); }
.sslot.ult { border-color: rgba(255,204,61,.42); }
.sslot .k { position: absolute; left: 5px; top: 2px; font-size: 9.5px; color: var(--muted); font-weight: 700; }
.sslot .ic { font-size: 20px; line-height: 1.1; }
.sslot .ic.ph { opacity: .3; }
.sslot small { font-size: 9.5px; line-height: 1.2; }
.sslot .x { position: absolute; right: 2px; top: 1px; width: 18px; height: 18px; padding: 0; border: 0; border-radius: 5px; background: transparent; color: var(--muted); font-size: 10px; }
.sslot .x:hover { color: #ff8a80; background: rgba(255,110,100,.12); }

.sk-section-h { font-size: 11px; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); margin: 4px 0 8px; }
.sk-section-h small { text-transform: none; letter-spacing: 0; opacity: .8; margin-left: 4px; }
.sk-group { font-size: 11px; color: var(--sys); margin: 10px 0 6px; letter-spacing: .3px; }
.sk-none { font-size: 12px; }

.sk-card {
  display: flex; gap: 11px; align-items: flex-start; padding: 11px 12px; margin-bottom: 7px;
  border-radius: 12px; background: linear-gradient(160deg, rgba(20,19,20,.7), rgba(28,26,25,.55));
  border: 1px solid rgba(231,182,107,.15);
}
.sk-card.is-ult { border-color: rgba(255,204,61,.34); background: linear-gradient(160deg, rgba(255,204,61,.06), rgba(24,22,22,.6)); }
/* TUYỆT PHẨM: bậc trên tuyệt kỹ. Tím đỏ để khác hẳn màu vàng của tuyệt kỹ thường. */
.sk-card.is-superult { border-color: rgba(214,92,255,.5); background: linear-gradient(160deg, rgba(214,92,255,.1), rgba(28,14,30,.72)); box-shadow: 0 0 0 1px rgba(214,92,255,.14) inset; }
.tag-superult { font-size: 9px; padding: 1px 5px; border-radius: 4px; background: rgba(214,92,255,.18); color: #e6a8ff; border: 1px solid rgba(214,92,255,.5); letter-spacing: .5px; }
/* TUYỆT PHẨM là trụ riêng: cái giá hiện ngay cạnh hiệu ứng, không có pips / cấp / nút nâng. */
.sk-cost { margin-top: 5px; font-size: 11px; color: #ffab91; }
.sk-superult-meta { margin-top: 3px; font-size: 10px; color: #c9a2d6; }
.sk-section-superult .sk-section-h { color: #e6a8ff; }
.sk-card-ic {
  width: 40px; height: 40px; flex: none; display: flex; align-items: center; justify-content: center;
  font-size: 21px; border-radius: 10px; background: rgba(0,0,0,.32); border: 1px solid rgba(231,182,107,.2);
}
.sk-card-main { flex: 1; min-width: 0; }
.sk-card-title { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sk-card-title b { font-size: 13.5px; }
.sk-lv { font-size: 11px; color: var(--sys); }
.tag-ult { font-size: 9px; padding: 1px 5px; border-radius: 4px; background: rgba(255,204,61,.16); color: #ffcc3d; border: 1px solid rgba(255,204,61,.4); letter-spacing: .5px; }
.sk-pips { display: flex; gap: 2px; margin: 4px 0 5px; }
.sk-pips i { width: 12px; height: 3px; border-radius: 2px; background: rgba(255,255,255,.12); }
.sk-pips i.on { background: var(--sys); box-shadow: 0 0 5px rgba(231,182,107,.5); }
.sk-desc { display: block; font-size: 11.5px; color: var(--muted); line-height: 1.45; }
.sk-nums { display: flex; flex-wrap: wrap; gap: 8px; font-size: 11.5px; margin-top: 4px; }
.sk-nums > span:first-child { color: #f6e6c8; }
.sk-next { font-size: 11px; color: #8fd9a8; margin-top: 3px; }
.sk-milestone { font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.sk-milestone.on { color: #8fd9a8; }
.sk-card-act { display: flex; flex-direction: column; gap: 4px; align-items: stretch; flex: none; width: 96px; }
.sk-card-act .btn { width: 100%; }
.sk-max { font-size: 11px; text-align: center; }
.sk-slots { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 3px; }
.sk-slots .slotbtn { flex: 0 0 auto; width: 26px; padding: 2px 0; font-size: 10.5px; text-align: center; }
.sk-slots .slotbtn.on { border-color: var(--sys); color: var(--sys); opacity: .8; }
.sk-empty { text-align: center; padding: 18px 10px; }
.sk-empty > b { display: block; font-size: 15px; margin-bottom: 6px; }
.sk-empty .schools { margin-top: 14px; text-align: left; }

/* ---------- THÚ (đồng hành + triệu hồi) ---------- */
.pet-wrap { display: flex; flex-direction: column; gap: 11px; }
.pet-head { display: flex; align-items: center; gap: 11px; padding: 11px 13px; border-radius: 13px;
  background: linear-gradient(150deg, rgba(118,190,139,.12), rgba(20,19,20,.7)); border: 1px solid rgba(118,190,139,.3); }
.pet-head-ic { font-size: 24px; flex: none; }
.pet-head-txt { flex: 1; min-width: 0; }
.pet-head-txt b { display: block; font-size: 14px; }
.pet-head-txt small { display: block; font-size: 11px; color: var(--muted); line-height: 1.45; }
.pet-head-count { text-align: center; flex: none; padding-left: 11px; border-left: 1px solid rgba(118,190,139,.25); }
.pet-head-count b { display: block; font-size: 13px; color: #a8e6bd; }
.pet-head-count small { font-size: 9.5px; color: var(--muted); }
.pet-note { font-size: 11.5px; margin: 0; line-height: 1.5; }
.pet-list { display: flex; flex-direction: column; gap: 9px; }
.pet-card {
  padding: 11px 13px; border-radius: 12px; background: linear-gradient(160deg, rgba(20,19,20,.72), rgba(28,26,25,.55));
  border: 1px solid rgba(231,182,107,.15);
}
.pet-card.on { border-color: rgba(118,190,139,.5); box-shadow: 0 0 16px rgba(118,190,139,.12); }
.pet-card.locked { opacity: .62; }
.pet-card-top { display: flex; gap: 11px; align-items: flex-start; }
.pet-ava {
  width: 44px; height: 44px; flex: none; display: flex; align-items: center; justify-content: center;
  font-size: 23px; border-radius: 11px; background: radial-gradient(circle at 50% 35%, rgba(118,190,139,.18), rgba(0,0,0,.4));
  border: 1px solid rgba(118,190,139,.28);
}
.pet-id { flex: 1; min-width: 0; }
.pet-id > b { display: block; font-size: 13.5px; }
.pet-id > small { display: block; font-size: 11px; color: var(--muted); line-height: 1.4; }
.pet-lv { font-size: 11px; color: var(--sys); }
.pet-stats { display: flex; flex-wrap: wrap; gap: 8px; font-size: 11.5px; margin-top: 4px; color: #f6e6c8; }
.pet-card-act { flex: none; display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.pet-lock { font-size: 11px; color: var(--muted); white-space: nowrap; }
.pet-bars { display: flex; flex-direction: column; gap: 3px; margin-top: 8px; }
.pet-bar { display: flex; align-items: center; gap: 6px; font-size: 10.5px; }
.pet-bar span { width: 12px; text-align: center; }
.pet-bar i { flex: 1; height: 5px; border-radius: 99px; background: linear-gradient(90deg, #76be8b, #a8e6bd); }
.pet-bar.hp i { background: linear-gradient(90deg, #b8503f, #e07a68); }
.pet-bar.mp i { background: linear-gradient(90deg, #3f7bb8, #68a8e0); }
.pet-bar.sta i { background: linear-gradient(90deg, #b89a3f, #e0cf68); }
.pet-bar b { min-width: 62px; text-align: right; color: var(--muted); font-weight: 500; }
.pet-skill-pick { margin-top: 8px; }
.pet-sub { font-size: 10.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-bottom: 4px; }
.pet-skills-line { font-size: 11.5px; margin-top: 7px; line-height: 1.6; }
.pet-gear { margin-top: 9px; padding: 9px 10px; border-radius: 10px; background: rgba(0,0,0,.24); border: 1px solid rgba(255,255,255,.07); }
.pet-gear-h { font-size: 10.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-bottom: 7px; }
.pet-gear-h small { text-transform: none; letter-spacing: 0; opacity: .75; }
.pet-gear-slot { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-top: 1px solid rgba(255,255,255,.05); }
.pet-gear-slot:first-of-type { border-top: 0; }
.pet-gear-ic { font-size: 15px; width: 20px; text-align: center; flex: none; }
.pet-gear-main { flex: 1; min-width: 0; }
.pet-gear-main small { display: block; font-size: 10px; color: var(--muted); }
.pet-gear-main b { font-size: 12px; }
.pet-gear-btns { gap: 4px; margin-top: 3px; }

/* ---------- NHIỆM VỤ ---------- */
.q-wrap { display: flex; flex-direction: column; gap: 10px; }
.q-card { padding: 12px 14px; border-radius: 12px; background: linear-gradient(160deg, rgba(20,19,20,.7), rgba(28,26,25,.55)); border: 1px solid rgba(231,182,107,.15); }
.q-card.q-main { border-color: rgba(231,182,107,.32); background: linear-gradient(160deg, rgba(231,182,107,.07), rgba(22,21,21,.72)); }
.q-card-h { display: flex; align-items: center; gap: 8px; font-size: 14.5px; font-weight: 700; color: #fff; margin-bottom: 9px; }
.q-state { margin-left: auto; font-size: 10px; font-weight: 600; padding: 2px 8px; border-radius: 99px; letter-spacing: .3px;
  background: rgba(255,255,255,.07); color: var(--muted); border: 1px solid rgba(255,255,255,.1); }
.q-state.active { color: #f2c879; border-color: rgba(242,200,121,.4); background: rgba(242,200,121,.1); }
.q-state.ready { color: #8fd9a8; border-color: rgba(143,217,168,.4); background: rgba(143,217,168,.1); }
.q-section-h { font-size: 11px; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); margin-bottom: 7px; }
.q-section-h small { text-transform: none; letter-spacing: 0; opacity: .8; margin-left: 4px; }
.q-lines p { font-size: 12px; margin: 0 0 4px; line-height: 1.5; }
.q-objs { margin: 9px 0; display: flex; flex-direction: column; gap: 3px; }
.q-obj { font-size: 12.5px; }
.q-obj.ok { color: #8fd9a8; }
.q-req { font-size: 12px; margin: 6px 0; }
.q-req.ok { color: #8fd9a8; } .q-req.bad { color: #ff8a80; }
.q-reward { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 11.5px; margin-top: 9px; padding-top: 9px; border-top: 1px solid rgba(231,182,107,.14); }
.q-reward > b { font-size: 10.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); width: 100%; }
.q-reward span { padding: 2px 8px; border-radius: 6px; background: rgba(0,0,0,.3); border: 1px solid rgba(255,255,255,.06); }
.q-daily { font-size: 12px; padding: 4px 0; border-bottom: 1px solid rgba(255,255,255,.04); }
.q-daily:last-child { border-bottom: 0; }
.q-daily b { color: #f6e6c8; }
.q-daily.done { color: #8fd9a8; }
.q-daily.ok b { color: #8fd9a8; }
.q-done { font-size: 12px; color: #8fd9a8; padding: 2px 0; }

/* Hướng dẫn nhận/làm/trả */
.quest-guide { display: flex; flex-direction: column; gap: 4px; padding: 9px 11px; border-radius: 10px; background: rgba(0,0,0,.26); border: 1px solid rgba(231,182,107,.14); }
.qg-row { display: flex; align-items: baseline; gap: 7px; font-size: 12px; color: var(--muted); }
.qg-row.on { color: var(--text); }
.qg-ic { width: 16px; text-align: center; flex: none; }
.qg-row b { flex: none; min-width: 34px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--sys); }
.qg-txt { flex: 1; min-width: 0; }

/* ---------- KHO ---------- */
.st-wrap { display: flex; flex-direction: column; gap: 11px; }
.st-head { display: flex; align-items: center; gap: 11px; padding: 11px 13px; border-radius: 13px;
  background: linear-gradient(150deg, rgba(231,182,107,.09), rgba(20,19,20,.7)); border: 1px solid rgba(231,182,107,.24); }
.st-head-ic { font-size: 22px; }
.st-head-txt b { display: block; font-size: 14px; }
.st-head-txt small { display: block; font-size: 11px; color: var(--muted); line-height: 1.45; }
.st-warn { font-size: 12px; color: #ffb74d; margin: 0; }
.st-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.st-col { min-width: 0; }
.st-col-h { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; margin-bottom: 7px; }
.st-cap { flex: 1; }
.st-cap span { display: block; font-size: 10px; color: var(--muted); font-weight: 400; }
.st-cap i { display: block; height: 3px; border-radius: 99px; background: var(--sys); margin-top: 2px; }

/* ---------- HỘI NHÓM (tab trong bảng) ---------- */
.pg-wrap { display: flex; flex-direction: column; gap: 10px; }
.pg-head { display: flex; align-items: baseline; gap: 8px; font-size: 13px; padding-bottom: 6px; border-bottom: 1px solid rgba(231,182,107,.16); }
.pg-head small { color: var(--muted); font-size: 11px; }
.pg-list { display: flex; flex-direction: column; gap: 6px; }
.pg-row {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 10px;
  background: linear-gradient(145deg, rgba(17,16,17,.72), rgba(27,25,25,.62)); border: 1px solid rgba(231,182,107,.15);
}
.pg-name { flex: 1; min-width: 0; font-size: 13px; display: flex; flex-direction: column; }
.pg-name small { color: var(--muted); font-size: 11px; }
.pg-name b { color: var(--gold); }
.pg-hp { flex: none; width: 84px; height: 5px; border-radius: 99px; background: rgba(0,0,0,.55); overflow: hidden; }
.pg-hp i { display: block; height: 100%; background: var(--hp); border-radius: 99px; }
.pg-btns { flex: none; display: flex; gap: 5px; }
.pg-empty { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 22px 14px; text-align: center; border-radius: 12px; background: rgba(10,10,11,.4); border: 1px dashed rgba(231,182,107,.22); }
.pg-empty span { font-size: 26px; }
.pg-empty b { font-size: 13.5px; }
.pg-empty small { color: var(--muted); font-size: 11.5px; max-width: 300px; }

/* ---------- CẤU HÌNH ---------- */
.cfg-wrap { display: flex; flex-direction: column; gap: 11px; }
.cfg-card { padding: 12px 14px; border-radius: 12px; background: linear-gradient(160deg, rgba(20,19,20,.7), rgba(28,26,25,.55)); border: 1px solid rgba(231,182,107,.15); }
.cfg-card-h { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 9px; padding-bottom: 8px; border-bottom: 1px solid rgba(231,182,107,.14); }
.cfg-card-h span { font-size: 15px; }
.cfg-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,.04); }
.cfg-row:last-child { border-bottom: 0; padding-bottom: 0; }
.cfg-lbl { flex: 1; min-width: 0; }
.cfg-lbl b { display: block; font-size: 12.5px; }
.cfg-lbl small { display: block; font-size: 10.5px; color: var(--muted); }
.cfg-ctl { flex: none; display: flex; align-items: center; gap: 8px; }
.cfg-val { font-size: 12px; color: #f6e6c8; }
.cfg-switch {
  display: flex; align-items: center; gap: 7px; padding: 4px 10px 4px 4px; border-radius: 99px;
  background: rgba(0,0,0,.4); border: 1px solid rgba(255,255,255,.12); color: var(--muted);
  font-size: 11.5px; cursor: pointer; transition: border-color .15s, background .15s;
}
.cfg-switch i { width: 26px; height: 16px; border-radius: 99px; background: rgba(255,255,255,.14); position: relative; transition: background .18s; }
.cfg-switch i::after {
  content: ''; position: absolute; left: 2px; top: 2px; width: 12px; height: 12px; border-radius: 50%;
  background: #cfc7bb; transition: transform .18s, background .18s;
}
.cfg-switch.on { border-color: rgba(143,217,168,.5); color: #a8e6bd; background: rgba(143,217,168,.1); }
.cfg-switch.on i { background: rgba(143,217,168,.45); }
.cfg-switch.on i::after { transform: translateX(10px); background: #eafff1; }
.cfg-slider { display: flex; align-items: center; gap: 8px; }
.cfg-slider input[type=range] {
  -webkit-appearance: none; appearance: none; width: 126px; height: 4px; border-radius: 99px;
  background: linear-gradient(90deg, var(--sys), rgba(255,255,255,.12)); outline: none; cursor: pointer;
}
.cfg-slider input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: #f1d49b;
  border: 1px solid #8a6a3d; box-shadow: 0 1px 5px rgba(0,0,0,.5); cursor: pointer;
}
.cfg-slider input[type=range]::-moz-range-thumb {
  width: 13px; height: 13px; border-radius: 50%; background: #f1d49b; border: 1px solid #8a6a3d; cursor: pointer;
}
.cfg-slider b { font-size: 11.5px; color: #f6e6c8; min-width: 34px; text-align: right; }
.cfg-slider.off { opacity: .4; }
.cfg-seg { display: flex; gap: 3px; padding: 3px; border-radius: 9px; background: rgba(0,0,0,.36); border: 1px solid rgba(255,255,255,.08); }
.cfg-seg-btn {
  padding: 5px 10px; border: 0; border-radius: 7px; background: transparent; color: var(--muted);
  font-size: 11.5px; cursor: pointer; white-space: nowrap; transition: background .15s, color .15s;
}
.cfg-seg-btn:hover { color: var(--text); }
.cfg-seg-btn.on { background: linear-gradient(180deg, #f1d49b, #d7a45b); color: #251913; font-weight: 700; }

/* ---------- Khung hẹp / khung thấp ----------
   Trên điện thoại khung game bị xoay 90° nên bề rộng thật là --gw, không phải bề rộng màn hình.
   Vì vậy dùng lớp html.narrow (khung ≤ 600) và html.compact (khung cao ≤ 500) thay cho media query. */
html.narrow .bag-wrap { grid-template-columns: minmax(0, 1fr); }
html.narrow .bag-side { order: -1; }
html.narrow .bag-empty { min-height: 0; padding: 14px 10px; }
html.narrow .bag-grid { grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); }
html.narrow .eq-wrap { grid-template-columns: minmax(0, 1fr) minmax(150px, 1fr) minmax(0, 1fr); gap: 6px; }
html.narrow .eq-slot { padding: 5px 6px; min-height: 40px; }
/* Tên đồ được xuống dòng thay vì cắt cụt ("Kiếm l…" thì vô nghĩa) */
html.narrow .eq-slot-txt b {
  font-size: 10.5px; white-space: normal; overflow: hidden; line-height: 1.2;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
html.narrow .eq-slot-txt small { display: none; }
html.narrow .eq-slot-ic { font-size: 18px; width: 20px; }
html.narrow .eq-slot-ic img.ico { width: 20px; height: 20px; }
html.narrow .eq-portrait { height: 130px; }
html.narrow .eq-stats { grid-template-columns: 1fr; }
html.narrow .ch-wrap { grid-template-columns: minmax(0, 1fr); }
html.narrow .st-cols { grid-template-columns: minmax(0, 1fr); }
html.narrow .sk-card { flex-wrap: wrap; }
html.narrow .sk-card-act { width: 100%; flex-direction: row; align-items: center; }
html.narrow .sk-card-act .btn { width: auto; flex: 1; }
html.narrow .sk-slots { flex: 1; }
html.narrow .cfg-row { flex-wrap: wrap; }
html.narrow .cfg-ctl { width: 100%; justify-content: flex-end; }
html.narrow .cfg-slider input[type=range] { flex: 1; width: auto; }

/* Khung thấp (điện thoại nằm ngang / xoay): thu nhỏ hình và khoảng đệm để bảng vẫn vừa */
html.compact .eq-portrait { height: 118px; }
html.compact .eq-slot { min-height: 40px; }
html.compact .panel-box.fixed #panel-body { padding: 12px; }
html.compact .sk-card { padding: 9px 10px; }
html.compact .pet-card { padding: 9px 11px; }
html.compact .q-card, html.compact .cfg-card, html.compact .ch-group { padding: 9px 11px; }
/* Khung thấp: để cả thân bảng cuộn như một khối. Trước đây cho từng khối tự cuộn, nhưng các phần
   nằm ngoài khối đó (hàng ô trống, khung chi tiết) bị cắt mất mà không cuộn tới được. */
html.compact #panel-body { overflow-y: auto; overscroll-behavior: contain; }
html.compact #panel-body > .bag-wrap,
html.compact #panel-body > .eq-wrap,
html.compact #panel-body > .ch-wrap,
html.compact #panel-body > .sk-wrap,
html.compact #panel-body > .pet-wrap,
html.compact #panel-body > .q-wrap,
html.compact #panel-body > .st-wrap,
html.compact #panel-body > .cfg-wrap { flex: 0 0 auto; min-height: 0; overflow: visible; }

/* Khung thấp (điện thoại xoay ngang): túi đồ chia hai cột, mỗi cột tự cuộn */
html.compact body.touch #panel-body.inv-mode { display: flex; flex-direction: column; overflow: hidden; }
html.compact body.touch #panel-body.inv-mode > .tabs { flex: 0 0 auto; }
html.compact body.touch #panel-body.inv-mode > .bag-wrap {
  flex: 1 1 auto; min-height: 0;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 40%); grid-template-rows: minmax(0, 1fr);
}
html.compact body.touch #panel-body.inv-mode > .bag-wrap > div {
  min-height: 0; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; -webkit-overflow-scrolling: touch;
}
html.compact body.touch #panel-body.inv-mode .bag-side { order: 0; }


/* ---------- CỬA HÀNG dạng ô (hai tab Mua / Bán) ---------- */
.cell.dim { opacity: .45; }
.cell.dim.sel { opacity: .8; }
.shop-groups { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.shop-groups .btn small { color: inherit; opacity: .7; font-size: 10.5px; }
.shop-qty {
  flex: 1 1 100%; display: flex; flex-direction: column; gap: 6px;
  padding: 8px; border-radius: 9px; background: rgba(255,255,255,.035); border: 1px solid rgba(255,255,255,.07);
}
.shop-qty-row { display: flex; align-items: center; gap: 6px; }
.shop-qty-row input {
  width: 58px; text-align: center; padding: 5px 4px; border-radius: 7px;
  background: rgba(0,0,0,.35); border: 1px solid rgba(231,182,107,.3); color: var(--text); font: inherit;
}
.shop-qty-row input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.shop-qty-row .btn { min-width: 30px; justify-content: center; }
.shop-qty-total { margin-left: auto; font-size: 12px; white-space: nowrap; }
.bag-side-head small.gold { color: var(--gold); }

/* Sách kỹ năng: khối mô tả kỹ năng sẽ học */
.book-skill {
  margin-top: 8px; padding: 8px 10px; border-radius: 9px;
  background: rgba(79,195,247,.06); border: 1px solid rgba(79,195,247,.2);
}
.book-skill-h { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12.5px; margin-bottom: 3px; }
.book-skill-h .ic { font-size: 18px; line-height: 1; }
.book-skill .sk-desc { display: block; font-size: 11.5px; line-height: 1.45; }

/* Túi đồ / cửa hàng trên điện thoại (khung thấp): mỗi cột phải được GIỚI HẠN theo chiều cao khung thì mới tự cuộn được.
   Trước đây cột dùng align-items:start nên cao bằng nội dung, tràn ra ngoài khung overflow:hidden và không kéo được. */
html.compact body.touch #panel-body.inv-mode > .bag-wrap { align-items: stretch; }
html.compact body.touch #panel-body.inv-mode > .bag-wrap > div { max-height: 100%; -webkit-overflow-scrolling: touch; }
html.compact body.touch #panel-body.inv-mode > .bag-wrap > .bag-side { align-self: stretch; }

/* Chat (xem public/js/ui/chat.js) */
#chat-bar { position: absolute; left: 10px; bottom: 54px; width: min(360px, calc(var(--gw, 100vw) * 0.5)); display: flex; gap: 4px; z-index: 6; }
#chat-bar.hidden { display: none; }
#chat-bar button {
  flex: none; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line); background: rgba(6, 11, 26, 0.85);
  color: var(--sys); font-size: 12px; cursor: pointer;
}
#chat-input {
  flex: 1; min-width: 0; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--sys);
  background: rgba(6, 11, 26, 0.88); color: #fff; font-size: 13px; outline: none;
}
body.touch #chat-bar { left: calc(195px + var(--sal)); bottom: auto; top: 86px; width: calc(var(--gw, 100vw) * 0.34); }
body.touch #chat-input { font-size: 16px; }   /* 16px: iPhone không tự phóng to trang khi bấm vào ô nhập */
html.compact body.touch #chat-bar { left: calc(185px + var(--sal)); top: 66px; }

/* Đội nhóm, giao dịch, chợ (public/js/ui/social.js) */
#party-hud { position: absolute; left: 10px; top: 108px; width: 170px; display: flex; flex-direction: column; gap: 3px; z-index: 5; }
#party-hud.hidden { display: none; }
#party-hud .pm { background: rgba(6, 11, 26, 0.72); border: 1px solid var(--line); border-left: 3px solid var(--ok); border-radius: 6px; padding: 3px 6px; font-size: 11.5px; }
#party-hud .pm.off { opacity: 0.5; }
#party-hud .pm.dead .pn { text-decoration: line-through; }
#party-hud .pn i { font-style: normal; color: var(--muted); }
#party-hud .pn b { color: var(--gold); margin-right: 2px; }
#party-hud .pb { height: 4px; background: rgba(0, 0, 0, 0.6); border-radius: 2px; margin-top: 2px; }
#party-hud .pb i { display: block; height: 100%; background: var(--hp); border-radius: 2px; }
#social-toasts { position: absolute; left: 50%; top: 56px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; z-index: 25; width: min(92%, 460px); }
#social-toasts .toast { display: flex; gap: 6px; align-items: center; background: rgba(6, 11, 26, 0.94); border: 1px solid var(--line-2); border-radius: 10px; padding: 8px 10px; font-size: 13px; }
#social-toasts .toast span { flex: 1; }
.swin { position: absolute; inset: 0; z-index: 24; display: flex; align-items: center; justify-content: center; background: rgba(2, 4, 12, 0.5); padding: 8px; }
.swin.hidden { display: none; }
.sw-box { background: rgba(8, 14, 32, 0.97); border: 1px solid var(--line-2); border-radius: 12px; width: min(94vw, 380px); max-height: 92%; display: flex; flex-direction: column; overflow: hidden; }
.sw-box.wide { width: min(96vw, 640px); }
.sw-box.small { width: min(90vw, 300px); }
.sw-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.sw-head small { color: var(--muted); font-weight: 400; margin-left: 6px; }
.sw-head .x { background: none; border: 0; color: var(--muted); font-size: 16px; cursor: pointer; }
.sw-body { padding: 10px 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.sw-body .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.sw-body .note { color: var(--muted); font-size: 11.5px; margin: 0; }
.sw-body .btns { display: flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap; }
.tcols { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ts { border: 1px solid var(--line); border-radius: 8px; padding: 6px; }
.ts.locked { border-color: var(--ok); box-shadow: inset 0 0 12px rgba(92, 242, 165, 0.15); }
.th { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.tg { min-height: 56px; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); }
.tbag { max-height: 150px; overflow-y: auto; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); }
.tgold { margin-top: 6px; font-size: 12.5px; display: flex; align-items: center; gap: 4px; }
.tgold input { width: 100%; min-width: 0; padding: 4px 6px; border-radius: 6px; border: 1px solid var(--line); background: rgba(6, 11, 26, 0.9); color: #fff; }
/* Tab trong cửa sổ nổi (chợ, giao dịch): chia đều bề ngang. Chỉ áp cho .swin, không áp cho dải tab của bảng
   (bảng cần tab giữ nguyên bề ngang và lướt ngang được). */
.swin .tabs { display: flex; border-bottom: 1px solid var(--line); }
.swin .tabs button { flex: 1; padding: 8px; background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 13px; }
.swin .tabs button.on { color: var(--text); box-shadow: inset 0 -2px 0 var(--sys); }
.mfilter { display: flex; gap: 6px; flex-wrap: wrap; }
.mfilter input, .mfilter select { padding: 5px 8px; border-radius: 6px; border: 1px solid var(--line); background: rgba(6, 11, 26, 0.9); color: #fff; font-size: 12.5px; min-width: 0; flex: 1; }
.mlist { display: flex; flex-direction: column; gap: 5px; }
.mrow { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 8px; padding: 4px 6px; }
.mrow .cell { width: 44px; flex: none; }
.mrow .mi { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 13px; }
.mrow .mi small { color: var(--muted); font-size: 11px; }
.mrow .mp { font-size: 12.5px; white-space: nowrap; }
.gold { color: var(--gold); }
.sw-body .ok { color: var(--ok); } .sw-body .bad { color: var(--bad); }
body.touch #party-hud { left: calc(10px + var(--sal)); top: 92px; width: 150px; }
html.compact body.touch #party-hud { top: 70px; }
html.compact body.touch #party-hud .pm { padding: 2px 5px; font-size: 10.5px; }


/* Chọn khu (ui/khu.js): lưới 30 ô, mỗi ô ghi số người; ô xanh = còn chỗ, đỏ = đầy, viền sáng = khu đang đứng */
#khu-badge { font-size: 12px; font-weight: 700; color: var(--sys); padding: 0 6px; align-self: center; text-shadow: 0 1px 2px #000; }
.khu-box { width: min(96vw, 460px); }
.khu-top { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); background: rgba(6, 11, 26, 0.9); }
.khu-cur { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.khu-cur b { font-size: 17px; color: var(--sys); } .khu-cur small { font-size: 11px; color: var(--muted); }
.khu-quick { padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line-2); background: rgba(40, 70, 120, 0.5); color: var(--text); font-size: 12.5px; cursor: pointer; white-space: nowrap; }
.khu-quick:disabled { opacity: 0.45; cursor: not-allowed; }
/* Lưới 5 cột gọn: cả 30 khu hiện trong một vùng cuộn duy nhất (không có cuộn lồng nhau) */
.khu-list { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.khu-cell { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 46px; padding: 4px 6px; border-radius: 8px; border: 1px solid var(--line); background: rgba(6, 11, 26, 0.9); color: var(--text); cursor: pointer; font-size: 12.5px; }
.khu-cell b { font-size: 12.5px; }
.khu-bar { align-self: stretch; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.khu-bar i { display: block; height: 100%; background: var(--ok); }
.khu-n { font-size: 11px; color: var(--muted); }
.khu-cell.some { border-color: rgba(92, 242, 165, 0.5); }
.khu-cell.busy { border-color: rgba(255, 213, 79, 0.6); } .khu-cell.busy .khu-bar i { background: #ffd54f; }
.khu-cell.full { border-color: rgba(239, 83, 80, 0.6); opacity: 0.6; cursor: not-allowed; } .khu-cell.full .khu-bar i { background: #ef5350; }
.khu-cell.empty { border-color: rgba(100, 170, 255, 0.45); } .khu-cell.empty .khu-bar i { background: #64aaff; }
.khu-cell.cur { border-color: var(--sys); box-shadow: 0 0 10px rgba(63, 208, 255, 0.45); cursor: default; }
.khu-legend { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); flex-wrap: wrap; }
.khu-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-left: 6px; }
.khu-legend i.empty { background: #64aaff; } .khu-legend i.some { background: var(--ok); } .khu-legend i.busy { background: #ffd54f; } .khu-legend i.full { background: #ef5350; }
