/* ======== Giao diện JX1 v2: Chat, Khung Hộp Thoại, Bảng Thông Báo, Thẻ Tab & Nút Bấm ========
   - Tối ưu giao diện Chat theo mẫu volamidle.pages.dev: chữ nét, độ tương phản cao, đổ bóng rõ ràng.
   - Bảng thông báo & hộp thoại: hoa văn rồng bạc trên và dưới (ornt2.png, ornb2.png), dải lụa tiêu đề (flor.png).
   - Thẻ dtabs phân trang: kiểu hoa văn đồng cổ điển JX1 kèm chấm đỏ thông báo (gdot).
*/

:root {
  --jxtxt: #0d1714;
  --jxglow: #9fe6d2;
}

/* ==================== 1. KHUNG HỘP THOẠI & BẢNG THÔNG BÁO (MBOX) ==================== */
#modal {
  background: rgba(0, 0, 0, 0.65) !important;
  backdrop-filter: blur(2px);
  z-index: 50 !important;
}

.mbox {
  position: relative !important;
  width: min(96%, 420px) !important;
  max-height: calc(100vh - 48px) !important;
  background: #252320 !important;
  border: 0 !important;
  border-image: none !important;
  border-radius: 2px !important;
  padding: 22px 12px 14px !important;
  box-shadow: 0 0 0 1px #000, 0 0 0 2px #797369, 0 0 0 4px #252320, 0 0 0 5px #000, 0 0 28px rgba(0,0,0,0.95) !important;
  color: #f2ecd0 !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
}

/* Hoa văn rồng bạc trên đỉnh hộp thoại */
.mbox::before {
  content: "" !important;
  position: absolute !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  top: -14px !important;
  width: min(90%, 360px) !important;
  height: 22px !important;
  background: url(jx1/ornt2.png) center bottom / contain no-repeat !important;
  pointer-events: none !important;
  z-index: 5 !important;
}

/* Hoa văn rồng bạc chạm khắc ở đáy hộp thoại */
.mbox::after {
  content: "" !important;
  position: sticky !important;
  display: block !important;
  bottom: -14px !important;
  height: 18px !important;
  margin: 10px auto -14px !important;
  width: min(85%, 320px) !important;
  background: url(jx1/ornb2.png) center top / contain no-repeat !important;
  pointer-events: none !important;
  z-index: 5 !important;
}

/* Nút đóng tròn kim loại góc trên bên phải */
.mx, #mClose {
  position: absolute !important;
  right: 6px !important;
  top: -12px !important;
  width: 24px !important;
  height: 24px !important;
  border-radius: 50% !important;
  border: 2px solid #c9c6b6 !important;
  background: radial-gradient(circle at 40% 35%, #6a6a66, #1d1d1b) !important;
  color: #fff !important;
  font-size: 13px !important;
  line-height: 20px !important;
  text-align: center !important;
  box-shadow: 0 0 6px #000 !important;
  cursor: pointer !important;
  z-index: 10 !important;
  padding: 0 !important;
  display: grid !important;
  place-items: center !important;
}
.mx::after, #mClose::after {
  content: "✕" !important;
  font-family: inherit !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  color: #f0f0f0 !important;
}
.mx:hover, #mClose:hover {
  filter: brightness(1.25) !important;
  border-color: #ffd76a !important;
}

/* Tiêu đề mục (h3) trong bảng thông báo */
.tab h3, .mbox h3 {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  background: url(jx1/flor.png) center / auto 100% repeat-x !important;
  margin: 6px 0 6px !important;
  padding: 5px 10px !important;
  border: 1px solid #000 !important;
  box-shadow: 0 0 0 1px #5a5850 !important;
  color: var(--jxtxt) !important;
  font-weight: 700 !important;
  font-size: 13.5px !important;
  text-shadow: 0 0 2px var(--jxglow), 0 0 2px var(--jxglow) !important;
  border-bottom: 1px solid #000 !important;
}
.mbox h3:first-child {
  margin-top: 0 !important;
}
.tab h3 small, .mbox h3 small {
  color: #1a2622 !important;
  text-shadow: 0 0 2px #cfe9df !important;
  font-weight: 500 !important;
  font-size: 11.5px !important;
}

/* Thanh phân trang Thẻ (dtabs) */
.dtabs {
  display: flex !important;
  gap: 0 !important;
  border: 1px solid #000 !important;
  box-shadow: 0 0 0 1px #5a5850 !important;
  background: #000 !important;
  margin: 6px 0 10px !important;
  overflow-x: auto !important;
}
.dtabs button {
  flex: 1 !important;
  min-width: fit-content !important;
  border: 0 !important;
  border-radius: 0 !important;
  padding: 6px 8px !important;
  margin: 0 !important;
  background: url(jx1/flor.png) center / auto 100% repeat-x !important;
  color: #e8f6e6 !important;
  font-weight: 700 !important;
  font-size: 12px !important;
  text-shadow: 0 0 2px #000, 0 0 2px #000, 0 1px 1px #000 !important;
  border-right: 1px solid #1d1d1a !important;
  filter: brightness(0.78) !important;
  cursor: pointer !important;
  white-space: nowrap !important;
}
.dtabs button:last-child {
  border-right: 0 !important;
}
.dtabs button:hover {
  filter: brightness(0.95) !important;
}
.dtabs button.on {
  filter: none !important;
  color: #fff8d8 !important;
  text-shadow: 0 0 3px #0b3a30, 0 0 2px #000, 0 0 1px #000 !important;
  box-shadow: inset 0 -2px 0 #e6c67a !important;
}

/* Chấm đỏ / huy hiệu thông báo */
.gdot {
  display: inline-block !important;
  min-width: 14px !important;
  height: 14px !important;
  padding: 0 3px !important;
  border-radius: 7px !important;
  background: #c4372a !important;
  color: #fff !important;
  font-size: 9.5px !important;
  line-height: 14px !important;
  font-weight: 600 !important;
  margin-left: 4px !important;
  vertical-align: middle !important;
  text-shadow: none !important;
  box-shadow: 0 0 2px #000 !important;
}

/* Card thông tin / nội dung bảng */
.card, .skl {
  background: #0b0b0a !important;
  border: 1px solid #000 !important;
  box-shadow: inset 0 0 0 1px #43413b, 0 0 0 1px #24231f !important;
  color: #e8ecd8 !important;
}

/* ==================== 2. GIAO DIỆN KÊNH CHAT & LOG THÔNG BÁO (CHUẨN HOÀI NIỆM) ==================== */
#chatBox {
  position: absolute;
  left: 8px;
  bottom: calc(94px * var(--hk, 1) + 6px);
  width: min(440px, 38vw);
  height: clamp(190px, 28vh, 280px);
  z-index: 25;
  display: flex;
  flex-direction: column;
  background: #040706d9;
  border: 1px solid #3a4540;
  border-radius: 3px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.7);
  pointer-events: auto;
  font-size: 12px;
  overflow: hidden;
  transition: height 0.15s ease, width 0.15s ease;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  box-sizing: border-box;
}

/* Thu gọn khung chat / log (chỉ giữ lại thanh tab) */
#chatBox.min {
  height: 28px !important;
  border-color: #2c3632;
}
#chatBox.min #chatLines,
#chatBox.min #chatIn {
  display: none !important;
}

/* Dải tab kênh chat/log (.pctabs) */
.pctabs {
  display: flex;
  gap: 2px;
  padding: 3px 4px;
  border-bottom: 1px solid #3a4540;
  background: #0b100ee6;
  flex-wrap: nowrap;
  align-items: center;
  overflow-x: auto;
  scrollbar-width: none;
  box-sizing: border-box;
  flex-shrink: 0;
  height: 28px;
}
.pctabs::-webkit-scrollbar {
  display: none;
}

.pctabs .cchan-btn {
  padding: 2px 6px;
  font-size: 11px;
  border: 1px solid #2c3632;
  border-radius: 2px;
  color: #8fa79a;
  background: #121815;
  cursor: pointer;
  white-space: nowrap;
  position: relative;
  font-family: inherit;
  line-height: 1.3;
  transition: all 0.12s ease;
}
.pctabs .cchan-btn:hover {
  color: #d1fbe6;
  border-color: #4a5c53;
}
.pctabs .cchan-btn.on {
  color: #fff3d0;
  background: linear-gradient(#6b5226, #3a2a10);
  border-color: #a8864a;
  font-weight: 700;
  text-shadow: 0 1px 1px #000;
}

/* Badge số tin nhắn mới trên tab Thế giới */
.pctabs .cbad {
  position: absolute;
  top: -4px;
  right: -5px;
  min-width: 14px;
  height: 14px;
  line-height: 14px;
  padding: 0 3px;
  border-radius: 7px;
  background: #e74c3c;
  color: #fff;
  font-size: 9px;
  font-style: normal;
  font-weight: bold;
  text-align: center;
  box-shadow: 0 0 3px #000;
  display: inline-block;
}
.pctabs .cbad:empty {
  display: none !important;
}

/* Nút ẩn/hiện khung chat (▾ / ▴) */
.chat-hide-btn {
  margin-left: auto;
  background: none;
  border: 0;
  color: #c8b99d;
  font-size: 13px;
  cursor: pointer;
  padding: 0 5px;
  line-height: 1;
  flex-shrink: 0;
}
.chat-hide-btn:hover {
  color: #ffd76a;
}

/* Khu vực hiển thị tin nhắn / log (#chatLines) */
#chatLines {
  flex: 1;
  overflow-y: auto;
  padding: 4px 7px;
  font-size: 12px;
  line-height: 1.45;
  scrollbar-width: thin;
  scrollbar-color: #5f7368 #0a0e0c;
  display: block;
  pointer-events: auto;
  margin: 0;
  max-height: none;
  -webkit-mask-image: none;
  mask-image: none;
}
#chatLines::-webkit-scrollbar {
  width: 5px;
}
#chatLines::-webkit-scrollbar-thumb {
  background: #5f7368;
  border-radius: 2px;
}
#chatLines::-webkit-scrollbar-track {
  background: #0a0e0c;
}

/* Định dạng màu các kênh log (chuẩn theo Hoài Niệm) */
#chatLines div, #logBox div {
  padding: 1px 0;
  word-break: break-word;
}
.c-loot {
  color: #cfe0ff !important;
}
.c-combat {
  color: #ffc9b0 !important;
}
.c-quest {
  color: #e6d39a !important;
}
.c-sys {
  color: #ffe08a !important;
}
.c-sys b {
  color: #ffb52e;
}
#chatLines time, #logBox time {
  margin-right: 5px;
  color: #7d8a83;
  font-size: 10.5px;
}

/* Định dạng tin nhắn chat người chơi */
#chatLines .cl {
  color: #f2ecd0;
  text-shadow: 0 1px 1px #000;
  line-height: 1.4;
  word-break: break-word;
  padding: 2px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.05);
}
#chatLines .cl i {
  font-style: normal;
  color: #7d8a83;
  font-size: 10.5px;
  margin-right: 4px;
}
#chatLines .cl b[data-pn] {
  cursor: pointer;
  text-decoration: underline dotted;
}
#chatLines .cl b[data-pn]:hover {
  text-decoration: underline;
  color: #fff;
}
#chatLines .cl.me b {
  color: #7fe0ff !important;
}
#chatLines .cl.sys {
  color: #ffe08a !important;
  font-style: italic;
}

/* Liên kết trang bị khoe trên kênh chat */
#chatLines a.chit {
  cursor: pointer;
  text-decoration: underline dotted;
  pointer-events: auto;
  font-weight: 600;
  padding: 0 2px;
}
#chatLines a.chit:hover {
  text-decoration: underline;
  filter: brightness(1.25);
}

/* Khung nhập tin nhắn chỉ hiện khi ở tab Thế giới (#chatIn) */
#chatIn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
  border-top: 1px solid #3a4540;
  background: #0b100ee6;
  box-sizing: border-box;
  flex-shrink: 0;
}
#chatTxt {
  flex: 1;
  min-width: 0;
  padding: 4px 7px;
  font-size: 12px;
  font-family: inherit;
  color: #f2ecd0;
  background: #030504;
  border: 1px solid #56665c;
  border-radius: 2px;
}
#chatTxt:focus {
  outline: none;
  border-color: #ffd76a;
}
#chatAtt {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  max-width: 38%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 11px;
  padding: 1px 4px;
  background: rgba(212, 163, 89, 0.2);
  border: 1px solid #8c7440;
  border-radius: 2px;
  color: #ffe08a;
}
#chatAtt:empty {
  display: none;
}
#chatAtt button {
  border: 0;
  background: none;
  color: #ff7875;
  cursor: pointer;
  padding: 0 2px;
  font-weight: 700;
}

/* Ẩn nút Chat nổi cũ vì đã có #chatBox tích hợp */
#chatBtn {
  display: none;
}

@media (max-width: 768px) {
  #chatBox {
    width: calc(100% - 16px);
    max-width: 440px;
    height: clamp(160px, 24vh, 220px);
  }
}

/* ==================== 3. BẢNG ĐIỂM DANH 7 NGÀY (LOGIN7 GRID) ==================== */
.days {
  display: flex !important;
  flex-wrap: nowrap !important;
  overflow-x: auto !important;
  gap: 6px !important;
  margin: 10px 0 !important;
  width: 100% !important;
  padding: 4px 2px 8px !important;
  box-sizing: border-box !important;
  scrollbar-width: thin;
}

.day {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: flex-start !important;
  flex: 0 0 85px !important;
  min-width: 85px !important;
  padding: 8px 4px !important;
  background: #181714 !important;
  border: 1px solid #454035 !important;
  box-shadow: inset 0 0 0 1px #000 !important;
  text-align: center !important;
  font-size: 11px !important;
  min-height: 125px !important;
  box-sizing: border-box !important;
  border-radius: 3px !important;
}

.day b {
  color: #ffd76a !important;
  font-size: 11px !important;
  margin-bottom: 6px !important;
  display: block !important;
  white-space: nowrap !important;
  border-bottom: 1px dashed #3a3528;
  padding-bottom: 3px;
  width: 100%;
}

.day small {
  color: #d6ccad !important;
  font-size: 10px !important;
  line-height: 1.35 !important;
  display: block !important;
  word-break: break-word !important;
  overflow-wrap: anywhere !important;
}

.day small img {
  height: 12px !important;
  vertical-align: -1px !important;
}

.day.cur {
  border-color: #ffd76a !important;
  box-shadow: inset 0 0 0 1px #ffd76a, 0 0 12px rgba(255, 215, 106, 0.4) !important;
  background: linear-gradient(180deg, #2a2518 0%, #15140e 100%) !important;
}

.day.got {
  opacity: 0.55 !important;
}

/* Nút nhận thưởng lớn */
#gLogin {
  width: 100% !important;
  height: 38px !important;
  font-size: 14px !important;
  font-weight: 700 !important;
  background: linear-gradient(#4b563b, #262c1e) !important;
  border: 1px solid #828c60 !important;
  color: #fff8d8 !important;
  text-shadow: 0 1px 2px #000 !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 2px 4px rgba(0,0,0,0.5) !important;
  cursor: pointer !important;
  border-radius: 2px !important;
}
#gLogin:hover:not(:disabled) {
  filter: brightness(1.2) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.3), 0 0 8px rgba(130,140,96,0.6) !important;
}
#gLogin:disabled {
  opacity: 0.6 !important;
  cursor: default !important;
}

/* Nút JX tiêu chuẩn */
.btn {
  border-radius: 2px !important;
  background: linear-gradient(#24463d, #13261f) !important;
  border: 1px solid #6f9c8b !important;
  color: #f3ecd2 !important;
  box-shadow: inset 0 0 0 1px #000;
  text-shadow: 0 1px 1px #000;
  font-weight: 600;
}
.btn:hover:not(:disabled) {
  filter: brightness(1.2);
}
.btn.on {
  background: linear-gradient(#5a4a22, #2a2110) !important;
  border-color: #e6c67a !important;
  color: #ffe9a8 !important;
}
.btn.red {
  background: linear-gradient(#5a1d16, #2a0c09) !important;
  border-color: #b55a48 !important;
  color: #ffe2dd !important;
}

/* ==================== 4. BẢNG NHIỆM VỤ, THÀNH TỰU & THÔNG BÁO ==================== */
.qrow {
  display: grid !important;
  grid-template-columns: 1fr auto auto !important;
  gap: 8px !important;
  align-items: center !important;
  padding: 6px 10px !important;
  margin: 4px 0 !important;
  border: 1px solid #000 !important;
  box-shadow: inset 0 0 0 1px #3a3934 !important;
  background: #111110 !important;
  border-radius: 2px !important;
}
.qrow:hover {
  background: #181816 !important;
  box-shadow: inset 0 0 0 1px #5a5850 !important;
}
.qrow b {
  color: #fff3c0 !important;
}
.qrow small {
  color: #a8a088 !important;
}

@media (orientation: landscape) {
  #chatBox {
    bottom: 52px;
  }
}

/* ==================== 5. HỆ THỐNG ĐỒ ĐỆ & TỔ ĐỘI 4 NHÂN VẬT ==================== */
.ptabs {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: 4px !important;
  margin: 4px 0 8px !important;
  padding: 4px 6px !important;
  background: rgba(0, 0, 0, 0.45) !important;
  border: 1px solid #4a3d24 !important;
  border-radius: 4px !important;
}
.ptabs button {
  position: relative !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 3px !important;
  padding: 3px 8px !important;
  font-size: 11px !important;
  line-height: 16px !important;
  background: #181510 !important;
  border: 1px solid #5a4a2a !important;
  color: #d4c498 !important;
  border-radius: 3px !important;
  cursor: pointer !important;
}
.ptabs button.on {
  background: linear-gradient(#5a4a22, #2a2110) !important;
  border-color: #ffd24a !important;
  color: #fff !important;
}
.ptabs button.ko {
  opacity: 0.55 !important;
}
.ptabs .pn {
  color: #ffd24a !important;
  font-weight: 700 !important;
}
.ptabs .pnm {
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  max-width: 90px !important;
}
.ptabs .pmain {
  margin-left: auto !important;
  background: linear-gradient(#4a3615, #221706) !important;
  border-color: #c8a45a !important;
  color: #ffe08a !important;
  font-weight: 700 !important;
}
.pctx {
  font-size: 12px !important;
  margin: -2px 0 6px !important;
  padding: 3px 8px !important;
  border-left: 3px solid currentColor !important;
  background: rgba(0, 0, 0, 0.4) !important;
  border-radius: 0 4px 4px 0 !important;
}
.pslots {
  display: flex !important;
  flex-direction: column !important;
  gap: 6px !important;
  margin: 8px 0 4px !important;
  padding: 8px !important;
  background: rgba(0, 0, 0, 0.45) !important;
  border: 1px solid #4a3d24 !important;
  border-radius: 4px !important;
}
.pslots .psl {
  position: relative !important;
  width: 36px !important;
  height: 36px !important;
  padding: 0 !important;
  border: 1px solid #6d6b55 !important;
  background: #1a1a14 !important;
  border-radius: 4px !important;
  cursor: pointer !important;
}
.pslots .psl.on {
  border-color: #ffd24a !important;
  box-shadow: 0 0 6px #ffd24a88 !important;
}
.pslots .psl img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  border-radius: 3px !important;
}
.pslots .psl u {
  position: absolute !important;
  right: 2px !important;
  bottom: 0 !important;
  font-size: 10px !important;
  text-decoration: none !important;
  color: #ffd24a !important;
  text-shadow: 0 0 2px #000 !important;
}
.pslpick {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 4px !important;
  width: 100% !important;
  padding: 6px !important;
  background: rgba(0, 0, 0, 0.6) !important;
  border-radius: 4px !important;
}
.pgive {
  display: flex !important;
  flex-direction: column !important;
  gap: 6px !important;
  margin: 8px 0 !important;
}
.pgv {
  text-align: left !important;
  padding: 8px !important;
  border: 1px solid #5a4828 !important;
  background: #1c1810 !important;
}
.pgv:hover:not(:disabled) {
  background: #2a2214 !important;
  border-color: #ffd24a !important;
}

