/* ==========================================================================
   TIÊN LONG — Giao diện người chơi "Tu Tiên × 7 Viên Ngọc Rồng"
   Nạp sau style.min.css và custom-theme.css (xem Themes/Client/Head.php).
   Mọi luật đều gắn với body.tl-theme để không ảnh hưởng trang admin.
   ========================================================================== */
:root {
    --tl-ink: #0b0911;
    --tl-ink-2: #120e1b;
    --tl-panel: rgba(19, 15, 28, 0.82);
    --tl-panel-2: rgba(28, 22, 40, 0.88);
    --tl-line: rgba(232, 190, 110, 0.18);
    --tl-line-strong: rgba(232, 190, 110, 0.38);
    --tl-gold: #f2c46b;
    --tl-gold-2: #ffe3a3;
    --tl-gold-deep: #b9792a;
    --tl-ember: #f08a2c;
    --tl-red: #d93a2b;
    --tl-jade: #3fd0a4;
    --tl-jade-soft: rgba(63, 208, 164, 0.14);
    --tl-text: #f1eadb;
    --tl-muted: #b3aac0;
    --tl-faint: #7d748d;
    --tl-serif: 'Noto Serif', 'Times New Roman', serif;
    --tl-sans: 'Be Vietnam Pro', 'Inter', system-ui, sans-serif;
    --tl-radius: 14px;
    --tl-cloud: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='120' viewBox='0 0 220 120'%3E%3Cg fill='none' stroke='%23f2c46b' stroke-opacity='0.07' stroke-width='2'%3E%3Cpath d='M20 80c0-14 12-24 26-22 4-14 20-22 34-15 8-12 28-12 36 2 14-4 28 6 26 20 12 2 18 14 12 22H26c-4 0-6-3-6-7z'/%3E%3Cpath d='M60 58c0-8 6-13 13-12M98 46c4-6 13-6 17 0M142 64c6-1 11 3 11 9'/%3E%3Cpath d='M150 30c0-8 7-13 15-12 3-7 12-10 19-5 7-2 13 4 12 10 6 1 9 7 6 11h-46c-4 0-6-2-6-4z'/%3E%3C/g%3E%3C/svg%3E");
    --tl-transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- Nền & chữ ---------- */
body.tl-theme {
    background-color: var(--tl-ink) !important;
    color: var(--tl-text) !important;
    font-family: var(--tl-sans) !important;
    font-size: 15px;
    line-height: 1.6;
}
body.tl-theme::before {
    background:
        radial-gradient(900px 520px at 12% -10%, rgba(63, 208, 164, 0.16), transparent 60%),
        radial-gradient(800px 600px at 100% 110%, rgba(240, 138, 44, 0.16), transparent 60%),
        radial-gradient(600px 400px at 85% 10%, rgba(242, 196, 107, 0.08), transparent 60%),
        linear-gradient(180deg, rgba(11, 9, 17, 0.62) 0%, rgba(11, 9, 17, 0.88) 40%, rgba(11, 9, 17, 0.96) 100%) !important;
}
body.tl-theme::after {
    content: '';
    position: fixed;
    inset: 0;
    background-image: var(--tl-cloud);
    background-size: 440px auto;
    z-index: -1;
    pointer-events: none;
    opacity: 0.7;
}
body.tl-theme ::selection { background: rgba(242, 196, 107, 0.35); color: #fff; }

body.tl-theme h1, body.tl-theme h2, body.tl-theme h3,
body.tl-theme h4, body.tl-theme h5, body.tl-theme h6,
body.tl-theme .hero-title {
    font-family: var(--tl-serif) !important;
    color: var(--tl-text) !important;
    letter-spacing: 0.01em;
    text-shadow: none;
}
body.tl-theme p, body.tl-theme li, body.tl-theme td, body.tl-theme label, body.tl-theme input, body.tl-theme textarea, body.tl-theme select {
    font-family: var(--tl-sans);
}
body.tl-theme .text-slate, body.tl-theme .text-muted-cvh, body.tl-theme .text-white-50 { color: var(--tl-muted) !important; }
body.tl-theme .text-muted { color: var(--tl-faint) !important; }
body.tl-theme .text-cyan { color: var(--tl-jade) !important; }
body.tl-theme .text-info { color: #7fdcc3 !important; }
body.tl-theme .text-warning { color: var(--tl-gold) !important; }
body.tl-theme .text-danger { color: #ff7a66 !important; }
body.tl-theme a { color: var(--tl-gold); }
body.tl-theme a:hover { color: var(--tl-gold-2); }

/* Chữ ánh kim dùng lại cho các lớp gradient cũ */
body.tl-theme .tl-gold-text,
body.tl-theme .text-gradient-cyan,
body.tl-theme .text-gradient-warning,
body.tl-theme .text-gradient-orange {
    background: linear-gradient(180deg, #fff3cf 0%, #f2c46b 45%, #c9852f 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}
body.tl-theme .text-gradient-cyan { background: linear-gradient(180deg, #d5fff1 0%, #3fd0a4 100%); -webkit-background-clip: text; background-clip: text; }

/* ---------- Viên Ngọc Rồng ---------- */
.db-ball {
    --db: 28px;
    position: relative;
    display: inline-block;
    flex: none;
    width: var(--db);
    height: var(--db);
    border-radius: 50%;
    background:
        radial-gradient(circle at 34% 28%, rgba(255, 255, 255, 0.95) 0 5%, rgba(255, 255, 255, 0) 14%),
        radial-gradient(circle at 50% 55%, #ffc95a 0%, #f59a1f 48%, #d4620e 78%, #8f3606 100%);
    box-shadow:
        inset -3px -4px 8px rgba(120, 40, 0, 0.55),
        inset 2px 3px 6px rgba(255, 236, 170, 0.5),
        0 0 0 1px rgba(255, 190, 90, 0.35),
        0 0 18px rgba(245, 154, 31, 0.35);
    vertical-align: middle;
}
.db-ball::after {
    content: '';
    position: absolute;
    left: 18%;
    top: 12%;
    width: 30%;
    height: 18%;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.55);
    filter: blur(1.5px);
    transform: rotate(-25deg);
}
.db-ball svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.db-ball svg polygon { fill: #d62a1e; stroke: #8f1208; stroke-width: 1.2; stroke-linejoin: round; }
.db-ball.db-xs { --db: 18px; }
.db-ball.db-sm { --db: 24px; }
.db-ball.db-md { --db: 36px; }
.db-ball.db-lg { --db: 56px; }
.db-ball.db-xl { --db: 72px; }

/* ---------- Header / menu ---------- */
body.tl-theme .app-header {
    background: linear-gradient(180deg, rgba(11, 9, 17, 0.92), rgba(11, 9, 17, 0.78)) !important;
    border-bottom: 1px solid var(--tl-line) !important;
    box-shadow: 0 10px 30px -20px rgba(0, 0, 0, 0.9);
}
body.tl-theme .app-header::after {
    content: '';
    position: absolute;
    left: 0; right: 0; bottom: -1px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(242, 196, 107, 0.65), transparent);
}
body.tl-theme .navbar-nav .nav-link {
    font-family: var(--tl-sans) !important;
    font-size: 0.86rem !important;
    letter-spacing: 0.06em;
    color: var(--tl-muted) !important;
    opacity: 1 !important;
}
body.tl-theme .navbar-nav .nav-link i { color: var(--tl-gold) !important; opacity: 0.85; }
body.tl-theme .navbar-nav .nav-link:hover,
body.tl-theme .navbar-nav .nav-link.active { color: var(--tl-gold-2) !important; transform: none !important; text-shadow: 0 0 14px rgba(242, 196, 107, 0.35) !important; }
body.tl-theme .navbar-nav .nav-link::after {
    width: 7px !important;
    height: 7px !important;
    border-radius: 50%;
    bottom: 6px !important;
    background: radial-gradient(circle at 35% 30%, #fff1c2, #f59a1f 60%, #b5500a) !important;
    opacity: 0;
    transition: opacity var(--tl-transition);
}
body.tl-theme .navbar-nav .nav-link:hover::after,
body.tl-theme .navbar-nav .nav-link.active::after { opacity: 1; }

body.tl-theme .btn-diem-danh {
    background: linear-gradient(180deg, #ffd27a, #e9932b) !important;
    color: #2a1405 !important;
    border: 1px solid rgba(255, 220, 150, 0.6) !important;
    box-shadow: 0 6px 18px -8px rgba(240, 138, 44, 0.7) !important;
}
body.tl-theme .btn-diem-danh:hover { transform: translateY(-1px) !important; filter: brightness(1.06); }
body.tl-theme .bg-glass { background: rgba(28, 22, 40, 0.7) !important; border-color: var(--tl-line) !important; }
body.tl-theme .dropdown-menu {
    background: var(--tl-ink-2) !important;
    border: 1px solid var(--tl-line-strong) !important;
    box-shadow: 0 20px 50px -10px rgba(0, 0, 0, 0.8) !important;
}
body.tl-theme .dropdown-item { color: var(--tl-text) !important; opacity: 0.9 !important; }
body.tl-theme .dropdown-item:hover { background: rgba(242, 196, 107, 0.1) !important; color: var(--tl-gold-2) !important; }
body.tl-theme .dropdown-header { color: var(--tl-gold) !important; letter-spacing: 0.12em; }
body.tl-theme .offcanvas { background: var(--tl-ink) !important; border-right: 1px solid var(--tl-line) !important; }
body.tl-theme .hover-bg-glass:hover, body.tl-theme .active-bg-glass { background: rgba(242, 196, 107, 0.1) !important; color: var(--tl-gold-2) !important; box-shadow: inset 3px 0 0 var(--tl-gold) !important; }
body.tl-theme .offcanvas .text-cyan, body.tl-theme .offcanvas i.text-cyan { color: var(--tl-gold) !important; }
body.tl-theme .btn-mobile-login { border-color: var(--tl-line-strong); color: var(--tl-gold); background: rgba(28, 22, 40, 0.7); }

/* ---------- Thẻ (panel) kiểu phù lục ---------- */
body.tl-theme .card-cvh,
body.tl-theme .glass-card,
body.tl-theme .tl-panel,
body.tl-theme .card.bg-dark,
body.tl-theme .leaderboard-card {
    position: relative;
    background:
        linear-gradient(180deg, rgba(242, 196, 107, 0.05), rgba(242, 196, 107, 0) 120px),
        var(--tl-panel) !important;
    border: 1px solid var(--tl-line) !important;
    border-radius: var(--tl-radius) !important;
    box-shadow: 0 24px 60px -30px rgba(0, 0, 0, 0.95), inset 0 1px 0 rgba(255, 236, 190, 0.06) !important;
    backdrop-filter: blur(10px);
    overflow: hidden;
}
/* 4 góc khung vàng */
body.tl-theme .card-cvh::after,
body.tl-theme .tl-panel::after,
body.tl-theme .leaderboard-card::after {
    content: '' !important;
    position: absolute;
    inset: 6px;
    pointer-events: none;
    border-radius: 10px;
    background:
        linear-gradient(var(--tl-gold), var(--tl-gold)) top left / 16px 1px,
        linear-gradient(var(--tl-gold), var(--tl-gold)) top left / 1px 16px,
        linear-gradient(var(--tl-gold), var(--tl-gold)) top right / 16px 1px,
        linear-gradient(var(--tl-gold), var(--tl-gold)) top right / 1px 16px,
        linear-gradient(var(--tl-gold), var(--tl-gold)) bottom left / 16px 1px,
        linear-gradient(var(--tl-gold), var(--tl-gold)) bottom left / 1px 16px,
        linear-gradient(var(--tl-gold), var(--tl-gold)) bottom right / 16px 1px,
        linear-gradient(var(--tl-gold), var(--tl-gold)) bottom right / 1px 16px !important;
    background-repeat: no-repeat !important;
    opacity: 0.55;
}
body.tl-theme .card-cvh:hover,
body.tl-theme .glass-card:hover { transform: none !important; border-color: var(--tl-line-strong) !important; }
body.tl-theme .card { color: var(--tl-text); }
body.tl-theme .card::before { display: none !important; }
body.tl-theme .card-header, body.tl-theme .card-header-cvh, body.tl-theme .card-footer { background: transparent !important; border-color: var(--tl-line) !important; }

/* ---------- Nút ---------- */
body.tl-theme .btn {
    font-family: var(--tl-sans) !important;
    letter-spacing: 0.04em;
    font-size: 0.9rem;
    font-weight: 700;
}
body.tl-theme .btn-cvh-primary,
body.tl-theme .tl-btn-gold {
    background: linear-gradient(180deg, #ffe09a 0%, #f2c46b 40%, #d48d2e 100%) !important;
    color: #2a1405 !important;
    border: 1px solid rgba(255, 228, 165, 0.7) !important;
    box-shadow: 0 10px 24px -12px rgba(240, 138, 44, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.5) !important;
    border-radius: 12px !important;
    letter-spacing: 0.06em;
}
body.tl-theme .btn-cvh-primary:hover,
body.tl-theme .tl-btn-gold:hover { transform: translateY(-1px) !important; filter: brightness(1.06); color: #1c0d03 !important; }
body.tl-theme .btn-cvh-warning {
    background: linear-gradient(180deg, #ffb35c, #e2701c) !important;
    color: #2a1405 !important;
    border: 1px solid rgba(255, 200, 140, 0.6) !important;
}
body.tl-theme .tl-btn-jade {
    background: linear-gradient(180deg, #5fe3bb, #23a57f) !important;
    color: #04241a !important;
    border: 1px solid rgba(160, 255, 220, 0.55) !important;
    border-radius: 12px !important;
    box-shadow: 0 10px 24px -12px rgba(63, 208, 164, 0.8) !important;
}
body.tl-theme .tl-btn-jade:hover { filter: brightness(1.06); transform: translateY(-1px); color: #021a12 !important; }
body.tl-theme .tl-btn-ghost {
    background: rgba(28, 22, 40, 0.65) !important;
    color: var(--tl-text) !important;
    border: 1px solid var(--tl-line-strong) !important;
    border-radius: 12px !important;
}
body.tl-theme .tl-btn-ghost:hover { border-color: var(--tl-gold) !important; color: var(--tl-gold-2) !important; background: rgba(242, 196, 107, 0.08) !important; }
body.tl-theme .tl-btn-ghost i { color: var(--tl-gold); }

/* Nút Bootstrap/neon cũ → tông ngọc rồng */
body.tl-theme .btn-primary {
    background: linear-gradient(180deg, #ffe09a, #d48d2e) !important;
    color: #2a1405 !important;
    border: 1px solid rgba(255, 228, 165, 0.7) !important;
    box-shadow: none !important;
}
body.tl-theme .btn-primary:hover { filter: brightness(1.06); transform: none !important; color: #1c0d03 !important; }
body.tl-theme .btn-info, body.tl-theme .btn-success {
    background: linear-gradient(180deg, #5fe3bb, #23a57f) !important;
    color: #04241a !important;
    border: 1px solid rgba(160, 255, 220, 0.5) !important;
    box-shadow: none !important;
}
body.tl-theme .btn-danger { background: linear-gradient(180deg, #ef6a54, #b8281a) !important; color: #fff !important; border: 1px solid rgba(255, 150, 130, 0.5) !important; box-shadow: none !important; }
body.tl-theme .btn-warning { background: linear-gradient(180deg, #ffd27a, #e9932b) !important; color: #2a1405 !important; border: 1px solid rgba(255, 220, 150, 0.6) !important; }
body.tl-theme [class*="btn-outline-"] { background: rgba(28, 22, 40, 0.5) !important; border: 1px solid var(--tl-line-strong) !important; color: var(--tl-text) !important; box-shadow: none !important; }
body.tl-theme [class*="btn-outline-"]:hover { border-color: var(--tl-gold) !important; color: var(--tl-gold-2) !important; }

/* ---------- Form ---------- */
body.tl-theme .form-control,
body.tl-theme .form-select,
body.tl-theme .form-control-cvh,
body.tl-theme .form-select-cvh {
    background-color: rgba(9, 7, 14, 0.75) !important;
    border: 1px solid var(--tl-line-strong) !important;
    color: var(--tl-text) !important;
    border-radius: 11px !important;
    box-shadow: none !important;
}
body.tl-theme .form-control:focus,
body.tl-theme .form-select:focus,
body.tl-theme .form-control-cvh:focus,
body.tl-theme .form-select-cvh:focus {
    border-color: var(--tl-gold) !important;
    box-shadow: 0 0 0 3px rgba(242, 196, 107, 0.16) !important;
}
body.tl-theme .form-control::placeholder { color: var(--tl-faint) !important; }
body.tl-theme .input-group-text { background: rgba(28, 22, 40, 0.9) !important; border-color: var(--tl-line-strong) !important; color: var(--tl-gold) !important; }
body.tl-theme .form-label { color: var(--tl-muted) !important; }

/* ---------- Bảng ---------- */
body.tl-theme .table-cvh thead th,
body.tl-theme .table thead th {
    background: rgba(242, 196, 107, 0.05) !important;
    color: rgba(242, 196, 107, 0.8) !important;
    font-family: var(--tl-sans);
    font-size: 0.7rem;
    letter-spacing: 0.14em;
    border-bottom: 1px solid var(--tl-line) !important;
}
body.tl-theme .table-cvh tbody td,
body.tl-theme .table tbody td { border-bottom: 1px solid rgba(232, 190, 110, 0.08) !important; color: var(--tl-text); }
body.tl-theme .table-hover > tbody > tr:hover > * { --bs-table-bg-state: rgba(63, 208, 164, 0.06); background-color: rgba(63, 208, 164, 0.06) !important; }
body.tl-theme .rank-card-1 { background: linear-gradient(90deg, rgba(242, 196, 107, 0.14), transparent 70%) !important; }
body.tl-theme .rank-card-2 { background: linear-gradient(90deg, rgba(210, 215, 230, 0.08), transparent 70%) !important; }
body.tl-theme .rank-card-3 { background: linear-gradient(90deg, rgba(205, 127, 50, 0.1), transparent 70%) !important; }

/* Huy hiệu hạng = viên ngọc nhỏ */
body.tl-theme .tl-rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--tl-muted);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(232, 190, 110, 0.18);
    font-variant-numeric: tabular-nums;
}
body.tl-theme .tl-rank.r1, body.tl-theme .tl-rank.r2, body.tl-theme .tl-rank.r3 {
    color: #3a1803;
    border: 0;
    background: radial-gradient(circle at 34% 28%, #fff6d8 0 8%, #ffcb62 30%, #ef8b1d 70%, #a9480a 100%);
    box-shadow: inset -2px -3px 5px rgba(120, 40, 0, 0.5), 0 0 12px rgba(245, 154, 31, 0.45);
}
body.tl-theme .tl-rank.r2 { filter: saturate(0.25) brightness(1.15); }
body.tl-theme .tl-rank.r3 { filter: hue-rotate(-12deg) saturate(0.8) brightness(0.88); }

/* ---------- Modal ---------- */
body.tl-theme .modal-content {
    background: var(--tl-ink-2) !important;
    border: 1px solid var(--tl-line-strong) !important;
    border-radius: 16px !important;
    color: var(--tl-text);
}
body.tl-theme .modal-header, body.tl-theme .modal-footer { border-color: var(--tl-line) !important; }
body.tl-theme .terms-modal-box { border-color: rgba(240, 138, 44, 0.75) !important; background: var(--tl-ink) !important; }
body.tl-theme .terms-modal-header { background: linear-gradient(135deg, #8f3606 0%, #d4620e 50%, #f59a1f 100%) !important; }
body.tl-theme .terms-modal-title { font-family: var(--tl-serif) !important; letter-spacing: 0.04em; }
body.tl-theme .terms-modal-body { background: #0e0b12 !important; }

/* SweetAlert */
body.tl-theme .swal2-popup { background: var(--tl-ink-2) !important; color: var(--tl-text) !important; border: 1px solid var(--tl-line-strong); border-radius: 16px !important; }
body.tl-theme .swal2-title { color: var(--tl-gold-2) !important; font-family: var(--tl-serif) !important; }
body.tl-theme .swal2-html-container { color: var(--tl-muted) !important; }
body.tl-theme .swal2-confirm { background: linear-gradient(180deg, #ffe09a, #d48d2e) !important; color: #2a1405 !important; border-radius: 10px !important; }

/* ---------- Hoa văn mây phân cách ---------- */
.tl-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    color: var(--tl-gold);
    margin: 8px auto 28px;
    max-width: 520px;
}
.tl-divider::before, .tl-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(242, 196, 107, 0.55));
}
.tl-divider::after { background: linear-gradient(270deg, transparent, rgba(242, 196, 107, 0.55)); }

/* ==========================================================================
   TRANG CHỦ
   ========================================================================== */
.tl-hero {
    position: relative;
    padding: 36px 16px 56px;
    text-align: center;
    overflow: hidden;
}
.tl-hero::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 46%;
    width: min(760px, 120vw);
    aspect-ratio: 1;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background:
        radial-gradient(circle, rgba(242, 196, 107, 0.12) 0%, rgba(242, 196, 107, 0) 60%),
        repeating-conic-gradient(from 0deg, rgba(242, 196, 107, 0.06) 0 2deg, transparent 2deg 15deg);
    -webkit-mask: radial-gradient(circle, #000 30%, transparent 70%);
    mask: radial-gradient(circle, #000 30%, transparent 70%);
    pointer-events: none;
    animation: tl-spin 120s linear infinite;
}
.tl-hero > * { position: relative; }

.tl-balls {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: clamp(8px, 2.4vw, 22px);
    margin: 0 auto 22px;
    height: 110px;
}
.tl-balls .db-ball { --db: clamp(30px, 7vw, 54px); animation: tl-float 5s ease-in-out infinite; }
.tl-balls .db-ball:nth-child(1) { transform: translateY(-4px); animation-delay: -0.0s; }
.tl-balls .db-ball:nth-child(2) { margin-bottom: 26px; animation-delay: -0.7s; }
.tl-balls .db-ball:nth-child(3) { margin-bottom: 46px; animation-delay: -1.4s; }
.tl-balls .db-ball:nth-child(4) { --db: clamp(40px, 9.5vw, 72px); margin-bottom: 54px; animation-delay: -2.1s; }
.tl-balls .db-ball:nth-child(5) { margin-bottom: 46px; animation-delay: -2.8s; }
.tl-balls .db-ball:nth-child(6) { margin-bottom: 26px; animation-delay: -3.5s; }
.tl-balls .db-ball:nth-child(7) { animation-delay: -4.2s; }

.tl-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: var(--tl-jade);
    margin-bottom: 12px;
}
.tl-eyebrow::before, .tl-eyebrow::after { content: ''; width: 28px; height: 1px; background: currentColor; opacity: 0.6; }
body.tl-theme .tl-hero-title {
    font-family: var(--tl-serif) !important;
    font-weight: 900;
    font-size: clamp(2.3rem, 7vw, 4.6rem);
    line-height: 1.05;
    margin: 0 0 14px;
    text-transform: none;
    letter-spacing: 0.01em;
    filter: drop-shadow(0 6px 24px rgba(240, 138, 44, 0.25));
}
body.tl-theme .tl-hero-title .tl-gold-text { display: inline-block; padding-bottom: 0.08em; }
.tl-hero-sub {
    color: var(--tl-muted);
    max-width: 620px;
    margin: 0 auto 26px;
    font-size: 1.02rem;
}
.tl-hero-sub b { color: var(--tl-gold-2); font-weight: 600; }
.tl-cta { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-bottom: 14px; }
.tl-cta .btn { padding: 13px 26px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 170px; }
.tl-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.tl-links .btn { text-transform: none !important; letter-spacing: 0.02em; padding: 8px 16px; font-size: 0.85rem; display: inline-flex; align-items: center; gap: 6px; }
.tl-links .btn.tl-hot { border-color: rgba(242, 196, 107, 0.7) !important; color: var(--tl-gold-2) !important; animation: tl-glow 2.4s ease-in-out infinite; }

.tl-section-head { text-align: center; margin: 8px 0 22px; }
body.tl-theme .tl-section-head h2 { font-size: clamp(1.4rem, 3vw, 2rem); font-weight: 800; margin: 0 0 4px; }
.tl-section-head p { color: var(--tl-muted); margin: 0; font-size: 0.92rem; }

.tl-board-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--tl-line);
}
body.tl-theme .tl-board-head h5 { margin: 0; font-size: 1.08rem; font-weight: 800; letter-spacing: 0.04em; }
.tl-board-head small { display: block; color: var(--tl-faint); font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; margin-top: 2px; }
.tl-board-head .tl-board-icon { margin-left: auto; font-size: 1.3rem; color: var(--tl-gold); opacity: 0.75; }
.tl-player { font-weight: 700; color: var(--tl-text); }
.tl-sub { display: block; font-size: 0.7rem; color: var(--tl-faint); }
.tl-realm { font-family: var(--tl-serif); font-weight: 700; font-size: 0.8rem; color: var(--tl-jade); }
.tl-num { font-weight: 800; font-variant-numeric: tabular-nums; }
.tl-empty { text-align: center; padding: 40px 16px !important; color: var(--tl-faint) !important; font-style: italic; }
.tl-qi { height: 6px; border-radius: 4px; background: rgba(255, 255, 255, 0.06); min-width: 50px; max-width: 90px; flex: 1; overflow: hidden; }
.tl-qi > span { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, #1f9e7b, #3fd0a4, #c7ffe9); box-shadow: 0 0 10px rgba(63, 208, 164, 0.6); }

/* Bục vinh danh */
body.tl-theme .podium-card { border-radius: 16px; border: 1px solid var(--tl-line-strong); }
body.tl-theme .podium-item-1 { background: linear-gradient(180deg, rgba(242, 196, 107, 0.28), rgba(120, 60, 10, 0.35)); border-color: rgba(242, 196, 107, 0.7); box-shadow: 0 20px 40px -20px rgba(240, 138, 44, 0.7); }
body.tl-theme .podium-item-2 { background: linear-gradient(180deg, rgba(200, 205, 220, 0.16), rgba(40, 36, 56, 0.6)); }
body.tl-theme .podium-item-3 { background: linear-gradient(180deg, rgba(205, 127, 50, 0.22), rgba(60, 30, 10, 0.5)); }
body.tl-theme .rank-name { font-family: var(--tl-serif); }
body.tl-theme .rank-item-minor { background: rgba(28, 22, 40, 0.6); border: 1px solid var(--tl-line); }

/* ---------- Chân trang ---------- */
body.tl-theme footer {
    position: relative;
    background: linear-gradient(180deg, rgba(11, 9, 17, 0), rgba(11, 9, 17, 0.9) 40%) !important;
    border-top: 1px solid var(--tl-line) !important;
}
.tl-footer-balls { display: inline-flex; gap: 8px; margin: 4px 0 14px; }
.tl-footer-balls .db-ball { --db: 16px; box-shadow: inset -2px -2px 4px rgba(120, 40, 0, 0.5), 0 0 8px rgba(245, 154, 31, 0.35); }

/* ---------- Hoạt ảnh ---------- */
@keyframes tl-float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -8px; } }
@keyframes tl-spin { to { transform: translate(-50%, -50%) rotate(360deg); } }
@keyframes tl-glow { 0%, 100% { box-shadow: 0 0 0 0 rgba(242, 196, 107, 0); } 50% { box-shadow: 0 0 18px 0 rgba(242, 196, 107, 0.35); } }
@media (prefers-reduced-motion: reduce) {
    .tl-balls .db-ball, .tl-hero::before, .tl-links .btn.tl-hot { animation: none !important; }
}

/* ---------- Mobile ---------- */
@media (max-width: 767px) {
    .tl-hero { padding: 18px 8px 36px; }
    .tl-balls { height: 80px; margin-bottom: 16px; }
    .tl-balls .db-ball:nth-child(2), .tl-balls .db-ball:nth-child(6) { margin-bottom: 16px; }
    .tl-balls .db-ball:nth-child(3), .tl-balls .db-ball:nth-child(5) { margin-bottom: 30px; }
    .tl-balls .db-ball:nth-child(4) { margin-bottom: 36px; }
    .tl-cta .btn { flex: 1 1 calc(50% - 12px); min-width: 0; padding: 12px 14px; }
    .tl-board-head { padding: 14px 14px 12px; }
}

/* Bảng xếp hạng gọn trên điện thoại (trước đây chỉ áp dụng khi có bảng Vinh danh) */
@media (max-width: 768px) {
    body.tl-theme .table-cvh th, body.tl-theme .table-cvh td { padding: 10px 6px !important; font-size: 0.78rem !important; }
    body.tl-theme .table-cvh th.ps-4, body.tl-theme .table-cvh td.ps-4 { padding-left: 12px !important; }
    body.tl-theme .table-cvh th.pe-4, body.tl-theme .table-cvh td.pe-4 { padding-right: 12px !important; }
}

/* ---------- Hộp thông báo Tiên Long (tlAlert) ---------- */
body.tl-theme .swal2-popup.tl-alert-popup {
    padding: 30px 26px 24px !important;
    border-radius: 18px !important;
    background:
        radial-gradient(260px 160px at 50% 0%, rgba(242, 196, 107, 0.16), transparent 70%),
        linear-gradient(180deg, #1a1426, #0f0b16) !important;
    border: 1px solid rgba(242, 196, 107, 0.45) !important;
    box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 236, 190, 0.08) !important;
    overflow: visible;
}
body.tl-theme .tl-alert-popup::before {
    content: '';
    position: absolute;
    inset: 7px;
    border-radius: 12px;
    pointer-events: none;
    background:
        linear-gradient(#f2c46b, #f2c46b) top left / 18px 1px, linear-gradient(#f2c46b, #f2c46b) top left / 1px 18px,
        linear-gradient(#f2c46b, #f2c46b) top right / 18px 1px, linear-gradient(#f2c46b, #f2c46b) top right / 1px 18px,
        linear-gradient(#f2c46b, #f2c46b) bottom left / 18px 1px, linear-gradient(#f2c46b, #f2c46b) bottom left / 1px 18px,
        linear-gradient(#f2c46b, #f2c46b) bottom right / 18px 1px, linear-gradient(#f2c46b, #f2c46b) bottom right / 1px 18px;
    background-repeat: no-repeat;
    opacity: 0.6;
}
body.tl-theme .tl-alert-popup .swal2-html-container { margin: 0 !important; padding: 0 !important; overflow: visible; }
.tl-alert { text-align: center; }
.tl-alert-orb { position: relative; display: inline-grid; place-items: center; margin: -62px 0 10px; }
.tl-alert-orb::before {
    content: '';
    position: absolute;
    width: 130px; height: 130px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 200, 90, 0.5), rgba(63, 208, 164, 0.15) 50%, transparent 70%);
    animation: tl-alert-pulse 2.4s ease-in-out infinite;
}
.tl-alert-orb .db-ball { --db: 76px; position: relative; animation: tl-float 4s ease-in-out infinite; }
.tl-alert-warning .tl-alert-orb .db-ball { filter: saturate(0.85); }
.tl-alert-seal {
    width: 72px; height: 72px; margin: -58px auto 12px;
    display: grid; place-items: center;
    border-radius: 50%;
    font-size: 2rem; color: #ffd9cf;
    background: radial-gradient(circle at 35% 30%, #ef6a54, #8f1d12);
    border: 2px solid rgba(255, 180, 160, 0.6);
    box-shadow: 0 0 30px rgba(226, 81, 61, 0.55);
}
.tl-alert-title {
    font-family: var(--tl-serif);
    font-weight: 800;
    font-size: 1.35rem;
    line-height: 1.3;
    margin-bottom: 8px;
    background: linear-gradient(180deg, #fff3cf, #f2c46b 55%, #c9852f);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent; color: transparent;
}
.tl-alert-error .tl-alert-title { background: linear-gradient(180deg, #ffe1d9, #ff8a70); -webkit-background-clip: text; background-clip: text; }
.tl-alert-text { color: var(--tl-muted); font-size: 0.95rem; line-height: 1.6; }
.tl-alert-text b { color: var(--tl-gold-2); }
body.tl-theme .tl-alert-popup .swal2-actions { margin-top: 20px !important; }
body.tl-theme .tl-alert-btn { min-width: 150px; padding: 10px 24px !important; }
@keyframes tl-alert-pulse { 0%, 100% { transform: scale(0.92); opacity: 0.75; } 50% { transform: scale(1.06); opacity: 1; } }
body.tl-theme .tl-alert-popup.tl-alert-in { animation: tl-alert-pop 0.32s cubic-bezier(0.2, 0.9, 0.3, 1.2); }
@keyframes tl-alert-pop { from { transform: translateY(14px) scale(0.94); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .tl-alert-orb::before, .tl-alert-orb .db-ball { animation: none; } }

/* Ký hiệu tăng / giảm hạng */
.tl-rank-cell { display: flex; align-items: center; gap: 6px; }
.tl-trend {
    display: inline-flex; align-items: center; gap: 1px;
    min-width: 26px;
    font-size: 0.72rem; font-weight: 800; line-height: 1;
    font-variant-numeric: tabular-nums;
}
.tl-trend svg { width: 9px; height: 9px; fill: currentColor; margin-right: 2px; flex: none; }
.tl-legend { white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }
.tl-trend.is-up { color: #3fd0a4; }
.tl-trend.is-down { color: #ff7a66; }
.tl-trend.is-same { color: var(--tl-faint); justify-content: center; }
.tl-trend.is-new {
    padding: 2px 5px; border-radius: 5px;
    font-size: 0.62rem; letter-spacing: 0.04em; text-transform: uppercase;
    color: #2a1405; background: linear-gradient(180deg, #ffe09a, #e3a442);
}
.tl-section-head .tl-trend { min-width: 0; vertical-align: middle; }

/* Bảng xếp hạng trang chủ: cột cố định, không xuống dòng lộn xộn */
body.tl-theme .tl-board-table { table-layout: fixed; width: 100%; }
body.tl-theme .tl-board-table .tl-col-rank { width: 84px; }
body.tl-theme .tl-board-table .tl-col-val { width: 44%; }
body.tl-theme .tl-board-table tbody td { padding-top: 11px !important; padding-bottom: 11px !important; overflow: hidden; }
body.tl-theme .tl-board-table .tl-player,
body.tl-theme .tl-board-table .tl-realm {
    display: block;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
body.tl-theme .tl-board-table .tl-player { line-height: 1.35; }
body.tl-theme .tl-board-table .tl-sub { white-space: nowrap; line-height: 1.3; margin-top: 1px; }
body.tl-theme .tl-board-table .tl-realm { font-size: 0.82rem; line-height: 1.35; }
body.tl-theme .tl-board-table .tl-rank-cell { gap: 5px; white-space: nowrap; }
body.tl-theme .tl-board-table .tl-trend { min-width: 0; }
body.tl-theme .tl-board-table .tl-trend.is-same { opacity: 0.45; }
body.tl-theme .tl-board-table .tl-qi { min-width: 36px; }
@media (max-width: 768px) {
    body.tl-theme .tl-board-table .tl-col-rank { width: 70px; }
    body.tl-theme .tl-board-table .tl-col-val { width: 46%; }
    body.tl-theme .tl-board-table tbody td { padding-top: 9px !important; padding-bottom: 9px !important; }
    body.tl-theme .tl-board-table .tl-player { font-size: 0.86rem !important; }
    body.tl-theme .tl-board-table .tl-realm { font-size: 0.76rem !important; }
    body.tl-theme .tl-board-table .tl-rank { width: 24px; height: 24px; font-size: 0.68rem; }
}

/* ==========================================================================
   TỐI ƯU ĐIỆN THOẠI (≤ 575px)
   ========================================================================== */
@media (max-width: 575px) {
    /* Tiêu đề trang không quá to, tránh gãy chữ */
    body.tl-theme h1.display-3, body.tl-theme h1.display-4, body.tl-theme h1.display-5,
    body.tl-theme .display-3, body.tl-theme .display-4, body.tl-theme .display-5 { font-size: 1.7rem !important; line-height: 1.2; }
    body.tl-theme h1.fw-900 { font-size: 1.6rem !important; line-height: 1.2; }
    body.tl-theme h2.fw-900 { font-size: 1.35rem !important; }
    body.tl-theme .card h3 { font-size: 1.15rem; }
    body.tl-theme .card h5 { font-size: 1rem; }

    /* Lề trang gọn, nội dung rộng hơn */
    body.tl-theme .body-wrapper.p-3 { padding-left: 0 !important; padding-right: 0 !important; }
    body.tl-theme .container-fluid { padding-left: 12px !important; padding-right: 12px !important; }
    body.tl-theme .card-body.p-4, body.tl-theme .card-body.p-md-5 { padding: 1.1rem !important; }
    body.tl-theme .mb-5 { margin-bottom: 1.75rem !important; }

    /* Trang chủ: nút không xuống dòng */
    .tl-hero-sub { font-size: 0.95rem; margin-bottom: 20px; }
    .tl-cta { gap: 10px; }
    .tl-cta .btn { flex: 1 1 0; padding: 12px 8px !important; font-size: 0.8rem; letter-spacing: 0.02em; white-space: nowrap; gap: 6px; }
    .tl-cta .btn i { font-size: 1.05rem !important; }
    .tl-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; }
    .tl-links .btn { justify-content: center; padding: 9px 6px; font-size: 0.8rem; white-space: nowrap; }
    .tl-section-head p { font-size: 0.85rem; }

    /* Ô nhập giftcode: không bị nút đè mất chỗ */
    body.tl-theme #redeem-code { height: 50px !important; font-size: 1rem !important; padding-left: 14px !important; padding-right: 10px !important; min-width: 0; }
    body.tl-theme #redeem-code + .btn { padding: 0 14px !important; font-size: 0.8rem; white-space: nowrap; }
    body.tl-theme #redeem-code + .btn i { font-size: 1.1rem !important; margin-right: 4px !important; }

    /* Bảng: chữ vừa màn hình */
    body.tl-theme .table td, body.tl-theme .table th { font-size: 0.8rem; }

    /* Hộp thông báo tlAlert */
    body.tl-theme .swal2-popup.tl-alert-popup { width: calc(100vw - 32px) !important; padding: 26px 18px 20px !important; }
    .tl-alert-title { font-size: 1.2rem; }

    /* Menu trượt bên: không chiếm hết màn hình */
    body.tl-theme .offcanvas.offcanvas-start { width: min(300px, 86vw) !important; }
}

/* Cảnh giới hiện dưới tên trên điện thoại (bảng Top Tu Vi) */
.tl-show-xs { display: none !important; }
@media (max-width: 575px) {
    .tl-hide-xs { display: none !important; }
    body.tl-theme .tl-board-table .tl-realm.tl-show-xs { display: block !important; text-align: left; font-size: 0.74rem !important; margin-top: 2px; white-space: normal; }
    body.tl-theme .tl-board-table .tl-col-rank { width: 66px; }
    body.tl-theme .tl-board-table .tl-col-val { width: 40%; }
    /* Thanh tài khoản trên header: chỉ avatar + điểm */
    body.tl-theme .app-header .dropdown > .nav-link .bg-glass { padding: 3px 8px 3px 3px !important; }
    body.tl-theme .navbar-brand img { height: 40px !important; }
}
@media (max-width: 575px) {
    body.tl-theme .card .fs-5.text-slate { font-size: 0.95rem !important; }
    body.tl-theme .card h4.text-uppercase { font-size: 1.1rem; }
}
