:root {
    --primary: #ef4444; /* Premium Red for gift box */
    --accent: #f59e0b;  /* Orange/Gold for Voucher/Glow */
    --bg-color: #080c16;
    --card-bg: rgba(15, 23, 42, 0.55);
    --border-color: rgba(255, 255, 255, 0.08);
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --blue-glow: #3b82f6;
    --blue-gradient: linear-gradient(135deg, #3b82f6, #1d4ed8);
    --gold-gradient: linear-gradient(135deg, #f59e0b, #d97706);
    --font-family: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
}

/* Background animated blurred shapes */
.background-shapes {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.shape {
    position: absolute;
    filter: blur(90px);
    border-radius: 50%;
    animation: float 25s infinite alternate cubic-bezier(0.4, 0, 0.2, 1);
}

.shape-1 {
    width: 480px;
    height: 480px;
    background: rgba(37, 99, 235, 0.25); /* Blue */
    top: -150px;
    left: -150px;
}

.shape-2 {
    width: 420px;
    height: 420px;
    background: rgba(239, 68, 68, 0.2); /* Red */
    bottom: -100px;
    right: -100px;
    animation-delay: -5s;
    animation-direction: alternate-reverse;
}

.shape-3 {
    width: 350px;
    height: 350px;
    background: rgba(245, 158, 11, 0.15); /* Amber Gold */
    top: 40%;
    left: 60%;
    animation-delay: -10s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1) rotate(0deg); }
    100% { transform: translate(60px, 80px) scale(1.15) rotate(15deg); }
}

/* Main Container Card */
.login-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

/* Glassmorphism main card */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid var(--border-color);
    border-radius: 30px;
    padding: 40px 24px;
    box-shadow: 0 25px 65px -12px rgba(0, 0, 0, 0.65);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.section-content {
    transition: opacity 0.5s ease, transform 0.5s ease;
    opacity: 1;
    transform: translateY(0);
}

.section-content.hidden {
    display: none !important;
    opacity: 0;
    transform: scale(0.95);
}

/* Step 1: Brand Logo & Title Header */
.logo-container {
    width: 76px;
    height: 76px;
    background: rgba(15, 23, 42, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 12px;
    position: relative;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.logo-container::before {
    content: '';
    position: absolute;
    inset: -5px;
    border-radius: 50%;
    border: 1.5px solid rgba(59, 130, 246, 0.45);
    animation: ripple 2.5s infinite ease-out;
}

.brand-logo-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.brand-title {
    font-size: 1.6rem;
    font-weight: 900;
    color: #ffffff;
    margin-bottom: 15px;
    letter-spacing: -0.02em;
    text-transform: uppercase;
    background: linear-gradient(135deg, #ffffff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 4px 10px rgba(0,0,0,0.35);
}

@keyframes ripple {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(1.4); opacity: 0; }
}

h2 {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
    background: linear-gradient(to right, #ffffff, #e2e8f0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-bottom: 25px;
    line-height: 1.5;
    padding: 0 10px;
}

/* -------------------------------------------------------------
 * 🎁 TRÒ CHƠI HỘP QUÀ TƯƠNG TÁC
 * ------------------------------------------------------------- */
.gift-grid {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin: 25px 0;
    padding: 10px 0;
}

.gift-item {
    cursor: pointer;
    perspective: 800px;
    transition: transform 0.3s, opacity 0.3s;
}

.gift-item:hover {
    transform: translateY(-8px);
}

.gift-item.fade-out {
    opacity: 0.2;
    pointer-events: none;
    transform: scale(0.85);
}

/* 3D-like Box drawing in CSS */
.gift-box-3d {
    width: 90px;
    height: 90px;
    position: relative;
    transform-style: preserve-3d;
    animation: boxFloat 3s infinite ease-in-out alternate;
}

/* Floating animation delays for 3 boxes to make it organic */
.gift-grid .gift-item:nth-child(1) .gift-box-3d { animation-delay: 0s; }
.gift-grid .gift-item:nth-child(2) .gift-box-3d { animation-delay: -1s; }
.gift-grid .gift-item:nth-child(3) .gift-box-3d { animation-delay: -2s; }

@keyframes boxFloat {
    0% { transform: translateY(0); }
    100% { transform: translateY(-10px); }
}

/* Shaking animation when hovered */
.gift-item:hover .gift-box-3d {
    animation: boxShake 0.6s infinite ease-in-out;
}

@keyframes boxShake {
    0%, 100% { transform: rotate(0deg); }
    20% { transform: rotate(-8deg) scale(1.05); }
    40% { transform: rotate(8deg) scale(1.05); }
    60% { transform: rotate(-5deg) scale(1.05); }
    80% { transform: rotate(5deg) scale(1.05); }
}

/* 3D Gift Box details */
.gift-cap {
    position: absolute;
    width: 98px;
    height: 18px;
    background: linear-gradient(135deg, #ff4d4d, #e60000);
    border-radius: 4px;
    top: 15px;
    left: -4px;
    z-index: 10;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    transition: transform 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.gift-body {
    position: absolute;
    width: 90px;
    height: 70px;
    background: linear-gradient(135deg, #e60000, #990000);
    border-radius: 0 0 10px 10px;
    top: 30px;
    left: 0;
    z-index: 5;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

/* Ribbons */
.gift-ribbon-v {
    position: absolute;
    width: 16px;
    height: 70px;
    background: linear-gradient(to right, #ffd700, #ffae00);
    left: 37px;
    top: 30px;
    z-index: 6;
}

.gift-ribbon-h {
    position: absolute;
    width: 90px;
    height: 14px;
    background: linear-gradient(to bottom, #ffd700, #ffae00);
    left: 0;
    top: 50px;
    z-index: 6;
}

.gift-bow {
    position: absolute;
    width: 44px;
    height: 24px;
    top: -4px;
    left: 23px;
    z-index: 11;
}

.gift-bow::before, .gift-bow::after {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    border: 5px solid #ffae00;
    border-radius: 50% 50% 0 50%;
    transform: rotate(-45deg);
    top: 0;
}

.gift-bow::after {
    border-radius: 50% 50% 50% 0;
    transform: rotate(45deg);
    left: 17px;
}

/* Open Gift Box cap flying animation */
.gift-item.opened .gift-cap {
    transform: translateY(-45px) rotate(-35deg) scale(0.9);
    opacity: 0;
}

.gift-item.opened .gift-box-3d {
    animation: boxOpenPulse 0.8s forwards ease-out;
}

@keyframes boxOpenPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); filter: brightness(1.2); }
    100% { transform: scale(1); filter: saturate(1.2); }
}

/* -------------------------------------------------------------
 * 🎟️ GIAO DIỆN VOUCHER NHẬN THƯỞNG
 * ------------------------------------------------------------- */
.reward-sparkle-icon {
    font-size: 3rem;
    margin-bottom: 12px;
    animation: bouncePop 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) infinite alternate;
}

@keyframes bouncePop {
    0% { transform: scale(0.9); filter: drop-shadow(0 0 5px var(--accent)); }
    100% { transform: scale(1.1); filter: drop-shadow(0 0 15px var(--accent)); }
}

/* Voucher Card Styling (Frosted Tickets) */
.voucher-card {
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    margin: 20px auto 25px;
    width: 100%;
    max-width: 340px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
    position: relative;
    overflow: hidden;
    animation: slideInReward 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

.voucher-glow {
    position: absolute;
    width: 150px;
    height: 150px;
    background: radial-gradient(circle, rgba(245, 158, 11, 0.25) 0%, transparent 70%);
    top: -50px;
    left: -50px;
    pointer-events: none;
}

.voucher-top {
    padding: 24px 20px 16px;
    position: relative;
}

.voucher-badge {
    display: inline-block;
    background: var(--gold-gradient);
    color: #0b0f19;
    font-size: 0.68rem;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 50px;
    letter-spacing: 0.08em;
    margin-bottom: 12px;
    box-shadow: 0 4px 10px rgba(245, 158, 11, 0.35);
}

.voucher-top h3 {
    font-size: 1.25rem;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 6px;
    line-height: 1.4;
}

.voucher-top p {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* Serrated coupon notches and divider */
.voucher-divider {
    height: 1px;
    border-top: 2px dashed rgba(255, 255, 255, 0.15);
    position: relative;
    margin: 0 15px;
}

.voucher-notch {
    position: absolute;
    width: 20px;
    height: 20px;
    background-color: #0c101b; /* Must match parent bg */
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 50%;
    top: -10px;
}

.notch-left {
    left: -26px;
    box-shadow: inset -6px 0 8px rgba(0,0,0,0.5);
}

.notch-right {
    right: -26px;
    box-shadow: inset 6px 0 8px rgba(0,0,0,0.5);
}

.voucher-bottom {
    padding: 16px 20px 24px;
    background: rgba(15, 23, 42, 0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

/* Realistic Prize Image styling */
.prize-placeholder {
    width: 110px;
    height: 110px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.18);
    background: rgba(15, 23, 42, 0.45);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.3s ease;
}

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

.coupon-code {
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--accent);
    letter-spacing: 2px;
    background: rgba(245, 158, 11, 0.1);
    padding: 6px 16px;
    border: 1px dashed rgba(245, 158, 11, 0.3);
    border-radius: 8px;
}

/* SCREENSHOT PROMPT (Flashing Yellow Alert) */
.screenshot-prompt {
    background: rgba(245, 158, 11, 0.12);
    border: 1.5px solid rgba(245, 158, 11, 0.4);
    border-radius: 14px;
    padding: 12px 16px;
    margin: 15px 0 25px;
    font-size: 0.85rem;
    color: #ffd000;
    line-height: 1.5;
    animation: pulseBorder 1.5s infinite alternate ease-in-out;
}

.camera-icon {
    font-size: 1.1rem;
    vertical-align: middle;
    display: inline-block;
    margin-right: 4px;
    animation: wobbleCamera 1s infinite alternate;
}

@keyframes pulseBorder {
    0% {
        box-shadow: 0 0 5px rgba(245, 158, 11, 0.1);
        border-color: rgba(245, 158, 11, 0.3);
        background: rgba(245, 158, 11, 0.08);
    }
    100% {
        box-shadow: 0 0 15px rgba(245, 158, 11, 0.3);
        border-color: rgba(245, 158, 11, 0.7);
        background: rgba(245, 158, 11, 0.16);
    }
}

@keyframes wobbleCamera {
    0% { transform: rotate(-10deg); }
    100% { transform: rotate(10deg); }
}

/* -------------------------------------------------------------
 * 🚀 NÚT BẤM KẾT NỐI & FORM
 * ------------------------------------------------------------- */
.connect-btn {
    width: 100%;
    background: var(--blue-gradient);
    color: #ffffff;
    border: none;
    border-radius: 16px;
    padding: 16px;
    font-size: 1.05rem;
    font-weight: 800;
    font-family: var(--font-family); /* Fixed: Explicitly apply font-family for buttons */
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(59, 130, 246, 0.35);
}

.shimmer-btn {
    background: var(--gold-gradient);
    color: #080c16;
    box-shadow: 0 5px 25px rgba(245, 158, 11, 0.4);
}

.connect-btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.3), transparent);
    transform: skewX(-25deg);
}

.connect-btn:hover {
    transform: translateY(-2.5px);
}

.connect-btn.shimmer-btn:hover {
    box-shadow: 0 8px 30px rgba(245, 158, 11, 0.6);
}

.connect-btn:not(.shimmer-btn):hover {
    box-shadow: 0 8px 30px rgba(37, 99, 235, 0.6);
}

.connect-btn:hover::after {
    left: 170%;
    transition: all 0.6s ease;
}

.connect-btn:active {
    transform: translateY(0);
}

.connect-btn.loading {
    background: var(--blue-gradient) !important;
    pointer-events: none;
    opacity: 0.95;
}

.connect-btn.loading .btn-text {
    visibility: hidden;
}

/* Connect button disabled state (grayed out) */
.connect-btn.disabled {
    background: rgba(255, 255, 255, 0.06) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    color: rgba(255, 255, 255, 0.25) !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
    box-shadow: none !important;
    transform: none !important;
}

.connect-btn.disabled::after {
    display: none !important;
}

.btn-hint {
    font-size: 0.76rem;
    color: var(--text-muted);
    margin-top: 8px;
    text-align: center;
    transition: all 0.3s ease;
}

.btn-hint.active {
    color: #3b82f6; /* Glowing blue when active */
    font-weight: 600;
}

/* Spinner Loader centered absolutely */
.loader {
    width: 22px;
    height: 22px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    border-top-color: #ffffff;
    animation: spin 0.85s linear infinite;
    position: absolute;
    top: calc(50% - 11px);
    left: calc(50% - 11px);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.footer {
    margin-top: 30px;
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.2);
    letter-spacing: 0.02em;
}

/* -------------------------------------------------------------
 * 🏠 OVERLAYS & MODALS
 * ------------------------------------------------------------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(8, 12, 22, 0.35); /* Lighter and semi-transparent to reveal grid behind */
    backdrop-filter: blur(6px);        /* Frosted, semi-blurred back elements */
    -webkit-backdrop-filter: blur(6px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(1.05);
}

.modal-card {
    background: rgba(15, 23, 42, 0.72); /* Semi-transparent card body */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1.5px solid rgba(245, 158, 11, 0.28); /* Gold accent border */
    border-radius: 28px;
    max-width: 380px;
    width: 100%;
    padding: 35px 28px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.65), 0 0 25px rgba(245, 158, 11, 0.15); /* Gold glow shadow */
    transform: scale(0.9);
    animation: modalPop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes modalPop {
    to { transform: scale(1); }
}

.welcome-card {
    text-align: center;
}

.gift-popup-icon {
    font-size: 3.5rem;
    margin-bottom: 15px;
    animation: spinGift 4s infinite linear;
}

@keyframes spinGift {
    0%, 90%, 100% { transform: rotate(0); }
    93% { transform: rotate(-15deg); }
    95% { transform: rotate(15deg); }
    97% { transform: rotate(-15deg); }
    98% { transform: rotate(15deg); }
}

.welcome-highlight {
    font-size: 1.05rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.5;
    margin-bottom: 12px;
}

.modal-content {
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 30px;
}

.text-center {
    text-align: center;
}

/* Confetti Overlay */
.confetti-overlay {
    position: fixed;
    inset: 0;
    z-index: 999;
    pointer-events: none;
    overflow: hidden;
}

.confetti-particle {
    position: absolute;
    width: 8px;
    height: 12px;
    background: #ff0;
    opacity: 0.8;
    border-radius: 2px;
    animation: fall 3s infinite linear;
}

@keyframes fall {
    0% { transform: translateY(-50px) rotate(0deg); opacity: 1; }
    100% { transform: translateY(105vh) rotate(360deg); opacity: 0; }
}

/* Utility class for hiding elements robustly */
.hidden {
    display: none !important;
}

/* Scrollbar and custom screen tweaks for Mobile Viewports */
@media (max-width: 480px) {
    .glass-card {
        padding: 20px 14px;
        border-radius: 24px;
    }
    
    h2 {
        font-size: 1.22rem;
        margin-bottom: 4px;
    }
    
    .subtitle {
        font-size: 0.8rem;
        margin-bottom: 12px;
        line-height: 1.4;
    }
    
    /* Highly Compact Gift Grid */
    .gift-grid {
        gap: 12px;
        margin: 10px 0;
        padding: 5px 0;
    }
    
    .gift-box-3d {
        width: 72px;
        height: 72px;
        animation: boxFloatMobile 3s infinite ease-in-out alternate;
    }

    @keyframes boxFloatMobile {
        0% { transform: translateY(0); }
        100% { transform: translateY(-6px); }
    }
    
    .gift-cap {
        width: 78px;
        height: 14px;
        top: 12px;
        left: -3px;
    }
    
    .gift-body {
        width: 72px;
        height: 56px;
        top: 24px;
        border-radius: 0 0 8px 8px;
    }
    
    .gift-ribbon-v {
        width: 12px;
        height: 56px;
        left: 30px;
        top: 24px;
    }
    
    .gift-ribbon-h {
        width: 72px;
        height: 11px;
        top: 40px;
    }
    
    .gift-bow {
        width: 32px;
        height: 18px;
        top: -4px;
        left: 20px;
    }

    .gift-bow::before, .gift-bow::after {
        width: 16px;
        height: 16px;
        border-width: 4px;
    }

    .gift-bow::after {
        left: 12px;
    }

    /* Open Cap lift translation */
    .gift-item.opened .gift-cap {
        transform: translateY(-30px) rotate(-25deg) scale(0.95);
    }
    
    /* Compact Voucher card */
    .voucher-card {
        margin: 10px auto 12px;
        border-radius: 16px;
    }

    .voucher-top {
        padding: 16px 14px 10px;
    }

    .voucher-badge {
        margin-bottom: 6px;
        font-size: 0.6rem;
    }

    .voucher-top h3 {
        font-size: 1.05rem;
    }

    .voucher-top p {
        font-size: 0.72rem;
    }

    .voucher-notch {
        width: 16px;
        height: 16px;
        top: -8px;
    }

    .notch-left { left: -24px; }
    .notch-right { right: -24px; }

    .voucher-bottom {
        padding: 10px 14px 16px;
        gap: 8px;
    }

    .brand-title {
        font-size: 1.3rem;
        margin-bottom: 8px;
    }

    .prize-placeholder {
        width: 90px;
        height: 90px;
        border-radius: 12px;
    }

    .coupon-code {
        font-size: 0.95rem;
        padding: 4px 12px;
    }

    /* Compact Screenshot prompt */
    .screenshot-prompt {
        padding: 8px 12px;
        margin: 8px 0 12px;
        font-size: 0.78rem;
    }

    .camera-icon {
        font-size: 0.95rem;
    }

    /* Compact Connect Button */
    .connect-btn {
        padding: 12px;
        font-size: 0.95rem;
        border-radius: 12px;
    }

    .btn-hint {
        font-size: 0.7rem;
        margin-top: 6px;
    }
    
    .footer {
        margin-top: 15px;
        font-size: 0.68rem;
    }
}
