body {
    box-sizing: border-box;
}

:root {
    --primary-purple: #8b5cf6;
    --accent-cyan: #22d3ee;
    --dark-base: #09090b;
    --dark-elevated: #0f0f1a;
    --light: #f8fafc;
}

body {
    font-family: 'Space Grotesk', sans-serif;
    background: #1c1c22;
    color: #f8fafc;
    overflow-x: hidden;
    position: relative;
}

.title-font {
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* Ẩn thanh cuộn nhưng vẫn cuộn được */
.no-scrollbar::-webkit-scrollbar {
    display: none;
}
.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Animated Background */
.cyber-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        linear-gradient(90deg, rgba(139, 92, 246, 0.03) 1px, transparent 1px),
        linear-gradient(rgba(139, 92, 246, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    z-index: 0;
    opacity: 0.4;
    animation: gridMove 20s linear infinite;
}

@keyframes gridMove {
    0% {
        background-position: 0 0;
    }

    100% {
        background-position: 50px 50px;
    }
}

.gradient-orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.3;
    z-index: 0;
    animation: float 20s ease-in-out infinite;
}

.orb-1 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.4), transparent 70%);
    top: -10%;
    right: -10%;
    animation-delay: 0s;
}

.orb-2 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(34, 211, 238, 0.3), transparent 70%);
    bottom: -10%;
    left: -5%;
    animation-delay: 5s;
}

.orb-3 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.2), transparent 70%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: 10s;
}

@keyframes float {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    33% {
        transform: translate(50px, -50px) scale(1.1);
    }

    66% {
        transform: translate(-50px, 50px) scale(0.9);
    }
}

/* Particle Network Canvas */
#particle-network {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

@keyframes wave1 {

    0%,
    100% {
        transform: translate(0, 0) rotate(0deg);
    }

    33% {
        transform: translate(5%, -5%) rotate(5deg);
    }

    66% {
        transform: translate(-5%, 5%) rotate(-5deg);
    }
}

@keyframes wave2 {

    0%,
    100% {
        transform: translate(0, 0) rotate(0deg);
    }

    33% {
        transform: translate(-7%, 7%) rotate(-7deg);
    }

    66% {
        transform: translate(7%, -7%) rotate(7deg);
    }
}

@keyframes wave3 {

    0%,
    100% {
        transform: translate(0, 0) rotate(0deg);
    }

    50% {
        transform: translate(10%, -10%) rotate(10deg);
    }
}

/* Preloader */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #09090b 0%, #0f0f1a 50%, #09090b 100%);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    transition: opacity 0.8s ease, visibility 0.8s ease;
}

#preloader.hidden {
    opacity: 0;
    visibility: hidden;
}

.loader-ring {
    width: 100px;
    height: 100px;
    border: 3px solid rgba(139, 92, 246, 0.1);
    border-top-color: var(--primary-purple);
    border-bottom-color: var(--accent-cyan);
    border-radius: 50%;
    animation: spin 1.5s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
    box-shadow:
        0 0 30px rgba(139, 92, 246, 0.5),
        inset 0 0 20px rgba(34, 211, 238, 0.3);
}

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

.loader-text {
    margin-top: 30px;
    font-size: 1.2rem;
    letter-spacing: 0.3em;
    background: linear-gradient(90deg, var(--primary-purple), var(--accent-cyan), var(--primary-purple));
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shimmer 3s linear infinite;
}

@keyframes shimmer {
    to {
        background-position: 200% center;
    }
}

/* Glassmorphism */
.glass-panel {
    background: rgba(15, 15, 26, 0.4);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(139, 92, 246, 0.2);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.glass-intense {
    background: rgba(15, 15, 26, 0.7);
    backdrop-filter: blur(30px);
    border: 1px solid rgba(139, 92, 246, 0.3);
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 0 30px rgba(139, 92, 246, 0.2);
}

/* Cyber Button */
.cyber-btn {
    position: relative;
    background: linear-gradient(135deg, var(--primary-purple), var(--accent-cyan));
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow:
        0 0 30px rgba(139, 92, 246, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    transition: all 0.3s cubic-bezier(0.075, 0.82, 0.165, 1);
    overflow: hidden;
}

.cyber-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.6s ease;
}

.cyber-btn:hover {
    transform: translateY(-3px);
    box-shadow:
        0 0 50px rgba(139, 92, 246, 0.8),
        0 10px 30px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.cyber-btn:hover::before {
    left: 100%;
}

.cyber-btn-secondary {
    background: rgba(15, 15, 26, 0.6);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(139, 92, 246, 0.5);
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.3);
    transition: all 0.3s ease;
}

.cyber-btn-secondary:hover {
    background: rgba(139, 92, 246, 0.2);
    border-color: var(--accent-cyan);
    box-shadow: 0 0 40px rgba(34, 211, 238, 0.5);
    transform: translateY(-2px);
}

/* Navigation */
.nav-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(9, 9, 11, 0.7);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(139, 92, 246, 0.2);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

.nav-link {
    position: relative;
    color: rgba(248, 250, 252, 0.7);
    transition: color 0.3s ease;
    padding: 0.5rem 1rem;
}

.nav-link::before {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary-purple), var(--accent-cyan));
    transition: width 0.3s ease;
    box-shadow: 0 0 10px var(--accent-cyan);
}

.nav-link:hover,
.nav-link.active {
    color: var(--light);
}

.nav-link:hover::before,
.nav-link.active::before {
    width: 100%;
}

/* Hero Text Glow */
.neon-text {
    text-shadow:
        0 0 10px rgba(139, 92, 246, 0.8),
        0 0 20px rgba(139, 92, 246, 0.6),
        0 0 40px rgba(139, 92, 246, 0.4),
        0 0 80px rgba(34, 211, 238, 0.3);
}

/* 3D Tilt Cards */
.tilt-card {
    transform-style: preserve-3d;
    transition: transform 0.3s cubic-bezier(0.075, 0.82, 0.165, 1);
}

.tilt-card:hover {
    transform:
        perspective(1000px) rotateX(var(--rotate-x, 0deg)) rotateY(var(--rotate-y, 0deg)) scale(1.05);
}

/* Stat Card Animation */
.stat-card {
    transition: all 0.4s ease;
}

.stat-card:hover {
    transform: translateY(-10px);
    box-shadow:
        0 20px 60px rgba(139, 92, 246, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

/* Content Sections */
.content-section {
    display: none;
    min-height: 100%;
}

.content-section.active {
    display: block;
    animation: fadeInUp 0.6s cubic-bezier(0.075, 0.82, 0.165, 1);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Feature Card Hover */
.feature-card {
    position: relative;
    overflow: hidden;
    transition: all 0.4s ease;
}

.feature-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.1), transparent 70%);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.feature-card:hover::before {
    opacity: 1;
}

.feature-card:hover {
    transform: translateY(-12px);
    border-color: rgba(139, 92, 246, 0.5);
    box-shadow:
        0 20px 60px rgba(139, 92, 246, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* Container cho bục vinh quang */
.podium-container {
    display: flex;
    align-items: flex-end;
    /* Căn đáy để tạo hiệu ứng cao thấp */
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 3rem;
    padding-top: 2rem;
    /* Chừa chỗ cho hiệu ứng hover lên trên */
}

/* Card chung cho Top 3 */
.podium-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.podium-card:hover {
    transform: translateY(-10px);
    z-index: 10;
}

/* Avatar trong Top 3 */
.podium-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 1rem;
    object-fit: cover;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

/* --- TÙY CHỈNH TỪNG VỊ TRÍ --- */

/* TOP 1 (GIỮA) */
.rank-1-card {
    order: 2;
    /* Nằm giữa */
    height: 380px;
    /* Cao nhất */
    width: 260px;
    background: linear-gradient(to bottom, rgba(255, 215, 0, 0.15), rgba(15, 15, 20, 0.8));
    border-color: rgba(255, 215, 0, 0.5);
    box-shadow: 0 0 50px rgba(255, 215, 0, 0.1);
    z-index: 5;
}

.rank-1-card .podium-avatar {
    width: 110px;
    height: 110px;
    border-color: #ffd700;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.3);
}

/* Vương miện cho Top 1 */
.crown-icon {
    position: absolute;
    top: -45px;
    font-size: 3.5rem;
    filter: drop-shadow(0 0 15px rgba(255, 215, 0, 0.6));
    animation: floatCrown 3s ease-in-out infinite;
}

@keyframes floatCrown {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

/* TOP 2 (TRÁI) */
.rank-2-card {
    order: 1;
    /* Nằm trái */
    height: 300px;
    width: 220px;
    background: linear-gradient(to bottom, rgba(229, 231, 235, 0.1), rgba(15, 15, 20, 0.6));
    border-color: rgba(229, 231, 235, 0.3);
}

/* TOP 3 (PHẢI) */
.rank-3-card {
    order: 3;
    /* Nằm phải */
    height: 270px;
    /* Thấp nhất */
    width: 220px;
    background: linear-gradient(to bottom, rgba(251, 146, 60, 0.1), rgba(15, 15, 20, 0.6));
    border-color: rgba(251, 146, 60, 0.3);
}

/* --- RESPONSIVE CHO MOBILE (Dưới 768px) --- */
@media (max-width: 768px) {
    
    /* 1. Container: Chuyển từ ngang sang dọc */
    .podium-container {
        flex-direction: column; /* Xếp chồng lên nhau */
        align-items: center;
        gap: 1rem;
        margin-top: 1rem;
    }

    /* 2. Sắp xếp lại thứ tự: Top 1 phải lên đầu */
    .rank-1-card { order: 1; }
    .rank-2-card { order: 2; }
    .rank-3-card { order: 3; }

    /* 3. Style chung cho thẻ Rank trên Mobile: Chuyển thành dạng thẻ ngang */
    .podium-card {
        width: 100% !important; /* Full chiều rộng màn hình */
        height: auto !important; /* Bỏ chiều cao cố định của PC */
        flex-direction: row; /* Avatar trái - Info phải */
        padding: 1rem;
        text-align: left; /* Canh trái văn bản */
        align-items: center; /* Căn giữa theo chiều dọc */
        gap: 15px;
        margin-bottom: 0;
    }

    /* 4. Chỉnh Avatar nhỏ lại cho vừa mobile */
    .podium-avatar {
        width: 60px !important;
        height: 60px !important;
        margin-bottom: 0; /* Bỏ margin dưới vì đã xếp ngang */
        border-width: 2px;
        flex-shrink: 0; /* Không bị bóp méo ảnh */
    }

    /* 5. Tùy chỉnh riêng Top 1 trên Mobile */
    .rank-1-card {
        background: linear-gradient(to right, rgba(255, 215, 0, 0.15), rgba(15, 15, 20, 0.9));
        border: 1px solid rgba(255, 215, 0, 0.4);
        margin-bottom: 1rem; /* Tách biệt Top 1 ra chút */
        transform: scale(1.02); /* Phóng to nhẹ cho nổi bật */
    }

    .rank-1-card .podium-avatar {
        width: 70px !important;
        height: 70px !important;
    }

    /* Chỉnh vị trí Vương miện trên mobile */
    .crown-icon {
        top: -20px;
        left: -10px; /* Đặt lệch góc trái avatar */
        right: auto;
        font-size: 2.5rem;
        display: block !important; /* Đảm bảo vẫn hiện vương miện */
    }

    /* 6. Tinh chỉnh Top 2 & 3 */
    .rank-2-card, .rank-3-card {
        background: rgba(15, 15, 20, 0.6); /* Nền tối hơn cho dễ đọc */
    }

    /* 7. Ẩn/Hiện/Chỉnh lại các dòng text phụ */
    .podium-card .border-t {
        margin-top: 0;
        padding-top: 0;
        border: none; /* Bỏ đường kẻ ngang trong card */
        width: auto;
    }

    /* Huy hiệu số 1, 2, 3 nhỏ lại */
    .rank-medal {
        width: 24px;
        height: 24px;
        font-size: 0.8rem;
        position: absolute;
        top: 10px;
        right: 10px; /* Đưa số thứ hạng sang góc phải trên */
        left: auto;
        margin: 0;
    }

    /* Chỉnh font chữ mobile */
    .podium-card h3 {
        font-size: 1.1rem; /* Tên nhỏ lại chút */
    }
    
    .podium-card p.text-4xl {
        font-size: 1.5rem; /* Điểm số Top 1 nhỏ lại */
    }
    
    .podium-card p.text-2xl {
        font-size: 1.2rem; /* Điểm số Top 2,3 nhỏ lại */
    }
}

/* Forum Post */
.forum-post {
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.forum-post:hover {
    border-left-color: var(--accent-cyan);
    transform: translateX(8px);
    background: rgba(139, 92, 246, 0.05);
}

.forum-post.pinned {
    border-left-color: #fbbf24;
    background: rgba(251, 191, 36, 0.05);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal.active {
    display: flex;
}

.modal-content {
    max-width: 500px;
    width: 100%;
    max-height: 90%;
    overflow-y: auto;
    animation: modalSlide 0.4s cubic-bezier(0.075, 0.82, 0.165, 1);
}

@keyframes modalSlide {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Input Focus */
.cyber-input {
    background: rgba(15, 15, 26, 0.5);
    border: 1px solid rgba(139, 92, 246, 0.3);
    color: var(--light);
    transition: all 0.3s ease;
}

.cyber-input:focus {
    outline: none;
    border-color: var(--accent-cyan);
    box-shadow:
        0 0 20px rgba(34, 211, 238, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    background: rgba(15, 15, 26, 0.7);
}

/* Status Badge */
.status-online {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: 999px;
    box-shadow: 0 0 20px rgba(34, 197, 94, 0.2);
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #22c55e;
    border-radius: 50%;
    box-shadow: 0 0 10px #22c55e;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.7;
        transform: scale(1.1);
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(15, 15, 26, 0.5);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--primary-purple), var(--accent-cyan));
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.5);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--accent-cyan), var(--primary-purple));
}

/* Mobile Optimization */
@media (max-width: 768px) {

    .orb-1,
    .orb-2,
    .orb-3 {
        width: 300px;
        height: 300px;
    }
}

/* IP Copy Animation */
@keyframes copySuccess {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

.copy-success {
    animation: copySuccess 0.3s ease;
}