/* ===== DESIGN TOKENS ===== */
:root {
    --bg-primary: #0a0a1a;
    --bg-secondary: #12122a;
    --bg-card: rgba(20, 20, 50, 0.6);
    --bg-glass: rgba(255, 255, 255, 0.03);
    --border-glass: rgba(255, 255, 255, 0.08);

    --neon-cyan: #00f0ff;
    --neon-purple: #b000ff;
    --neon-magenta: #ff00aa;
    --neon-green: #00ff88;
    --neon-orange: #ff6600;
    --neon-yellow: #ffee00;

    --text-primary: #e8e8f0;
    --text-secondary: #8888aa;
    --text-muted: #555577;

    --glow-cyan: 0 0 20px rgba(0, 240, 255, 0.3), 0 0 60px rgba(0, 240, 255, 0.1);
    --glow-purple: 0 0 20px rgba(176, 0, 255, 0.3), 0 0 60px rgba(176, 0, 255, 0.1);
    --glow-magenta: 0 0 20px rgba(255, 0, 170, 0.3), 0 0 60px rgba(255, 0, 170, 0.1);

    --font-main: 'Orbitron', sans-serif;
    --font-body: 'Rajdhani', sans-serif;

    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;

    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-med: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== RESET & BASE ===== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
    font-size: 16px;
}

a {
    text-decoration: none;
    color: inherit;
}

/* ===== ANIMATED BACKGROUND ===== */
#bg-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.page-content {
    position: relative;
    z-index: 1;
}

/* ===== NAVIGATION ===== */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: 16px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(10, 10, 26, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-glass);
}

.nav-logo {
    font-family: var(--font-main);
    font-size: 1.4rem;
    font-weight: 900;
    letter-spacing: 3px;
    background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-transform: uppercase;
}

.nav-logo span {
    -webkit-text-fill-color: var(--neon-magenta);
    font-size: 0.8rem;
    letter-spacing: 1px;
    display: block;
    margin-top: -4px;
}

.nav-links {
    display: flex;
    gap: 24px;
    align-items: center;
}

.nav-link {
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    transition: color var(--transition-fast);
    position: relative;
    text-transform: uppercase;
    letter-spacing: 2px;
}

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

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--neon-cyan);
    transition: width var(--transition-med);
    box-shadow: var(--glow-cyan);
}

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

.nav-score {
    font-family: var(--font-main);
    font-size: 0.85rem;
    color: var(--neon-green);
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
    letter-spacing: 1px;
}

/* ===== HERO SECTION ===== */
.hero {
    min-height: 60vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 120px 24px 40px;
    position: relative;
}

.hero h1 {
    font-family: var(--font-main);
    font-size: clamp(2.5rem, 6vw, 5rem);
    font-weight: 900;
    letter-spacing: 6px;
    text-transform: uppercase;
    line-height: 1.1;
    margin-bottom: 16px;
    background: linear-gradient(135deg, var(--neon-cyan) 0%, var(--neon-purple) 50%, var(--neon-magenta) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: titleGlow 3s ease-in-out infinite;
}

@keyframes titleGlow {

    0%,
    100% {
        filter: brightness(1) drop-shadow(0 0 20px rgba(0, 240, 255, 0.3));
    }

    50% {
        filter: brightness(1.2) drop-shadow(0 0 40px rgba(176, 0, 255, 0.5));
    }
}

.hero p {
    font-size: 1.2rem;
    color: var(--text-secondary);
    max-width: 600px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.hero-stats {
    display: flex;
    gap: 48px;
    margin-top: 40px;
}

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

.hero-stat-value {
    font-family: var(--font-main);
    font-size: 2rem;
    font-weight: 900;
    color: var(--neon-cyan);
    text-shadow: var(--glow-cyan);
}

.hero-stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-top: 4px;
}

/* ===== GAME GRID ===== */
.games-section {
    padding: 40px 32px 80px;
    max-width: 1400px;
    margin: 0 auto;
}

.section-title {
    font-family: var(--font-main);
    font-size: 1.2rem;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 32px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--border-glass), transparent);
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 24px;
}

/* ===== GAME CARD ===== */
.game-card {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition-med);
    cursor: pointer;
}

.game-card:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: rgba(0, 240, 255, 0.3);
    box-shadow: var(--glow-cyan);
}

.game-card-visual {
    height: 200px;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.game-card-visual canvas {
    width: 100%;
    height: 100%;
}

.game-card-icon {
    font-size: 4rem;
    position: absolute;
    z-index: 2;
    filter: drop-shadow(0 0 20px rgba(0, 240, 255, 0.5));
    transition: transform var(--transition-med);
}

.game-card:hover .game-card-icon {
    transform: scale(1.15) rotate(5deg);
}

.game-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 40%, rgba(10, 10, 26, 0.95) 100%);
    z-index: 1;
}

.game-card-body {
    padding: 20px 24px 24px;
    position: relative;
    z-index: 2;
    margin-top: -40px;
}

.game-card-tag {
    display: inline-block;
    font-family: var(--font-main);
    font-size: 0.6rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    padding: 4px 12px;
    border-radius: 20px;
    margin-bottom: 12px;
}

.tag-puzzle {
    background: rgba(0, 240, 255, 0.15);
    color: var(--neon-cyan);
    border: 1px solid rgba(0, 240, 255, 0.3);
}

.tag-arcade {
    background: rgba(255, 0, 170, 0.15);
    color: var(--neon-magenta);
    border: 1px solid rgba(255, 0, 170, 0.3);
}

.tag-strategy {
    background: rgba(176, 0, 255, 0.15);
    color: var(--neon-purple);
    border: 1px solid rgba(176, 0, 255, 0.3);
}

.tag-reflex {
    background: rgba(0, 255, 136, 0.15);
    color: var(--neon-green);
    border: 1px solid rgba(0, 255, 136, 0.3);
}

.tag-classic {
    background: rgba(255, 102, 0, 0.15);
    color: var(--neon-orange);
    border: 1px solid rgba(255, 102, 0, 0.3);
}

.game-card-title {
    font-family: var(--font-main);
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 2px;
    margin-bottom: 8px;
}

.game-card-desc {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 16px;
}

.game-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.game-card-score {
    font-family: var(--font-main);
    font-size: 0.75rem;
    color: var(--neon-yellow);
    letter-spacing: 1px;
}

.game-card-play {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-main);
    font-size: 0.75rem;
    color: var(--neon-cyan);
    letter-spacing: 2px;
    text-transform: uppercase;
    transition: all var(--transition-fast);
}

.game-card-play .arrow {
    transition: transform var(--transition-fast);
}

.game-card:hover .game-card-play .arrow {
    transform: translateX(6px);
}

/* ===== GAME PAGE LAYOUT ===== */
.game-page {
    padding: 80px 24px 40px;
    max-width: 1100px;
    margin: 0 auto;
    min-height: 100vh;
}

.game-header {
    text-align: center;
    margin-bottom: 24px;
}

.game-header h1 {
    font-family: var(--font-main);
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    letter-spacing: 4px;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.game-controls {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.game-info-bar {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.game-info-item {
    text-align: center;
    padding: 12px 24px;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    min-width: 120px;
}

.game-info-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.game-info-value {
    font-family: var(--font-main);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--neon-cyan);
    text-shadow: var(--glow-cyan);
}

/* ===== GAME CONTAINER ===== */
.game-container {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 32px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.game-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--neon-cyan), var(--neon-purple), var(--neon-magenta));
}

/* ===== BUTTONS ===== */
.btn {
    font-family: var(--font-main);
    font-size: 0.75rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    padding: 12px 28px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple));
    color: #fff;
    box-shadow: 0 4px 20px rgba(0, 240, 255, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(0, 240, 255, 0.5);
}

.btn-secondary {
    background: var(--bg-glass);
    color: var(--text-primary);
    border: 1px solid var(--border-glass);
}

.btn-secondary:hover {
    border-color: var(--neon-cyan);
    color: var(--neon-cyan);
}

.btn-danger {
    background: rgba(255, 0, 100, 0.15);
    color: var(--neon-magenta);
    border: 1px solid rgba(255, 0, 170, 0.3);
}

.btn-danger:hover {
    background: rgba(255, 0, 100, 0.3);
}

/* ===== MODAL ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-fast);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 40px;
    text-align: center;
    max-width: 420px;
    width: 90%;
    transform: scale(0.9);
    transition: transform var(--transition-med);
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal h2 {
    font-family: var(--font-main);
    font-size: 1.5rem;
    letter-spacing: 3px;
    margin-bottom: 8px;
}

.modal .score-display {
    font-family: var(--font-main);
    font-size: 3rem;
    font-weight: 900;
    color: var(--neon-cyan);
    text-shadow: var(--glow-cyan);
    margin: 16px 0;
}

.modal p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* ===== TOAST ===== */
.toast {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 12px 28px;
    background: var(--bg-secondary);
    border: 1px solid var(--neon-green);
    border-radius: var(--radius-sm);
    color: var(--neon-green);
    font-family: var(--font-main);
    font-size: 0.75rem;
    letter-spacing: 2px;
    z-index: 1001;
    transition: transform var(--transition-med);
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.3);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

/* ===== BACK BUTTON ===== */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-family: var(--font-main);
    font-size: 0.7rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 24px;
    transition: color var(--transition-fast);
}

.back-link:hover {
    color: var(--neon-cyan);
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ===== LOADING ===== */
.page-loader {
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease;
}

.page-loader.hidden {
    opacity: 0;
    pointer-events: none;
}

.loader-ring {
    width: 50px;
    height: 50px;
    border: 3px solid transparent;
    border-top-color: var(--neon-cyan);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    position: relative;
}

.loader-ring::before {
    content: '';
    position: absolute;
    inset: 4px;
    border: 3px solid transparent;
    border-top-color: var(--neon-purple);
    border-radius: 50%;
    animation: spin 0.8s linear infinite reverse;
}

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

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .nav {
        padding: 12px 16px;
    }

    .nav-logo {
        font-size: 1.1rem;
    }

    .nav-links {
        gap: 12px;
    }

    .hero {
        padding: 100px 16px 32px;
        min-height: 50vh;
    }

    .hero-stats {
        gap: 24px;
    }

    .games-section {
        padding: 24px 16px 60px;
    }

    .games-grid {
        grid-template-columns: 1fr;
    }

    .game-page {
        padding: 72px 16px 32px;
    }

    .game-info-bar {
        gap: 12px;
    }

    .game-info-item {
        min-width: 90px;
        padding: 8px 16px;
    }

    .game-controls {
        gap: 8px;
    }

    .btn {
        padding: 10px 20px;
        font-size: 0.65rem;
    }
}

/* ===== PARTICLE ANIMATION ===== */
@keyframes float {

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

    33% {
        transform: translateY(-20px) rotate(5deg);
    }

    66% {
        transform: translateY(10px) rotate(-3deg);
    }
}

/* ===== SCANLINE EFFECT ===== */
.scanlines::after {
    content: '';
    position: fixed;
    inset: 0;
    background: repeating-linear-gradient(0deg,
            transparent,
            transparent 2px,
            rgba(0, 0, 0, 0.03) 2px,
            rgba(0, 0, 0, 0.03) 4px);
    pointer-events: none;
    z-index: 9998;
}