/* RESET CƠ BẢN */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: #d9d9d9; /* Màu nền xám hai bên khi xem trên máy tính */
    display: flex;
    justify-content: center;
    min-height: 100vh;
}

/* KHUNG CHÍNH (Responsive PC & Mobile) */
.app-container {
    width: 100%;
    max-width: 480px; /* Kích thước chuẩn khung di động trên máy tính */
    height: 100vh;
    background-color: #ffffff;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

/* 1. THANH HEADER */
.app-header {
    height: 54px;
    /* THAY ĐƯỜNG DẪN ẢNH NỀN HEADER CỦA BẠN VÀO ĐÂY */
    background-image: url('images/background.webp'), linear-gradient(90deg, #fff3e0 0%, #ffe0b2 50%, #fff3e0 100%);
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    flex-shrink: 0;
    border-bottom: 1px solid #f2dcb3;
}

.menu-icon {
    font-size: 22px;
    color: #f58220;
    cursor: pointer;
}

.logo-img {
    height: 36px;
    object-fit: contain;
}

.fallback-logo {
    font-size: 24px;
    font-weight: 900;
    color: #f58220;
    letter-spacing: 1px;
}

.vip-img {
    height: 30px;
    object-fit: contain;
    cursor: pointer;
}

.fallback-vip {
    background: linear-gradient(135deg, #f59f00, #e67700);
    color: #fff;
    font-weight: bold;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 6px;
}

/* KHUNG CUỘN GIỮA */
.scrollable-body {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    scrollbar-width: none;
}
.scrollable-body::-webkit-scrollbar {
    display: none;
}

/* 2. BANNER SWIPER */
.banner-swiper {
    width: 100%;
    height: 155px;
    flex-shrink: 0;
}

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

.swiper-pagination-bullet {
    background: #fff !important;
    opacity: 0.6;
}
.swiper-pagination-bullet-active {
    background: #ff7b00 !important;
    opacity: 1;
    width: 16px !important;
    border-radius: 4px !important;
}

/* 3. THANH THÔNG BÁO */
.notice-bar {
    display: flex;
    align-items: center;
    padding: 6px 10px;
    background: #fff;
    font-size: 12px;
    border-bottom: 1px solid #f5f5f5;
    flex-shrink: 0;
}

.notice-icon {
    color: #666;
    margin-right: 8px;
    font-size: 14px;
}

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

.marquee-text {
    display: inline-block;
    color: #444;
    animation: marquee 14s linear infinite;
}

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

.notice-tag {
    display: flex;
    align-items: center;
    background: #fff5e6;
    color: #ff8800;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 6px;
    position: relative;
}

.badge-hot {
    background: #ffb84d;
    color: #fff;
    font-size: 8px;
    padding: 1px 3px;
    border-radius: 4px;
    margin-right: 4px;
}

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

/* 4. ĐĂNG NHẬP / ĐĂNG KÝ & ICON NHANH */
.action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #fff;
    flex-shrink: 0;
}

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

.btn {
    padding: 8px 15px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

.btn-login {
    background: #fff;
    color: #f58220;
    border: 1px solid #f58220;
}

.btn-register {
    background: linear-gradient(180deg, #ff9900, #f58220);
    color: #fff;
    border: 1px solid #f58220;
}

.quick-links {
    display: flex;
    gap: 16px; /* Khoảng cách giữa 3 mục */
    align-items: flex-end;
}

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

/* Chỉnh kích thước chung cho tất cả ảnh icon trong quick-item */
.quick-item img,
.sinhloi-img,
.quick-icon {
    width: 35px;          /* Chiều rộng chuẩn trên mobile */
    height: 35px;         /* Chiều cao chuẩn trên mobile */
    object-fit: contain;  /* Giữ nguyên tỷ lệ ảnh, không bị méo */
    margin-bottom: 4px;   /* Khoảng cách từ ảnh xuống chữ */
    display: block;
}

/* Nhãn 88% màu xanh nằm đè lên góc phải icon Sinh Lời */
.rate-badge {
    position: absolute;
    top: -5px;
    right: -8px;
    background: #00c853;
    color: #fff;
    font-size: 9px;
    font-weight: bold;
    padding: 1px 4px;
    border-radius: 6px;
    z-index: 2;           /* Đảm bảo nhãn luôn nổi lên trên ảnh */
    line-height: 1.1;
}

/* Tối ưu khoảng cách khung chứa để dành tối đa diện tích cho cột game */
.main-game-area {
    display: flex;
    flex: 1;
    padding: 6px 8px;
    gap: 8px;
    overflow: hidden;
}

/* Cột Danh mục trái */
.category-sidebar {
    width: 76px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    padding: 2px 2px 20px 2px;
    scrollbar-width: none;
}
.category-sidebar::-webkit-scrollbar {
    display: none;
}

.cat-item {
    background: #ffffff;
    border: 1px solid #e6e6e6;
    border-bottom: 3px solid #dcdcdc; /* Hiệu ứng gờ nổi 3D bên dưới thẻ */
    border-radius: 10px;
    padding: 8px 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
    transition: all 0.2s ease;
    flex-shrink: 0;
}

/* Kích thước chuẩn cho các icon nhỏ (Hot, Blockchain, Game bài, Bắn cá, Thể thao, Đá gà) */
.cat-item .cat-icon {
    width: 28px;
    height: 28px;
    object-fit: contain;
    margin-bottom: 5px;
    display: block;
}

/* Kích thước khung và icon to riêng cho CASINO và NỔ HŨ */
.cat-item.cat-large {
    padding: 16px 4px 12px 4px;
}

.cat-item.cat-large .cat-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 8px;
}

.cat-item span {
    font-size: 11px;
    font-weight: 500;
    color: #555;
    text-align: center;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Trạng thái khi mục đang được chọn (Active) */
.cat-item.active {
    background: linear-gradient(180deg, #ffe8c8 0%, #ffffff 90%);
    border-color: #f5c384;
    border-bottom: 3px solid #d4b28c;
}

.cat-item.active span {
    color: #222;
    font-weight: 600;
}

/* Cột Game bên phải */
.game-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0; /* Chống tràn khung flex */
}

.sub-tabs {
    display: flex;
    justify-content: space-around;
    border-bottom: 1px solid #eee;
    padding-bottom: 6px;
    margin-bottom: 10px;
    flex-shrink: 0;
}

.sub-tab {
    font-size: 13px;
    font-weight: 600;
    color: #444;
    cursor: pointer;
    position: relative;
}

.sub-tab.active {
    color: #f58220;
}

/* Lưới 3 cột Game - Phóng to ảnh tối đa */
.game-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr)); /* Ép 3 cột bung rộng 100% diện tích */
    gap: 12px 8px; /* Khoảng cách dọc 12px, ngang 8px sát nhau như bản gốc */
    align-content: start; /* Giữ các hàng xếp sát lên trên, không bị kéo giãn */
    overflow-y: auto;
    padding-bottom: 24px;
    scrollbar-width: none;
}
.game-grid::-webkit-scrollbar {
    display: none;
}

.game-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    width: 100%;
    /* Đã bỏ overflow: hidden ở đây để chữ bên dưới không bị cắt mất nửa dòng */
}

.card-thumb {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 14px;
    overflow: hidden;
    background: transparent;
}

.card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Phóng đầy 100% ô vuông, xóa bỏ hoàn toàn khoảng trắng thừa */
    display: block;
}

.game-title {
    font-size: 12px;
    line-height: 1.4; /* Tăng chiều cao dòng để không mất dấu tiếng Việt */
    color: #555;
    margin-top: 5px;
    width: 100%;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 6. THANH FOOTER DƯỚI CÙNG */
.bottom-nav {
    height: 62px;
    /* THAY ĐƯỜNG DẪN ẢNH NỀN FOOTER CỦA BẠN VÀO ĐÂY */
    background-image: url('images/footer.webp');
    background-size: 100% 100%; /* Kéo giãn vừa khít 100% chiều ngang và dọc của thanh */
    background-position: center;
    background-repeat: no-repeat;
    border-top: 1px solid #f2e1c2;
    display: flex;
    justify-content: space-around;
    align-items: center;
    flex-shrink: 0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #333; /* Màu chữ đen xám đậm giống ảnh mẫu */
    font-size: 11.5px;
    font-weight: 500;
    gap: 4px;
    flex: 1;
    height: 100%;
}

.nav-item i {
    font-size: 22px;
    color: #9e9e9e; /* Màu icon xám nhạt khi chưa chọn */
    transition: 0.2s;
}

/* Trạng thái đang chọn (Trang Chủ) */
.nav-item.active,
.nav-item.active i {
    color: #ff8000; /* Màu cam sáng đồng bộ cho cả icon và chữ */
    font-weight: 600;
}
/* ================= 7. MODAL ĐĂNG NHẬP / ĐĂNG KÝ (Chuẩn khung PC & Mobile) ================= */
.auth-modal {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%); /* Tự động căn giữa trên màn hình máy tính */
    width: 100%;
    max-width: 480px; /* Khóa chiều rộng chuẩn khung điện thoại trên PC */
    height: 100vh;
    background: #ff8c00; /* Nền cam phía dưới chân form */
    z-index: 9999;
    display: none;
    flex-direction: column;
    justify-content: flex-start;
    overflow-y: auto;
    scrollbar-width: none;
    box-shadow: 0 0 25px rgba(0, 0, 0, 0.25);
}
.auth-modal::-webkit-scrollbar {
    display: none;
}

.auth-modal.show {
    display: flex;
    animation: fadeInModal 0.2s ease;
}

@keyframes fadeInModal {
    from { opacity: 0; }
    to { opacity: 1; }
}

.auth-modal-content {
    width: 100%;
    min-height: calc(100vh - 18px); /* Chừa 18px viền cam bo cong ở đáy giống ảnh gốc */
    background: #ffffff;
    border-bottom-left-radius: 32px;
    border-bottom-right-radius: 32px;
    padding: 16px 20px 26px 20px;
    position: relative;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

/* Xóa bỏ lớp ::after cũ nếu có */
.auth-modal::after {
    display: none;
}

/* Mép cam góc dưới cùng như ảnh mẫu */
.auth-modal::after {
    content: "";
    display: block;
    width: 100%;
    height: 30px;
    background: #ff8c00;
    margin-top: -22px;
    z-index: -1;
    flex-shrink: 0;
}

.auth-back-btn {
    background: none;
    border: none;
    font-size: 20px;
    color: #666;
    cursor: pointer;
    padding: 4px 8px 4px 0;
}

.auth-logo-wrap {
    text-align: center;
    margin-top: -10px;
    margin-bottom: 12px;
}

.auth-logo {
    height: 58px;
    object-fit: contain;
}

.auth-logo-fallback {
    font-size: 38px;
    font-weight: 900;
    color: #ff8800;
    letter-spacing: 1px;
}

/* Đại sứ thương hiệu */
.ambassador-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding: 0 4px;
}

.amb-info strong {
    display: block;
    font-size: 13.5px;
    color: #111;
    line-height: 1.35;
}

.amb-info span {
    font-size: 12.5px;
    color: #333;
    margin-top: 3px;
    display: block;
}

.amb-sign {
    height: 44px;
    object-fit: contain;
}

.amb-sign-fallback {
    font-family: "Brush Script MT", cursive, sans-serif;
    font-size: 28px;
    color: #111;
    transform: rotate(-6deg);
}

/* Thanh chuyển Tab Viên Thuốc (Cam / Xám) */
.auth-switch-bar {
    display: flex;
    background: #666666;
    border-radius: 30px;
    height: 44px;
    margin-bottom: 18px;
    overflow: hidden;
}

.switch-tab {
    flex: 1;
    border: none;
    background: transparent;
    color: #ffffff;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    border-radius: 30px;
    transition: all 0.25s ease;
}

.switch-tab.active {
    background: #ff8800;
    box-shadow: 0 2px 8px rgba(255, 136, 0, 0.4);
}

/* Các ô nhập liệu */
.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
}

.input-group {
    display: flex;
    align-items: center;
    border: 1px solid #ff9922;
    border-radius: 10px;
    height: 46px;
    padding: 0 12px;
    background: #fff;
    margin-bottom: 4px;
}

.input-group.input-error {
    border-color: #e53935;
    background: #fff8f8;
}

.input-icon {
    color: #ff8800;
    font-size: 17px;
    width: 22px;
}

.req-star {
    color: #ff3b30;
    font-weight: bold;
    margin-right: 4px;
    font-size: 14px;
}

.input-group input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 13.5px;
    color: #222;
    background: transparent;
}

.input-group input::placeholder {
    color: #a6a6a6;
}

.toggle-pass {
    color: #ccc;
    font-size: 17px;
    cursor: pointer;
    padding-left: 8px;
}

.toggle-pass.active {
    color: #ff8800;
}

/* Thông báo lỗi Ràng buộc */
.error-msg {
    color: #e53935;
    font-size: 11.5px;
    min-height: 16px;
    margin-bottom: 6px;
    padding-left: 4px;
}

/* Độ mạnh mật khẩu */
.strength-bar-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 2px 0 12px 2px;
    font-size: 12.5px;
    color: #222;
}

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

.strength-bars span {
    height: 6px;
    flex: 1;
    background: #e0e0e0;
    border-radius: 4px;
    transition: 0.3s;
}

.strength-bars.weak span:nth-child(1) { background: #ff4d4f; }
.strength-bars.medium span:nth-child(1),
.strength-bars.medium span:nth-child(2) { background: #faad14; }
.strength-bars.good span:nth-child(1),
.strength-bars.good span:nth-child(2),
.strength-bars.good span:nth-child(3) { background: #52c41a; }
.strength-bars.strong span { background: #13c2c2; }

.bank-note {
    color: #16993b;
    font-size: 12px;
    margin: -2px 0 12px 4px;
}

/* Checkbox xanh lá */
.custom-check {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 12.5px;
    color: #222;
    cursor: pointer;
    margin-top: 4px;
    user-select: none;
}

.custom-check input {
    display: none;
}

.checkmark {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 1.5px solid #00b32c;
    display: flex;
    align-items: center;
    justify-content: center;
    color: transparent;
    font-size: 11px;
    flex-shrink: 0;
    margin-top: 1px;
}

.custom-check input:checked + .checkmark {
    background: #00b32c;
    color: #fff;
}

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

/* Nút Submit Cam lớn */
.btn-submit-auth {
    width: 72%;
    height: 44px;
    margin: 12px auto 14px auto;
    display: block;
    background: linear-gradient(180deg, #ff9900, #f58220);
    color: #fff;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(245, 130, 32, 0.3);
}

.btn-submit-auth.glow-border {
    box-shadow: 0 0 0 5px #ffecd2;
}

/* Hàng link CSKH / Chơi thử / Quên MK */
.auth-links-row {
    display: flex;
    justify-content: space-between;
    padding: 0 14px;
    margin-bottom: 18px;
}

.auth-links-row.two-cols {
    padding: 0 42px;
}

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

/* Đường kẻ chữ giữa */
.divider-line {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 12.5px;
    margin-bottom: 14px;
}

.divider-line::before,
.divider-line::after {
    content: "";
    width: 55px;
    height: 1px;
    background: #e5e5e5;
    margin: 0 10px;
}

/* Nút Google tròn */
.social-login {
    display: flex;
    justify-content: center;
    margin-bottom: 18px;
}

.google-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid #eee;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.google-btn img {
    width: 22px;
    height: 22px;
}

/* Khung Tải App dưới cùng */
.download-app-pill {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(180deg, #ffffff 0%, #ececec 100%);
    border: 1.5px solid #ff9922;
    border-radius: 40px;
    padding: 5px 6px;
}

.os-circle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ffd54f, #ff9800);
    border: 2px solid #fff;
    box-shadow: 0 0 0 1.5px #ff9800;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 24px;
    flex-shrink: 0;
}

.dl-center-text {
    text-align: center;
    flex: 1;
    padding: 0 4px;
}

.dl-center-text strong {
    display: block;
    color: #ff8000;
    font-size: 11px;
    font-weight: 800;
    margin-bottom: 2px;
}

.dl-center-text span {
    display: block;
    color: #666;
    font-size: 10px;
    font-weight: 700;
}