:root {
    --primary: #e03c52;
    --primary-dark: #c7283e;
    --primary-light: #fff0f2;
    --green: #1ec759;
    --text-dark: #222222;
    --text-gray: #666666;
    --bg-outer: #e9ecef;
    --bg-card: #f5f6f8;
    --app-width: 480px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-outer);
    color: var(--text-dark);
    display: flex;
    justify-content: center;
    min-height: 100vh;
}

/* Khung chính: toàn màn hình trên mobile, căn giữa 480px trên PC */
.app-container {
    width: 100%;
    max-width: var(--app-width);
    min-height: 100vh;
    background: #ffffff;
    position: relative;
    padding-top: 56px;    /* Thêm dòng này */
    padding-bottom: 72px;
    box-shadow: 0 0 25px rgba(0, 0, 0, 0.08);
    overflow-x: hidden;
}

/* ===== HEADER ===== */
.top-header {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: var(--app-width);
    z-index: 100;
    height: 56px;
    padding: 0 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #ffe5e9;
    background-image: url('images/background.webp');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-bottom: 1px solid #f5d5da;
}

.header-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.15s ease;
}

.header-btn:active {
    transform: scale(0.92);
}

.menu-btn img {
    width: 36px;
    height: 36px;
    object-fit: contain;
    display: block;
}

.vip-btn img {
    width: 44px;
    height: 44px;
    object-fit: contain;
    display: block;
}

.logo-box {
    height: 44px;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
}

.logo-box img {
    max-height: 100%;
    max-width: 205px;
    object-fit: contain;
    display: block;
}

.logo-fallback {
    display: none;
    align-items: center;
    gap: 8px;
    font-weight: 900;
    font-size: 22px;
    letter-spacing: 0.5px;
}

.brand-red { color: var(--primary); }
.divider { color: #ccc; font-weight: 300; }
.brand-vip { color: #111; font-style: italic; }
/* ===== BANNER SLIDER ===== */
.banner-section {
    width: 100%;
    background: #fff;
}

.slider-viewport {
    position: relative;
    width: 100%;
    overflow: hidden;
    aspect-ratio: 16 / 7;
}

.slider-track {
    display: flex;
    height: 100%;
    will-change: transform;
}

.slide {
    min-width: 100%;
    height: 100%;
}

.slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.slider-dots {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    z-index: 5;
}

.dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.55);
    cursor: pointer;
    transition: all 0.3s ease;
}

.dot.active {
    width: 18px;
    border-radius: 10px;
    background: #ffffff;
}

/* ===== NOTICE MARQUEE ===== */
.notice-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #fff;
    border-bottom: 1px solid #f1f1f1;
    font-size: 13px;
}

.notice-icon {
    color: var(--primary);
    font-size: 16px;
    flex-shrink: 0;
}

.marquee-wrap {
    flex: 1;
    overflow: hidden;
    white-space: nowrap;
}

.marquee-text {
    display: inline-block;
    padding-left: 100%;
    color: #444;
    animation: marqueeScroll 18s linear infinite;
}

@keyframes marqueeScroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-100%); }
}

.notice-badge {
    position: relative;
    display: flex;
    align-items: center;
    gap: 4px;
    border: none;
    background: var(--primary-light);
    color: var(--primary);
    padding: 4px 8px;
    border-radius: 14px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
}

.hot-pill {
    background: linear-gradient(135deg, #ff6b00, #e03c52);
    color: #fff;
    font-size: 9px;
    padding: 1px 4px;
    border-radius: 6px;
    font-style: italic;
}

.red-dot {
    position: absolute;
    top: -1px;
    right: -1px;
    width: 7px;
    height: 7px;
    background: #ff1e1e;
    border-radius: 50%;
}

/* ===== ACTION BAR (AUTH + QUICK LINKS) ===== */
.action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    gap: 8px;
    background: #fff;
}

.auth-buttons {
    display: flex;
    gap: 8px;
}

.btn-outline,
.btn-primary {
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: transform 0.15s;
}

.btn-outline:active,
.btn-primary:active {
    transform: scale(0.96);
}

.btn-outline {
    background: #fff;
    border: 1px solid #e0a5ad;
    color: var(--primary);
}

.btn-primary {
    background: linear-gradient(180deg, #ef5366 0%, var(--primary) 100%);
    border: none;
    color: #fff;
}

.quick-links {
    display: flex;
    align-items: center;
    gap: 22px;
}

.quick-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #333;
    font-size: 11px;
    gap: 3px;
}

.quick-item i {
    font-size: 30px;
    color: var(--primary);
}

.green-tag {
    position: absolute;
    top: -10px;
    right: -6px;
    background: var(--green);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 8px;
    white-space: nowrap;
}

/* ===== MAIN CONTENT (SIDEBAR + GAME GRID) ===== */
.main-content {
    display: flex;
    gap: 10px;
    padding: 8px 10px 16px;
    align-items: flex-start;
}

.sidebar {
    width: 82px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: sticky;
    top: 62px;
}

.cat-item {
    width: 100%;
    padding: 12px 4px;
    border: 1px solid #f0f0f0;
    border-radius: 10px;
    background: #f7f7f7;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cat-img {
    width: 42px;
    height: 42px;
    object-fit: contain;
    display: block;
}

.cat-item span {
    font-size: 11px;
    font-weight: 700;
    color: #333;
    text-align: center;
    line-height: 1.2;
}

.cat-item.active {
    background: linear-gradient(180deg, #fff5f6 0%, #ffe3e7 100%);
    border-color: #f5b7c0;
    box-shadow: 0 3px 8px rgba(224, 60, 82, 0.16);
}

.cat-item.active span {
    color: var(--primary);
}

/* Game Panel */
.game-panel {
    flex: 1;
    min-width: 0;
}

.sub-tabs {
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 4px 0 12px;
}

.sub-tab {
    border: none;
    background: transparent;
    font-size: 14px;
    font-weight: 700;
    color: #444;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
}

.sub-tab.active {
    color: var(--primary);
}

.sub-tab i {
    color: #ff6b00;
}

.game-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr)); /* Đổi từ 1fr sang minmax(0, 1fr) */
    gap: 12px 8px;
}

.game-card {
    display: flex;
    flex-direction: column;
    cursor: pointer;
    min-width: 0; /* Thêm dòng này để ngăn chữ dài đẩy rộng cột */
}

.game-thumb {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 12px;
    overflow: hidden;
    background: #eceff1;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.game-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.25s;
}

.game-card:hover .game-thumb img {
    transform: scale(1.05);
}

.hot-badge {
    position: absolute;
    top: 0;
    left: 0;
    width: 22px;
    height: 20px;
    border-bottom-right-radius: 8px;
    background: linear-gradient(135deg, #ffa726, #f57c00);
    color: #fff;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fav-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.4);
    color: #fff;
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fav-btn.active {
    color: #ffd600;
}

.game-title {
    margin-top: 6px;
    font-size: 12px;
    font-weight: 500;
    color: #555;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* ===== FLOATING PROMO ===== */
.floating-promo {
    position: fixed;
    bottom: 78px;
    right: max(10px, calc(50% - 230px));
    z-index: 90;
}

.close-promo {
    position: absolute;
    top: -6px;
    right: -2px;
    z-index: 2;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.promo-img {
    width: 82px;
    height: auto;
    display: block;
    cursor: pointer;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
    animation: pulsePromo 2s infinite;
}

@keyframes pulsePromo {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.06); }
}

/* ===== BOTTOM NAVIGATION ===== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: var(--app-width);
    height: 68px;
    padding-bottom: 4px;
    background-color: #fff2f4;
    background-image: url('images/bottom.webp');
    background-size: cover;
    background-position: center bottom;
    background-repeat: no-repeat;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.06);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 100;
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    text-decoration: none;
    color: #8c8c8c;
    font-size: 12px;
    font-weight: 500;
    transition: transform 0.15s ease;
}

.nav-item:active {
    transform: scale(0.94);
}

.nav-item i {
    font-size: 24px;
    line-height: 1;
}

/* Mục đang chọn (Trang Chủ) */
.nav-item.active {
    color: #e63950;
    font-weight: 600;
}

/* Hiệu ứng phát sáng cho icon Khuyến Mãi giống bản gốc */
.nav-item.promo-gift i {
    color: #ff9800;
    filter: drop-shadow(0 0 6px rgba(255, 160, 0, 0.75));
    font-size: 25px;
}
/* ===== MODAL ĐĂNG NHẬP / ĐĂNG KÝ BẢN GỐC ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 10px;
}

.modal-overlay.show {
    display: flex;
}

.modal-box.auth-screen {
    width: 100%;
    max-width: 400px;
    max-height: 95vh;
    overflow-y: auto;
    background: linear-gradient(180deg, #ffffff 0%, #f7f7f9 100%);
    border-radius: 16px;
    border-bottom: 3px solid #e63946;
    padding: 18px 20px 22px;
    position: relative;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
}

/* Nút quay lại góc trái */
.auth-back-btn {
    position: absolute;
    top: 14px;
    left: 14px;
    border: none;
    background: transparent;
    color: #777;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
}

/* Logo & Đại sứ */
.auth-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin: 6px 0 18px;
}

.auth-logo-img {
    width: 78%;
    max-width: 280px;
    height: auto;
    object-fit: contain;
}

.auth-ambassador-img {
    width: 96%;
    max-width: 340px;
    height: auto;
    object-fit: contain;
}

/* Tab Đăng Nhập / Đăng Ký */
.auth-tabs {
    display: flex;
    background: #9a9a9a;
    border-radius: 999px;
    margin-bottom: 18px;
    overflow: hidden;
}

.auth-tab {
    flex: 1;
    border: none;
    background: transparent;
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    padding: 11px 0;
    cursor: pointer;
    border-radius: 999px;
    transition: background 0.2s;
}

.auth-tab.active {
    background: linear-gradient(180deg, #ff4b64 0%, #c82333 100%);
}

/* Ô nhập liệu */
.auth-input-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1px solid #ececec;
    border-radius: 8px;
    padding: 11px 12px;
    margin-bottom: 12px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
}

.auth-icon {
    color: #f03a55;
    font-size: 17px;
    width: 20px;
    text-align: center;
}

.req-star {
    color: #f03a55;
    font-weight: 700;
    margin-right: -4px;
}

.auth-input-box input {
    border: none;
    outline: none;
    background: transparent;
    width: 100%;
    font-size: 14px;
    color: #333;
}

.auth-input-box input::placeholder {
    color: #a3a3a3;
}

.toggle-pass {
    color: #ccc;
    font-size: 16px;
    cursor: pointer;
}

/* Tiền tố +84 & Cờ Việt Nam */
.vn-prefix {
    display: flex;
    align-items: center;
    gap: 6px;
    padding-right: 10px;
    margin-right: 2px;
    border-right: 1px solid #ddd;
    font-size: 14px;
    color: #333;
    flex-shrink: 0;
}

.vn-flag {
    width: 22px;
    height: 15px;
    background: #da251d;
    border-radius: 2px;
    position: relative;
    display: inline-block;
}

.vn-flag::after {
    content: "★";
    color: #ffff00;
    font-size: 10px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -52%);
    line-height: 1;
}

/* Gợi ý tài khoản & Độ mạnh mật khẩu */
.auth-hint {
    font-size: 12px;
    color: #999;
    margin: -6px 0 12px;
    line-height: 1.4;
}

.pass-strength {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #444;
    margin: -4px 0 12px;
}

.strength-bars {
    display: flex;
    gap: 6px;
    flex: 1;
}

.strength-bars span {
    flex: 1;
    height: 5px;
    background: #dcdcdc;
    border-radius: 999px;
    transition: background 0.2s;
}

.strength-bars span.level-1 { background: #ff4d4f; }
.strength-bars span.level-2 { background: #faad14; }
.strength-bars span.level-3 { background: #52c41a; }

/* Dòng nhắc tên thẻ ngân hàng phát sáng xanh */
.bank-note {
    font-size: 12.5px;
    color: #169c4f;
    text-align: center;
    margin: -2px 0 12px;
    text-shadow: 0 0 8px rgba(46, 204, 113, 0.55);
}

/* Checkbox */
.auth-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 13px;
    color: #333;
    margin-bottom: 14px;
    cursor: pointer;
    line-height: 1.4;
}

.auth-checkbox input {
    accent-color: #f03a55;
    width: 16px;
    height: 16px;
    margin-top: 2px;
    flex-shrink: 0;
}

.terms-link {
    color: #f03a55;
    text-decoration: none;
}

.form-error {
    color: #d90429;
    font-size: 12px;
    margin: -6px 0 10px;
    min-height: 16px;
    text-align: center;
}

/* Nút Submit viền hồng phát sáng */
.auth-submit-btn {
    width: 100%;
    padding: 12px;
    font-size: 17px;
    font-weight: 700;
    color: #fff;
    border: none;
    border-radius: 999px;
    background: linear-gradient(180deg, #ff5168 0%, #cf2a3c 100%);
    box-shadow: 0 0 0 4px rgba(255, 81, 104, 0.28);
    cursor: pointer;
    margin-bottom: 16px;
}

/* Liên kết CSKH / Chơi thử / Quên MK */
.auth-links {
    display: flex;
    justify-content: space-around;
    margin-bottom: 18px;
}

.auth-links a {
    color: #f03a55;
    font-size: 13px;
    text-decoration: none;
}

/* Đường kẻ chia Đăng Nhập Nhanh */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #999;
    font-size: 13px;
    margin-bottom: 16px;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: #dcdcdc;
}

/* Nút tròn Đăng Nhập Nhanh */
.quick-login-icons {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 18px;
}

.quick-circle-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* Banner tải app dưới cùng */
.app-download-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    border: 1.5px solid #e63946;
    border-radius: 999px;
    padding: 5px 6px;
    background: linear-gradient(180deg, #ffffff 0%, #f0f0f0 100%);
    cursor: pointer;
}

.app-circle {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(180deg, #ff5168 0%, #cf2a3c 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.app-banner-text {
    display: flex;
    flex-direction: column;
    text-align: center;
    line-height: 1.3;
}

.app-banner-text strong {
    color: #e63946;
    font-size: 11px;
}

.app-banner-text span {
    color: #555;
    font-size: 10px;
    font-weight: 700;
}

/* Tối ưu màn hình nhỏ dưới 360px */
@media (max-width: 360px) {
    .sidebar { width: 72px; }
    .btn-outline, .btn-primary { padding: 7px 10px; font-size: 12px; }
    .quick-links { gap: 8px; }
}