:root {
  --bg-dark: #0a0e17;
  --bg-card: rgba(16, 24, 40, 0.75);
  --bg-card-hover: rgba(23, 35, 60, 0.85);
  --border-cyan: rgba(0, 229, 255, 0.25);
  --border-gold: rgba(255, 215, 0, 0.35);
  --cyan-glow: #00e5ff;
  --gold-glow: #ffd700;
  --purple-glow: #c084fc;
  --emerald-glow: #00e676;
  --crimson-glow: #ff1744;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --font-heading: 'Space Grotesk', 'Plus Jakarta Sans', sans-serif;
  --font-body: 'Plus Jakarta Sans', system-ui, sans-serif;
  --kx-header-h: 48px;
  --kx-top-action-h: 50px;
  --kx-bottom-dock-h: 50px;
  --kx-view-pad: 12px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  height: 100dvh;
  max-height: 100dvh;
  width: 100%;
  max-width: 100vw;
  overflow: hidden !important;
  overflow-x: hidden !important;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-dark);
  color: var(--text-main);
  height: 100%;
  height: 100dvh;
  max-height: 100dvh;
  width: 100%;
  max-width: 100vw;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden !important;
  overflow-x: hidden !important;
  background-image: 
    radial-gradient(circle at 50% 10%, rgba(0, 229, 255, 0.08) 0%, transparent 60%),
    radial-gradient(circle at 80% 80%, rgba(192, 132, 252, 0.06) 0%, transparent 50%),
    radial-gradient(circle at 20% 90%, rgba(255, 215, 0, 0.05) 0%, transparent 50%);
}

#bg-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

/* Container - Viewport Fluid One View */
.kx-container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 16px;
  position: relative;
  z-index: 10;
  box-sizing: border-box;
}

/* =============================================================================
   CHẾ ĐỘ TRÌNH BÀY GIAO DIỆN THỐNG NHẤT (TABLET / MOBILE FRAMEWORK)
   PC sẽ trình bày tập trung như Tablet (max-width: 768px, căn giữa màn hình)
============================================================================= */
:root {
  --kx-app-max-w: 768px;
}

body.kx-fullscreen-mode main.kx-container,
main.kx-container:has(#kx-view-stack) {
  position: fixed !important;
  inset: 0 !important;
  top: 0 !important;
  bottom: 0 !important;
  left: 50% !important;
  right: auto !important;
  transform: translateX(-50%) !important;
  width: 100vw !important;
  max-width: var(--kx-app-max-w, 768px) !important;
  height: 100dvh !important;
  max-height: 100dvh !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  z-index: 10;
  display: block !important;
  border-left: 1px solid rgba(0, 229, 255, 0.16);
  border-right: 1px solid rgba(0, 229, 255, 0.16);
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.9), 0 0 25px rgba(0, 229, 255, 0.08);
  box-sizing: border-box;
}

@media (max-width: 768px) {
  body.kx-fullscreen-mode main.kx-container,
  main.kx-container:has(#kx-view-stack) {
    left: 0 !important;
    transform: none !important;
    width: 100% !important;
    max-width: 100% !important;
    border-left: none !important;
    border-right: none !important;
    box-shadow: none !important;
  }
}

main.kx-container {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  box-sizing: border-box;
  padding-top: calc(var(--kx-header-h, 50px) + 8px);
  padding-bottom: calc(var(--kx-bottom-dock-h, 56px) + 8px);
  padding-left: 16px;
  padding-right: 16px;
  width: 100%;
}

@media (max-width: 767px) {
  :root {
    --kx-header-h: 44px;
    --kx-top-action-h: 46px;
    --kx-bottom-dock-h: 48px;
    --kx-view-pad: 8px;
  }
  main.kx-container {
    padding-left: 8px;
    padding-right: 8px;
    padding-top: calc(var(--kx-header-h, 46px) + 6px);
    padding-bottom: calc(var(--kx-bottom-dock-h, 52px) + 6px);
  }
}

/* Header & Status Bar - Floating Glass Overlay at Viewport Top */
.kx-header {
  position: fixed;
  top: 0;
  left: 50% !important;
  right: auto !important;
  transform: translateX(-50%) !important;
  width: 100% !important;
  max-width: var(--kx-app-max-w, 768px) !important;
  height: var(--kx-header-h, 48px);
  z-index: 1000;
  flex-shrink: 0;
  background: rgba(8, 12, 22, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1.5px solid rgba(0, 229, 255, 0.25);
  border-left: 1px solid rgba(0, 229, 255, 0.16);
  border-right: 1px solid rgba(0, 229, 255, 0.16);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
  padding: 0;
  display: flex;
  align-items: center;
  transition: all 0.25s ease;
  pointer-events: auto;
  box-sizing: border-box;
}
.kx-header .kx-container {
  max-width: 100% !important;
  width: 100% !important;
  margin: 0 auto;
  padding: 0 14px;
}
@media (max-width: 768px) {
  .kx-header {
    left: 0 !important;
    transform: none !important;
    max-width: 100% !important;
    border-left: none !important;
    border-right: none !important;
  }
}
@media (max-width: 767px) {
  .kx-header .kx-container {
    padding: 0 8px;
  }
}

/* 3 cột: 2 cột bên bằng nhau (1fr) để đồng hồ Âm Dương ở giữa luôn nằm đúng tâm header,
   bất kể khối trái (nhân vật) và khối phải (vật phẩm) rộng hẹp khác nhau. */
.kx-status-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  width: 100%;
}

/* CỘT 1 (TRÁI): THÔNG TIN NHÂN VẬT (AVATAR + 3 DÒNG) */
.kx-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-self: start;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

/* CỘT 2 (GIỮA): 2 DÒNG (QUẢ CẦU 3D & CANH GIỜ/ĐỒNG HỒ) */
.kx-header-center {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-width: 0;
}

/* CỘT 3 (PHẢI): 2 DÒNG VẬT PHẨM (LINH THẠCH & ĐAN DƯỢC) CĂN PHẢI */
.kx-header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  justify-self: end;
  min-width: 0;
}

@media (max-width: 991px) {
  .kx-status-bar {
    gap: 6px;
  }
  .kx-header-left {
    gap: 6px;
  }
}

@media (max-width: 767px) {
  .kx-header {
    padding: 3px 0;
  }
  .kx-status-bar {
    gap: 4px;
  }
  .kx-header-left {
    min-width: 0;
    max-width: 100%;
    gap: 4px;
    overflow: hidden;
  }
  .kx-header-center {
    order: 2;
    flex: 0 0 auto;
    min-width: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 !important;
    width: auto !important;
  }
  .kx-header-right {
    order: 3;
    flex: 0 0 auto;
    flex-direction: column !important;
    align-items: flex-end !important;
    gap: 2px !important;
    flex-shrink: 0;
  }
  /* Ẩn mọi nút popup dư thừa trong Header */
  .kx-header-right .kx-icon-popup-btn {
    display: none !important;
  }
  .kx-avatar-container {
    width: 32px !important;
    height: 32px !important;
    flex-shrink: 0;
  }
  .kx-avatar-circle {
    width: 32px !important;
    height: 32px !important;
    font-size: 0.85rem !important;
  }
  .kx-avatar-badge-corner {
    width: 14px !important;
    height: 14px !important;
    font-size: 0.46rem !important;
  }
  .kx-profile-3lines {
    gap: 1px;
    max-width: calc(100% - 36px);
  }
  .kx-profile-line-title {
    max-width: 105px !important;
    font-size: 0.58rem !important;
  }
  .kx-role-mini {
    font-size: 0.5rem !important;
    padding: 0 3px !important;
  }
  .kx-title-text {
    font-size: 0.58rem !important;
  }
  .kx-profile-line-name {
    max-width: 105px !important;
  }
  .kx-daohieu-name {
    font-size: 0.76rem !important;
    max-width: 90px !important;
  }
  .kx-edit-pencil {
    font-size: 0.5rem !important;
  }
  .kx-profile-line-realm {
    max-width: 105px !important;
    font-size: 0.58rem !important;
  }
  .kx-realm-text {
    font-size: 0.58rem !important;
  }
  .kx-badge-stat {
    padding: 1px 5px !important;
    font-size: 0.65rem !important;
    gap: 3px !important;
    border-radius: 8px !important;
    line-height: 1.2 !important;
  }
  .kx-badge-stat i {
    font-size: 0.62rem !important;
  }
  .kx-header-stats-row {
    gap: 3px !important;
  }
  



.kx-header-tuvi-bar {
    height: 16px !important;
    min-width: 90px !important;
    border-radius: 8px !important;
  }
  .kx-header-tuvi-fill {
    border-radius: 7px !important;
  }
  .kx-header-tuvi-text {
    font-size: 0.61rem !important;
    gap: 3px !important;
    padding: 0 4px !important;
  }
  .kx-header-tuvi-text i {
    font-size: 0.56rem !important;
  }
  .kx-audio-btn {
    display: none !important;
  }
}

/* =============================================================================
   THÔNG TIN NHÂN VẬT (AVATAR + 3 DÒNG: DANH XƯNG, TÊN, CẤP TU TIÊN)
============================================================================= */
.kx-profile-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.kx-avatar-container {
  position: relative;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
}

.kx-avatar-circle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.2) 0%, rgba(13, 20, 36, 0.95) 100%);
  border: 1.5px solid var(--border-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--cyan-glow);
  font-size: 1.15rem;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.3);
  overflow: hidden;
  user-select: none;
}
.kx-avatar-circle:hover {
  border-color: var(--gold-glow);
  color: var(--gold-glow);
  box-shadow: 0 0 16px rgba(255, 215, 0, 0.5);
  transform: scale(1.05);
}

.kx-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

/* Badge Nghỉ Chân (Gắn trên góc ảnh Profile) */
/* Badge Nhận Diện Góc Dưới-Phải Avatar (Tôn Vị Super / Admin hoặc Tông Môn) */
.kx-avatar-badge-corner {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.58rem;
  z-index: 5;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.9);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  pointer-events: none;
}
.kx-avatar-badge-corner.super {
  background: linear-gradient(135deg, #ffd700, #ff9100);
  border: 1.5px solid #fff3b0;
  color: #1a1200;
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.9);
  animation: kxPulseGold 2s infinite;
}
.kx-avatar-badge-corner.admin {
  background: #0a0e17;
  border: 1.5px solid var(--cyan-glow);
  color: var(--cyan-glow);
  box-shadow: 0 0 8px rgba(0, 229, 255, 0.6);
}
.kx-avatar-badge-corner.sect {
  background: #080d1a;
  border: 1.5px solid currentColor;
  box-shadow: 0 0 8px currentColor;
}
.kx-avatar-badge-corner.free {
  background: #0a0f18;
  border: 1.5px solid #4ade80;
  color: #4ade80;
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.6);
}
@media (max-width: 767px) {
  .kx-avatar-badge-corner {
    width: 14px;
    height: 14px;
    font-size: 0.46rem;
    bottom: -2px;
    right: -2px;
  }
}

/* =========================================================================
   HỒ SƠ TIÊN ĐẠO (ĐẠO ĐIỆN) - 3 TAB: NHÂN VẬT · TÀI KHOẢN · CÀI ĐẶT
========================================================================= */
.kx-profile-tabs-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(12, 18, 32, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 4px;
  border-radius: 14px;
  margin-bottom: 14px;
}
.kx-profile-tab-pill {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-heading);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}
.kx-profile-tab-pill:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}
.kx-profile-tab-pill.active {
  color: #000;
  background: linear-gradient(135deg, #00e5ff, #00b0ff);
  box-shadow: 0 2px 10px rgba(0, 229, 255, 0.4);
}
.kx-profile-tab-pill.active.tab-account {
  background: linear-gradient(135deg, #ffd700, #ff9100);
  box-shadow: 0 2px 10px rgba(255, 215, 0, 0.4);
}
.kx-profile-tab-pill.active.tab-settings {
  background: linear-gradient(135deg, #c084fc, #a855f7);
  box-shadow: 0 2px 10px rgba(192, 132, 252, 0.4);
}
.kx-profile-tab-panel {
  display: none;
}
.kx-profile-tab-panel.active {
  display: block;
  animation: kxProfileTabFade 0.22s ease forwards;
}
@keyframes kxProfileTabFade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.kx-profile-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.kx-profile-stat-card {
  background: rgba(14, 22, 38, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.kx-profile-stat-icon {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  flex-shrink: 0;
}
.kx-profile-stat-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.kx-profile-stat-lbl {
  font-size: 0.64rem;
  color: var(--text-muted);
}
.kx-profile-stat-val {
  font-size: 0.76rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 3 DÒNG THÔNG TIN NHÂN VẬT GỌN GÀNG */
.kx-profile-3lines {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  line-height: 1.15;
  min-width: 0;
}

/* Dòng 1: Danh xưng */
.kx-profile-line-title {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
  transition: color 0.2s ease;
}
.kx-profile-line-title:hover .kx-title-text {
  color: var(--gold-glow);
}
.kx-role-mini {
  font-size: 0.55rem;
  font-weight: 800;
  padding: 0 4px;
  border-radius: 4px;
  line-height: 1.2;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.kx-role-mini.super {
  background: rgba(255, 215, 0, 0.25);
  border: 1px solid var(--gold-glow);
  color: #ffd700;
  text-shadow: 0 0 6px rgba(255, 215, 0, 0.6);
}
.kx-role-mini.admin {
  background: rgba(0, 229, 255, 0.25);
  border: 1px solid var(--cyan-glow);
  color: #00e5ff;
}
.kx-title-text {
  font-size: 0.66rem;
  color: #cbd5e1;
  opacity: 0.9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

/* Dòng 2: Tên (Đạo Hiệu) */
.kx-profile-line-name {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}
.kx-profile-line-name:hover .kx-daohieu-name {
  color: var(--cyan-glow);
}
.kx-profile-line-name:hover .kx-edit-pencil {
  opacity: 1;
  color: var(--cyan-glow);
}
.kx-daohieu-name {
  font-weight: 800;
  font-size: 0.86rem;
  color: #ffffff;
  font-family: var(--font-heading);
  letter-spacing: 0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.2s ease;
}
.kx-edit-pencil {
  font-size: 0.55rem;
  color: var(--text-muted);
  opacity: 0.5;
  transition: all 0.2s ease;
}

/* Dòng 3: Cấp Tu Tiên */
.kx-profile-line-realm {
  display: flex;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
  transition: color 0.2s ease;
}
.kx-profile-line-realm:hover .kx-realm-text {
  color: var(--gold-glow);
}
.kx-realm-text {
  font-size: 0.65rem;
  color: var(--cyan-glow);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Icon choice trong modal Avatar */
.kx-avatar-icon-choice:hover {
  border-color: var(--cyan-glow) !important;
  color: var(--cyan-glow) !important;
  transform: scale(1.1);
}
.kx-avatar-icon-choice.active {
  border-color: var(--gold-glow) !important;
  background: rgba(255, 215, 0, 0.2) !important;
  color: var(--gold-glow) !important;
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}
.kx-profile-daohieu {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
}
.kx-profile-daohieu:hover {
  color: var(--cyan-glow);
}

.kx-daohieu-text {
  display: inline-block;
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

@media (max-width: 991px) {
  .kx-daohieu-text {
    max-width: 130px;
  }
}

@media (max-width: 767px) {
  .kx-daohieu-text {
    max-width: 110px;
    font-size: 0.9rem;
  }
  .kx-profile-row-top {
    gap: 4px;
    flex-wrap: nowrap;
  }
  .kx-profile-row-bottom {
    gap: 4px;
    flex-wrap: nowrap;
  }
}

.kx-role-tag {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 1px 7px;
  border-radius: 4px;
  letter-spacing: 0.5px;
  line-height: 1.3;
}
.kx-role-tag.super {
  background: rgba(255, 215, 0, 0.2);
  border: 1px solid var(--gold-glow);
  color: var(--gold-glow);
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.4);
}
.kx-role-tag.admin {
  background: rgba(0, 229, 255, 0.2);
  border: 1px solid var(--cyan-glow);
  color: var(--cyan-glow);
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.4);
}

/* Pill Cảnh Giới nhỏ gọn */
.kx-realm-pill {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-cyan);
  color: var(--cyan-glow);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
  line-height: 1.3;
  user-select: none;
}
.kx-realm-pill:hover {
  background: rgba(0, 229, 255, 0.15);
  border-color: var(--cyan-glow);
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.3);
  transform: translateY(-1px);
}

/* =============================================================================
   3D CELESTIAL DAY/NIGHT & CANH GIỜ THIÊN ĐỊA - 2 DÒNG (DÒNG 1: QUẢ CẦU, DÒNG 2: CHỮ & GIỜ)
============================================================================= */
.kx-celestial-sphere-wrapper {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(13, 20, 36, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 2px 10px;
  border-radius: 14px;
  height: 28px;
  backdrop-filter: blur(8px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  transition: all 0.3s ease;
  user-select: none;
  box-sizing: border-box;
}
.kx-celestial-sphere-wrapper:hover {
  border-color: rgba(0, 229, 255, 0.4);
  box-shadow: 0 0 16px rgba(0, 229, 255, 0.25);
}

.kx-celestial-3d-orb {
  position: relative;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  flex-shrink: 0;
  perspective: 400px;
}

.kx-celestial-body {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  transition: all 1s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

/* Quả cầu ban ngày - Thái Dương Kim Ô */
.kx-celestial-3d-orb.day .kx-celestial-body,
.kx-celestial-3d-orb.day-noon .kx-celestial-body {
  background: radial-gradient(circle at 35% 35%, #ffffff 0%, #fff176 30%, #ffd700 65%, #ff6d00 100%);
  box-shadow: 0 0 14px rgba(255, 215, 0, 0.9), 0 0 24px rgba(255, 109, 0, 0.5), inset -2px -2px 5px rgba(0, 0, 0, 0.35);
}

/* Quả cầu ban đêm - Thái Âm Nguyệt Lượng */
.kx-celestial-3d-orb.night .kx-celestial-body,
.kx-celestial-3d-orb.night-deep .kx-celestial-body,
.kx-celestial-3d-orb.night-dawn .kx-celestial-body {
  background: radial-gradient(circle at 35% 35%, #ffffff 0%, #e0f7fa 30%, #00e5ff 70%, #0d47a1 100%);
  box-shadow: 0 0 14px rgba(0, 229, 255, 0.8), 0 0 22px rgba(33, 150, 243, 0.4), inset -2px -2px 5px rgba(0, 0, 0, 0.5);
}

/* Quả cầu rạng đông / hoàng hôn - Tử Khí Đông Lai */
.kx-celestial-3d-orb.dawn .kx-celestial-body,
.kx-celestial-3d-orb.dusk .kx-celestial-body,
.kx-celestial-3d-orb.day-dusk .kx-celestial-body {
  background: radial-gradient(circle at 35% 35%, #fff9c4 0%, #ff4081 40%, #7c4dff 80%, #311b92 100%);
  box-shadow: 0 0 14px rgba(224, 64, 251, 0.8), 0 0 24px rgba(255, 64, 129, 0.4), inset -2px -2px 5px rgba(0, 0, 0, 0.4);
}

/* Vành đai quỹ đạo 3D xoay tròn */
.kx-celestial-orbit-ring {
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border-radius: 50%;
  pointer-events: none;
  transform: rotateX(70deg) rotateY(20deg);
  transform-style: preserve-3d;
  border: 1px dashed rgba(255, 215, 0, 0.4);
  animation: kxSpin 14s linear infinite;
}

.kx-celestial-3d-orb.night .kx-celestial-orbit-ring,
.kx-celestial-3d-orb.night-deep .kx-celestial-orbit-ring,
.kx-celestial-3d-orb.night-dawn .kx-celestial-orbit-ring {
  border-color: rgba(0, 229, 255, 0.5);
}

/* Thông tin canh giờ & đồng hồ - Dòng 2 */
.kx-celestial-label-box {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 4px;
  line-height: 1;
  white-space: nowrap;
}

.kx-celestial-canh-name {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--gold-glow);
  font-family: var(--font-heading);
  letter-spacing: 0.3px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  line-height: 1;
}

.kx-celestial-sep {
  font-size: 0.62rem;
  color: rgba(255, 255, 255, 0.4);
  line-height: 1;
}

.kx-celestial-clock {
  font-size: 0.65rem;
  color: var(--cyan-glow);
  font-variant-numeric: tabular-nums;
  font-family: monospace;
  letter-spacing: 0.3px;
  line-height: 1;
}

/* Responsive adjustments for Celestial Sphere */
@media (max-width: 991px) {
  .kx-celestial-sphere-wrapper {
    padding: 2px 8px;
    gap: 2px;
  }
  .kx-celestial-3d-orb {
    width: 20px;
    height: 20px;
  }
}

@media (max-width: 767px) {
  .kx-celestial-sphere-wrapper {
    padding: 1px 6px !important;
    gap: 4px !important;
    background: rgba(13, 20, 36, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px !important;
    height: 26px !important;
    max-width: none;
    width: auto;
    margin: 0;
    display: inline-flex !important;
    flex-direction: row !important;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
  }
  .kx-celestial-3d-orb {
    width: 17px !important;
    height: 17px !important;
  }
  .kx-celestial-label-box {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 3px;
    line-height: 1;
    white-space: nowrap;
  }
  .kx-celestial-canh-name {
    font-size: 0.60rem !important;
    font-weight: 700;
  }
  .kx-celestial-sep {
    font-size: 0.55rem !important;
  }
  .kx-celestial-clock {
    display: inline-block;
    font-size: 0.58rem !important;
    color: var(--cyan-glow);
  }
}

.kx-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-main);
  font-size: 1.25rem;
  font-weight: 700;
  font-family: var(--font-heading);
}

.kx-brand i {
  color: var(--gold-glow);
  font-size: 1.5rem;
  filter: drop-shadow(0 0 8px var(--gold-glow));
}

.kx-brand span {
  color: var(--cyan-glow);
}

.kx-cultivator-info {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.kx-badge-stat {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.25;
  white-space: nowrap;
  user-select: none;
  transition: all 0.2s ease;
}

.kx-badge-stat i {
  font-size: 0.7rem;
}

.kx-badge-stat.gold {
  border-color: rgba(255, 215, 0, 0.35);
  background: rgba(255, 215, 0, 0.08);
  color: #fef08a;
}
.kx-badge-stat.gold i {
  color: var(--gold-glow);
}

.kx-badge-stat.pill {
  border-color: rgba(0, 230, 118, 0.35);
  background: rgba(0, 230, 118, 0.08);
  color: #a7f3d0;
}
.kx-badge-stat.pill i {
  color: var(--emerald-glow);
}

/* Tu vi trên header (luôn thấy ở mọi giao diện) */
.kx-badge-stat.tuvi {
  border-color: rgba(0, 229, 255, 0.35);
  background: transparent !important;
  color: #a5f3fc;
}
.kx-badge-stat.tuvi i {
  color: var(--cyan-glow);
}

/* DÒNG 1 HEADER: Linh thạch và Trúc cơ đan cùng 1 hàng */
.kx-header-stats-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

/* DÒNG 2 HEADER: Thanh tiến trình Tu Vi */




.kx-header-tuvi-bar {
  position: relative;
  width: 100%;
  min-width: 120px;
  height: 18px;
  background: rgba(4, 18, 28, 0.7);
  border: 1px solid rgba(0, 229, 255, 0.35);
  border-radius: 9px;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.55), 0 0 6px rgba(0, 229, 255, 0.15);
  transition: all 0.25s ease;
  box-sizing: border-box;
}

.kx-header-tuvi-bar:hover {
  border-color: rgba(0, 229, 255, 0.75);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.55), 0 0 10px rgba(0, 229, 255, 0.35);
}

.kx-header-tuvi-bar.can-break {
  border-color: rgba(255, 215, 0, 0.75);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.55), 0 0 12px rgba(255, 215, 0, 0.5);
  animation: kxTuviPulse 1.8s infinite alternate;
}

@keyframes kxTuviPulse {
  0% {
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.55), 0 0 6px rgba(255, 215, 0, 0.35);
    border-color: rgba(255, 215, 0, 0.55);
  }
  100% {
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.55), 0 0 14px rgba(255, 215, 0, 0.85);
    border-color: rgba(255, 215, 0, 0.95);
  }
}

.kx-header-tuvi-fill {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  height: 100%;
  background: linear-gradient(90deg, rgba(0, 140, 200, 0.65), rgba(0, 229, 255, 0.85));
  border-radius: 8px;
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 8px rgba(0, 229, 255, 0.45);
  pointer-events: none;
}

.kx-header-tuvi-bar.can-break .kx-header-tuvi-fill {
  background: linear-gradient(90deg, rgba(0, 229, 255, 0.85), rgba(255, 215, 0, 0.95));
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.65);
}

.kx-header-tuvi-text {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 6px;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
  color: #a5f3fc;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95), 0 0 4px rgba(0, 0, 0, 0.8);
  white-space: nowrap;
  pointer-events: none;
}

.kx-header-tuvi-text i {
  font-size: 0.62rem;
  color: var(--cyan-glow);
}

.kx-header-tuvi-bar.can-break .kx-header-tuvi-text {
  color: #fffbeb;
}

.kx-header-tuvi-bar.can-break .kx-header-tuvi-text i {
  color: var(--gold-glow);
}

.kx-badge-stat.cyan {
  border-color: var(--border-cyan);
  color: var(--cyan-glow);
}

.kx-audio-btn {
  background: transparent;
  border: 1px solid var(--border-cyan);
  color: var(--cyan-glow);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.kx-audio-btn:hover {
  background: rgba(0, 229, 255, 0.15);
  box-shadow: 0 0 10px var(--cyan-glow);
}

/* Nav Menu Tabs */
.kx-nav-tabs {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin: 16px 0;
  flex-wrap: wrap;
  overflow: visible;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.kx-nav-tabs::-webkit-scrollbar {
  display: none;
}

.kx-tab-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.7) 0%, rgba(15, 23, 42, 0.85) 100%);
  border: 1px solid rgba(0, 229, 255, 0.25);
  border-radius: 4px;
  clip-path: polygon(8px 0%, calc(100% - 8px) 0%, 100% 8px, 100% calc(100% - 8px), calc(100% - 8px) 100%, 8px 100%, 0% calc(100% - 8px), 0% 8px);
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.3px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  position: relative;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 4px 12px rgba(0, 0, 0, 0.3);
}

@media (max-width: 991px) and (min-width: 768px) {
  .kx-nav-tabs {
    gap: 6px;
    margin: 12px 0;
  }
  .kx-tab-item {
    padding: 7px 12px;
    font-size: 0.82rem;
    gap: 5px;
    clip-path: polygon(6px 0%, calc(100% - 6px) 0%, 100% 6px, 100% calc(100% - 6px), calc(100% - 6px) 100%, 6px 100%, 0% calc(100% - 6px), 0% 6px);
  }
}

@media (max-width: 767px) {
  .kx-nav-container {
    padding: 0 4px !important;
  }
  .kx-nav-tabs {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    justify-content: flex-start;
    gap: 8px;
    margin: 8px 0 14px 0;
    padding: 4px 8px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    scroll-snap-type: x mandatory;
  }
  .kx-nav-tabs::-webkit-scrollbar {
    display: none;
  }
  .kx-tab-item {
    flex-shrink: 0;
    scroll-snap-align: start;
    padding: 8px 14px;
    font-size: 0.82rem;
    clip-path: none;
    border-radius: 10px;
    white-space: nowrap;
    gap: 6px;
  }
}

.kx-tab-item:hover {
  color: var(--cyan-glow);
  border-color: var(--cyan-glow);
  background: linear-gradient(180deg, rgba(0, 229, 255, 0.2) 0%, rgba(15, 23, 42, 0.9) 100%);
  box-shadow: 0 0 16px rgba(0, 229, 255, 0.35), inset 0 1px 0 rgba(0, 229, 255, 0.3);
  transform: translateY(-2px);
}

.kx-tab-item.active {
  color: #fff;
  border-color: var(--gold-glow);
  background: linear-gradient(180deg, rgba(255, 215, 0, 0.22) 0%, rgba(15, 23, 42, 0.95) 100%);
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.45), inset 0 1px 0 rgba(255, 215, 0, 0.4);
  transform: translateY(-2px);
}

.kx-tab-item i {
  transition: transform 0.25s ease;
}
.kx-tab-item:hover i {
  transform: scale(1.15);
}

/* Tu Vi Progress Bar - Floating HUD Card under Top Action Bar */
.kx-progress-box {
  position: absolute;
  top: calc(var(--kx-header-h, 48px) + var(--kx-top-action-h, 50px) + 24px);
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 24px);
  max-width: 580px;
  z-index: 35;
  background: rgba(10, 16, 30, 0.85);
  border: 1px solid rgba(0, 229, 255, 0.25);
  border-radius: 14px;
  padding: 6px 14px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.55), 0 0 15px rgba(0, 229, 255, 0.1);
  flex-shrink: 0;
  box-sizing: border-box;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

body.kx-view-active .kx-progress-box {
  display: none !important;
}

@media (max-width: 767px) {
  .kx-progress-box {
    top: calc(var(--kx-header-h, 44px) + var(--kx-top-action-h, 46px) + 18px);
    width: calc(100% - 16px);
    padding: 5px 12px;
    border-radius: 12px;
  }
}

.kx-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2px;
  font-size: 0.82rem;
}

@media (max-width: 767px) {
  .kx-progress-header {
    flex-wrap: nowrap;
    gap: 4px;
    font-size: 0.72rem;
  }
}

.kx-realm-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--gold-glow);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

@media (max-width: 767px) {
  .kx-realm-title {
    font-size: 0.72rem;
    gap: 4px;
  }
}

.kx-progress-bar-bg {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
}

.kx-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #00e5ff, #ffd700);
  border-radius: 4px;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 10px var(--cyan-glow);
}

/* MAIN CAVE (ĐẢ TỌA ĐỘNG PHỦ) */
.kx-cave-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 0 40px;
  position: relative;
}

/* Trận đồ bát quái tương tác */
.kx-bagua-wrapper {
  position: relative;
  width: 260px;
  height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  margin-bottom: 24px;
}

.kx-bagua-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px dashed rgba(0, 229, 255, 0.4);
  animation: rotateBagua 25s linear infinite;
  box-shadow: 0 0 30px rgba(0, 229, 255, 0.2);
}

.kx-bagua-core {
  width: 190px;
  height: 190px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(23, 35, 60, 0.95) 0%, rgba(10, 14, 23, 0.95) 100%);
  border: 3px solid var(--cyan-glow);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 35px rgba(0, 229, 255, 0.4);
  transition: all 0.12s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.kx-bagua-wrapper:active .kx-bagua-core {
  transform: scale(0.92);
  box-shadow: 0 0 55px rgba(255, 215, 0, 0.6);
  border-color: var(--gold-glow);
}

.kx-bagua-icon {
  font-size: 3.5rem;
  color: var(--cyan-glow);
  filter: drop-shadow(0 0 12px var(--cyan-glow));
  margin-bottom: 4px;
  transition: all 0.15s ease;
}

.kx-bagua-wrapper:active .kx-bagua-icon {
  color: var(--gold-glow);
  filter: drop-shadow(0 0 16px var(--gold-glow));
}

.kx-bagua-text {
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-main);
}

@keyframes rotateBagua {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Floating number text */
.kx-floating-tuvi {
  position: absolute;
  color: var(--cyan-glow);
  font-weight: 800;
  font-size: 1.35rem;
  font-family: var(--font-heading);
  pointer-events: none;
  animation: floatUp 0.85s ease-out forwards;
  text-shadow: 0 0 10px var(--cyan-glow);
  z-index: 1000;
}

@keyframes floatUp {
  0% { opacity: 1; transform: translate(-50%, 0) scale(0.8); }
  50% { transform: translate(-50%, -35px) scale(1.15); }
  100% { opacity: 0; transform: translate(-50%, -70px) scale(1); }
}

/* Nút Đột Phá Lôi Kiếp Rực Sáng */
.kx-btn-breakthrough {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 32px;
  font-size: 1.15rem;
  font-weight: 800;
  font-family: var(--font-heading);
  border-radius: 30px;
  cursor: pointer;
  border: none;
  color: #0a0e17;
  background: linear-gradient(135deg, #ffd700, #ff9100);
  box-shadow: 0 0 25px rgba(255, 215, 0, 0.6);
  transition: all 0.25s ease;
  animation: pulseBreakthrough 1.8s infinite;
}

.kx-btn-breakthrough:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 0 35px rgba(255, 215, 0, 0.85);
}

@keyframes pulseBreakthrough {
  0%, 100% { box-shadow: 0 0 15px rgba(255, 215, 0, 0.5); }
  50% { box-shadow: 0 0 30px rgba(255, 215, 0, 0.9); }
}

/* Cards & Grid */
.kx-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

@media (max-width: 820px) {
  .kx-grid-2 {
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 20px;
  }
}

.kx-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

@media (max-width: 991px) {
  .kx-grid-3 {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
}

@media (max-width: 600px) {
  .kx-grid-3 {
    grid-template-columns: 1fr;
    gap: 14px;
  }
}

.kx-card {
  background: var(--bg-card);
  border: 1px solid var(--border-cyan);
  border-radius: 16px;
  padding: 20px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

@media (max-width: 600px) {
  .kx-card {
    padding: 14px;
    border-radius: 14px;
  }
}

.kx-card-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--cyan-glow);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

@media (max-width: 600px) {
  .kx-card-title {
    font-size: 0.98rem;
    margin-bottom: 10px;
  }
}

/* Incense burner (Lư hương) */
.kx-incense-display {
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(255, 255, 255, 0.03);
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 12px;
}

.kx-incense-stick {
  width: 6px;
  height: 50px;
  background: #ff5722;
  border-radius: 3px;
  position: relative;
  box-shadow: 0 -4px 8px #ff9800;
}

.kx-incense-smoke {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.6);
  filter: blur(2px);
  animation: smokeRise 2s infinite ease-out;
}

@keyframes smokeRise {
  0% { opacity: 0.8; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -30px) scale(3); }
}

/* Modals */
.kx-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.kx-modal-overlay.open {
  display: flex;
}

.kx-modal-box {
  background: #111827;
  border: 2px solid var(--cyan-glow);
  box-shadow: 0 0 40px rgba(0, 229, 255, 0.35);
  border-radius: 20px;
  max-width: 500px;
  width: 100%;
  padding: 24px;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}

@media (max-width: 600px) {
  .kx-modal-overlay {
    padding: 10px;
  }
  .kx-modal-box {
    padding: 18px 14px;
    border-radius: 16px;
    max-height: 92vh;
  }
}

/* Lightning Tribulation Flash */
.kx-tribulation-flash {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: white;
  opacity: 0;
  pointer-events: none;
  z-index: 9999;
  transition: opacity 0.08s ease;
}

.kx-tribulation-flash.flash {
  opacity: 0.95;
}

/* Buttons */
.kx-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  text-decoration: none;
}

.kx-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  filter: saturate(0.6);
  box-shadow: none;
}

.kx-btn-primary {
  background: var(--cyan-glow);
  color: #0a0e17;
}

.kx-btn-primary:hover {
  background: #33ebff;
  box-shadow: 0 0 15px rgba(0, 229, 255, 0.5);
}

.kx-btn-outline {
  background: transparent;
  border-color: var(--border-cyan);
  color: var(--cyan-glow);
}

.kx-btn-outline:hover {
  background: rgba(0, 229, 255, 0.12);
}

.kx-btn-gold {
  background: var(--gold-glow);
  color: #0a0e17;
}

/* Footer */
.kx-footer {
  text-align: center;
  padding: 30px 0;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  margin-top: 40px;
}

.kx-footer a {
  color: var(--cyan-glow);
  text-decoration: none;
}


/* =============================================================================
   kNotify - TOAST & CỔ PHONG DIALOG STYLING
============================================================================= */

/* 1. TOAST CONTAINER & CARDS */
.kx-toast-container {
  position: fixed;
  top: 75px;
  right: 20px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 380px;
  width: calc(100% - 40px);
  pointer-events: none;
}

@media (max-width: 600px) {
  .kx-toast-container {
    top: 70px;
    right: 12px;
    left: 12px;
    width: calc(100% - 24px);
    max-width: 100%;
  }
}

.kx-toast {
  position: relative;
  background: rgba(13, 20, 36, 0.95);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-cyan);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 15px rgba(0, 229, 255, 0.2);
  pointer-events: auto;
  animation: toastSlideIn 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  transition: all 0.3s ease;
}

.kx-toast.kx-toast-fadeout {
  opacity: 0;
  transform: translateX(60px);
}

.kx-toast-content {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
}

.kx-toast-icon {
  font-size: 1.3rem;
  color: var(--cyan-glow);
  filter: drop-shadow(0 0 6px var(--cyan-glow));
}

.kx-toast-text {
  flex: 1;
  font-size: 0.92rem;
  font-weight: 600;
  color: #f1f5f9;
  line-height: 1.4;
}

.kx-toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: color 0.15s ease;
}

.kx-toast-close:hover {
  color: #fff;
}

.kx-toast-bar {
  display: none !important; /* Bỏ thanh đếm ngược thời gian: nhìn như spam */
  height: 3px;
  background: linear-gradient(90deg, var(--cyan-glow), var(--gold-glow));
  width: 100%;
  animation: toastBarShrink linear forwards;
}

/* Toast Color Variations */
.kx-toast-alchemy {
  border-color: #ff7043;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 15px rgba(255, 112, 67, 0.3);
}
.kx-toast-alchemy .kx-toast-icon {
  color: #ff7043;
  filter: drop-shadow(0 0 6px #ff7043);
}

.kx-toast-danger, .kx-toast-error {
  border-color: var(--crimson-glow);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 15px rgba(255, 23, 68, 0.3);
}
.kx-toast-danger .kx-toast-icon, .kx-toast-error .kx-toast-icon {
  color: var(--crimson-glow);
  filter: drop-shadow(0 0 6px var(--crimson-glow));
}

.kx-toast-gold {
  border-color: var(--gold-glow);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 15px rgba(255, 215, 0, 0.3);
}
.kx-toast-gold .kx-toast-icon {
  color: var(--gold-glow);
  filter: drop-shadow(0 0 6px var(--gold-glow));
}

.kx-toast-breakthrough {
  border-color: var(--cyan-glow);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 15px rgba(0, 229, 255, 0.45);
}
.kx-toast-breakthrough .kx-toast-icon {
  color: var(--cyan-glow);
  filter: drop-shadow(0 0 8px var(--cyan-glow));
}

.kx-toast-title {
  display: block;
  margin-bottom: 3px;
  font-size: 0.95rem;
  color: var(--gold-glow);
}

.kx-toast-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}
.kx-toast-actions .kx-btn {
  padding: 5px 12px;
  font-size: 0.8rem;
}

/* kConfirm tại chỗ: nút đang chờ bấm lần 2 để xác nhận */
.kx-confirm-armed {
  border-color: var(--crimson-glow) !important;
  color: #ff8a80 !important;
  box-shadow: 0 0 0 1px var(--crimson-glow), 0 0 14px rgba(255, 23, 68, 0.45) !important;
  animation: kxConfirmArmed 0.9s ease-in-out infinite alternate;
}
@keyframes kxConfirmArmed {
  from { box-shadow: 0 0 0 1px var(--crimson-glow), 0 0 6px rgba(255, 23, 68, 0.3); }
  to { box-shadow: 0 0 0 1px var(--crimson-glow), 0 0 18px rgba(255, 23, 68, 0.6); }
}

@keyframes toastSlideIn {
  from { opacity: 0; transform: translateX(80px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toastBarShrink {
  from { width: 100%; }
  to { width: 0%; }
}

/* 2. CỔ PHONG DIALOG (Thay thế alert) */
.kx-dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 14, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100000;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.kx-dialog-overlay.kx-dialog-active {
  opacity: 1;
  pointer-events: auto;
}

.kx-dialog-box {
  position: relative;
  width: 100%;
  max-width: 480px;
  background: radial-gradient(circle at 50% 0%, rgba(26, 38, 64, 0.98) 0%, rgba(10, 15, 28, 0.98) 100%);
  border-radius: 20px;
  padding: 28px 24px 24px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 45px rgba(255, 215, 0, 0.2);
  border: 1.5px solid var(--border-gold);
  text-align: center;
  transform: scale(0.85) translateY(20px);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
}

@media (max-width: 600px) {
  .kx-dialog-box {
    padding: 20px 16px 18px;
    max-width: calc(100vw - 24px);
    border-radius: 16px;
  }
}

.kx-dialog-overlay.kx-dialog-active .kx-dialog-box {
  transform: scale(1) translateY(0);
}

/* Aura Halo trên đỉnh modal */
.kx-dialog-halo {
  position: absolute;
  top: -80px;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 215, 0, 0.35) 0%, transparent 70%);
  filter: blur(25px);
  pointer-events: none;
}

.kx-dialog-header {
  margin-bottom: 16px;
  position: relative;
  z-index: 2;
}

.kx-dialog-icon {
  width: 68px;
  height: 68px;
  margin: 0 auto 14px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  background: rgba(255, 255, 255, 0.04);
  border: 2px solid var(--gold-glow);
  color: var(--gold-glow);
  box-shadow: 0 0 25px rgba(255, 215, 0, 0.4);
}

.kx-dialog-title {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--gold-glow);
  letter-spacing: 0.5px;
  text-shadow: 0 0 15px rgba(255, 215, 0, 0.4);
}

.kx-dialog-body {
  margin-bottom: 24px;
  position: relative;
  z-index: 2;
}

.kx-dialog-body p {
  color: #cbd5e1;
  font-size: 1.02rem;
  line-height: 1.6;
  font-weight: 500;
}

.kx-dialog-footer {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: center;
}

.kx-dialog-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 36px;
  border-radius: 30px;
  font-size: 1rem;
  font-weight: 800;
  font-family: var(--font-heading);
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  border: none;
  background: linear-gradient(135deg, #ffd700 0%, #ff9800 100%);
  color: #0a0e17;
  box-shadow: 0 0 25px rgba(255, 215, 0, 0.5);
  transition: all 0.2s ease;
}

.kx-dialog-btn:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 0 35px rgba(255, 215, 0, 0.8);
}

.kx-dialog-btn:active {
  transform: translateY(1px) scale(0.98);
}

/* Dialog Theme Variations */
/* Alchemy: Đỏ lửa lò bát quái */
.kx-dialog-alchemy {
  border-color: #ff7043;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 45px rgba(255, 112, 67, 0.35);
}
.kx-dialog-alchemy .kx-dialog-halo {
  background: radial-gradient(circle, rgba(255, 87, 34, 0.45) 0%, transparent 70%);
}
.kx-dialog-alchemy .kx-dialog-icon {
  border-color: #ff7043;
  color: #ff9e80;
  box-shadow: 0 0 25px rgba(255, 112, 67, 0.5);
}
.kx-dialog-alchemy .kx-dialog-title {
  color: #ffab91;
  text-shadow: 0 0 15px rgba(255, 112, 67, 0.5);
}
.kx-dialog-alchemy .kx-dialog-btn {
  background: linear-gradient(135deg, #ff7043 0%, #d84315 100%);
  color: #fff;
  box-shadow: 0 0 25px rgba(255, 112, 67, 0.5);
}

/* Danger / Tâm Ma / Nổ lò */
.kx-dialog-danger {
  border-color: var(--crimson-glow);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 45px rgba(255, 23, 68, 0.35);
}
.kx-dialog-danger .kx-dialog-halo {
  background: radial-gradient(circle, rgba(255, 23, 68, 0.4) 0%, transparent 70%);
}
.kx-dialog-danger .kx-dialog-icon {
  border-color: var(--crimson-glow);
  color: var(--crimson-glow);
  box-shadow: 0 0 25px rgba(255, 23, 68, 0.5);
}
.kx-dialog-danger .kx-dialog-title {
  color: var(--crimson-glow);
  text-shadow: 0 0 15px rgba(255, 23, 68, 0.5);
}
.kx-dialog-danger .kx-dialog-btn {
  background: linear-gradient(135deg, #ff1744 0%, #b71c1c 100%);
  color: #fff;
  box-shadow: 0 0 25px rgba(255, 23, 68, 0.5);
}

/* Breakthrough: Lam Lôi Sét Đánh */
.kx-dialog-breakthrough {
  border-color: var(--cyan-glow);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 45px rgba(0, 229, 255, 0.35);
}
.kx-dialog-breakthrough .kx-dialog-halo {
  background: radial-gradient(circle, rgba(0, 229, 255, 0.4) 0%, transparent 70%);
}
.kx-dialog-breakthrough .kx-dialog-icon {
  border-color: var(--cyan-glow);
  color: var(--cyan-glow);
  box-shadow: 0 0 25px rgba(0, 229, 255, 0.5);
}
.kx-dialog-breakthrough .kx-dialog-title {
  color: var(--cyan-glow);
  text-shadow: 0 0 15px rgba(0, 229, 255, 0.5);
}
.kx-dialog-breakthrough .kx-dialog-btn {
  background: linear-gradient(135deg, #00e5ff 0%, #0091ea 100%);
  color: #0a0e17;
  box-shadow: 0 0 25px rgba(0, 229, 255, 0.5);
}

/* ==========================================================
   TOPBAR ICON POPUP & FLOATING TALISMAN (TÁN LỘC THÍ TIÊN)
   ========================================================== */
.kx-icon-popup-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(255, 215, 0, 0.08);
  border: 1px solid var(--border-gold);
  border-radius: 10px;
  padding: 4px 10px;
  color: var(--gold-glow);
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.15);
  outline: none;
}
.kx-icon-popup-btn:hover {
  background: rgba(255, 215, 0, 0.18);
  border-color: var(--gold-glow);
  box-shadow: 0 0 18px rgba(255, 215, 0, 0.4);
  transform: translateY(-2px);
}
.kx-icon-popup-btn i {
  font-size: 1.05rem;
}
.kx-icon-popup-btn .kx-icon-popup-lbl {
  font-size: 0.68rem;
  font-weight: 700;
  margin-top: 2px;
  letter-spacing: 0.3px;
  color: #fce77d;
}

@media (max-width: 480px) {
  .kx-icon-popup-btn {
    padding: 6px 8px;
    height: 34px;
    width: 34px;
  }
  .kx-icon-popup-btn .kx-icon-popup-lbl {
    display: none;
  }
}

/* Floating Talisman Widget (Góc dưới phải màn hình) */
.kx-floating-talisman {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 990;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.25) 0%, rgba(16, 24, 40, 0.95) 100%);
  border: 2px solid var(--gold-glow);
  box-shadow: 0 0 22px rgba(255, 215, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.6);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  backdrop-filter: blur(8px);
}
.kx-floating-talisman:hover {
  transform: scale(1.1) translateY(-4px);
  box-shadow: 0 0 32px rgba(255, 215, 0, 0.65), 0 12px 28px rgba(0, 0, 0, 0.8);
  border-color: #fff;
}
.kx-floating-talisman-icon {
  font-size: 1.25rem;
  color: var(--gold-glow);
  line-height: 1;
  margin-bottom: 2px;
  filter: drop-shadow(0 0 6px rgba(255, 215, 0, 0.8));
}
.kx-floating-talisman-label {
  font-size: 0.62rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

@media (max-width: 767px) {
  .kx-floating-talisman {
    bottom: 16px;
    right: 16px;
    width: 48px;
    height: 48px;
  }
  .kx-floating-talisman-icon {
    font-size: 1.1rem;
  }
  .kx-floating-talisman-label {
    font-size: 0.52rem;
  }
}

/* Interactive Gender Selection Cards */
.kx-gender-select-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
.kx-gender-card {
  cursor: pointer;
  border-radius: 12px;
  padding: 12px 10px;
  text-align: center;
  transition: all 0.25s ease;
  user-select: none;
  background: rgba(0, 0, 0, 0.4);
  border: 1.5px solid rgba(255, 255, 255, 0.15);
}
.kx-gender-card:hover {
  transform: translateY(-2px);
}
.kx-gender-card.active-nam {
  border-color: #00e5ff;
  background: rgba(0, 229, 255, 0.12);
  box-shadow: 0 0 18px rgba(0, 229, 255, 0.3);
}
.kx-gender-card.active-nu {
  border-color: #ff4081;
  background: rgba(255, 64, 129, 0.12);
  box-shadow: 0 0 18px rgba(255, 64, 129, 0.3);
}

/* Thiên Thư Cảnh Giới UI Styles */
.kx-btn-realm-info {
  background: rgba(255, 215, 0, 0.12);
  border: none !important;
  box-shadow: none !important;
  color: var(--gold-glow);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.25s ease;
  backdrop-filter: blur(4px);
}
.kx-btn-realm-info:hover {
  background: rgba(255, 215, 0, 0.28);
  border-color: var(--gold-glow);
  box-shadow: 0 0 14px rgba(255, 215, 0, 0.55);
  transform: translateY(-1px);
}

.kx-realm-card {
  background: rgba(13, 20, 36, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 10px;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}
.kx-realm-card.achieved {
  border-color: rgba(0, 230, 118, 0.35);
  background: rgba(0, 230, 118, 0.04);
}
.kx-realm-card.current {
  border: 2px solid var(--gold-glow);
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.15) 0%, rgba(13, 20, 36, 0.95) 100%);
  box-shadow: 0 0 24px rgba(255, 215, 0, 0.35), inset 0 0 16px rgba(255, 215, 0, 0.1);
}
.kx-realm-card.locked {
  border-color: rgba(255, 255, 255, 0.07);
  opacity: 0.75;
}
.kx-realm-card.locked:hover {
  opacity: 0.95;
  border-color: rgba(0, 229, 255, 0.3);
}

/* =============================================================================
   HỆ THỐNG DANH HIỆU & DANH XƯNG (TITLE BADGES & AURAS)
============================================================================= */

/* Tag danh hiệu mini hiển thị cạnh tên */
.kx-title-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 6px;
  letter-spacing: 0.3px;
  white-space: nowrap;
  user-select: none;
  transition: all 0.25s ease;
  line-height: 1.3;
}
.kx-title-tag.common {
  background: rgba(0, 229, 255, 0.12);
  border: 1px solid rgba(0, 229, 255, 0.4);
  color: #00e5ff;
}
.kx-title-tag.rare {
  background: rgba(118, 255, 3, 0.12);
  border: 1px solid rgba(118, 255, 3, 0.45);
  color: #76ff03;
  box-shadow: 0 0 8px rgba(118, 255, 3, 0.2);
}
.kx-title-tag.epic {
  background: rgba(255, 215, 0, 0.15);
  border: 1px solid rgba(255, 215, 0, 0.5);
  color: #ffd700;
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.25);
}
.kx-title-tag.legendary {
  background: rgba(224, 64, 251, 0.15);
  border: 1px solid rgba(224, 64, 251, 0.55);
  color: #e040fb;
  box-shadow: 0 0 12px rgba(224, 64, 251, 0.3);
}
.kx-title-tag.mythic {
  background: rgba(179, 136, 255, 0.18);
  border: 1px solid rgba(179, 136, 255, 0.6);
  color: #b388ff;
  box-shadow: 0 0 14px rgba(179, 136, 255, 0.35);
}
.kx-title-tag.god {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.3), rgba(255, 23, 68, 0.3));
  border: 1px solid #ff1744;
  color: #fff;
  text-shadow: 0 0 6px #ffd700;
  box-shadow: 0 0 16px rgba(255, 23, 68, 0.45);
  animation: kxPulse 2.5s infinite;
}
.kx-title-tag.supreme {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.35), rgba(224, 64, 251, 0.35));
  border: 1.5px solid #ffd700;
  color: #ffd700;
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.8);
  box-shadow: 0 0 18px rgba(255, 215, 0, 0.5);
  animation: kxPulse 2s infinite;
}

/* Nút Danh Hiệu trên Topbar */
.kx-title-badge-btn {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.15), rgba(0, 229, 255, 0.1));
  border: 1px solid rgba(255, 215, 0, 0.4);
  color: var(--gold-glow);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.25s ease;
  backdrop-filter: blur(6px);
  text-decoration: none;
}
.kx-title-badge-btn:hover {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.28), rgba(0, 229, 255, 0.2));
  border-color: var(--gold-glow);
  box-shadow: 0 0 14px rgba(255, 215, 0, 0.45);
  transform: translateY(-1px);
}

/* Vòng Hào Quang Danh Xưng bay trên đầu nhân vật tại Động Phủ */
.kx-cave-title-banner {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(10, 14, 23, 0.85);
  border: none !important;
  box-shadow: none !important;
  padding: 4px 14px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 0 16px rgba(255, 215, 0, 0.3);
  backdrop-filter: blur(8px);
  margin-bottom: 6px;
}
.kx-cave-title-banner:hover {
  transform: translateY(-2px) scale(1.05);
  border-color: var(--gold-glow);
  box-shadow: 0 0 24px rgba(255, 215, 0, 0.55);
}

/* Card danh hiệu trong Modal Điện Phong Danh */
.kx-title-item-card {
  background: rgba(16, 24, 40, 0.7);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 12px 14px;
  transition: all 0.25s ease;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.kx-title-item-card.equipped {
  border-color: var(--gold-glow);
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.18), rgba(16, 24, 40, 0.9));
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.25);
}
.kx-title-item-card.unlocked:not(.equipped):hover {
  border-color: rgba(0, 229, 255, 0.4);
  background: rgba(16, 24, 40, 0.9);
  transform: translateY(-2px);
}
.kx-title-item-card.locked {
  opacity: 0.6;
  border-color: rgba(255, 255, 255, 0.05);
}

/* =============================================================================
   THIÊN ĐẠO ĐIỆN TABS (CÁC PHÒNG QUẢN TRỊ TU CHÂN GIỚI)
============================================================================= */
@keyframes kxFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.kx-admin-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 18px;
  background: rgba(13, 20, 36, 0.75);
  padding: 8px;
  border-radius: 14px;
  border: 1px solid rgba(255, 215, 0, 0.25);
  box-shadow: 0 4px 25px rgba(0, 0, 0, 0.45);
}

@media (max-width: 900px) {
  .kx-admin-tabs {
    gap: 6px;
    padding: 6px;
  }
  .kx-admin-tab-btn {
    padding: 8px 8px;
    min-height: 50px;
  }
  .kx-admin-tab-btn .tab-main-title {
    font-size: 0.85rem;
  }
  .kx-admin-tab-btn .tab-sub-title {
    font-size: 0.68rem;
  }
}

@media (max-width: 900px) {
  .kx-admin-tabs {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 6px !important;
    padding: 6px !important;
    margin-bottom: 10px !important;
    border-radius: 12px !important;
  }
  .kx-admin-tab-btn {
    padding: 8px 10px !important;
    min-height: 44px !important;
    border-radius: 8px !important;
    gap: 6px !important;
    flex-direction: row !important;
    justify-content: flex-start !important;
    text-align: left !important;
  }
  .kx-admin-tab-btn .tab-main-title {
    font-size: 0.82rem !important;
    gap: 6px !important;
    flex-direction: row !important;
    line-height: 1.2 !important;
    white-space: nowrap !important;
  }
  .kx-admin-tab-btn .tab-main-title i {
    font-size: 0.85rem !important;
  }
  .kx-admin-tab-btn .tab-sub-title {
    display: none !important;
  }
}

@media (max-width: 540px) {
  .kx-admin-tabs {
    gap: 5px !important;
    padding: 5px !important;
  }
  .kx-admin-tab-btn {
    padding: 6px 8px !important;
    min-height: 40px !important;
  }
  .kx-admin-tab-btn .tab-main-title {
    font-size: 0.76rem !important;
    gap: 5px !important;
  }
  .kx-admin-tab-btn .tab-main-title i {
    font-size: 0.82rem !important;
  }
}

.kx-admin-tab-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 4px;
  transition: all 0.25s ease;
  user-select: none;
  min-height: 58px;
}

.kx-admin-tab-btn .tab-main-title {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.95rem;
  font-weight: 700;
  color: #e2e8f0;
}

.kx-admin-tab-btn .tab-sub-title {
  font-size: 0.74rem;
  font-weight: 400;
  color: var(--text-muted);
  opacity: 0.85;
}

.kx-admin-tab-btn:hover {
  background: rgba(255, 215, 0, 0.08);
  color: #fff;
  border-color: rgba(255, 215, 0, 0.35);
  transform: translateY(-2px);
}

.kx-admin-tab-btn:hover .tab-main-title {
  color: #fff;
}

.kx-admin-tab-btn.active {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.2) 0%, rgba(13, 20, 36, 0.95) 100%);
  border-color: var(--gold-glow);
  box-shadow: 0 0 16px rgba(255, 215, 0, 0.3);
}

.kx-admin-tab-btn.active .tab-main-title {
  color: var(--gold-glow);
  font-weight: 800;
}

.kx-admin-tab-btn.active .tab-sub-title {
  color: #fef08a;
  opacity: 0.95;
}

.kx-admin-vietqr-grid {
  display: grid;
  grid-template-columns: minmax(320px, 1.35fr) minmax(280px, 1fr);
  gap: 20px;
  align-items: start;
}

@media (max-width: 860px) {
  .kx-admin-vietqr-grid {
    grid-template-columns: 1fr;
  }
}

.kx-admin-tab-panel {
  display: none;
  animation: kxFadeIn 0.3s ease;
}

.kx-admin-tab-panel.active {
  display: block;
}

/* =============================================================================
   HỆ THỐNG TỐI ƯU HÓA ĐA NỀN TẢNG (PC - TABLET - MOBILE COMPATIBILITY)
   ============================================================================= */

/* 1. iOS / Mobile Input Fix (Tránh Safari tự động phóng to làm vỡ layout) */
input[type="text"],
input[type="password"],
input[type="email"],
input[type="tel"],
input[type="number"],
select,
textarea {
  font-size: 16px !important;
}

/* 2. Tiêu đề linh hoạt & Auth Card */
h1, .kx-page-title {
  font-size: clamp(1.4rem, 4vw, 2.2rem) !important;
}

.kx-auth-card {
  padding: 32px 26px;
}
@media (max-width: 480px) {
  .kx-auth-card {
    padding: 20px 14px;
    border-radius: 14px;
  }
}

/* 3. Bảng Dữ Liệu Co Giãn Vuốt Chạm (Responsive Table Wrapper) */
.kx-table-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.25);
}

.kx-table-wrapper table {
  min-width: 650px;
}

.kx-scroll-hint {
  display: none;
  font-size: 0.76rem;
  color: var(--cyan-glow);
  margin-bottom: 6px;
  align-items: center;
  gap: 5px;
}

@media (max-width: 768px) {
  .kx-scroll-hint {
    display: flex;
  }
}

/* 4. Thẻ Luyện Đan Co Giãn (Alchemy Recipe Responsive Card) */
.kx-recipe-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 16px;
  flex-wrap: wrap;
  gap: 12px;
  transition: all 0.25s ease;
}

.kx-recipe-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(0, 229, 255, 0.25);
}

@media (max-width: 640px) {
  .kx-recipe-item {
    flex-direction: column;
    align-items: stretch;
    padding: 12px;
    gap: 10px;
  }
  .kx-recipe-action {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding-top: 10px;
  }
}

/* 5. Cặp Đôi Tiên Phủ Song Tu (Couple Banner Mobile Responsive) */
.kx-couple-display {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

@media (max-width: 480px) {
  .kx-couple-display {
    gap: 10px;
  }
  .kx-couple-avatar {
    width: 56px !important;
    height: 56px !important;
    font-size: 1.5rem !important;
  }
  .kx-couple-line {
    width: 45px !important;
  }
  .kx-couple-heart {
    font-size: 1.6rem !important;
  }
}

/* 6. Luân Hồi Điện Thần Thông Grid Responsive */
.kx-reincarnation-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
  max-width: 1040px;
  margin: 0 auto 36px auto;
}

@media (max-width: 960px) {
  .kx-reincarnation-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
}

@media (max-width: 640px) {
  .kx-reincarnation-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

/* 7. Luân Hồi Stats Banner Mobile Fix */
@media (max-width: 640px) {
  .kx-reincarnation-stat-divider {
    display: none !important;
  }
  .kx-reincarnation-stats-box {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 12px !important;
  }
  .kx-reincarnation-stats-box > div:last-child {
    grid-column: 1 / -1;
  }
}

/* 8. Tối ưu Touch Feedback trên Di Động */
.kx-btn, .kx-tab-item, .kx-cultivator-wrapper, .kx-bamboo-tube, .kx-furnace-body, .kx-dock-item {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

/* =========================================================================
   THANH PHÁP BẢO TIÊN TUNG - BOTTOM NAVIGATION BAR (DẢI ĐÁY CỐ ĐỊNH TOÀN DẢI)
========================================================================= */
.kx-floating-dock {
  position: fixed !important;
  bottom: 0 !important;
  left: 50% !important;
  right: auto !important;
  transform: translateX(-50%) !important;
  top: auto !important;
  width: 100% !important;
  max-width: var(--kx-app-max-w, 768px) !important;
  height: calc(var(--kx-bottom-dock-h, 52px) + env(safe-area-inset-bottom, 0px)) !important;
  z-index: 1050 !important;
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  background: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  padding: 3px 12px !important;
  padding-bottom: max(3px, env(safe-area-inset-bottom, 3px)) !important;
  box-sizing: border-box !important;
  border: none !important;
  border-top: none !important;
  border-left: none !important;
  border-right: none !important;
  border-bottom: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  margin: 0 !important;
  overflow: hidden !important;
  overflow-x: hidden !important;
  overflow-y: hidden !important;
  scrollbar-width: none !important;
  user-select: none !important;
  touch-action: manipulation !important;
  transition: none !important;
}

@media (max-width: 768px) {
  .kx-floating-dock {
    left: 0 !important;
    transform: none !important;
    max-width: 100% !important;
    border-left: none !important;
    border-right: none !important;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.6) !important;
  }
}

.kx-floating-dock::-webkit-scrollbar {
  display: none !important;
}

.kx-dock-item {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  max-width: none;
  height: 46px;
  border-radius: 12px;
  background: transparent !important;
  border: none !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  color: var(--text-muted);
  padding: 2px 2px;
  box-sizing: border-box;
  overflow: hidden;
}

.kx-dock-item .kx-dock-icon {
  font-size: 1.05rem;
  line-height: 1;
  margin-bottom: 2px;
  transition: transform 0.2s ease, filter 0.2s ease;
}

.kx-dock-item .kx-dock-label {
  font-size: 0.62rem;
  font-weight: 700;
  font-family: var(--font-heading);
  line-height: 1;
  letter-spacing: 0.2px;
  color: #cbd5e1;
  text-align: center;
  white-space: nowrap;
}

/* Tooltip bay lên trên khi hover ở menu bottom */
.kx-dock-item .kx-dock-tooltip {
  position: absolute;
  bottom: calc(100% + 10px);
  top: auto;
  left: 50%;
  right: auto;
  transform: translateX(-50%) translateY(4px);
  background: rgba(10, 16, 30, 0.96);
  border: 1px solid var(--border-cyan);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.7), 0 0 12px rgba(0, 229, 255, 0.3);
  color: #fff;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  backdrop-filter: blur(10px);
  z-index: 1100;
}

.kx-dock-item .kx-dock-tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 5px;
  border-style: solid;
  border-color: rgba(10, 16, 30, 0.96) transparent transparent transparent;
}

.kx-dock-item:hover {
  border-color: rgba(0, 229, 255, 0.5);
  box-shadow: 0 0 14px rgba(0, 229, 255, 0.4);
  color: #fff;
}

.kx-dock-item:hover .kx-dock-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.kx-dock-item:hover .kx-dock-icon {
  transform: scale(1.1);
}

/* 1. ĐỘNG PHỦ (Thanh Khiết Lam) */
.kx-dock-item.cave {
  border-color: rgba(0, 229, 255, 0.28);
}
.kx-dock-item.cave .kx-dock-icon { color: var(--cyan-glow); }
.kx-dock-item.cave:hover { border-color: var(--cyan-glow); box-shadow: 0 0 18px rgba(0, 229, 255, 0.5); }
.kx-dock-item.cave.active {
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.25) 0%, rgba(13, 20, 36, 0.98) 100%);
  border-color: var(--cyan-glow);
  box-shadow: 0 0 20px rgba(0, 229, 255, 0.6), inset 0 0 10px rgba(0, 229, 255, 0.2);
}
.kx-dock-item.cave.active .kx-dock-label { color: #fff; font-weight: 900; }
.kx-dock-item.cave.active::after {
  background: var(--cyan-glow);
  box-shadow: 0 0 8px var(--cyan-glow);
}


/* 3. TU NHÂN (Vị Trí Trung Tâm Thứ 3 - Hero Centerpiece) */
.kx-dock-item.nhanvat {
  flex: 1.18 1 0 !important;
  height: 52px !important;
  margin-top: -6px !important;
  border-radius: 14px !important;
  background: linear-gradient(180deg, rgba(0, 229, 255, 0.14) 0%, rgba(13, 20, 36, 0.98) 100%) !important;
  border: 1.5px solid rgba(0, 229, 255, 0.45) !important;
  box-shadow: 0 -3px 14px rgba(0, 229, 255, 0.25), 0 4px 10px rgba(0, 0, 0, 0.5) !important;
  z-index: 5;
}
.kx-dock-item.nhanvat .kx-dock-icon {
  font-size: 1.3rem !important;
  color: var(--cyan-glow) !important;
  margin-bottom: 2px !important;
  filter: drop-shadow(0 0 6px rgba(0, 229, 255, 0.6));
}
.kx-dock-item.nhanvat .kx-dock-label {
  font-size: 0.66rem !important;
  font-weight: 800 !important;
  color: #fff !important;
  letter-spacing: 0.3px !important;
}
.kx-dock-item.nhanvat:hover {
  border-color: var(--gold-glow) !important;
  box-shadow: 0 -4px 18px rgba(255, 215, 0, 0.4) !important;
  transform: translateY(-2px);
}
.kx-dock-item.nhanvat.active {
  background: linear-gradient(180deg, rgba(255, 215, 0, 0.25) 0%, rgba(13, 20, 36, 0.98) 100%) !important;
  border-color: var(--gold-glow) !important;
  box-shadow: 0 -4px 22px rgba(255, 215, 0, 0.65), inset 0 0 12px rgba(255, 215, 0, 0.25) !important;
}
.kx-dock-item.nhanvat.active .kx-dock-icon {
  color: var(--gold-glow) !important;
  filter: drop-shadow(0 0 8px var(--gold-glow));
}
.kx-dock-item.nhanvat.active .kx-dock-label {
  color: #fff !important;
  font-weight: 900 !important;
}
.kx-dock-item.nhanvat.active::after {
  background: var(--gold-glow) !important;
  box-shadow: 0 0 8px var(--gold-glow) !important;
}

/* 2. LỊCH LUYỆN (Bích Lục Sơn Hà) */
.kx-dock-item.lichluyen {
  border-color: rgba(0, 230, 118, 0.28);
}
.kx-dock-item.lichluyen .kx-dock-icon { color: #00e676; }
.kx-dock-item.lichluyen:hover { border-color: #00e676; box-shadow: 0 0 18px rgba(0, 230, 118, 0.5); }
.kx-dock-item.lichluyen.active {
  background: linear-gradient(135deg, rgba(0, 230, 118, 0.25) 0%, rgba(13, 20, 36, 0.98) 100%);
  border-color: #00e676;
  box-shadow: 0 0 20px rgba(0, 230, 118, 0.6), inset 0 0 10px rgba(0, 230, 118, 0.2);
}
.kx-dock-item.lichluyen.active .kx-dock-label { color: #fff; font-weight: 900; }
.kx-dock-item.lichluyen.active::after {
  background: #00e676;
  box-shadow: 0 0 8px #00e676;
}

/* 3. HỒNG TRẦN (Hồng Duyên Đạo Lữ) */
.kx-dock-item.hongtran {
  border-color: rgba(255, 64, 129, 0.28);
}
.kx-dock-item.hongtran .kx-dock-icon { color: #ff4081; }
.kx-dock-item.hongtran:hover { border-color: #ff4081; box-shadow: 0 0 18px rgba(255, 64, 129, 0.5); }
.kx-dock-item.hongtran.active {
  background: linear-gradient(135deg, rgba(255, 64, 129, 0.25) 0%, rgba(13, 20, 36, 0.98) 100%);
  border-color: #ff4081;
  box-shadow: 0 0 20px rgba(255, 64, 129, 0.6), inset 0 0 10px rgba(255, 64, 129, 0.2);
}
.kx-dock-item.hongtran.active .kx-dock-label { color: #fff; font-weight: 900; }
.kx-dock-item.hongtran.active::after {
  background: #ff4081;
  box-shadow: 0 0 8px #ff4081;
}

/* 4. THIÊN ĐẠO (Hoàng Kim Vận Mệnh) */
.kx-dock-item.thiendao {
  border-color: rgba(255, 215, 0, 0.28);
}
.kx-dock-item.thiendao .kx-dock-icon { color: var(--gold-glow); }
.kx-dock-item.thiendao:hover { border-color: var(--gold-glow); box-shadow: 0 0 18px rgba(255, 215, 0, 0.5); }
.kx-dock-item.thiendao.active {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.25) 0%, rgba(13, 20, 36, 0.98) 100%);
  border-color: var(--gold-glow);
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.6), inset 0 0 10px rgba(255, 215, 0, 0.2);
}
.kx-dock-item.thiendao.active .kx-dock-label { color: #fff; font-weight: 900; }
.kx-dock-item.thiendao.active::after {
  background: var(--gold-glow);
  box-shadow: 0 0 8px var(--gold-glow);
}

/* Vạch sáng báo hiệu Active dưới chân icon */
.kx-dock-item.active::after {
  content: "";
  position: absolute;
  bottom: 2px;
  left: 50%;
  top: auto;
  right: auto;
  transform: translateX(-50%);
  width: 18px;
  height: 3px;
  border-radius: 2px;
}

/* Tablet & PC */
@media (min-width: 768px) {
  .kx-floating-dock {
    justify-content: center !important;
    gap: 16px !important;
    border-radius: 0 !important;
  }
  .kx-dock-item {
    flex: 0 0 110px !important;
    width: 110px !important;
    height: 42px !important;
    border-radius: 10px;
  }
  .kx-dock-item.nhanvat {
    flex: 0 0 126px !important;
    width: 126px !important;
    height: 50px !important;
    margin-top: -6px !important;
    border-radius: 12px !important;
  }
  .kx-dock-item .kx-dock-icon {
    font-size: 1.12rem;
  }
  .kx-dock-item .kx-dock-label {
    font-size: 0.68rem;
  }
}

/* Mobile */
@media (max-width: 767px) {
  .kx-floating-dock {
    justify-content: space-around !important;
    gap: 4px !important;
    padding: 3px 6px !important;
    padding-bottom: max(3px, env(safe-area-inset-bottom, 3px)) !important;
    border-radius: 0 !important;
  }
  .kx-dock-item {
    flex: 1 1 0 !important;
    min-width: 0 !important;
    max-width: 90px !important;
    height: 42px !important;
    padding: 2px 2px !important;
    border-radius: 10px !important;
  }
  .kx-dock-item.nhanvat {
    flex: 1.15 1 0 !important;
    max-width: 95px !important;
    height: 48px !important;
    margin-top: -5px !important;
    border-radius: 10px !important;
  }
  .kx-dock-item:active {
    transform: scale(0.95);
  }
  .kx-dock-item .kx-dock-icon {
    font-size: 1.12rem;
    margin-bottom: 2px;
  }
  .kx-dock-item .kx-dock-label {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0;
  }
}

/* =========================================================================
   CÁC GIAO DIỆN TÍNH NĂNG CỦA DOCK (FULLSCREEN VIEWS TRONG #kx-view-stack)
   Mỗi nút dock = một giao diện full màn hình lấp kín không gian tiên giới
========================================================================= */
.kx-view-stack {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.kx-feature-modal {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 20;
  display: flex;
  justify-content: center;
  align-items: stretch;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.25s cubic-bezier(0.16, 1, 0.3, 1), transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.kx-feature-modal.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: none;
}

/* Khi một giao diện tính năng đang mở: ẩn Động Phủ & thanh trạng thái riêng */
body.kx-view-active .kx-cave-stage {
  visibility: hidden;
  pointer-events: none;
}
body.kx-view-active .kx-cave-status-strip {
  display: none !important;
}

.kx-feature-modal-box {
  --kx-view-bg: url('/static/img/floating_xianxia_mountains.jpg');
  width: 100%;
  height: 100%;
  background:
    linear-gradient(180deg, rgba(8, 12, 22, 0.8) 0%, rgba(8, 12, 22, 0.9) 55%, rgba(8, 12, 22, 0.96) 100%),
    var(--kx-view-bg) center / cover no-repeat,
    #0c1424;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* Ảnh nền riêng cho từng giao diện */
.kx-view-divination .kx-feature-modal-box { --kx-view-bg: url('/static/img/divination_tube.jpg'); }
.kx-view-alchemy .kx-feature-modal-box { --kx-view-bg: url('/static/img/alchemy_furnace.jpg'); }
.kx-view-travel .kx-feature-modal-box { --kx-view-bg: url('/static/img/thon_tran_hong_tran.jpg'); }
.kx-view-marriage .kx-feature-modal-box { --kx-view-bg: url('/static/img/hac_phong_linh.jpg'); }
.kx-view-reincarnation .kx-feature-modal-box { --kx-view-bg: url('/static/img/luan_hoi_dien.jpg'); }
.kx-view-sect .kx-feature-modal-box,
.kx-view-tongmon .kx-feature-modal-box,
.kx-view-phongthan .kx-feature-modal-box { --kx-view-bg: url('/static/img/bong_lai_tien_dao.jpg'); }
.kx-view-super .kx-feature-modal-box { --kx-view-bg: url('/static/img/bi_canh_co_mo.jpg'); }
.kx-view-bequan .kx-feature-modal-box { --kx-view-bg: url('/static/img/cultivator_meditating.jpg'); }
.kx-view-danghuong .kx-feature-modal-box { --kx-view-bg: url('/static/img/hac_phong_linh.jpg'); }
.kx-view-danduoc .kx-feature-modal-box { --kx-view-bg: url('/static/img/alchemy_furnace.jpg'); }
.kx-view-dongphu .kx-feature-modal-box { --kx-view-bg: url('/static/img/floating_xianxia_mountains.jpg'); }
.kx-view-dotpha .kx-feature-modal-box { --kx-view-bg: url('/static/img/bi_canh_co_mo.jpg'); }
.kx-view-thienthu .kx-feature-modal-box { --kx-view-bg: url('/static/img/luan_hoi_dien.jpg'); }
.kx-view-danhhieu .kx-feature-modal-box { --kx-view-bg: url('/static/img/bong_lai_tien_dao.jpg'); }
.kx-view-donate .kx-feature-modal-box { --kx-view-bg: url('/static/img/hac_phong_linh.jpg'); }
.kx-view-hoso .kx-feature-modal-box { --kx-view-bg: url('/static/img/cultivator_meditating.jpg'); }

/* Khung Card Modal Nổi Kính Mờ Căn Giữa Cả 2 Chiều X và Y */
.kx-view-global-panel .kx-modal-box,
.kx-modal-box {
  background: rgba(10, 16, 28, 0.86) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  border: 1px solid rgba(0, 229, 255, 0.28) !important;
  border-radius: 18px !important;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.75), 0 0 25px rgba(0, 229, 255, 0.1) !important;
  margin: auto !important;
  box-sizing: border-box !important;
  max-height: calc(100dvh - var(--kx-header-h, 50px) - var(--kx-top-action-h, 46px) - var(--kx-bottom-dock-h, 56px) - 24px);
  overflow-y: auto !important;
}

/* Xoá bỏ hoàn toàn nút thoát thừa trên giao diện */
.kx-feature-modal-close,
.kx-feature-modal .kx-feature-modal-close {
  display: none !important;
}
.kx-view-tabs-moved {
  display: none !important;
}

/* Header Modal Tinh Gọn */
.kx-feature-modal-header {
  padding-top: calc(var(--kx-header-h, 48px) + var(--kx-top-action-h, 50px) + 18px) !important;
  padding-left: 18px !important;
  padding-right: 18px !important;
  padding-bottom: 8px !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: center;
  align-items: center;
  background: transparent;
  flex-shrink: 0;
}

.kx-feature-modal-title {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: center;
}
.kx-feature-modal-title i {
  font-size: 1.25rem;
}
.kx-feature-modal-title h3 {
  margin: 0;
  font-size: 1.05rem;
  font-family: var(--font-heading);
  letter-spacing: 0.5px;
}
.kx-feature-modal-title span {
  font-size: 0.72rem;
  color: var(--text-muted);
  display: block;
  margin-top: 1px;
}

/* Body Modal: Cuộn mượt mà từ trên xuống dưới (flex-start) tránh bị che khuất phần trên */
.kx-feature-modal-body {
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: flex-start !important;
  padding: 12px 14px calc(var(--kx-bottom-dock-h, 52px) + 24px + env(safe-area-inset-bottom, 0px)) 14px !important;
  box-sizing: border-box !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 229, 255, 0.3) transparent;
}

/* Các khối nội dung con trong body luôn cân giữa X */
.kx-feature-modal-body > * {
  margin-left: auto !important;
  margin-right: auto !important;
}

@media (max-width: 767px) {
  .kx-feature-modal-header {
    padding-top: calc(var(--kx-header-h, 44px) + var(--kx-top-action-h, 46px) + 14px) !important;
    padding-left: 10px !important;
    padding-right: 10px !important;
    padding-bottom: 6px !important;
  }
  .kx-feature-modal-title h3 {
    font-size: 0.95rem;
  }
  .kx-feature-modal-title span {
    font-size: 0.68rem;
  }
  .kx-feature-modal-body {
    padding: 10px 8px calc(var(--kx-bottom-dock-h, 48px) + 20px + env(safe-area-inset-bottom, 0px)) 8px !important;
    justify-content: flex-start !important;
  }
}

.kx-feature-modal-body::-webkit-scrollbar {
  width: 6px;
}
.kx-feature-modal-body::-webkit-scrollbar-thumb {
  background: rgba(0, 229, 255, 0.3);
  border-radius: 4px;
}

/* =========================================================================
   THANH STATUS TIỂU BẢNG ĐẠO VẬN (TRONG CAVE - COMPACT FLUID)
========================================================================= */
.kx-cave-status-strip {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 2px auto 4px auto;
  max-width: 820px;
  flex-shrink: 0;
}
.kx-status-pill {
  background: rgba(13, 20, 36, 0.75);
  border: 1px solid rgba(0, 229, 255, 0.2);
  border-radius: 14px;
  padding: 3px 10px;
  font-size: 0.72rem;
  color: #e2e8f0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(8px);
}
.kx-status-pill:hover {
  border-color: var(--border-cyan);
  background: rgba(0, 229, 255, 0.12);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 229, 255, 0.2);
}

@media (max-width: 767px) {
  .kx-cave-status-strip {
    gap: 4px;
    margin: 1px auto 2px auto;
  }
  .kx-status-pill {
    padding: 2px 7px;
    font-size: 0.65rem;
    border-radius: 10px;
    gap: 3px;
  }
}

/* =========================================================================
   THANH ACTION MENU ĐẦU MÀN HÌNH (MENU TOP ACTION BAR - FLOATING HUD PILL)
========================================================================= */
.kx-bottom-action-bar {
  position: fixed;
  top: calc(var(--kx-header-h, 48px) + 12px);
  bottom: auto;
  left: 50% !important;
  right: auto !important;
  transform: translateX(-50%) !important;
  height: var(--kx-top-action-h, 50px);
  z-index: 920;
  background: transparent !important;
  background-color: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border: none !important;
  box-shadow: none !important;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 4px 12px;
  border-radius: 26px;
  margin: 0;
  box-sizing: border-box;
  overflow: visible;
  user-select: none;
  touch-action: manipulation;
  transition: all 0.2s ease;
}

.kx-bottom-action-bar.active {
  display: flex !important;
}

@media (min-width: 768px) {
  .kx-bottom-action-bar {
    width: max-content;
    min-width: 440px;
    max-width: min(740px, calc(100vw - 24px));
    justify-content: center;
    gap: 8px;
    padding: 4px 16px;
    border-radius: 26px;
  }
  .kx-bottom-action-bar .kx-bottom-action-btn {
    min-width: 80px;
  }
}

@media (max-width: 767px) {
  .kx-bottom-action-bar {
    top: calc(var(--kx-header-h, 44px) + 8px);
    height: var(--kx-top-action-h, 46px);
    width: calc(100% - 16px);
    max-width: 480px;
    padding: 3px 6px;
    gap: 4px;
    border-radius: 22px;
  }
  .kx-bottom-action-bar .kx-bottom-action-btn {
    flex: 1 1 0;
    min-width: 0;
    padding: 2px 2px;
  }
  .kx-bottom-action-bar .kx-bottom-action-lbl {
    font-size: 0.62rem;
    letter-spacing: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .kx-bottom-action-bar .kx-bottom-action-sub {
    font-size: 0.52rem;
  }
}

.kx-bottom-action-btn {
  background: none;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  cursor: pointer;
  padding: 3px 6px;
  border-radius: 12px;
  position: relative;
  min-width: 48px;
  height: 100%;
  box-sizing: border-box;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  user-select: none;
}
.kx-bottom-action-btn:hover {
  color: var(--cyan-glow);
  transform: translateY(1px);
  background: transparent !important;
}
.kx-bottom-action-btn:active {
  transform: scale(0.92);
}
.kx-bottom-action-btn.action-tap {
  background: transparent !important;
  border: none !important;
  color: var(--cyan-glow);
  box-shadow: none !important;
}
.kx-bottom-action-icon {
  font-size: 1.05rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.kx-bottom-action-lbl {
  font-size: 0.65rem;
  font-weight: 700;
  font-family: var(--font-heading);
  letter-spacing: 0.2px;
  white-space: nowrap;
  line-height: 1.1;
}
.kx-bottom-action-sub {
  font-size: 0.56rem;
  color: var(--gold-glow);
  font-weight: 700;
  margin-top: 1px;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1;
  display: block;
}
.kx-bottom-action-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: var(--gold-glow);
  color: #000;
  font-size: 0.56rem;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 6px;
  animation: kxPulse 1.5s infinite;
  line-height: 1.2;
}
.kx-bottom-action-dot {
  position: absolute;
  top: 4px;
  right: 6px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #00e676;
  box-shadow: 0 0 8px #00e676;
}

/* Nút Đột Phá Lôi Kiếp Nhanh Ở Đáy */
.kx-bottom-breakthrough-pill {
  background: linear-gradient(135deg, #ffd700, #ff9100);
  color: #000;
  font-weight: 800;
  border: none;
  border-radius: 22px;
  padding: 8px 14px;
  font-size: 0.75rem;
  font-family: var(--font-heading);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.7);
  animation: kxPulseGold 1.5s infinite;
  cursor: pointer;
  transition: all 0.2s ease;
}
@keyframes kxPulseGold {
  0% { box-shadow: 0 0 10px rgba(255, 215, 0, 0.5); }
  50% { box-shadow: 0 0 25px rgba(255, 215, 0, 0.9), 0 0 40px rgba(255, 145, 0, 0.6); }
  100% { box-shadow: 0 0 10px rgba(255, 215, 0, 0.5); }
}

/* Mỗi giao diện có một thanh chức năng đáy riêng (data-view); chỉ thanh của giao diện đang mở hiện ra */
.kx-bottom-action-bar:not(.active) {
  display: none;
}
/* Nút dạng tab (Phong Thần, Thiên Đạo) đang chọn */
.kx-bottom-action-btn.is-current {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  color: var(--cyan-glow);
}
/* Nút hành động chính của giao diện (Thỉnh Quẻ, Luân Hồi...) */
.kx-bottom-action-btn.action-main {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  color: var(--gold-glow);
}
.kx-bottom-action-btn.action-main .kx-bottom-action-lbl {
  color: var(--gold-glow);
}

/* =========================================================================
   BOTTOM SHEET PANELS CHO ACTION MENU
========================================================================= */
.kx-bottom-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  z-index: 940;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}
.kx-bottom-overlay.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.kx-bottom-sheet-panel {
  position: fixed;
  z-index: 950;
  background: rgba(11, 17, 30, 0.97);
  backdrop-filter: blur(24px);
  border: 1.5px solid var(--border-cyan);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 -12px 50px rgba(0, 0, 0, 0.9);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
}

/* Trên Mobile: Slide từ đáy màn hình */
@media (max-width: 767px) {
  .kx-bottom-sheet-panel {
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 82vh;
    border-radius: 22px 22px 0 0;
    transform: translateY(105%);
  }
  .kx-bottom-sheet-panel.open {
    transform: translateY(0);
  }
}

/* Trên Desktop: Floating Dialog nổi phía trên bottom bar */
@media (min-width: 768px) {
  .kx-bottom-sheet-panel {
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%) translateY(30px);
    opacity: 0;
    pointer-events: none;
    width: 90%;
    max-width: 660px;
    max-height: calc(100dvh - 80px);
    border-radius: 18px;
  }
  .kx-bottom-sheet-panel.open {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: auto;
  }
}

.kx-sheet-handle-bar {
  display: flex;
  justify-content: center;
  padding: 8px 0 2px 0;
}
.kx-sheet-handle {
  width: 42px;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}
.kx-sheet-header {
  padding: 10px 18px 12px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.kx-sheet-title {
  display: flex;
  align-items: center;
  gap: 10px;
}
.kx-sheet-title i {
  font-size: 1.3rem;
}
.kx-sheet-title h4 {
  margin: 0;
  font-size: 1.1rem;
  font-family: var(--font-heading);
}
.kx-sheet-title span {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: block;
}
.kx-sheet-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
}
.kx-sheet-close-btn:hover {
  color: #fff;
}
.kx-sheet-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px 24px 18px;
}

/* Đảm bảo nội dung trang không bị che khuất bởi Bottom Bar */
body {
  padding-bottom: 74px !important;
}


/* =========================================================================
   VẤN ĐẠO: 3 KHUNG (VẤN TIÊN · THỈNH QUẺ · KẾT GIAO) - chuyển bằng thanh đáy
========================================================================= */
.kx-vd-panel {
  display: none;
}
.kx-vd-panel.active {
  display: block;
}
/* Khi đang ở Kết Giao: thân giao diện không cuộn, khung chat lấp đầy chiều cao */
.kx-view-divination.vd-chat .kx-feature-modal-body {
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.kx-vd-panel.kx-chat.active {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 12px;
  flex: 1 1 auto;
  min-height: 0;
}

/* ----- Danh sách kênh ----- */
.kx-chat-sidebar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(0, 229, 255, 0.18);
  border-radius: 12px;
  padding: 8px;
}
.kx-chat-sidebar-actions {
  display: flex;
  gap: 6px;
}
.kx-chat-mini-btn {
  flex: 1 1 0;
  background: transparent !important;
  border: 1px solid rgba(0, 229, 255, 0.3);
  color: var(--cyan-glow);
  border-radius: 8px;
  padding: 5px 6px;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.kx-chat-mini-btn:hover {
  background: rgba(0, 229, 255, 0.18);
}
.kx-chat-channel-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.kx-chat-section-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  margin: 6px 4px 2px;
}
.kx-chat-channel {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 9px;
  cursor: pointer;
  border: 1px solid transparent;
  background: none;
  color: inherit;
  text-align: left;
  width: 100%;
}
.kx-chat-channel:hover {
  background: rgba(255, 255, 255, 0.05);
}
.kx-chat-channel.active {
  background: rgba(0, 229, 255, 0.1);
  border-color: rgba(0, 229, 255, 0.35);
}
.kx-chat-channel-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  font-size: 0.8rem;
}
.kx-chat-channel-text {
  min-width: 0;
  flex: 1 1 auto;
}
.kx-chat-channel-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kx-chat-channel-preview {
  font-size: 0.68rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kx-chat-unread {
  background: #ff4081;
  color: #fff;
  font-size: 0.62rem;
  font-weight: 800;
  border-radius: 9px;
  padding: 1px 6px;
  flex-shrink: 0;
}

/* ----- Ô tìm tu sĩ / lập nhóm ----- */
.kx-chat-picker {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px dashed rgba(255, 215, 0, 0.4);
  border-radius: 10px;
  padding: 8px;
}
.kx-chat-picker-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--gold-glow);
}
.kx-chat-picker input {
  width: 100%;
  padding: 6px 10px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border-cyan);
  border-radius: 8px;
  color: #fff;
  font-size: 0.8rem;
  outline: none;
}
.kx-chat-picker-results {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 160px;
  overflow-y: auto;
}
.kx-chat-picker-item {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 7px;
  padding: 5px 8px;
  color: #fff;
  font-size: 0.75rem;
  text-align: left;
  cursor: pointer;
}
.kx-chat-picker-item:hover {
  border-color: var(--cyan-glow);
}
.kx-chat-picker-item small {
  color: var(--text-muted);
  font-family: monospace;
}

/* ----- Khung trò chuyện ----- */
.kx-chat-main {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(0, 229, 255, 0.18);
  border-radius: 12px;
  overflow: hidden;
}
.kx-chat-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.3);
}
.kx-chat-title {
  font-weight: 800;
  color: var(--gold-glow);
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kx-chat-subtitle {
  font-size: 0.7rem;
  color: var(--text-muted);
}
.kx-chat-head-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.kx-chat-messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.kx-chat-empty {
  margin: auto;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-align: center;
}
.kx-chat-msg {
  max-width: 78%;
  align-self: flex-start;
}
.kx-chat-msg.mine {
  align-self: flex-end;
  text-align: right;
}
.kx-chat-msg-meta {
  font-size: 0.66rem;
  color: var(--text-muted);
  margin-bottom: 2px;
}
.kx-chat-msg-meta b {
  color: var(--cyan-glow);
}
.kx-chat-msg.mine .kx-chat-msg-meta b {
  color: var(--gold-glow);
}
.kx-chat-msg-bubble {
  display: inline-block;
  text-align: left;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px 12px 12px 4px;
  padding: 6px 10px;
  font-size: 0.85rem;
  color: #e5e7eb;
  white-space: pre-wrap;
  word-break: break-word;
}
.kx-chat-msg.mine .kx-chat-msg-bubble {
  background: rgba(0, 229, 255, 0.12);
  border-color: rgba(0, 229, 255, 0.3);
  border-radius: 12px 12px 4px 12px;
}
.kx-chat-msg-del {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.62rem;
  cursor: pointer;
  padding: 0 4px;
}
.kx-chat-msg-del:hover {
  color: #ff5252;
}
.kx-chat-input {
  display: flex;
  gap: 6px;
  padding: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.kx-chat-input input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border-cyan);
  border-radius: 10px;
  color: #fff;
  font-size: 0.88rem;
  outline: none;
}
.kx-chat-input .kx-btn {
  padding: 8px 14px;
}

/* Mobile: danh sách kênh thành một hàng cuộn ngang phía trên khung chat */
@media (max-width: 767px) {
  .kx-vd-panel.kx-chat.active {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    gap: 8px;
  }
  .kx-chat-sidebar {
    padding: 6px;
    gap: 6px;
  }
  .kx-chat-channel-list {
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
  }
  .kx-chat-section-label {
    display: none;
  }
  .kx-chat-channel {
    width: auto;
    flex: 0 0 auto;
    max-width: 150px;
    padding: 5px 8px;
  }
  .kx-chat-channel-preview {
    display: none;
  }
  .kx-chat-msg {
    max-width: 90%;
  }
}

/* =========================================================================
   TRANG ĐĂNG NHẬP / ĐĂNG KÝ: vừa một màn hình, tự cuộn nếu màn hình quá thấp
========================================================================= */
.kx-auth-wrap {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 10px 2px 16px;
  scrollbar-width: thin;
}
.kx-auth-wrap .kx-auth-card {
  padding: 20px 22px;
}
.kx-reg-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 14px;
}
.kx-reg-head > i {
  font-size: 2rem;
  color: var(--cyan-glow);
}
.kx-reg-head h2 {
  color: var(--cyan-glow);
  font-size: 1.3rem;
  font-family: var(--font-heading);
  margin: 0;
}
.kx-reg-head p {
  margin: 2px 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.kx-reg-head p i,
.kx-reg-head p b {
  color: var(--gold-glow);
}
.kx-reg-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
  margin-bottom: 14px;
}
.kx-reg-span {
  grid-column: 1 / -1;
}
.kx-reg-field label {
  display: block;
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kx-reg-field label small {
  font-size: 0.68rem;
  opacity: 0.8;
}
.kx-reg-field input,
.kx-reg-field select {
  width: 100%;
  padding: 9px 12px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border-cyan);
  border-radius: 9px;
  color: #fff;
  font-size: 0.92rem;
  outline: none;
}
.kx-reg-field select {
  background: #1e293b;
  font-size: 0.85rem;
}
.kx-reg-field input:focus,
.kx-reg-field select:focus {
  border-color: var(--gold-glow);
}
.kx-reg-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: -4px;
}
.kx-reg-hint i {
  color: var(--cyan-glow);
}
.kx-reg-gender {
  margin-bottom: 0;
  gap: 10px;
}
.kx-reg-gender .kx-gender-card {
  padding: 8px 10px;
  font-size: 0.88rem;
}
.kx-reg-submit {
  width: 100%;
  padding: 11px;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.5px;
}
.kx-reg-switch {
  text-align: center;
  margin-top: 12px;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.kx-reg-switch a {
  color: var(--gold-glow);
  font-weight: 700;
  text-decoration: none;
  margin-left: 4px;
}
@media (max-width: 480px) {
  .kx-auth-wrap .kx-auth-card {
    padding: 14px 12px;
  }
  .kx-reg-grid {
    gap: 8px 8px;
  }
  .kx-reg-field input,
  .kx-reg-field select {
    padding: 8px 10px;
    font-size: 0.88rem;
  }
}
@media (max-width: 340px) {
  .kx-reg-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
/* Trang đăng nhập/đăng ký không có thanh chức năng đáy: bỏ khoảng chừa 58px phía dưới */
main.kx-container:has(.kx-auth-wrap) {
  padding-bottom: 8px !important;
}
/* Màn hình thấp (laptop 13", trình duyệt có nhiều thanh công cụ): thu gọn thêm để vừa một màn hình */
@media (max-height: 720px) {
  .kx-auth-wrap {
    padding-top: 4px;
    padding-bottom: 6px;
  }
  .kx-auth-wrap .kx-auth-card {
    padding: 12px 18px;
  }
  .kx-reg-head {
    margin-bottom: 8px;
  }
  .kx-reg-head > i {
    font-size: 1.5rem;
  }
  .kx-reg-head h2 {
    font-size: 1.1rem;
  }
  .kx-reg-grid {
    gap: 6px 12px;
    margin-bottom: 10px;
  }
  .kx-reg-field label {
    margin-bottom: 2px;
  }
  .kx-reg-field input,
  .kx-reg-field select {
    padding: 6px 10px;
  }
  .kx-reg-gender .kx-gender-card {
    padding: 5px 8px;
  }
  .kx-reg-submit {
    padding: 8px;
  }
  .kx-reg-switch {
    margin-top: 6px;
  }
}

/* =========================================================================
   GIAO DIỆN TÁN LỘC THÍ TIÊN (1-VIEW BALANCED 2-COLUMN CENTERED LAYOUT)
========================================================================= */
.kx-donate-modal-box {
  max-width: 820px !important;
  width: 100% !important;
  padding: 16px 20px !important;
  margin: auto !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
  background: rgba(10, 16, 28, 0.88) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  border: 1.5px solid rgba(255, 215, 0, 0.35) !important;
  border-radius: 20px !important;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.8), 0 0 25px rgba(255, 215, 0, 0.12) !important;
  box-sizing: border-box !important;
}
.kx-donate-head {
  text-align: center;
}
.kx-donate-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--gold-glow);
  font-family: var(--font-heading);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.kx-donate-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.kx-donate-bank-badge {
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--border-cyan);
  border-radius: 10px;
  padding: 6px 14px;
  font-size: 0.82rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.kx-donate-bank-hint {
  color: var(--text-muted);
  font-size: 0.75rem;
}
.kx-donate-twocol {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 14px;
  align-items: stretch;
}
.kx-donate-grid-compact {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.kx-donate-pack-btn {
  cursor: pointer;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--pack-color, rgba(255, 255, 255, 0.15));
  border-radius: 10px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.2s ease;
}
.kx-donate-pack-btn:hover, .kx-donate-pack-btn.active {
  background: rgba(255, 215, 0, 0.14) !important;
  border-color: var(--gold-glow) !important;
  box-shadow: 0 0 16px rgba(255, 215, 0, 0.35) !important;
  transform: scale(1.02);
}
.kx-donate-pack-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}
.kx-donate-pack-info {
  min-width: 0;
  text-align: left;
}
.kx-donate-pack-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kx-donate-pack-amt {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--gold-glow);
  font-family: var(--font-heading);
  line-height: 1.1;
  margin-top: 1px;
}
.kx-donate-notice-pill {
  margin-top: 8px;
  background: rgba(255, 215, 0, 0.05);
  border: 1px dashed rgba(255, 215, 0, 0.25);
  border-radius: 8px;
  padding: 5px 8px;
  font-size: 0.68rem;
  line-height: 1.35;
  color: #cbd5e1;
  display: flex;
  align-items: center;
  gap: 6px;
}
.kx-donate-qr-card {
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 215, 0, 0.3);
  border-radius: 12px;
  padding: 10px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  box-sizing: border-box;
}
.kx-donate-qr-title {
  color: var(--gold-glow);
  font-size: 0.92rem;
  margin: 0 0 2px 0;
  font-weight: 700;
}
.kx-donate-qr-amount {
  font-size: 1.2rem;
  font-weight: 900;
  color: #ffd700;
  font-family: var(--font-heading);
  margin-bottom: 6px;
}
.kx-donate-qr-img-wrapper {
  background: #fff;
  border-radius: 10px;
  padding: 6px;
  display: inline-flex;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
}
.kx-donate-qr-img-wrapper img {
  width: 140px;
  height: 140px;
  display: block;
  object-fit: contain;
}

@media (max-width: 767px) {
  .kx-donate-modal-box {
    max-width: 95% !important;
    padding: 10px 12px !important;
    gap: 6px !important;
  }
  .kx-donate-title {
    font-size: 1.05rem;
  }
  .kx-donate-sub {
    font-size: 0.68rem;
  }
  .kx-donate-bank-badge {
    padding: 4px 8px;
    font-size: 0.72rem;
  }
  .kx-donate-twocol {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .kx-donate-grid-compact {
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
  }
  .kx-donate-pack-btn {
    padding: 4px 6px;
    gap: 4px;
    flex-direction: column;
    text-align: center;
  }
  .kx-donate-pack-info {
    text-align: center;
  }
  .kx-donate-pack-title {
    font-size: 0.68rem;
  }
  .kx-donate-pack-amt {
    font-size: 0.8rem;
  }
  .kx-donate-qr-img-wrapper img {
    width: 110px;
    height: 110px;
  }
  .kx-donate-qr-amount {
    font-size: 1rem;
    margin-bottom: 2px;
  }
}

/* =========================================================================
   GIAO DIỆN LÒ ĐAN BÁT QUÁI (1-VIEW 2-COLUMN BALANCED LAYOUT)
========================================================================= */
.kx-alchemy-wrapper {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 18px;
  max-width: 860px;
  width: 100%;
  margin: auto;
  align-items: center;
  box-sizing: border-box;
}
.kx-alchemy-left {
  text-align: center;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 109, 0, 0.25);
  border-radius: 14px;
  padding: 12px;
}
.kx-alchemy-right {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.kx-alchemy-herbs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
}
.kx-alchemy-recipes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

@media (max-width: 767px) {
  .kx-alchemy-wrapper {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .kx-alchemy-left {
    padding: 8px;
  }
  .kx-alchemy-left .kx-furnace-body {
    max-width: 100px !important;
  }
  .kx-alchemy-left .kx-furnace-img {
    max-width: 90px !important;
  }
}

/* =========================================================================
   GIAO DIỆN CÁC VIEW KHÁC CÂN ĐỐI 1 MÀN HÌNH (1-VIEW BALANCED FIT)
========================================================================= */
.kx-view-travel .kx-feature-modal-body,
.kx-view-marriage .kx-feature-modal-body,
.kx-view-sect .kx-feature-modal-body,
.kx-view-divination .kx-feature-modal-body,
.kx-view-super .kx-feature-modal-body {
  justify-content: flex-start !important;
}
.kx-view-reincarnation .kx-feature-modal-body {
  justify-content: center !important;
}
@media (max-height: 700px), (max-width: 767px) {
  .kx-view-reincarnation .kx-feature-modal-body {
    justify-content: flex-start !important;
  }
}

#travel-realms-grid {
  max-width: 880px;
  width: 100%;
  margin: 0 auto;
}

#panel-sect-cultivators {
  max-width: 820px;
  width: 100%;
  margin: 0 auto;
}

.kx-table-wrapper {
  max-height: clamp(200px, 45vh, 360px);
  overflow-y: auto;
  border-radius: 10px;
}
