/* ==========================================================================
   UI Võ Lâm 1: Nhân vật, Hành trang, Võ công (Chuẩn kích thước & Đầy đủ thao tác)
   ========================================================================== */

:root {
  --w2bg: rgba(20, 22, 18, 0.96);
  --w2ln: #7d7a62;
  --w2ln2: #3a392e;
  --w2tx: #e9e1c2;
  --w2gd: #ffd970;
  --w2cell: #0b0c0a;
}

/* Đảm bảo popup thông tin chi tiết (Kỹ năng, Trang bị, v.v...) LUÔN nổi lên trên cùng */
#modal {
  z-index: 9999 !important;
}

/* Tự động căn giữa và co giãn kích thước #panel vừa vặn hoàn hảo từng tab */
#panel:has(#t-char:not(.hidden)) {
  width: min(650px, 98vw) !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  top: 36px !important;
  max-height: calc(100vh - 84px) !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding-bottom: 24px !important;
}

#panel:has(#t-skill:not(.hidden)) {
  width: min(680px, 98vw) !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  top: 36px !important;
  max-height: calc(100vh - 84px) !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding-bottom: 24px !important;
}

#panel:has(#t-inv:not(.hidden)) {
  width: min(440px, 98vw) !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  top: 36px !important;
  max-height: calc(100vh - 84px) !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding-bottom: 24px !important;
}

/* Các thành phần tiêu đề & khung trong tab */
.u2h {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #e8d49a;
  font-weight: 600;
  margin: 8px 0 3px;
  padding: 2px 6px;
  background: linear-gradient(90deg, #3a3a2c, transparent);
  border-left: 2px solid #b9974f;
}
.u2h .sp, .u2foot .sp, .u2bh .sp { flex: 1; }

.u2box {
  border: 1px solid #4e4c3c;
  background: rgba(0, 0, 0, 0.55);
  padding: 5px 7px;
  margin-bottom: 4px;
}

.u2btns {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
  margin: 6px 0 0;
}

.gold { color: var(--w2gd); }

.u2tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--w2ln);
  margin: 0 0 6px;
  padding: 0;
}
.u2tabs button {
  flex: 0 0 auto;
  background: linear-gradient(#3b3d33, #202119) !important;
  border: 1px solid #6d6b55 !important;
  border-bottom: 0 !important;
  border-radius: 4px 4px 0 0 !important;
  color: #cfc8a8 !important;
  padding: 4px 14px !important;
  font-size: 12px;
  cursor: pointer;
}
.u2tabs button.on {
  background: linear-gradient(#6a6a52, #38382a) !important;
  color: var(--w2gd) !important;
  font-weight: 700;
}

/* ==========================================================================
   1. TAB NHÂN VẬT (CHARACTER)
   ========================================================================== */
.u2char {
  display: grid;
  grid-template-columns: 262px 1fr;
  gap: 12px;
}

.u2dollw {
  margin: 0 auto;
}

.u2nm {
  text-align: center;
  color: var(--w2gd);
  font-weight: 700;
  padding: 3px;
  background: linear-gradient(90deg, transparent, #3a3a2c, transparent);
  margin-bottom: 3px;
}

.u2doll {
  position: relative;
  width: 252px;
  height: 300px;
  margin: 0 auto;
  background: radial-gradient(ellipse at 50% 45%, #2b2d26, #0d0e0b 75%);
  border: 1px solid #5c5a45;
  box-shadow: inset 0 0 20px #000;
}

#u2doll {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.u2s {
  position: absolute;
  display: grid;
  place-items: center;
  border: 1px solid #5c5a45 !important;
  border-radius: 0 !important;
  background: rgba(11, 12, 10, 0.75) !important;
  box-shadow: inset 0 0 8px #000;
  font-size: 10px;
  color: #6f6c58;
  cursor: pointer !important;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.u2s:hover {
  border-color: #ffd24a !important;
  box-shadow: 0 0 6px rgba(255, 210, 74, 0.5) !important;
}

.u2s .it {
  width: 100% !important;
  height: 100% !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
}

.u2s .it img {
  max-width: 82% !important;
  max-height: 82% !important;
  object-fit: contain !important;
  image-rendering: pixelated !important;
  display: block !important;
  margin: auto !important;
  pointer-events: none !important;
}

.u2s span {
  text-align: center;
  line-height: 11px;
  pointer-events: none;
}

.u2a {
  display: grid;
  grid-template-columns: 1fr 50px 24px 24px;
  gap: 4px;
  align-items: center;
  padding: 2px 0;
}
.u2a b {
  text-align: right;
  color: var(--w2gd);
}
.u2a button {
  height: 20px;
  padding: 0;
  border: 1px solid #8b845f;
  background: linear-gradient(#5a4a26, #2e240e);
  color: #ffd970;
  border-radius: 2px;
  cursor: pointer;
}
.u2a button:disabled {
  opacity: 0.35;
  cursor: default;
}

.u2st {
  display: grid;
  grid-template-columns: auto 1fr auto 1fr;
  gap: 2px 8px;
  font-size: 11.5px;
}
.u2st span:nth-child(odd) {
  color: #b8b29a;
}
.u2st span:nth-child(even) {
  color: #fff;
  font-weight: 600;
}

.u2note {
  font-size: 11px;
  margin-top: 3px;
  color: #9fe3ff;
}

@media (max-width: 600px) {
  .u2char {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   2. TAB HÀNH TRANG (INVENTORY)
   ========================================================================== */
.u2bag {
  padding: 0 4px;
}

.u2bag .invgrid {
  display: grid !important;
  grid-template-columns: repeat(6, 40px) !important;
  gap: 2px !important;
  justify-content: center;
  background: #2b2a22;
  border: 1px solid #4e4c3c;
  padding: 3px;
  width: max-content;
  margin: 0 auto;
}

.u2bag .it {
  width: 40px !important;
  height: 40px !important;
  background: #0b0c0a;
  border: 1px solid #4e4c3c;
  border-radius: 0;
  box-shadow: inset 0 0 6px #000;
  position: relative;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: border-color 0.15s;
}
.u2bag .it:hover:not(.empty) {
  border-color: #ffd24a !important;
}

.u2bag .it.empty {
  display: block;
  cursor: default;
}
.u2bag .it.r1 { border-color: #6aa8ff; }
.u2bag .it.r2 { border-color: #ffd24a; }
.u2bag .it.r3 { border-color: #c77bff; }
.u2bag .it img {
  width: 30px;
  height: 30px;
  image-rendering: pixelated;
  pointer-events: none;
}
.u2bag .it i {
  position: absolute;
  right: 2px;
  bottom: 1px;
  font-size: 10px;
  color: #fff;
  text-shadow: 0 0 2px #000;
  pointer-events: none;
}

.u2bh {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  font-size: 12px;
  color: #e8d49a;
}

.u2money {
  display: grid;
  grid-template-columns: auto 1fr auto 1fr;
  gap: 3px 6px;
  margin-top: 8px;
  font-size: 12px;
  align-items: center;
}
.u2money b {
  background: #0b0c0a;
  border: 1px solid #4e4c3c;
  padding: 2px 6px;
  color: var(--w2gd);
  text-align: right;
  font-size: 11.5px;
}

/* ==========================================================================
   3. TAB VÕ CÔNG (SKILLS)
   ========================================================================== */
.u2kg {
  display: flex;
  justify-content: center;
  gap: 4px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 2px 8px;
  min-height: 250px;
}

.u2kc {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 58px;
  width: 58px;
  flex-shrink: 0;
}

.u2kh {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: #e8e0c0;
  background: linear-gradient(#2e4a44, #152824);
  border: 1px solid #4d6b62;
  padding: 3px 0;
}

.u2k {
  position: relative;
  width: 58px;
  height: 58px;
  border: 1px solid #4e4c3c;
  background: #0b0c0a;
  box-shadow: inset 0 0 6px #000;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.u2k:hover:not(.empty) {
  border-color: #ffd24a;
  box-shadow: 0 0 6px rgba(255, 210, 74, 0.4);
}

.u2k.empty {
  cursor: default;
  background: rgba(11, 12, 10, 0.35);
  border-color: #2b2a22;
}

.u2k img {
  width: 40px;
  height: 40px;
  image-rendering: pixelated;
  pointer-events: none;
}
.u2k.off img {
  filter: grayscale(1) brightness(0.5);
}
.u2k.lock img {
  opacity: 0.4;
  filter: grayscale(1) brightness(0.4);
}

.u2k.main {
  border-color: #ffd24a !important;
  box-shadow: inset 0 0 8px #a88420 !important;
}
.u2k.lockm {
  outline: 2px solid #ffd24a;
}

.u2k i {
  position: absolute;
  left: 3px;
  bottom: 1px;
  font: 11px var(--font);
  font-weight: 700;
  color: #fff;
  text-shadow: 0 0 2px #000, 0 0 2px #000;
  pointer-events: none;
}

/* NÚT CỘNG ĐIỂM KỸ NĂNG: Nổi bật, nút đỏ viền trắng, vùng bấm to rõ ràng */
.u2k .plus {
  position: absolute !important;
  right: 2px !important;
  bottom: 2px !important;
  width: 18px !important;
  height: 18px !important;
  padding: 0 !important;
  margin: 0 !important;
  line-height: 15px !important;
  font-size: 14px !important;
  font-weight: 900 !important;
  border: 1.5px solid #ffffff !important;
  border-image: none !important;
  background: #d32f2f !important;
  color: #ffffff !important;
  border-radius: 3px !important;
  cursor: pointer !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.9) !important;
  z-index: 10 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: transform 0.1s, background-color 0.1s;
}
.u2k .plus:hover {
  background: #ff3333 !important;
  transform: scale(1.15) !important;
}
.u2k .plus:active {
  transform: scale(0.95) !important;
}

.u2k .u2dt {
  position: absolute !important;
  right: 1px !important;
  top: 1px !important;
  border: 0 !important;
  background: none !important;
  font-size: 13px !important;
  padding: 0 !important;
  cursor: pointer !important;
  z-index: 10 !important;
}

.u2foot {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  border-top: 1px solid #4e4c3c;
  padding-top: 8px;
  font-size: 12px;
}
.u2pts {
  margin-left: 8px;
  font-size: 12px;
}
.u2pts b {
  color: #ff5555;
  font-size: 14px;
}

.u2tip {
  margin: 6px 0 0;
  font-size: 11px;
  color: #a8a088;
}
.plusd {
  background: #d32f2f;
  color: #fff;
  padding: 0 4px;
  border-radius: 2px;
  font-weight: bold;
}
