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

:root {
    --primary: #00f0ff;
    --secondary: #ff00ff;
    --accent: #ffff00;
    --dark: #0a0e27;
    --darker: #050714;
    --light: #ffffff;
    --gray: #8892b0;
}

body {
    font-family: 'Rajdhani', sans-serif;
    background: var(--darker);
    color: var(--light);
    overflow-x: hidden;
    position: relative;
}

.stars, .twinkling {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    display: block;
    z-index: -1;
}

.stars {
    background: #000 url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAYAAABytg0kAAAAE0lEQVQIW2NkYGD4z8DAwMgABgAZAAIBBQABhAAAAABJRU5ErkJggg==') repeat top center;
}

.twinkling {
    background: transparent url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAYAAABytg0kAAAAE0lEQVQIW2NkYGD4z8DAwMgABgAZAAIBBQABhAAAAABJRU5ErkJggg==') repeat top center;
    animation: move-twink-back 200s linear infinite;
}

@keyframes move-twink-back {
    from {background-position: 0 0;}
    to {background-position: -10000px 5000px;}
}

.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(10, 14, 39, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 2px solid var(--primary);
    z-index: 1000;
    padding: 1rem 0;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo h1 {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.5rem;
    font-weight: 900;
    letter-spacing: 2px;
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 30px rgba(0, 240, 255, 0.5);
}

.nav-menu {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-link {
    color: var(--light);
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
    transition: all 0.3s;
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: width 0.3s;
}

.nav-link:hover::after {
    width: 100%;
}

.nav-link:hover {
    color: var(--primary);
}

.btn-login, .btn-register, .btn-logout {
    padding: 0.6rem 1.5rem;
    border: 2px solid var(--primary);
    background: transparent;
    color: var(--primary);
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    font-family: 'Orbitron', sans-serif;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 1px;
}

.btn-register {
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    border: none;
    color: var(--dark);
}

.btn-login:hover, .btn-logout:hover {
    background: var(--primary);
    color: var(--dark);
    box-shadow: 0 0 20px var(--primary);
}

.btn-register:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px var(--primary);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

#username {
    color: var(--primary);
    font-weight: 700;
    font-size: 1.1rem;
}

.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 8rem 2rem 4rem;
    background: radial-gradient(ellipse at center, rgba(0, 240, 255, 0.1) 0%, transparent 70%);
}

.hero-content {
    max-width: 1200px;
}

.hero-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 4rem;
    font-weight: 900;
    margin-bottom: 1rem;
    background: linear-gradient(45deg, var(--primary), var(--secondary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 50px rgba(0, 240, 255, 0.5);
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from {
        filter: drop-shadow(0 0 20px rgba(0, 240, 255, 0.5));
    }
    to {
        filter: drop-shadow(0 0 40px rgba(255, 0, 255, 0.8));
    }
}

.hero-subtitle {
    font-size: 1.5rem;
    color: var(--gray);
    margin-bottom: 3rem;
    font-weight: 300;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 4rem;
    margin-top: 4rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.stat-number {
    font-family: 'Orbitron', sans-serif;
    font-size: 3rem;
    font-weight: 900;
    color: var(--primary);
    text-shadow: 0 0 20px var(--primary);
}

.stat-label {
    font-size: 1rem;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.games-section, .leaderboard-section {
    padding: 6rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.section-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 3rem;
    text-align: center;
    margin-bottom: 4rem;
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-transform: uppercase;
    letter-spacing: 4px;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.game-card {
    background: rgba(10, 14, 39, 0.8);
    border: 2px solid rgba(0, 240, 255, 0.3);
    border-radius: 20px;
    padding: 2rem;
    text-align: center;
    transition: all 0.3s;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.game-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(0, 240, 255, 0.1) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s;
}

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

.game-card:hover {
    transform: translateY(-10px);
    border-color: var(--primary);
    box-shadow: 0 10px 40px rgba(0, 240, 255, 0.4);
}

.game-card-featured {
    grid-column: span 2;
    background: linear-gradient(135deg, rgba(0, 240, 255, 0.1), rgba(255, 0, 255, 0.1));
    border-color: var(--secondary);
}

.game-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    filter: drop-shadow(0 0 10px var(--primary));
}

.game-card h3 {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    color: var(--primary);
}

.game-card p {
    color: var(--gray);
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
}

.game-stats {
    margin-bottom: 1.5rem;
    color: var(--gray);
    font-size: 0.9rem;
}

.btn-play {
    padding: 1rem 2rem;
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    border: none;
    color: var(--dark);
    font-weight: 700;
    font-family: 'Orbitron', sans-serif;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 1rem;
    border-radius: 10px;
    position: relative;
    z-index: 1;
}

.btn-play:hover {
    transform: scale(1.1);
    box-shadow: 0 0 30px rgba(0, 240, 255, 0.6);
}

.leaderboard-container {
    background: rgba(10, 14, 39, 0.8);
    border: 2px solid rgba(0, 240, 255, 0.3);
    border-radius: 20px;
    padding: 2rem;
}

.leaderboard-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    justify-content: center;
}

.tab-btn {
    padding: 0.8rem 1.5rem;
    background: transparent;
    border: 2px solid rgba(0, 240, 255, 0.3);
    color: var(--gray);
    cursor: pointer;
    transition: all 0.3s;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 600;
    font-size: 1rem;
    border-radius: 10px;
}

.tab-btn.active, .tab-btn:hover {
    background: var(--primary);
    color: var(--dark);
    border-color: var(--primary);
}

.leaderboard-content {
    min-height: 400px;
}

.leaderboard-table {
    width: 100%;
}

.leaderboard-item {
    display: grid;
    grid-template-columns: 80px 1fr 150px 150px;
    padding: 1.5rem;
    background: rgba(0, 240, 255, 0.05);
    margin-bottom: 1rem;
    border-radius: 10px;
    border-left: 4px solid var(--primary);
    transition: all 0.3s;
    align-items: center;
}

.leaderboard-item:hover {
    background: rgba(0, 240, 255, 0.1);
    transform: translateX(10px);
}

.leaderboard-item.rank-1 {
    border-left-color: #ffd700;
    background: rgba(255, 215, 0, 0.1);
}

.leaderboard-item.rank-2 {
    border-left-color: #c0c0c0;
}

.leaderboard-item.rank-3 {
    border-left-color: #cd7f32;
}

.rank {
    font-family: 'Orbitron', sans-serif;
    font-size: 2rem;
    font-weight: 900;
    color: var(--primary);
}

.rank-1 .rank {
    color: #ffd700;
}

.player-name {
    font-size: 1.3rem;
    font-weight: 700;
}

.score, .games-played {
    font-size: 1.1rem;
    color: var(--gray);
    text-align: right;
}

.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: var(--dark);
    margin: 5% auto;
    padding: 3rem;
    border: 2px solid var(--primary);
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 0 50px rgba(0, 240, 255, 0.5);
}

.close-modal {
    position: absolute;
    right: 1.5rem;
    top: 1rem;
    font-size: 2rem;
    color: var(--gray);
    cursor: pointer;
    transition: all 0.3s;
}

.close-modal:hover {
    color: var(--primary);
}

.auth-form h2 {
    font-family: 'Orbitron', sans-serif;
    text-align: center;
    margin-bottom: 2rem;
    color: var(--primary);
    font-size: 2rem;
}

.auth-form input {
    width: 100%;
    padding: 1rem;
    margin-bottom: 1.5rem;
    background: rgba(0, 240, 255, 0.05);
    border: 2px solid rgba(0, 240, 255, 0.3);
    border-radius: 10px;
    color: var(--light);
    font-size: 1rem;
    font-family: 'Rajdhani', sans-serif;
    transition: all 0.3s;
}

.auth-form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.3);
}

.btn-submit {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    border: none;
    color: var(--dark);
    font-weight: 700;
    font-family: 'Orbitron', sans-serif;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 1.1rem;
    border-radius: 10px;
}

.btn-submit:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(0, 240, 255, 0.6);
}

.switch-auth {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--gray);
}

.switch-auth a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 700;
}

.chat-widget {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 350px;
    height: 500px;
    background: rgba(10, 14, 39, 0.95);
    border: 2px solid var(--primary);
    border-radius: 15px;
    display: none;
    flex-direction: column;
    z-index: 1500;
    box-shadow: 0 0 30px rgba(0, 240, 255, 0.4);
}

.chat-widget.active {
    display: flex;
}

.chat-header {
    padding: 1rem;
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    color: var(--dark);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 13px 13px 0 0;
}

.chat-header h3 {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.2rem;
}

.chat-minimize {
    background: none;
    border: none;
    color: var(--dark);
    font-size: 1.5rem;
    cursor: pointer;
    font-weight: 900;
}

.chat-messages {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.chat-message {
    padding: 0.8rem;
    background: rgba(0, 240, 255, 0.1);
    border-radius: 10px;
    border-left: 3px solid var(--primary);
}

.chat-message .sender {
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.3rem;
}

.chat-message .text {
    color: var(--light);
    font-size: 0.9rem;
}

.chat-input-container {
    display: flex;
    padding: 1rem;
    gap: 0.5rem;
    border-top: 1px solid rgba(0, 240, 255, 0.3);
}

.chat-input-container input {
    flex: 1;
    padding: 0.8rem;
    background: rgba(0, 240, 255, 0.05);
    border: 1px solid rgba(0, 240, 255, 0.3);
    border-radius: 8px;
    color: var(--light);
    font-family: 'Rajdhani', sans-serif;
}

.chat-input-container button {
    padding: 0.8rem 1.5rem;
    background: var(--primary);
    border: none;
    color: var(--dark);
    font-weight: 700;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s;
}

.chat-input-container button:hover {
    transform: scale(1.05);
}

.game-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--darker);
    z-index: 1800;
    padding: 6rem 2rem 2rem;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 0 2rem;
}

.btn-back {
    padding: 0.8rem 1.5rem;
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    font-family: 'Orbitron', sans-serif;
    border-radius: 8px;
}

.btn-back:hover {
    background: var(--primary);
    color: var(--dark);
}

#gameTitle {
    font-family: 'Orbitron', sans-serif;
    font-size: 2rem;
    color: var(--primary);
}

.game-score {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--light);
}

#gameCanvas {
    width: 100%;
    height: calc(100vh - 200px);
    background: rgba(10, 14, 39, 0.5);
    border: 2px solid var(--primary);
    border-radius: 15px;
    position: relative;
}

.footer {
    text-align: center;
    padding: 2rem;
    color: var(--gray);
    border-top: 1px solid rgba(0, 240, 255, 0.3);
}

.loading {
    text-align: center;
    padding: 4rem;
    color: var(--gray);
    font-size: 1.2rem;
}

@media (max-width: 768px) {
    .hero-title {
        font-size: 2.5rem;
    }
    
    .hero-stats {
        flex-direction: column;
        gap: 2rem;
    }
    
    .games-grid {
        grid-template-columns: 1fr;
    }
    
    .game-card-featured {
        grid-column: span 1;
    }
    
    .nav-menu {
        flex-direction: column;
        gap: 1rem;
    }
    
    .chat-widget {
        width: 90%;
        right: 5%;
    }
    
    .leaderboard-item {
        grid-template-columns: 60px 1fr 100px;
        font-size: 0.9rem;
    }
    
    .games-played {
        display: none;
    }
}
