:root {
    --amber: #ffb54d;
    --amber-2: #c98a2f;
    --nav-bg: rgba(0, 0, 0, .6);
}

html,
body {
    height: 80%;
}

body.bg-game {
    background: #0b0b0b url('../image/bg.jpg') no-repeat top center;
    background-size: 100% auto;
}

.bg-wrapper {
    background: #0b0b0b url('../image/bg.jpg') no-repeat top center;
    background-size: 100% auto;
    min-height: 100vh;
}

bg-overlay {
    position: absolute;
    inset: 0;
    height: 100%;
    pointer-events: none;
    background: radial-gradient(ellipse at center, rgba(0, 0, 0, .25), rgba(0, 0, 0, .65) 55%, rgba(0, 0, 0, .85) 100%);
}

.nav-wrap {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--nav-bg);
    backdrop-filter: blur(6px);
}

.navbar .navbar-brand {
    letter-spacing: .12em;
}

.navbar .nav-link {
    font-weight: 600;
    letter-spacing: .05em;
    padding: .75rem 1rem;
    color: #eaeaea;
}

.navbar .nav-link.active,
.navbar .nav-link:hover {
    color: var(--amber);
}

.main-menu .nav-link {
    text-transform: uppercase;
}

.btn-auth {
    padding: .6rem 1.2rem;
    border-radius: .5rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: .04em;
}

.btn-amber {
    color: #1a1a1a;
    background: linear-gradient(180deg, var(--amber), var(--amber-2));
    border: 1px solid rgba(255, 255, 255, .15);
    box-shadow: inset 0 0 10px rgba(255, 255, 255, .15), 0 0 30px rgba(255, 181, 77, .15);
}

.btn-amber:hover {
    filter: brightness(1.05);
}

.btn-outline-amber {
    color: var(--amber);
    border: 1px solid var(--amber-2);
    background: rgba(255, 181, 77, .08);
}

.btn-outline-amber:hover {
    background: rgba(255, 181, 77, .18);
    color: #ffd79c;
}

.content-shell {
    position: relative;
    z-index: 1;
    padding-top: 17rem;
    padding-bottom: 3rem;
}

.card {
    border-radius: 1rem;
    background: rgba(0, 0, 0, .45);
    border: 1px solid rgba(255, 255, 255, .08);
    color: #eaeaea;
}

.card .btn {
    border-radius: .6rem;
}

.form-control,
.form-select {
    background: rgba(255, 255, 255, .06);
    color: #eaeaea;
    border-color: rgba(255, 255, 255, .15);
}

.form-control:focus,
.form-select:focus {
    box-shadow: 0 0 0 .2rem rgba(255, 181, 77, .15);
    border-color: var(--amber);
}

.img-fluid,
.card-img-top {
    border-radius: .75rem;
}

.footer {
    border-top: 1px solid rgba(255, 255, 255, .1);
    font-size: 0.9rem;
}

.footer img {
    filter: drop-shadow(0 0 3px rgba(0, 0, 0, .6));
}

/* Panels on home */

.home-top .panel {
    min-height: 50px;
}

.panel {
    background: rgba(0, 0, 0, .55);
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 1rem;
    padding: 0.2rem 0.5rem;
    color: #eee;
}

.panel__title {
    font-weight: 800;
    letter-spacing: .06em;
    color: #ffb54d;
    text-transform: uppercase;
}

.panel__sub {
    color: #d9d9d9;
    opacity: .85;
}

.panel--status .progress {
    background: rgba(255, 255, 255, .12);
}

.panel--status .progress-bar {
    background: linear-gradient(180deg, #ffb54d, #c98a2f);
}

/* Status dot with rhythmic animation */

.status-dot {
    --c: #2ecc71;
    /* default color (online) */
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: var(--c);
    box-shadow: 0 0 8px var(--c);
    position: relative;
    isolation: isolate;
    animation: dotPulse 2.2s ease-in-out infinite;
}

/* State colors + tempo */

.status-dot.online {
    --c: #2ecc71;
    animation-duration: 2.2s;
}

.status-dot.offline {
    --c: #e74c3c;
    animation-duration: 1.6s;
}

/* Expanding ring */

.status-dot::after {
    content: "";
    position: absolute;
    inset: -4px;
    border-radius: inherit;
    border: 2px solid var(--c);
    opacity: .5;
    transform: scale(1);
    animation: dotRing 2.2s ease-out infinite;
}

.status-dot.offline::after {
    animation-duration: 1.6s;
}

/* Animations */

@keyframes dotPulse {
    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 0 8px var(--c);
    }
    50% {
        transform: scale(1.18);
        box-shadow: 0 0 16px var(--c);
    }
}

@keyframes dotRing {
    0% {
        transform: scale(1);
        opacity: .45;
    }
    70% {
        transform: scale(2.2);
        opacity: 0;
    }
    100% {
        transform: scale(2.2);
        opacity: 0;
    }
}

/* Respect reduced motion */

@media (prefers-reduced-motion: reduce) {
    .status-dot,
    .status-dot::after {
        animation: none !important;
    }
}

.feature-card {
    border-radius: 1rem;
    overflow: hidden;
    background: rgba(0, 0, 0, .45);
    border: 1px solid rgba(255, 255, 255, .08);
}

.carousel-caption {
    background: linear-gradient(180deg, rgba(0, 0, 0, .35), rgba(0, 0, 0, .75));
    border-radius: .75rem;
    padding: 1rem 1.25rem;
}

.panel--announce .announce-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: .75rem;
    align-items: center;
    padding: .6rem .25rem;
    border-bottom: 1px dashed rgba(255, 255, 255, .1);
}

.panel--announce .announce-row:last-child {
    border-bottom: 0;
}

.panel--announce .tag {
    color: #ffb54d;
    font-weight: 700;
}

.panel--announce .title {
    color: #eaeaea;
    text-decoration: none;
}

.panel--announce .title:hover {
    color: #ffd79c;
}

.panel--announce .date {
    color: #bfbfbf;
}

/* Buttons (re-use header styles) */

.btn-amber {
    color: #1a1a1a;
    background: linear-gradient(180deg, #ffb54d, #c98a2f);
    border: 1px solid rgba(255, 255, 255, .15);
    border-radius: .6rem;
    font-weight: 800;
    text-transform: uppercase;
}

.rank-card {
    border-radius: 1rem;
    background-size: cover;
    background-position: top;
    padding: 0.5rem;
    color: #fff;
    position: relative;
    overflow: hidden;
    min-height: 400px;
}

.rank-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .45);
}

.rank-card>* {
    position: relative;
    z-index: 1;
}

.rank-title {
    color: #ffb54d;
    font-weight: 800;
    text-transform: uppercase;
    margin-bottom: .5rem;
    text-shadow: 0 0 6px #000;
    text-align: center;
}

.rank-card table {
    background: transparent;
    border-radius: .5rem;
}

.rank-card th {
    font-size: .8rem;
    text-transform: uppercase;
    color: #ffb54d;
    background: transparent;
}

.rank-card td {
    font-size: .85rem;
    background: transparent;
    color: #f8e6c0;
}

.text-amber {
    color: var(--amber);
}

.auth-modal .modal-backdrop {
    opacity: .85;
}

.modal-backdrop.show {
    opacity: .85;
}

.auth-panel {
    background: #ffffff url('../image/pattern.png') repeat;
    /* tuỳ chọn: bỏ nếu không có pattern */
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 1rem;
    box-shadow: 0 10px 50px rgba(0, 0, 0, .6), inset 0 -6px 0 rgba(255, 181, 77, .08);
    color: #eaeaea;
    position: relative;
    overflow: hidden;
    max-width: 500px;
    margin: 1.5rem auto;
}

.auth-close {
    position: absolute;
    top: .75rem;
    right: .75rem;
    filter: drop-shadow(0 0 4px rgba(0, 0, 0, .6));
}

.auth-header {
    padding-top: 1.5rem;
}

.auth-body {
    padding: 1.25rem 2rem 2rem;
}

.auth-input {
    background: rgba(0, 0, 0, .35);
    border: 1px solid rgba(255, 255, 255, .12);
    color: #eee;
    box-shadow: 0 0 0 .2rem transparent;
}

.auth-input:focus {
    border-color: var(--amber);
    box-shadow: 0 0 0 .2rem rgba(255, 181, 77, .18);
}

/* ============ Post Detail ============ */

.post-detail {
    padding: 2rem 0 3rem;
    margin-top: -250px;
    /*  */
    position: relative;
    z-index: 2;
}

.post-body.md-content {
    background: rgba(0, 0, 0, .55);
}

.post-frame {
    max-width: 980px;
    position: relative;
}

/* Hai cột viền vàng hai bên như demo */

.post-frame::before,
.post-frame::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    width: 6px;
    background: linear-gradient(180deg, rgba(255, 181, 77, .8), rgba(255, 181, 77, .15));
    border-radius: 6px;
    filter: drop-shadow(0 0 6px rgba(255, 181, 77, .35));
}

.post-frame::before {
    left: -24px;
}

.post-frame::after {
    right: -24px;
}

/* Header */

.post-kicker {
    font-weight: 800;
    letter-spacing: .06em;
    color: #f0f0f0;
    margin-bottom: .25rem;
    text-transform: uppercase;
}

.post-title {
    font-weight: 900;
    letter-spacing: .02em;
    margin: 0;
    color: #ffd79c;
    text-transform: uppercase;
    text-shadow: 0 2px 0 rgba(0, 0, 0, .6);
    font-size: clamp(1.5rem, 2.8vw, 2rem);
}

.post-meta {
    color: #cfcfcf;
    opacity: .85;
    margin-top: .3rem;
    font-size: .95rem;
}

.post-rule {
    height: 2px;
    border: 0;
    margin: 1rem auto 1.25rem;
    max-width: 640px;
    background: linear-gradient(90deg, transparent, rgba(255, 181, 77, .7), transparent);
}

/* Nội dung Markdown */

.md-content {
    background: rgba(0, 0, 0, .35);
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: .75rem;
    padding: 1.25rem 1.2rem;
    color: #eaeaea;
    line-height: 1.7;
}

.md-content h1,
.md-content h2,
.md-content h3,
.md-content h4 {
    color: #ffcc80;
    font-weight: 800;
    margin-top: 1.2rem;
    text-transform: none;
    letter-spacing: .01em;
}

.md-content p {
    margin: .5rem 1rem;
}

.md-content a {
    color: #ffb54d;
    text-decoration: underline;
}

.md-content a:hover {
    color: #ffd79c;
}

.md-content ul {
    padding-left: 1.2rem;
    margin-bottom: 1rem;
}

.md-content li {
    margin: .25rem 0;
}

/* Ảnh trong bài */

.md-content img {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: .5rem;
    margin: .75rem auto 1rem;
    box-shadow: 0 8px 30px rgba(0, 0, 0, .35);
}

/* Bảng/blockquote nếu có */

.md-content table {
    width: 100%;
    border-collapse: collapse;
    margin: .75rem 0 1rem;
}

.md-content th,
.md-content td {
    border: 1px solid rgba(255, 255, 255, .12);
    padding: .5rem .6rem;
    vertical-align: top;
}

.md-content blockquote {
    border-left: 4px solid rgba(255, 181, 77, .6);
    padding: .4rem .9rem;
    margin: .75rem 0;
    color: #f3f3f3;
    background: rgba(255, 181, 77, .06);
}

/* Mobile: nới padding cho dễ đọc */

@media (max-width: 576px) {
    .post-frame::before,
    .post-frame::after {
        display: none;
    }
    .md-content {
        padding: 1rem;
    }
}

/* ----- Post Detail (giữ các rule trước đó nếu bạn đã thêm) ----- */

/* Khối bài viết dùng nền khung */

.post-body.frame-bg {
    position: relative;
    margin: 0 auto 2rem;
    width: 100%;
    max-width: 980px;
    aspect-ratio: 1049 / 768;
    /* giữ tỉ lệ khung */
    background: url('../image/post-frame.png') center / no-repeat;
    filter: drop-shadow(0 10px 30px rgba(0, 0, 0, .35));
}

/* Vùng thật đặt nội dung markdown bên trong khung */

.post-body.frame-bg .frame-inner {
    position: absolute;
    /* canh lề khớp với phần giấy vàng bên trong khung */
    left: 12%;
    right: 12%;
    top: 14%;
    bottom: 14%;
    overflow: auto;
    /* nếu bài dài sẽ có scrollbar trong khung */
}

/* Bỏ nền/viền cũ của md-content khi nằm trong khung */

.post-body.frame-bg .md-content {
    background: transparent;
    border: 0;
    padding: 0;
    color: #2b1e12;
    /* chữ đậm hơn trên nền giấy */
    line-height: 1.7;
}

/* Tinh chỉnh heading/liên kết/ảnh trong nội dung */

.post-body.frame-bg .md-content h1,
.post-body.frame-bg .md-content h2,
.post-body.frame-bg .md-content h3 {
    color: #7a3b00;
    /* tông nâu vàng */
    margin: .5rem 0 .25rem;
    text-transform: none;
}

.post-body.frame-bg .md-content a {
    color: #b25a00;
    text-decoration: underline;
}

.post-body.frame-bg .md-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: .5rem auto;
    border-radius: .25rem;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .15);
}

/* Mobile: nới lề bên trong cho dễ đọc, bỏ aspect-ratio nếu cần */

@media (max-width: 576px) {
    .post-body.frame-bg {
        aspect-ratio: auto;
        background-size: cover;
        padding-top: 36vw;
        /* tạo phần trên của khung */
        padding-bottom: 36vw;
        /* phần dưới của khung */
    }
    .post-body.frame-bg .frame-inner {
        position: static;
        margin: 0 10%;
        max-height: none;
        overflow: visible;
    }
}

/* Weekly Events – dark card khớp layout */

.we-card {
    background: #0f1014;
    border: 1px solid rgba(255, 255, 255, .06);
    border-radius: 18px;
    padding: 18px 18px 14px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, .35) inset, 0 2px 12px rgba(0, 0, 0, .35);
}

/* Header – glow like lucky-message */

.we-card__head {
    border-bottom: 1px dashed rgba(255, 255, 255, .06);
    padding-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.we-card__head h6 {
    color: #ffb54d;
    letter-spacing: .3px;
    text-shadow: 0 0 10px rgba(255, 215, 100, 0.7);
    animation: glow-text 2.5s ease-in-out infinite;
}

/* Dot pulse (giữ .we-dot cũ nhưng có nhịp) */

.we-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: linear-gradient(180deg, #ffdc73, #f69b3d);
    box-shadow: 0 0 10px #f6a63d;
    animation: head-pulse 2.5s ease-in-out infinite;
}

/* Keyframes (nếu đặt trong .cshtml, nhớ dùng @@keyframes để escape Razor) */

@keyframes glow-text {
    0%,
    100% {
        text-shadow: 0 0 10px rgba(255, 215, 100, 0.7);
    }
    50% {
        text-shadow: 0 0 20px rgba(255, 255, 180, 1);
    }
}

@keyframes head-pulse {
    0%,
    100% {
        box-shadow: 0 0 8px rgba(246, 166, 61, .8), 0 0 0 0 rgba(246, 166, 61, 0);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 18px rgba(255, 215, 100, 1), 0 0 0 6px rgba(246, 166, 61, .25);
        transform: scale(1.06);
    }
}

/* Tabs */

.we-tabs {
    gap: .5rem;
    pointer-events: auto;
}

.we-tab {
    background: rgba(255, 255, 255, .06);
    color: #ffb54d;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 12px;
    padding: 8px 14px;
    font-weight: 600;
    transition: all .15s ease;
}

.we-tab:hover {
    filter: brightness(1.15);
    transform: translateY(-1px);
}

.we-tab.active {
    color: #0b0e13;
    background: linear-gradient(180deg, #ffd86b, #f6a542);
    border-color: transparent;
}

/* List */

.we-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.we-item {
    display: grid;
    grid-template-columns: 120px 1fr auto;
    align-items: center;
    gap: 14px;
    background: rgba(255, 255, 255, .03);
    border: 1px solid rgba(255, 255, 255, .06);
    border-radius: 12px;
    padding: 10px 12px;
}

.we-time {
    font-weight: 800;
    color: #f8e6c0;
    background: linear-gradient(180deg, #8fe3ff, #53b9ff);
    border-radius: 10px;
    padding: 6px 10px;
    text-align: center;
    min-width: 92px;
}

.we-title {
    font-weight: 700;
    color: #ffb54d;
}

.we-desc {
    color: #f8e6c0;
    font-size: .95rem;
    margin-top: 2px;
}

.we-icon {
    color: #79808d;
}

.we-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: #95a0b0;
    padding: 28px 10px;
}

.we-empty i {
    font-size: 22px;
    opacity: .8;
}

/* Responsive */

@media (max-width: 576px) {
    .we-item {
        grid-template-columns: 90px 1fr 20px;
    }
    .we-time {
        padding: 6px 8px;
        font-size: .92rem;
        color: #f8e6c0;
    }
}

/* layout item */

.we-item {
    padding: 14px 16px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
}

.we-item+.we-item {
    margin-top: 10px;
}

.we-title {
    font-weight: 700;
}

/* badge giờ gọn – nhẹ nhàng, không chiếm full width */

.we-time-badge {
    white-space: nowrap;
    font-weight: 700;
    font-size: 0.95rem;
    padding: 6px 12px;
    border-radius: 9999px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
    color: #f8e6c0;
    display: inline-flex;
    align-items: center;
    animation: wePulse 3.4s ease-in-out infinite, weShimmer 2.6s ease-in-out infinite;
}

.we-time-badge::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    transform: translateX(-140%);
    background: linear-gradient(120deg, transparent 30%, rgba(248, 230, 192, .35) 50%, transparent 70%);
    opacity: .5;
    filter: blur(.3px);
}

/* Animations */

/*.we-time-badge {
    white-space: nowrap;
    font-weight: 700;
    font-size: .95rem;
    padding: 6px 12px;
    border-radius: 9999px;
    border: 1px solid rgba(255,255,255,.12);
    background: rgba(255,255,255,.06);
    color: var(--tone);
    display: inline-flex;
    align-items: center;
    position: relative;
    overflow: hidden;
    isolation: isolate;*/

/* glow + shimmer */

/*box-shadow: 0 0 0 rgba(248,230,192,0);
    animation: wePulse 3.4s ease-in-out infinite, weShimmer 2.6s ease-in-out infinite;
}

    .we-time-badge::after {
        content: "";
        position: absolute;
        inset: 0;
        pointer-events: none;
        transform: translateX(-140%);
        background: linear-gradient(120deg, transparent 30%, rgba(248,230,192,.35) 50%, transparent 70%);
        opacity: .5;
        filter: blur(.3px);
    }*/

/* Animations */

/* mobile: đưa badge xuống dưới title cho đỡ chật */

@media (max-width: 576px) {
    .we-item {
        flex-wrap: wrap;
    }
    .we-time-badge {
        order: 3;
        margin-top: 8px;
    }
}

/* Overlay luôn ở dưới, không chặn chuột */

.bg-overlay {
    position: fixed;
    /* hoặc absolute, miễn là phủ nền */
    inset: 0;
    z-index: 0;
    /* thấp hơn header */
    pointer-events: none;
    /* quan trọng: không nhận click/hover */
}

/* Header và dropdown nằm trên overlay */

.nav-wrap,
.navbar {
    position: relative;
    z-index: 1050;
}

/* Đảm bảo menu xổ ra không bị các section cắt mất */

.navbar .dropdown-menu {
    z-index: 2000;
}

/* Nếu trang chủ có section dùng overflow/transform thì đừng cắt menu */

header,
.nav-wrap {
    overflow: visible;
}

/* Background cho we-card (giữ nguyên nội dung cũ) */

.we-card--bg {
    position: relative;
    overflow: hidden;
}

.we-card--bg::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    background-image: var(--we-bg);
    background-size: cover;
    background-position: center;
    transform: scale(1.06);
    filter: saturate(.95) brightness(.55) contrast(1.05);
    animation: weBgDrift 48s ease-in-out infinite alternate;
}

.we-card--bg::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    background: radial-gradient(120% 120% at 10% 0%, rgba(0, 0, 0, .38) 0, rgba(0, 0, 0, 0) 55%), linear-gradient(180deg, rgba(15, 16, 20, .80) 0%, rgba(15, 16, 20, .86) 50%, rgba(15, 16, 20, .92) 100%);
}

/* Nội dung nổi lên trên nền */

.we-card--bg>* {
    position: relative;
    z-index: 1;
}

/* Animation nền nhẹ */

@keyframes weBgDrift {
    0% {
        transform: scale(1.06);
        background-position: 48% 46%;
    }
    50% {
        transform: scale(1.10);
        background-position: 52% 49%;
    }
    100% {
        transform: scale(1.12);
        background-position: 50% 45%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .we-card--bg::before {
        animation: none;
    }
}

/* ============================
   Mobile + bugfix overrides
   ============================ */

/* Fix: selector thiếu dấu chấm trong file gốc */

.bg-overlay {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

/* Make page background scale better on small screens */

body.bg-game {
    background-size: cover;
    /* was 100% auto; causes cropping on mobile */
    background-position: center top;
    background-attachment: fixed;
    /* optional, remove if causes performance issues on mobile */
}

/* Ensure dropdown always above transformed elements */

.navbar .dropdown-menu {
    z-index: 3000 !important;
}

/* Reduce the huge top padding for small screens so content is visible */

@media (max-width: 992px) {
    .content-shell {
        padding-top: 6.5rem;
        /* desktop kept at 17rem; mobile compact */
        padding-bottom: 3rem;
    }
}

/* Auth modal responsive */

.auth-panel {
    max-width: 500px;
}

@media (max-width: 576px) {
    .auth-panel {
        max-width: calc(100% - 32px);
        margin: 1rem auto;
        padding: 1rem;
    }
    .auth-header img {
        height: 56px;
    }
}

/* Post frame: avoid negative margins causing overlap on mobile */

.post-detail {
    margin-top: -250px;
}

@media (max-width: 992px) {
    .post-detail {
        margin-top: -120px;
        /* reduce overlap on tablets */
    }
}

@media (max-width: 576px) {
    .post-detail {
        margin-top: 0;
        /* stack normally on phones */
    }
}

/* Post-body .frame-bg: make aspect and inner content flow on mobile */

.post-body.frame-bg {
    aspect-ratio: 1049 / 768;
}

@media (max-width: 768px) {
    .post-body.frame-bg {
        aspect-ratio: auto;
        background-size: cover;
        padding-top: 42vw;
        padding-bottom: 42vw;
    }
    .post-body.frame-bg .frame-inner {
        position: static;
        margin: 0 8%;
        max-height: none;
        overflow: visible;
    }
}

/* Weekly events: collapse grid into stacked items on small screens */

.we-item {
    display: grid;
    grid-template-columns: 120px 1fr auto;
}

@media (max-width: 768px) {
    .we-item {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        padding: 12px;
    }
    .we-item .we-time {
        min-width: auto;
        align-self: flex-start;
    }
    .we-item .we-time-badge {
        order: 3;
        margin-top: 8px;
    }
}

/* Ensure images scale & stay centered in panels */

.img-fluid,
.card-img-top,
.monphai-img,
.giftcode-img {
    max-width: 100%;
    height: auto;
    object-fit: contain;
}

/* Smaller hero/large images on mobile */

@media (max-width: 576px) {
    .monphai-img {
        height: 220px !important;
    }
    .rank-card {
        min-height: 260px;
    }
    .panel__title {
        font-size: 0.9rem;
    }
}

/* Make sure header sticky doesn't cover content when anchor links used */

.nav-wrap {
    position: sticky;
    top: 0;
    z-index: 1100;
}

/* Improve button sizes on small screens */

.btn-amber,
.btn-outline-amber {
    padding: .45rem .9rem;
    font-size: 0.95rem;
}

/* Prevent transform/overflow in parent cutting off dropdowns */

header,
.nav-wrap,
.main-menu,
.content-shell {
    overflow: visible !important;
}

/* Optional: hide background-attachment fixed on low-perf mobile to avoid jank */

@media (max-width: 480px) {
    body.bg-game {
        background-attachment: scroll;
    }
}

/* ===== monphai (sửa lỗi để không phá carousel) ===== */

.monphai-section {
    position: relative;
    overflow: hidden;
}

/* background (nền) */

.monphai-section .monphai-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    background: #0b0b0b url('../image/monphai/bg_monphai.jpg') center/cover no-repeat;
    filter: brightness(1.08) contrast(1.03);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 18px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28) inset;
}

/* đảm bảo phần hiển thị lên trên nền */

.monphai-card,
.monphai-section .container {
    position: relative;
    z-index: 1;
}

/* Không override display của .carousel-item (để bootstrap hoạt động) */

/* Chỉ dùng flex cho nội dung bên trong để căn giữa */

.monphai-section .carousel-inner {
    min-height: clamp(300px, 48vw, 540px);
}

.monphai-section .carousel-item {
    /* giữ mặc định, nhưng đảm bảo con bên trong được căn giữa */
    position: relative;
}

/* Khung cho nhân vật: đặt một frame con nằm giữa slide */

.monphai-frame {
    /*width: clamp(220px, 34vw, 420px);
    height: clamp(220px, 34vw, 420px);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;*/
    /* canh giữa ngang */
    /*transition: transform .22s ease;*/
    /* nhẹ để không lag */
    /*pointer-events: none;*/
    /* tránh drag ảnh gây rối */
    width: clamp(260px, 36vw, 480px);
    height: clamp(260px, 36vw, 480px);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    position: relative;
    transform: scale(2.5) translateX(15px);
    /* === PHÓNG TO NHÂN VẬT === */
    transform-origin: center center;
    pointer-events: none;
}

/* Ảnh nằm gọn trong vòng tròn (không phóng to quá) */

.monphai-frame img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    pointer-events: none;
}

/* nếu muốn scale nhẹ khi hover (tùy) */

.monphai-frame:hover {
    transform: scale(1.02);
}

/* nút active */

.monphai-section .btn.active {
    color: #1b1b1b !important;
    background: #ffd86b !important;
    border-color: #ffd86b !important;
}

/* ===== Responsive tweaks ===== */

/* Tablet */

@media (max-width: 992px) {
    .monphai-section .carousel-inner {
        min-height: clamp(260px, 60vw, 480px);
    }
    .monphai-frame {
        width: clamp(200px, 40vw, 380px);
        height: clamp(200px, 40vw, 380px);
    }
}

/* Mobile */

@media (max-width: 768px) {
    .monphai-section .card-header .btn {
        padding: .375rem .75rem;
    }
    .monphai-section .carousel-inner {
        min-height: clamp(220px, 68vw, 420px);
    }
    .monphai-frame {
        width: clamp(160px, 52vw, 320px);
        height: clamp(160px, 52vw, 320px);
    }
}

/* Very small */

@media (max-width: 576px) {
    .monphai-frame {
        width: clamp(140px, 62vw, 280px);
        height: clamp(140px, 62vw, 280px);
    }
}

/* ======================================== */

/* SPARK ANIMATION (NO ROTATION - UPWARDS)  */

/* ======================================== */

.spark-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 50vh;
    /* Chỉ hiện ở nửa trên màn hình */
    pointer-events: none;
    overflow: hidden;
    z-index: 999;
    /* Làm mờ phần đáy để lửa hiện ra tự nhiên */
    -webkit-mask-image: linear-gradient(to bottom, black 80%, transparent 100%);
    mask-image: linear-gradient(to bottom, black 80%, transparent 100%);
}

.spark {
    position: absolute;
    top: 105%;
    /* Mặc định nằm ẩn dưới đáy khung */
    background-image: url('../image/tia-lua-Left.png');
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    opacity: 0;
    mix-blend-mode: screen;
    /* Hoà trộn màu cho đẹp */
    /* Animation bay lên */
    animation: sparkRise 10s infinite linear;
}

/* Vị trí xuất phát ngang (Left) của các hạt */

.spark-1 {
    left: 10%;
    width: 620px;
    height: 620px;
}

.spark-2 {
    left: 20%;
    width: 750px;
    height: 750px;
    animation-delay: 2s;
}

.spark-3 {
    left: 30%;
    width: 500px;
    height: 500px;
    animation-delay: 4s;
}

.spark-4 {
    left: 50%;
    width: 640px;
    height: 640px;
    animation-delay: 1s;
}

.spark-5 {
    left: 70%;
    width: 710px;
    height: 710px;
    animation-delay: 3s;
}

.spark-6 {
    left: 80%;
    width: 160px;
    height: 160px;
    animation-delay: 5s;
}

.spark-7 {
    left: 15%;
    width: 130px;
    height: 130px;
    animation-delay: 1.5s;
}

.spark-8 {
    left: 45%;
    width: 115px;
    height: 115px;
    animation-delay: 3.5s;
}

.spark-9 {
    left: 75%;
    width: 145px;
    height: 145px;
    animation-delay: 2.5s;
}

.spark-10 {
    left: 95%;
    width: 105px;
    height: 105px;
    animation-delay: 4.5s;
}

/* KEYFRAMES: CHỈ BAY LÊN VÀ LƯỢN NGANG, KHÔNG XOAY */

@keyframes sparkRise {
    0% {
        top: 105%;
        /* Bắt đầu từ dưới đáy */
        /* translateX(0) là vị trí gốc */
        transform: translateX(0) scale(1);
        opacity: 0;
    }
    10% {
        opacity: 1;
        /* Hiện rõ nhanh chóng */
    }
    100% {
        top: -20%;
        /* Bay vút lên qua khỏi màn hình */
        /* translateX: Bay lệch sang trái hoặc phải dựa vào biến JS --drift-x
           scale: Phóng to/nhỏ dựa vào biến JS --rand-scale
           KHÔNG CÓ ROTATE Ở ĐÂY
        */
        transform: translateX(calc(var(--drift-x, 0) * 1px)) scale(var(--rand-scale, 1));
        opacity: 0;
    }
}

/* CSS cho menu xổ xuống */

.custom-dropdown {
    position: relative;
}

.custom-dropdown:hover .custom-menu {
    display: block;
    /* Hiện menu khi di chuột vào */
}

.custom-menu {
    display: none;
    /* Mặc định ẩn */
    position: absolute;
    top: 100%;
    /* Hiện ngay dưới menu cha */
    left: 0;
    min-width: 160px;
    z-index: 1000;
    background-color: #222;
    /* Màu nền tối hợp game */
    border: 1px solid #444;
    padding: 5px 0;
    list-style: none;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
}

.custom-menu li a {
    color: #fff !important;
    /* Chữ trắng */
    padding: 8px 15px;
    display: block;
    text-decoration: none;
    white-space: nowrap;
}

.custom-menu li a:hover {
    background-color: #d9534f;
    /* Màu đỏ khi di chuột vào mục con */
    color: #fff;
}

/* =========================================
   FIX CĂN CHỈNH ẢNH CKEDITOR (FRONTEND)
   ========================================= */

/* Đảm bảo nội dung hiển thị giống trong editor */

.ck-content {
    /* Tùy chỉnh font hoặc màu sắc chung nếu cần */
    line-height: 1.6;
}

/* Xử lý thẻ figure (bao quanh ảnh) */

.ck-content .image {
    display: table;
    clear: both;
    text-align: center;
    margin: 1em auto;
    /* Mặc định cách trên dưới 1em */
}

/* Đảm bảo ảnh không bị tràn khung */

.ck-content .image img {
    display: block;
    margin: 0 auto;
    max-width: 100%;
    min-width: 50px;
    height: auto;
}

/* --- CĂN TRÁI --- */

.ck-content .image-style-align-left {
    float: left;
    margin-right: 1.5em;
    margin-bottom: 1em;
}

/* --- CĂN PHẢI --- */

.ck-content .image-style-align-right {
    float: right;
    margin-left: 1.5em;
    margin-bottom: 1em;
}

/* --- CĂN GIỮA (QUAN TRỌNG NHẤT VỚI BẠN) --- */

.ck-content .image-style-align-center {
    margin-left: auto;
    margin-right: auto;
    float: none;
    /* Đảm bảo không bị float */
    clear: both;
}

/* Caption ảnh (nếu có) */

.ck-content .image>figcaption {
    display: table-caption;
    caption-side: bottom;
    word-break: break-word;
    color: #aaa;
    background-color: transparent;
    padding: .6em;
    font-size: .75em;
    outline-offset: -1px;
    text-align: center;
}

/* ============================================================= */

/* ============ BẢNG XẾP HẠNG mới (tabbed, phẳng) ============== */

/* ============================================================= */

.lb-card {
    background: linear-gradient(180deg, rgba(28, 20, 12, .82), rgba(10, 7, 4, .8));
    border: 1px solid rgba(255, 207, 122, .25);
    border-radius: 16px;
    padding: 18px 18px 20px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05), 0 12px 30px rgba(0, 0, 0, .45);
}

.lb-heading {
    text-align: center;
    font-family: "Cormorant Garamond", serif;
    font-weight: 700;
    color: #ffcf7a;
    font-size: 26px;
    margin: 0 0 14px;
    text-shadow: 0 2px 6px rgba(0, 0, 0, .5);
}

.lb-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 12px;
    margin-bottom: 16px;
    border-bottom: 1px solid rgba(255, 207, 122, .18);
    -webkit-overflow-scrolling: touch;
}

.lb-tabs::-webkit-scrollbar {
    height: 4px;
}

.lb-tab {
    flex: 0 0 auto;
    padding: 8px 16px;
    border-radius: 999px;
    border: 1px solid rgba(255, 207, 122, .28);
    background: rgba(0, 0, 0, .25);
    color: #e9d9bb;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
    font-family: inherit;
}

.lb-tab:hover {
    color: #fff;
    border-color: rgba(255, 207, 122, .55);
}

.lb-tab.active {
    color: #2f1a00;
    background: linear-gradient(180deg, #ffd468, #e7a71f);
    border-color: #e5b75c;
}

.lb-pane {
    display: none;
}

.lb-pane.active {
    display: block;
    animation: lbfade .2s ease;
}

@keyframes lbfade {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

/* Bục vinh danh Top 3 */

.lb-podium {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 12px;
    margin-bottom: 18px;
}

.lb-pod {
    flex: 1 1 0;
    max-width: 210px;
    text-align: center;
}

.lb-pod .ava {
    width: 52px;
    height: 52px;
    margin: 0 auto 6px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 18px;
    border: 2px solid;
}

.lb-pod .nm {
    font-size: 13px;
    color: #ffe5a0;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lb-pod .fac {
    display: inline-block;
    font-size: 11px;
    padding: 1px 8px;
    border-radius: 999px;
    margin-top: 3px;
}

.lb-pod .val {
    margin-top: 8px;
    border-radius: 8px 8px 0 0;
    padding: 10px 4px;
    font-weight: 800;
    color: #ffd468;
    font-size: 14px;
    border: 1px solid;
    background: linear-gradient(180deg, #2a2013, #17110a);
}

.lb-pod.lb-p1 {
    order: 2;
}

.lb-pod.lb-p2 {
    order: 1;
}

.lb-pod.lb-p3 {
    order: 3;
}

.lb-p1 .ava {
    border-color: #ffcf7a;
    color: #ffcf7a;
    background: rgba(255, 207, 122, .15);
    width: 60px;
    height: 60px;
    font-size: 20px;
}

.lb-p1 .val {
    border-color: rgba(255, 207, 122, .45);
    padding: 14px 4px;
    font-size: 15px;
}

.lb-p2 .ava {
    border-color: #c0c0c0;
    color: #d8d8d8;
    background: rgba(192, 192, 192, .12);
}

.lb-p2 .val {
    border-color: rgba(192, 192, 192, .3);
}

.lb-p3 .ava {
    border-color: #cd7f32;
    color: #e0a060;
    background: rgba(205, 127, 50, .12);
}

.lb-p3 .val {
    border-color: rgba(205, 127, 50, .3);
}

/* Danh sách hạng còn lại */

.lb-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.lb-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-radius: 8px;
}

.lb-row:nth-child(odd) {
    background: rgba(255, 255, 255, .03);
}

.lb-row .rk {
    width: 26px;
    text-align: center;
    color: #c9962f;
    font-weight: 700;
    font-size: 14px;
    flex: 0 0 auto;
}

.lb-row .nm {
    flex: 1 1 auto;
    min-width: 0;
    color: #ffe5a0;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lb-row .fac {
    flex: 0 0 auto;
    font-size: 11.5px;
    padding: 2px 9px;
    border-radius: 999px;
}

.lb-row .vl {
    flex: 0 0 auto;
    text-align: right;
}

.lb-row .vl .v-main {
    color: #ffd468;
    font-weight: 600;
    font-size: 14px;
}

.lb-row .vl small {
    display: block;
    color: #cdbb93;
    font-size: 11px;
}

.lb-empty {
    text-align: center;
    color: #cdbb93;
    padding: 34px 0;
}

.tl-form-label {
    display: block;
    color: #c9b88a;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 7px;
}

.tl-login-links {
    margin-top: 22px;
    padding-top: 22px;
    border-top: 1px solid rgba(241, 196, 15, 0.15);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.tl-login-links a {
    font-weight: 700;
    color: #c9b88a;
    text-decoration: none;
    font-size: 13.5px;
    transition: color 0.2s ease;
}

.tl-link-register {
    font-weight: 700;
    color: #f1c40f !important;
}

.tl-link-forgot {
    color: #9d8c63 !important;
    font-size: 12.5px;
}

@media (max-width: 576px) {
    .lb-heading {
        font-size: 22px;
    }
    .lb-pod .ava {
        width: 44px;
        height: 44px;
        font-size: 15px;
    }
    .lb-p1 .ava {
        width: 50px;
        height: 50px;
        font-size: 17px;
    }
    .lb-pod .nm {
        font-size: 12px;
    }
    .lb-pod .val {
        font-size: 13px;
    }
    .lb-row .fac {
        display: none;
    }
}
