.ui-icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}

.ui-icon {
  display: block;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.banner a {
  color: inherit;
  font-weight: 900;
  text-decoration: underline;
  text-underline-offset: 3px;
}

button > .ui-icon,
a > .ui-icon {
  pointer-events: none;
}

.primary,
.secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.mobile-menu-button,
.close-sidebar,
.sidebar-backdrop {
  display: none;
}

.profile #logoutButton span {
  display: none;
}

.avatar[role="button"] {
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease;
}

.avatar[role="button"]:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 0 3px rgba(129, 114, 255, .18);
}

.profile #logoutButton .ui-icon { width: 16px; height: 16px; }
.stat-card .stat-icon .ui-icon { width: 17px; height: 17px; }
.mini-icon .ui-icon { width: 16px; height: 16px; }
.toggle-button .ui-icon { width: 15px; height: 15px; stroke-width: 2; }
.delete-button .ui-icon { width: 20px; height: 20px; }
.stop-worker .ui-icon { width: 15px; height: 15px; }
.stop-worker { display: flex; align-items: center; justify-content: center; gap: 8px; }
.chat-action-btn .ui-icon { width: 14px; height: 14px; }
.empty .empty-ui-icon { width: 38px; height: 38px; margin: 0 auto; }

.admin-visibility-card {
  width: min(520px, 94%);
  text-align: left;
}

.admin-visibility-note {
  margin: 0 0 16px;
  color: #93a8bf;
  font-size: 13px;
  line-height: 1.5;
}

.admin-visibility-list {
  display: grid;
  gap: 10px;
}

.visibility-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  border: 1px solid rgba(148, 180, 220, .14);
  border-radius: 14px;
  padding: 14px;
  color: #edf5ff;
  background: rgba(7, 15, 27, .45);
  cursor: pointer;
  text-align: left;
}

.visibility-toggle:hover {
  border-color: rgba(39, 215, 232, .35);
  background: rgba(39, 215, 232, .08);
}

.visibility-toggle-master {
  border-color: rgba(255, 171, 92, .26);
  background: linear-gradient(135deg, rgba(255, 171, 92, .12), rgba(129, 114, 255, .08));
}

.visibility-toggle strong,
.visibility-toggle small {
  display: block;
}

.visibility-toggle small {
  margin-top: 4px;
  color: #8da2bb;
  font-size: 12px;
  line-height: 1.35;
}

.visibility-toggle b {
  flex: 0 0 auto;
  min-width: 88px;
  border-radius: 999px;
  padding: 7px 10px;
  color: #61e9b6;
  background: rgba(37, 212, 147, .11);
  border: 1px solid rgba(37, 212, 147, .22);
  font-size: 11px;
  text-align: center;
}

.visibility-toggle.is-hidden b {
  color: #ff93a2;
  background: rgba(255, 98, 120, .1);
  border-color: rgba(255, 98, 120, .24);
}

.visibility-toggle-master.is-hidden b {
  color: #ffcf9f;
  background: rgba(255, 171, 92, .13);
  border-color: rgba(255, 171, 92, .28);
}

.nav-item > .nav-icon {
  display: inline-grid;
  place-items: center;
  width: 28px;
  color: #56ccdc;
  vertical-align: middle;
}

.nav-item > .nav-icon svg {
  width: 18px;
  height: 18px;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.captcha-slot {
  min-height: 66px;
  overflow: visible;
  border-radius: 0;
}

.captcha-slot > div {
  max-width: 100%;
}

.captcha-slot iframe {
  display: block;
  max-width: 100%;
  border: 0;
}

.account-quota {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-top: 6px;
  padding: 7px 10px;
  border: 1px solid rgba(125, 109, 255, .12);
  border-radius: 9px;
  color: #8195ae;
  background: rgba(109, 91, 220, .06);
  font-size: 9px;
}

.account-quota span { color: #9f93ff; font-weight: 700; }
.account-quota b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-quota + .worker-status { margin-top: 9px; }

.plan-strip {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(180px, 1fr) auto;
  gap: 18px;
  align-items: center;
  margin-bottom: 17px;
  padding: 15px 18px;
  border-radius: 16px;
  background: linear-gradient(120deg, rgba(111, 91, 237, .12), rgba(28, 180, 181, .08));
}

.plan-strip small,
.plan-strip strong {
  display: block;
}

.plan-strip small {
  color: #7188a4;
  font-size: 8px;
  letter-spacing: .12em;
}

.plan-strip strong {
  margin-top: 4px;
  font-size: 15px;
}

.market-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 26px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(30, 45, 78, .95), rgba(10, 28, 43, .9));
}

.market-hero .eyebrow { margin: 0 0 7px; }
.market-hero h3 { margin: 0; font-size: 25px; }
.market-hero span { display: block; max-width: 650px; margin-top: 8px; color: #879bb4; font-size: 12px; line-height: 1.5; }
.market-current { flex: 0 0 auto; padding: 10px 13px; border: 1px solid rgba(72, 221, 173, .2); border-radius: 99px; color: #69e4ba; background: rgba(35, 172, 125, .1); font-size: 11px; font-weight: 700; }

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.pricing-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 470px;
  padding: 24px;
  overflow: hidden;
  border: 1px solid rgba(140, 168, 208, .14);
  border-radius: 20px;
  background: linear-gradient(155deg, rgba(16, 31, 52, .98), rgba(8, 20, 34, .95));
  box-shadow: 0 18px 46px rgba(0,0,0,.2);
}

.pricing-card.featured { border-color: rgba(132, 110, 255, .32); box-shadow: 0 20px 55px rgba(80, 62, 190, .16); }
.pricing-card.premium { border-color: rgba(255, 176, 87, .24); }
.pricing-ribbon { position: absolute; top: 16px; right: -31px; width: 126px; padding: 5px; transform: rotate(37deg); color: #fff; background: #7460e9; font-size: 8px; font-weight: 700; text-align: center; letter-spacing: .08em; }
.pricing-head { min-height: 47px; }
.pricing-head span, .pricing-head b { display: block; }
.pricing-head span { color: #6de0dd; font-size: 9px; letter-spacing: .11em; }
.pricing-head b { margin-top: 5px; color: #c6d2e1; font-size: 12px; }
.pricing-card h3 { margin: 20px 0 0; font-size: 34px; letter-spacing: -.03em; }
.pricing-card > p { margin: 5px 0 20px; color: #7f94ae; font-size: 11px; }
.pricing-card ul { display: grid; gap: 12px; margin: 0 0 24px; padding: 0; list-style: none; }
.pricing-card li { position: relative; display: flex; justify-content: space-between; gap: 10px; padding-left: 20px; color: #b5c4d6; font-size: 12px; }
.pricing-card li::before { content: "✓"; position: absolute; left: 0; color: #40dda8; font-weight: 700; }
.pricing-card li em { color: #6f839c; font-size: 9px; font-style: normal; }
.plan-button { display: flex; justify-content: center; align-items: center; min-height: 43px; margin-top: auto; border: 1px solid rgba(115, 105, 255, .22); border-radius: 11px; color: #fff; background: linear-gradient(135deg, #705de5, #25b7c7); font-size: 12px; font-weight: 700; text-decoration: none; }
.plan-button.current { color: #8597ad; background: rgba(120, 145, 181, .08); cursor: default; }

.admin-plan-select {
  min-width: 145px;
  border: 1px solid #2b4261;
  border-radius: 8px;
  padding: 8px;
  color: #fff;
  background: #0a1728;
  font-family: inherit;
}

.admin-owner-field { grid-column: 1 / -1; }
.account-form select {
  width: 100%;
  border: 1px solid rgba(132, 163, 204, .16);
  border-radius: 12px;
  padding: 13px 14px;
  color: #fff;
  background: #081525;
  font: inherit;
  outline: 0;
}
.token-contact {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-top: 18px;
  padding: 18px;
  border: 1px solid rgba(76, 216, 192, .2);
  border-radius: 15px;
  background: linear-gradient(120deg, rgba(37, 181, 157, .1), rgba(105, 89, 232, .1));
}
.token-contact > div { display: flex; align-items: center; gap: 12px; }
.token-contact > div > span { color: #52dbce; font-size: 25px; }
.token-contact strong, .token-contact p { display: block; margin: 0; }
.token-contact p { margin-top: 4px; color: #8298b3; font-size: 11px; }
.token-contact a { display: inline-flex; align-items: center; justify-content: center; gap: 7px; flex: 0 0 auto; padding: 11px 15px; border-radius: 10px; color: #07131f; background: #53d9c6; font-size: 11px; font-weight: 800; text-decoration: none; }

.reward-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, .8fr);
  gap: 34px;
  align-items: center;
  padding: 32px;
  border-radius: 22px;
  background: radial-gradient(circle at 8% 20%, rgba(93, 77, 218, .2), transparent 40%), linear-gradient(135deg, rgba(16, 31, 54, .98), rgba(8, 24, 37, .96));
}
.reward-copy .eyebrow { margin: 0 0 8px; }
.reward-copy h3 { margin: 0; font-size: 28px; }
.reward-copy > p:not(.eyebrow) { max-width: 600px; margin: 10px 0 18px; color: #8da1ba; font-size: 12px; line-height: 1.65; }
.reward-plan { display: inline-flex; padding: 9px 13px; border: 1px solid rgba(76, 220, 175, .2); border-radius: 99px; color: #6ce2bc; background: rgba(38, 179, 132, .09); font-size: 10px; font-weight: 800; }
.redeem-form { display: grid; gap: 12px; padding: 20px; border: 1px solid rgba(139, 166, 207, .13); border-radius: 17px; background: rgba(4, 13, 24, .55); }
.redeem-form input, .gift-code-form input { font-family: ui-monospace, "Cascadia Code", monospace; text-transform: uppercase; letter-spacing: .05em; }
.redeem-form small { color: #7087a2; font-size: 9px; text-align: center; }
.reward-history { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.reward-history-card { padding: 17px; border: 1px solid rgba(130, 158, 198, .13); border-radius: 15px; background: rgba(12, 27, 46, .82); }
.reward-history-card small, .reward-history-card strong, .reward-history-card span { display: block; }
.reward-history-card small { color: #69d7d0; font-size: 8px; letter-spacing: .12em; }
.reward-history-card strong { margin-top: 7px; font-family: ui-monospace, "Cascadia Code", monospace; font-size: 12px; }
.reward-history-card span { margin-top: 6px; color: #7f94ad; font-size: 10px; }

.gift-admin-panel { padding: 27px; border-radius: 20px; }
.gift-admin-panel > div:first-child .eyebrow { margin: 0 0 7px; }
.gift-admin-panel h3 { margin: 0; font-size: 24px; }
.gift-admin-panel > div:first-child > p:not(.eyebrow) { margin: 8px 0 0; color: #8398b1; font-size: 11px; }
.gift-code-form { display: grid; grid-template-columns: 1fr 1.2fr .65fr auto; gap: 12px; align-items: end; margin-top: 22px; }
.gift-code-form select { width: 100%; border: 1px solid rgba(132, 163, 204, .16); border-radius: 12px; padding: 13px 14px; color: #fff; background: #081525; font: inherit; outline: 0; }
.created-gift { margin-top: 15px; padding: 13px 15px; border: 1px dashed rgba(80, 221, 187, .35); border-radius: 12px; color: #62e0bd; background: rgba(35, 173, 131, .08); font-family: ui-monospace, "Cascadia Code", monospace; font-size: 13px; font-weight: 800; text-align: center; }
.gift-code-value { font-family: ui-monospace, "Cascadia Code", monospace; color: #71e0d8; letter-spacing: .04em; }

@media (max-width: 980px) {
  .pricing-grid { grid-template-columns: 1fr; }
  .pricing-card { min-height: 0; }
  .reward-shell { grid-template-columns: 1fr; }
  .gift-code-form { grid-template-columns: 1fr 1fr; }
  .gift-code-form button { grid-column: span 2; }
  .reward-history { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 760px) {
  body.menu-open { overflow: hidden; }
  .mobile-menu-button {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    margin-top: 14px;
    margin-right: 12px;
    border: 1px solid rgba(139, 169, 210, .16);
    border-radius: 12px;
    color: #dce8f8;
    background: rgba(16, 31, 52, .9);
    font-size: 20px;
    cursor: pointer;
  }

  .sidebar {
    position: fixed !important;
    z-index: 40 !important;
    inset: 0 auto 0 0 !important;
    display: flex !important;
    flex-direction: column !important;
    width: min(310px, 86vw) !important;
    height: 100dvh !important;
    padding: 18px 14px !important;
    border-radius: 0 22px 22px 0 !important;
    transform: translateX(-105%);
    transition: transform .25s ease;
  }

  .sidebar.open { transform: translateX(0); }
  .side-brand { display: flex !important; padding: 4px 38px 24px 7px !important; }
  .side-brand > div { display: block !important; }
  .close-sidebar { position: absolute; z-index: 2; top: 18px; right: 16px; display: grid; place-items: center; width: 32px; height: 32px; border: 1px solid rgba(142, 171, 211, .14); border-radius: 10px; color: #aebed1; background: rgba(7, 15, 27, .55); font-size: 20px; cursor: pointer; }
  .sidebar nav { display: grid !important; flex: 0 1 auto !important; justify-content: stretch !important; width: 100% !important; margin-left: 0 !important; gap: 7px !important; overflow-y: auto; }
  .nav-item { display: flex !important; justify-content: flex-start !important; align-items: center !important; width: 100% !important; min-height: 46px !important; padding: 12px 14px !important; font-size: 13px !important; text-align: left !important; }
  .sidebar .nav-item.hidden { display: none !important; }
  .nav-item > .nav-icon { width: 28px !important; }
  .nav-item.active { box-shadow: inset 3px 0 0 #8172ff !important; }
  .profile { display: grid !important; grid-template-columns: 38px minmax(0,1fr) auto !important; margin-top: auto !important; padding: 15px 6px 2px !important; border-top: 1px solid rgba(148,180,220,.14) !important; border-left: 0 !important; }
  .profile > div:nth-child(2) { display: block !important; }
  .profile #logoutButton { display: flex !important; gap: 7px; align-items: center; width: auto !important; min-width: 36px; padding: 0 9px; color: #ff93a2; font-size: 13px; }
  .profile #logoutButton span { display: inline; }
  .sidebar-backdrop { position: fixed; z-index: 35; inset: 0; display: block; border: 0; background: rgba(2, 7, 14, .72); backdrop-filter: blur(3px); }
  .content { padding-top: 20px !important; }
  .topbar { display: flex; align-items: flex-start; }
  .topbar-heading { min-width: 0; text-align: center; }
  .topbar-tools { margin-left: auto; }
  .plan-strip { grid-template-columns: 1fr 1fr; gap: 12px; padding: 14px; }
  .plan-strip > button { grid-column: span 2; }
  .market-hero { display: block; padding: 20px; }
  .market-current { width: auto; max-width: 100%; display: inline-block; border-radius: 12px; margin-top: 16px; word-break: break-word; }
  .token-contact { align-items: stretch; flex-direction: column; }
  .token-contact a { text-align: center; }
  .reward-shell, .gift-admin-panel { padding: 20px; }
  .reward-copy h3 { font-size: 23px; }
  .gift-code-form, .reward-history { grid-template-columns: 1fr; }
  .gift-code-form button { grid-column: auto; }
}

/* --- ĐỘ KIẾP ĐÀI & PHÒNG CHAT UPGRADES --- */

/* Khung Thiên Đạo Ban Thưởng */
.reward-rules-box {
  margin-bottom: 24px;
  padding: 20px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.05), rgba(129, 114, 255, 0.08));
  border: 1px solid rgba(255, 215, 0, 0.15);
}
.reward-rules-box h4 {
  margin: 0 0 10px;
  color: #ffd700;
  font-size: 18px;
}
.reward-rules-box p {
  margin: 0 0 16px;
  color: #aebed1;
  font-size: 13px;
}
.reward-ranks-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.reward-rank-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px;
  border-radius: 12px;
  background: rgba(10, 23, 39, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
  text-align: center;
}
.reward-rank-card .rank-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 800;
  margin-bottom: 10px;
}
.reward-rank-card.gold { border-color: rgba(255, 215, 0, 0.3); }
.reward-rank-card.gold .rank-badge { background: #ffd700; color: #000; }
.reward-rank-card.silver { border-color: rgba(192, 192, 192, 0.3); }
.reward-rank-card.silver .rank-badge { background: #c0c0c0; color: #000; }
.reward-rank-card.bronze { border-color: rgba(205, 127, 50, 0.3); }
.reward-rank-card.bronze .rank-badge { background: #cd7f32; color: #000; }
.reward-rank-card strong {
  font-size: 14px;
  color: #fff;
  margin-bottom: 4px;
}
.reward-rank-card small {
  font-size: 11px;
  color: #6c7a89;
}

/* Bố cục 2 bảng xếp hạng */
.leaderboards-grid {
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.leaderboard-block table {
  min-width: auto !important;
  width: 100% !important;
  table-layout: fixed;
}
.leaderboard-block th:nth-child(1),
.leaderboard-block td:nth-child(1) {
  width: 70px;
}
.leaderboard-block th:nth-child(2),
.leaderboard-block td:nth-child(2) {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.leaderboard-block th:nth-child(3),
.leaderboard-block td:nth-child(3) {
  width: 200px;
}
.leaderboard-block th:nth-child(4),
.leaderboard-block td:nth-child(4) {
  width: 160px;
  text-align: right;
}
.leaderboard-block {
  padding: 20px;
  border-radius: 18px;
}
.leaderboard-block .block-title {
  margin-bottom: 18px;
}
.leaderboard-block .block-title h4 {
  margin: 0;
  font-size: 17px;
  color: #fff;
}
.leaderboard-block .block-title small {
  color: #889ec1;
  font-size: 12px;
}

/* Dòng làm nổi bật Tu sĩ của mình */
tr.user-highlight td {
  background: rgba(129, 114, 255, 0.12) !important;
  border-bottom: 1px solid rgba(129, 114, 255, 0.3) !important;
}
tr.user-highlight strong {
  color: #a29bfe;
}
tr.divider-row td {
  background: rgba(255, 255, 255, 0.02) !important;
  border-bottom: 0 !important;
}

/* Cảnh Giới Tags */
.realm-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}
.realm-luyen-khi { background: #3b3f46; color: #aebed1; }
.realm-truc-co, [class*="realm-truc-co-"] { background: rgba(46, 204, 113, 0.15); color: #2ecc71; border: 1px solid rgba(46, 204, 113, 0.3); }
.realm-ket-dan, [class*="realm-ket-dan-"] { background: rgba(52, 152, 219, 0.15); color: #3498db; border: 1px solid rgba(52, 152, 219, 0.3); }
.realm-nguyen-anh, [class*="realm-nguyen-anh-"] { background: rgba(155, 89, 182, 0.15); color: #9b59b6; border: 1px solid rgba(155, 89, 182, 0.3); }
.realm-hoa-than, [class*="realm-hoa-than-"] { background: rgba(230, 126, 34, 0.15); color: #e67e22; border: 1px solid rgba(230, 126, 34, 0.3); }
.realm-anh-bien, [class*="realm-anh-bien-"] { background: rgba(231, 76, 60, 0.15); color: #e74c3c; border: 1px solid rgba(231, 76, 60, 0.3); }
.realm-van-dinh, [class*="realm-van-dinh-"] { background: rgba(241, 242, 246, 0.12); color: #f1f2f6; border: 1px solid rgba(241, 242, 246, 0.25); }

/* Cảnh giới cao - Blink & Glow */
.realm-khuy-niet, [class*="realm-khuy-niet-"], .realm-tinh-niet, [class*="realm-tinh-niet-"], .realm-toai-niet, [class*="realm-toai-niet-"] {
  background: rgba(254, 159, 67, 0.2);
  color: #ff9f43;
  border: 1px solid #ff9f43;
  text-shadow: 0 0 5px #ff9f43;
  animation: glow-pulse 1.5s infinite alternate;
}
.realm-khong-niet, [class*="realm-khong-niet-"], .realm-khong-linh, [class*="realm-khong-linh-"], .realm-khong-huyen, [class*="realm-khong-huyen-"] {
  background: rgba(10, 189, 227, 0.2);
  color: #0abde3;
  border: 1px solid #0abde3;
  text-shadow: 0 0 5px #0abde3;
  animation: glow-pulse 1.2s infinite alternate;
}
.realm-dai-ton, .realm-kim-ton, .realm-thien-ton {
  background: rgba(238, 82, 83, 0.2);
  color: #ee5253;
  border: 1px solid #ee5253;
  text-shadow: 0 0 5px #ee5253;
  animation: glow-pulse-fast 0.8s infinite alternate;
}
.realm-duoc-thien-ton, .realm-dai-thien-ton, .realm-dap-thien-canh {
  background: rgba(243, 104, 224, 0.2);
  color: #f368e0;
  border: 1px dashed #f368e0;
  text-shadow: 0 0 8px #f368e0;
  animation: rainbow-glow 3s infinite linear;
}

/* Thiên Đạo */
.realm-thien-dao {
  background: linear-gradient(135deg, #ff007f, #7f00ff, #00f0ff);
  background-size: 200% 200%;
  color: #fff;
  border: 1px solid #fff;
  box-shadow: 0 0 10px rgba(127, 0, 255, 0.8);
  text-shadow: 0 0 3px #000;
  animation: gradient-move 2s infinite linear, glow-pulse-fast 0.8s infinite alternate;
}

@keyframes glow-pulse {
  from { box-shadow: 0 0 2px rgba(255, 159, 67, 0.2); opacity: 0.8; }
  to { box-shadow: 0 0 8px rgba(255, 159, 67, 0.8); opacity: 1; }
}
@keyframes glow-pulse-fast {
  from { box-shadow: 0 0 1px rgba(238, 82, 83, 0.2); opacity: 0.7; }
  to { box-shadow: 0 0 10px rgba(238, 82, 83, 0.9); opacity: 1; }
}
@keyframes rainbow-glow {
  0% { box-shadow: 0 0 4px #ff007f; border-color: #ff007f; }
  33% { box-shadow: 0 0 4px #7f00ff; border-color: #7f00ff; }
  66% { box-shadow: 0 0 4px #00f0ff; border-color: #00f0ff; }
  100% { box-shadow: 0 0 4px #ff007f; border-color: #ff007f; }
}
@keyframes gradient-move {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* PHÒNG CHAT TU SĨ */
.chat-container {
  display: flex;
  flex-direction: column;
  height: 520px;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(148, 180, 220, 0.14);
}
.chat-messages-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: rgba(4, 11, 20, 0.4);
}
.chat-message-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  animation: fade-in-slide 0.2s ease-out;
}
@keyframes fade-in-slide {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.chat-message-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.chat-sender {
  color: #fff;
  font-weight: 700;
}
.chat-sender.admin {
  color: #ff7675;
  text-shadow: 0 0 5px rgba(255, 118, 117, 0.4);
}
.chat-time {
  color: #57606f;
  font-size: 10px;
}
.chat-message-content {
  color: #dce8f8;
  font-size: 13px;
  line-height: 1.5;
  background: rgba(255, 255, 255, 0.03);
  padding: 8px 12px;
  border-radius: 4px 12px 12px 12px;
  align-self: flex-start;
  max-width: 90%;
  border-left: 2px solid rgba(86, 204, 220, 0.3);
}
.chat-message-row:has(.admin) .chat-message-content {
  border-left-color: rgba(255, 118, 117, 0.6);
  background: rgba(255, 118, 117, 0.04);
}

/* Chat Form */
.chat-form {
  display: flex;
  padding: 14px 20px;
  background: rgba(7, 18, 33, 0.85);
  border-top: 1px solid rgba(148, 180, 220, 0.14);
  gap: 12px;
}
.chat-form input {
  flex: 1;
  border: 1px solid rgba(132, 163, 204, 0.16);
  border-radius: 12px;
  padding: 12px 16px;
  color: #fff;
  background: #081525;
  font-size: 14px;
  outline: 0;
  transition: border-color 0.2s;
}
.chat-form input:focus {
  border-color: #56ccdc;
}
.chat-form button {
  padding: 0 24px;
  font-weight: 800;
  border-radius: 12px;
}
.chat-status-message {
  padding: 20px;
  text-align: center;
  background: rgba(238, 82, 83, 0.1);
  color: #ee5253;
  font-size: 13px;
  font-weight: 700;
  border-top: 1px solid rgba(238, 82, 83, 0.2);
}
.chat-empty {
  text-align: center;
  color: #57606f;
  margin: auto;
  font-size: 13px;
  font-style: italic;
}

/* Admin controls inside Chat */
.chat-admin-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
}
.chat-action-btn {
  background: transparent;
  border: 0;
  cursor: pointer;
  padding: 2px 4px;
  font-size: 11px;
  border-radius: 4px;
  transition: background 0.2s;
}
.chat-action-btn.delete-btn {
  color: #ff7675;
}
.chat-action-btn.delete-btn:hover {
  background: rgba(255, 118, 117, 0.15);
}
.chat-action-btn.mute-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* Banner info (purple/violet styling matching theme-v2) */
.banner.info {
  background: rgba(111, 93, 238, 0.08);
  border: 1px solid rgba(111, 93, 238, 0.25);
  color: #c9c2ff;
}
.banner.info strong {
  color: #ffffff;
}
.banner.info svg {
  color: #a393ff;
}

@media (max-width: 760px) {
  .reward-ranks-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .leaderboards-grid {
    gap: 20px;
  }
  .leaderboard-block td, .leaderboard-block th {
    padding: 10px 4px !important;
    font-size: 11px;
  }
  .leaderboard-block th:nth-child(1),
  .leaderboard-block td:nth-child(1) {
    width: 45px;
  }
  .leaderboard-block th:nth-child(3),
  .leaderboard-block td:nth-child(3) {
    width: 110px;
  }
  .leaderboard-block th:nth-child(4),
  .leaderboard-block td:nth-child(4) {
    width: 80px;
  }
  .realm-tag {
    padding: 2px 4px;
    font-size: 9px;
  }
  .chat-container {
    height: 430px;
  }
  #adminGrantPlanForm {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
  #adminGrantPlanForm button {
    width: 100%;
  }
}

/* Startup Loading Screen */
.loading-shell {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background: var(--bg);
  z-index: 9999;
  transition: opacity 0.4s ease;
}
.loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}
.loading-logo {
  width: 90px;
  height: 90px;
  border-radius: 24px;
  background: linear-gradient(135deg, var(--violet), #28becd);
  padding: 3px;
  box-shadow: 0 0 30px rgba(111, 93, 238, 0.4);
  animation: logo-glow 2s infinite alternate ease-in-out;
}
.loading-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 21px;
}
.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.05);
  border-top-color: #27d7e8;
  border-radius: 50%;
  animation: spin 1s infinite linear;
}
.loading-text {
  font-size: 14px;
  color: var(--muted);
  letter-spacing: 0.05em;
  font-weight: 600;
  animation: pulse 1.5s infinite alternate;
}

/* Custom Alert Modal */
.alert-modal {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(4, 9, 17, 0.75);
  backdrop-filter: blur(10px);
  z-index: 10000;
  animation: fadeIn 0.25s ease;
}
.alert-modal-card {
  width: min(420px, 90%);
  border-radius: 20px;
  border: 1px solid rgba(148, 180, 220, 0.2);
  padding: 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  animation: scaleUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.alert-modal-body {
  margin-bottom: 20px;
  color: var(--text);
  word-break: break-word;
}
.alert-modal-foot {
  display: flex;
  justify-content: flex-end;
}
.alert-modal-foot button {
  padding: 10px 24px;
  font-size: 13px;
  font-weight: 800;
  min-width: 100px;
}

/* --- POPUP EDIT USER STYLES --- */
.edit-user-modal-header {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  margin-bottom: 15px !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
  padding-bottom: 10px !important;
  width: 100% !important;
}

.edit-user-modal-header h3 {
  margin: 0 !important;
  font-size: 16px !important;
  color: #fff !important;
}

.edit-user-modal-footer {
  display: flex !important;
  justify-content: flex-end !important;
  gap: 10px !important;
  border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
  padding-top: 15px !important;
  margin-top: 10px !important;
  width: 100% !important;
}

.edit-user-modal-footer button {
  margin: 0 !important;
  padding: 10px 20px !important;
  font-size: 13px !important;
}

#editUserModal .alert-modal-card {
  max-width: 520px;
  width: 95%;
  background: rgba(14, 28, 47, 0.96) !important;
  border: 1px solid rgba(148, 180, 220, 0.2) !important;
  border-radius: 20px !important;
  padding: 24px !important;
  box-shadow: var(--shadow) !important;
  backdrop-filter: blur(25px) !important;
}

#editUserModalCloseBtn {
  background: transparent !important;
  border: none !important;
  color: #7188a4 !important;
  font-size: 24px !important;
  line-height: 1 !important;
  cursor: pointer;
  padding: 0 !important;
  margin: 0 !important;
  width: auto !important;
  height: auto !important;
  min-width: 0 !important;
  box-shadow: none !important;
  outline: none !important;
}

#editUserModalCloseBtn:hover {
  color: #fff !important;
}

#editUserForm label {
  display: block !important;
  margin-bottom: 12px !important;
  font-size: 12px !important;
  font-weight: 750 !important;
  color: #aac0d7 !important;
}

#editUserForm input,
#editUserForm select {
  width: 100% !important;
  border: 1px solid #2b4261 !important;
  background: #0a1728 !important;
  color: white !important;
  border-radius: 12px !important;
  padding: 12px 14px !important;
  outline: 0 !important;
  font-size: 14px !important;
  margin-top: 6px !important;
  font-family: inherit !important;
  box-shadow: none !important;
}

#editUserForm input:focus,
#editUserForm select:focus {
  border-color: #4bcbd9 !important;
  box-shadow: 0 0 0 3px rgba(75, 203, 217, 0.12) !important;
}

.account-actions {
  display: grid !important;
  grid-template-columns: minmax(170px, 1.4fr) minmax(100px, .7fr) 48px;
  gap: 9px;
  align-items: stretch;
}

.account-speed-select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  min-width: 0;
  min-height: 42px;
  border: 1px solid rgba(123, 184, 255, .22);
  border-radius: 10px;
  padding: 10px 38px 10px 12px;
  color: #fff;
  background-color: rgba(3, 9, 19, .78);
  background-image: linear-gradient(45deg, transparent 50%, #7bb8ff 50%), linear-gradient(135deg, #7bb8ff 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  font: inherit;
  cursor: pointer;
  transition: border-color .18s, box-shadow .18s, background-color .18s;
}

.account-speed-select:focus { border-color: rgba(85, 240, 200, .65); box-shadow: 0 0 0 3px rgba(85, 240, 200, .1); }
.account-speed-select:disabled { opacity: .55; cursor: not-allowed; }
.account-actions .toggle-button { min-width: 0; padding-inline: 10px; }
.account-actions .delete-button { width: 48px; padding: 0; }

/* Dashboard làm mới định kỳ; giữ thẻ đứng yên để hover không bị lặp thành hiệu ứng rung. */
.account-card:hover { transform: none !important; }

@media(max-width: 560px) {
  .account-actions { grid-template-columns: minmax(130px, 1fr) 82px 44px; gap: 7px; }
  .account-actions .delete-button { width: 44px; }
  .account-speed-select { padding-left: 10px; font-size: 11px; }
}

.account-responsibility-note {
  grid-column: 1 / -1;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 14px 0 0;
  padding: 12px 14px;
  border: 1px solid rgba(255, 177, 93, .22);
  border-radius: 13px;
  color: #c6d2e2;
  background: rgba(255, 177, 93, .07);
  font-size: 12px;
  line-height: 1.55;
}

.account-responsibility-note input[type="checkbox"] {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  padding: 0;
  accent-color: #55f0c8;
  cursor: pointer;
}

.account-responsibility-note span { cursor: pointer; }

#addGameSubmit:disabled {
  cursor: not-allowed;
  opacity: .48;
  filter: saturate(.45);
  box-shadow: none;
}

#editUserForm select {
  appearance: none !important;
  -webkit-appearance: none !important;
  background-image: url("data:image/svg+xml;utf8,<svg fill='white' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/><path d='M0 0h24v24H0z' fill='none'/></svg>") !important;
  background-repeat: no-repeat !important;
  background-position: right 14px center !important;
  background-size: 20px !important;
  padding-right: 40px !important;
}

@keyframes logo-glow {
  0% { box-shadow: 0 0 20px rgba(111, 93, 238, 0.2); }
  100% { box-shadow: 0 0 40px rgba(39, 215, 232, 0.6); }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes pulse {
  0% { opacity: 0.6; }
  100% { opacity: 1; }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes scaleUp {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* Styled Alert Success Details */
.alert-success-title {
  font-size: 16px;
  font-weight: 800;
  color: #43dfaa;
  margin-bottom: 8px;
  text-align: center;
  letter-spacing: 0.05em;
  text-shadow: 0 0 10px rgba(67, 223, 170, 0.3);
}
.alert-success-subtitle {
  font-size: 13px;
  color: #c9d7ec;
  margin-bottom: 12px;
  text-align: center;
}
.alert-success-subtitle .highlight-name {
  color: #fff;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: var(--violet);
}
.alert-success-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}
.alert-success-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  margin: 2px 0;
}
.alert-success-item span {
  color: #edf5ff;
}
.alert-success-item b {
  color: #27d7e8;
  font-weight: 700;
}

/* --- PAGINATION & ADMIN EDIT POPUP --- */
.pagination-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
  padding: 10px 0;
}
.pagination-btn {
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 700;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #c9d7ec;
  cursor: pointer;
  transition: all 0.2s ease;
  margin: 0;
}
.pagination-btn:hover:not(:disabled) {
  background: #6f5bed;
  color: #fff;
  border-color: #6f5bed;
  box-shadow: 0 0 10px rgba(111, 91, 237, 0.4);
}
.pagination-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.pagination-info {
  font-size: 13px;
  color: #8da2bb;
}
.proxy-admin-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(240px, .5fr);
  gap: 18px;
  margin-bottom: 18px;
}

.proxy-editor {
  display: grid;
  gap: 14px;
  padding: 20px;
  border-radius: 18px;
}

.proxy-editor label {
  display: grid;
  gap: 8px;
}

.proxy-editor textarea {
  width: 100%;
  min-height: 260px;
  resize: vertical;
  padding: 14px;
  color: #edf5ff;
  background: rgba(3, 9, 20, .72);
  border: 1px solid rgba(105, 228, 186, .22);
  border-radius: 12px;
  font: 13px/1.55 Consolas, monospace;
}

.proxy-editor small { color: #8da2bb; }
.proxy-overview { display: grid; gap: 12px; padding: 18px; border-radius: 18px; }
.proxy-overview div { display: flex; align-items: center; justify-content: space-between; padding: 14px; background: rgba(255,255,255,.035); border-radius: 12px; }
.proxy-overview small { color: #8da2bb; }
.proxy-overview strong { color: #69e4ba; font-size: 24px; }

@media (max-width: 760px) {
  .proxy-admin-layout { grid-template-columns: 1fr; }
}
