/* ==========================================================================
   DINH DANG CSS CO BAN DUNG CHUNG CHO TOAN BO TRANG (NGOC.DEV)
   ========================================================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

body, html {
    width: 100%;
    max-width: 100vw;
    height: 100%;
    overflow: hidden;
    overflow-x: hidden !important;
    background-color: #030014;
    font-family: 'Outfit', sans-serif;
    color: #ffffff;
}

/* Canvas 3D toan man hinh */
#webgl-canvas, #ambient-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: block;
    z-index: 1;
    cursor: default;
    pointer-events: none;
}

/* ==========================================================================
   1. THANH MENU NOI DANG KINH MO (FLOATING GLASS DOCK BAR)
   ========================================================================== */
.floating-dock-nav {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: rgba(10, 15, 30, 0.75);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    padding: 6px 10px;
    border-radius: 40px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6), 0 0 20px rgba(0, 242, 254, 0.15);
    animation: fadeInDock 1.2s cubic-bezier(0.16, 1, 0.3, 1);
    max-width: 95vw;
    box-sizing: border-box;
}

@keyframes fadeInDock {
    from { opacity: 0; transform: translate(-50%, -20px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

/* Cac nut Tab tren thanh menu */
.nav-tab {
    background: transparent;
    border: none;
    outline: none;
    text-decoration: none;
    color: #94a3b8;
    padding: 8px 16px;
    border-radius: 30px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.nav-tab i {
    font-size: 0.9rem;
    transition: transform 0.3s ease;
}

.nav-tab:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-1px);
}

.nav-tab.active {
    color: #030014;
    background: linear-gradient(135deg, #00f2fe 0%, #38bdf8 100%);
    font-weight: 700;
    box-shadow: 0 0 20px rgba(0, 242, 254, 0.5);
}

.nav-tab.active i {
    transform: scale(1.1);
}

/* ==========================================================================
   2. KHUNG CHUA CHU WELLCOME TRUNG TAM TRANG CHU
   ========================================================================== */
.welcome-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 10;
    pointer-events: none;
    perspective: 1000px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 95vw;
    max-width: 100vw;
    box-sizing: border-box;
    animation: welcomeIntro 2.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.welcome-container.minimized {
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(0.7) !important;
}

@keyframes welcomeIntro {
    0% {
        opacity: 0;
        transform: translate(-50%, -46%) scale(0.8);
        filter: blur(25px);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
        filter: blur(0);
    }
}

/* Hao quang nen phia sau chu */
.welcome-aura {
    position: absolute;
    width: 135%;
    height: 150%;
    border-radius: 50%;
    z-index: -1;
    pointer-events: none;
    transition: all 0.8s ease;
}

/* Dinh dang chu tieu de WELLCOME */
.welcome-title {
    font-size: clamp(2.4rem, 10.5vw, 8.5rem);
    font-weight: 900;
    line-height: 1;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    letter-spacing: clamp(3px, 1.5vw, 16px);
    will-change: filter, transform;
    max-width: 100%;
    white-space: nowrap;
    transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.welcome-title .char {
    display: inline-block;
    will-change: transform;
}

/* ==========================================================================
   3. THANH DIEU KHIEN DOI HIEU UNG 3D NGAU NHIEN (GOC DUOI MAN HINH)
   ========================================================================== */
.effect-hud {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 20;
    max-width: calc(100vw - 32px);
    animation: fadeInHud 1.5s ease-out;
}

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

.effect-badge {
    background: rgba(10, 15, 30, 0.75);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #e2e8f0;
    padding: 8px 16px;
    border-radius: 30px;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all 0.3s ease;
}

.effect-badge.flash {
    border-color: #00f2fe;
    color: #00f2fe;
    box-shadow: 0 0 20px rgba(0, 242, 254, 0.4);
    transform: scale(1.05);
}

.dice-btn {
    background: linear-gradient(135deg, rgba(0, 242, 254, 0.2), rgba(255, 0, 127, 0.2));
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(0, 242, 254, 0.5);
    color: #fff;
    padding: 8px 16px;
    border-radius: 30px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6), 0 0 15px rgba(0, 242, 254, 0.3);
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.dice-btn i {
    font-size: 1.05rem;
    color: #00f2fe;
    transition: transform 0.4s ease;
}

.dice-btn:hover {
    background: linear-gradient(135deg, #00f2fe, #ff007f);
    color: #030014;
    transform: translateY(-2px) scale(1.04);
    box-shadow: 0 0 25px rgba(0, 242, 254, 0.6);
}

.dice-btn:hover i {
    color: #030014;
    transform: rotate(180deg);
}

.dice-btn:active {
    transform: scale(0.96);
}

/* ==========================================================================
   4. TUONG THICH TOI UU RIENG CHO MAN HINH DIEN THOAI (RESPONSIVE)
   ========================================================================= */
@media (max-width: 768px) {
    .floating-dock-nav {
        top: 12px;
        width: calc(100% - 20px);
        max-width: 440px;
        padding: 4px 6px;
        gap: 3px;
        justify-content: space-between;
    }
    .nav-tab {
        padding: 6px 8px;
        font-size: 0.72rem;
        gap: 4px;
        flex: 1;
        justify-content: center;
    }
    .nav-tab i {
        font-size: 0.8rem;
    }
    .welcome-container {
        width: 100vw;
        max-width: 100vw;
        padding: 0 10px;
    }
    .welcome-title {
        font-size: clamp(1.6rem, 7.8vw, 3rem) !important;
        letter-spacing: clamp(1px, 0.8vw, 3px) !important;
        max-width: 92vw !important;
    }
    .effect-hud {
        bottom: 14px;
        right: 12px;
        left: 12px;
        justify-content: space-between;
    }
    .effect-badge {
        font-size: 0.72rem;
        padding: 6px 12px;
        max-width: 65%;
    }
    .dice-btn {
        font-size: 0.75rem;
        padding: 6px 12px;
    }
    .dice-btn span {
        display: none;
    }
}

@media (max-width: 480px) {
    .floating-dock-nav {
        top: 10px;
        padding: 3px 4px;
        gap: 2px;
    }
    .nav-tab {
        padding: 6px 4px;
        font-size: 0.68rem;
        gap: 3px;
    }
    .nav-tab i {
        font-size: 0.75rem;
    }
    .welcome-title {
        font-size: clamp(1.35rem, 7.2vw, 2.2rem) !important;
        letter-spacing: 1px !important;
        max-width: 94vw !important;
    }
}

@media (max-width: 360px) {
    .nav-tab {
        padding: 5px 2px;
        font-size: 0.62rem;
    }
    .nav-tab i {
        font-size: 0.7rem;
    }
    .welcome-title {
        font-size: clamp(1.2rem, 6.8vw, 1.8rem) !important;
        letter-spacing: 0.5px !important;
        max-width: 95vw !important;
    }
}
