:root {
    --bg-dark: #000000;
    --text-white: #ffffff;
    --border-white: #ffffff;
    --glow-color: rgba(255, 255, 255, 0.6);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* --- Định dạng Body chính --- */
body {
    background-color: var(--bg-dark);
    color: var(--text-white);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden; /* Ngăn cuộn trang xuất hiện thanh cuộn */
}

/* --- Lớp nền Canvas vũ trụ --- */
#starfield {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1; 
}

/* --- Container chung cho các màn hình --- */
.view-container {
    width: 100%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    animation: fadeIn 0.5s ease-in-out;
    z-index: 1; 
    position: relative;
    /* Đảm bảo nội dung không đè lên nút quay lại ở màn 2 */
    margin-top: 40px; 
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Cấu hình Avatar --- */
.avatar-container {
    border-radius: 50%;
    padding: 3px;
    background: transparent;
    border: 2px solid transparent;
    box-shadow: 0 0 25px 5px var(--glow-color);
    margin-bottom: 25px;
}

.avatar-container.large {
    width: 150px;
    height: 150px;
}

.avatar-container.small {
    width: 100px;
    height: 100px;
    margin-top: 10px;
}

.avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

/* --- Text Profile --- */
.profile-title {
    font-size: 32px;
    font-weight: bold;
    margin-bottom: 30px;
    letter-spacing: 1px;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    text-align: center;
}

.cursor {
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* --- Nút bấm viền trắng bo góc chung --- */
.outline-btn {
    background: transparent;
    color: var(--text-white);
    border: 2px solid var(--border-white);
    border-radius: 30px;
    padding: 12px 40px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.outline-btn:hover {
    background: var(--text-white);
    color: var(--bg-dark);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.4);
}

/* --- Nút Back góc trái trên (Đã sửa lỗi) --- */
.top-nav {
    position: fixed; /* Ghim cứng vào màn hình thay vì khung chứa */
    top: 20px;
    left: 20px;
    z-index: 100; /* Nổi lên trên cùng */
}

.back-btn {
    background: transparent;
    color: var(--text-white);
    border: 1px solid var(--border-white);
    border-radius: 20px;
    padding: 8px 15px;
    font-size: 14px;
    cursor: pointer;
    transition: 0.3s;
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* --- Danh sách Menu màn 2 --- */
.menu-list {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
}

.menu-item {
    width: 100%;
    padding: 15px 20px;
}

/* =========================================
   GIAO DIỆN MODAL THÔNG BÁO CHÀO MỪNG
   ========================================= */
.custom-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 99;
    display: none; 
    opacity: 0;
    transition: opacity 0.3s ease;
}

.custom-modal {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background: rgba(20, 20, 20, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 15px;
    padding: 25px;
    width: 90%;
    max-width: 400px;
    z-index: 100;
    display: none; 
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
    text-align: center;
}

.custom-overlay.show, .custom-modal.show {
    display: block;
    opacity: 1;
}
.custom-modal.show {
    transform: translate(-50%, -50%) scale(1);
}

.close-btn {
    position: absolute;
    top: 10px; right: 15px;
    background: transparent;
    border: none;
    color: var(--text-white);
    font-size: 26px;
    cursor: pointer;
    transition: 0.2s;
}
.close-btn:hover {
    color: #ff4d4f;
}

.modal-title {
    font-size: 20px;
    margin-bottom: 10px;
    color: var(--text-white);
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid rgba(255,255,255,0.2);
    padding-bottom: 10px;
}

.modal-desc {
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 20px;
    color: #cccccc;
}

.gift-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.gift-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.05);
    padding: 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.gift-item img {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.gift-item span {
    font-size: 16px;
    font-weight: bold;
    color: #00d2ff; 
}

.gift-item.highlight {
    border-color: rgba(255, 170, 0, 0.5);
    background: rgba(255, 170, 0, 0.1);
}

.gift-item.highlight span {
    color: #ffaa00; 
}

.modal-footer-text {
    font-size: 12px;
    color: #888888;
    font-style: italic;
}

/* =========================================
   ĐIỀU CHỈNH RESPONSIVE CHO ĐIỆN THOẠI
   ========================================= */
@media screen and (max-width: 480px) {
    .profile-title {
        font-size: 24px;
        margin-bottom: 20px;
    }
    
    .avatar-container.large {
        width: 120px;
        height: 120px;
    }
    
    .avatar-container.small {
        width: 80px;
        height: 80px;
    }
    
    .outline-btn {
        font-size: 14px;
        padding: 10px 20px;
    }
    
    .menu-item {
        padding: 12px 15px;
        font-size: 14px;
    }
    
    .top-nav {
        top: 15px;
        left: 15px;
    }
    
    .custom-modal {
        padding: 20px 15px;
    }
    
    .gift-item img {
        width: 30px;
        height: 30px;
    }
    
    .gift-item span {
        font-size: 14px;
    }
}
/* =========================================
   GIAO DIỆN FORM ĐĂNG NHẬP / ĐĂNG KÝ
   ========================================= */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.custom-input {
    width: 100%;
    padding: 12px 15px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    color: var(--text-white);
    font-size: 14px;
    outline: none;
    transition: 0.3s;
}

.custom-input:focus {
    border-color: #00d2ff;
    background: rgba(255, 255, 255, 0.15);
}

.custom-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.submit-btn {
    width: 100%;
    margin-bottom: 15px;
    background: rgba(0, 210, 255, 0.1);
    border-color: #00d2ff;
}

.submit-btn:hover {
    background: #00d2ff;
    color: #000;
    box-shadow: 0 0 15px rgba(0, 210, 255, 0.6);
}

.toggle-link {
    color: #ffaa00;
    cursor: pointer;
    font-weight: bold;
    text-decoration: underline;
}
/* =========================================
   GIAO DIỆN THÔNG TIN USER (GÓC PHẢI)
   ========================================= */
.user-info-box {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(20, 20, 20, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 6px 12px;
    border-radius: 30px;
    z-index: 100;
    box-shadow: 0 0 15px rgba(0, 210, 255, 0.15);
    backdrop-filter: blur(5px);
}

.user-avatar {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 18px; /* Kích thước icon phi hành gia */
    border: 1px solid #00d2ff;
}

.user-details {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.user-name {
    font-size: 13px;
    font-weight: bold;
    color: var(--text-white);
    max-width: 90px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; /* Tên dài quá sẽ hiện dấu ... */
}

.user-diamonds {
    font-size: 12px;
    color: #00d2ff;
    font-weight: bold;
    margin-top: 2px;
}

.logout-mini-btn {
    background: transparent;
    border: none;
    font-size: 16px;
    cursor: pointer;
    margin-left: 5px;
    transition: transform 0.3s;
    filter: grayscale(100%) brightness(200%);
}

.logout-mini-btn:hover {
    transform: scale(1.2);
    filter: none;
}

/* Điều chỉnh lại Responsive cho mobile để 2 nút Trái/Phải không bị chèn ép */
@media screen and (max-width: 480px) {
    .user-info-box {
        top: 15px;
        right: 15px;
        padding: 5px 8px;
    }
    .user-avatar { width: 28px; height: 28px; font-size: 15px; }
    .user-name { font-size: 11px; max-width: 60px; }
    .user-diamonds { font-size: 10px; }
}
/* =========================================
   GIAO DIỆN MODAL PROFILE (KHI BẤM VÀO TÊN)
   ========================================= */
.user-info-box {
    cursor: pointer;
    transition: 0.3s;
}

.user-info-box:hover {
    background: rgba(20, 20, 20, 0.9);
    box-shadow: 0 0 20px rgba(0, 210, 255, 0.3);
}

.profile-stats {
    display: flex;
    flex-direction: column;
    gap: 15px;
    text-align: left;
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 15px;
    color: var(--text-white);
    border-bottom: 1px dashed rgba(255, 255, 255, 0.2);
    padding-bottom: 10px;
}

.stat-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.stat-value {
    font-size: 18px;
    font-weight: bold;
}

.text-blue { color: #00d2ff; }
.text-yellow { color: #ffaa00; }
.text-green { color: #00e676; }

#btnLogout:hover {
    background: #ff4d4f !important;
    color: #fff !important;
    box-shadow: 0 0 15px rgba(255, 77, 79, 0.6) !important;
}
/* =========================================
   GIAO DIỆN VÒNG QUAY MAY MẮN
   ========================================= */
.wheel-container {
    position: relative;
    width: 280px;
    height: 280px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
}

.wheel-pointer {
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 40px;
    color: #ff4d4f; /* Màu đỏ nổi bật */
    z-index: 10;
    text-shadow: 0 4px 10px rgba(0,0,0,0.8);
}

.wheel-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    /* Hiệu ứng xoay mượt mà 4 giây */
    transition: transform 4s cubic-bezier(0.17, 0.67, 0.12, 0.99); 
}
/* =========================================
   FIX GIAO DIỆN Ô SELECT (PHƯƠNG THỨC ĐĂNG NHẬP)
   ========================================= */
select.custom-input {
    appearance: none; /* Xóa style mặc định */
    -webkit-appearance: none;
    -moz-appearance: none;
    /* Thêm icon mũi tên trắng tùy chỉnh */
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 15px;
    padding-right: 40px; 
}

/* Đổi màu nền cho các lựa chọn bên trong thả xuống */
select.custom-input option {
    background-color: #222;
    color: #fff;
}
/* --- GIAO DIỆN CHỌN PHƯƠNG THỨC ĐĂNG NHẬP MỚI --- */
.platform-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 15px;
}

.platform-selector input[type="radio"] {
    display: none; /* Ẩn nút radio tròn mặc định */
}

.platform-selector label {
    padding: 12px 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: #ccc;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 13px;
    user-select: none;
}

.platform-selector label:hover {
    border-color: rgba(0, 210, 255, 0.5);
}

.platform-selector input[type="radio"]:checked + label {
    background: rgba(0, 210, 255, 0.1);
    border-color: #00d2ff;
    color: #00d2ff;
    font-weight: bold;
    box-shadow: 0 0 15px rgba(0, 210, 255, 0.2);
}