/* ==================== Global Styles ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Theme colors */
    --primary: #667eea;
    --secondary: #764ba2;
    --accent: #f093fb;
    --success: #4facfe;
    --warning: #43e97b;
    --danger: #fa709a;
    
    /* Category colors */
    --puzzle-color: #667eea;
    --action-color: #f093fb;
    --arcade-color: #feca57;
    --board-color: #48dbfb;
    --memory-color: #ff6348;
    --typing-color: #1dd1a1;
    --casual-color: #ee5a6f;
    
    /* Dark theme */
    --dark-bg: #0f0f23;
    --dark-surface: #1a1a2e;
    --dark-card: #16213e;
    
    /* Text colors */
    --text-primary: #ffffff;
    --text-secondary: #b8b8d1;
    --text-muted: #6c6c8a;
    
    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 20px rgba(102, 126, 234, 0.5);
    --radius-sm: 12px;
    --radius-md: 18px;
    --radius-lg: 26px;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background:
        radial-gradient(circle at 12% 18%, rgba(102, 126, 234, 0.2), transparent 36%),
        radial-gradient(circle at 88% 12%, rgba(240, 147, 251, 0.16), transparent 38%),
        radial-gradient(circle at 50% 88%, rgba(79, 172, 254, 0.12), transparent 42%),
        var(--dark-bg);
    color: var(--text-primary);
    overflow-x: hidden;
    line-height: 1.6;
    letter-spacing: 0.01em;
}

.container {
    max-width: 1320px;
    margin: 0 auto;
    padding: 0 28px;
}

/* ==================== Animated Background ==================== */
.animated-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    background:
        radial-gradient(circle at 8% 12%, rgba(123, 97, 255, 0.22), transparent 34%),
        radial-gradient(circle at 82% 10%, rgba(0, 224, 255, 0.17), transparent 36%),
        radial-gradient(circle at 50% 92%, rgba(255, 94, 180, 0.13), transparent 40%),
        linear-gradient(145deg, #090c1d 0%, #0f1226 45%, #0b0d1c 100%);
}

.animated-bg::before,
.animated-bg::after {
    content: '';
    position: absolute;
    inset: -10%;
    pointer-events: none;
}

.animated-bg::before {
    background-image:
        linear-gradient(rgba(120, 170, 255, 0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(120, 170, 255, 0.08) 1px, transparent 1px);
    background-size: 42px 42px;
    opacity: 0.22;
    animation: driftGrid 24s linear infinite;
}

.animated-bg::after {
    background:
        radial-gradient(circle at center, transparent 35%, rgba(5, 8, 22, 0.55) 100%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 28%);
    mix-blend-mode: screen;
}

.gradient-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(96px);
    opacity: 0.34;
    animation: floatOrb 18s ease-in-out infinite;
}

.orb-1 {
    width: 540px;
    height: 540px;
    background: linear-gradient(135deg, #6f5dff, #8245ff);
    top: -220px;
    left: -180px;
    animation-delay: 0s;
}

.orb-2 {
    width: 480px;
    height: 480px;
    background: linear-gradient(135deg, #12d6ff, #4f84ff);
    bottom: -210px;
    right: -170px;
    animation-delay: -6s;
}

.orb-3 {
    width: 420px;
    height: 420px;
    background: linear-gradient(135deg, #ff4da7, #ff7d5c);
    top: 40%;
    left: 54%;
    animation-delay: -12s;
}

@keyframes floatOrb {
    0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
    25% { transform: translate3d(36px, -28px, 0) scale(1.05); }
    50% { transform: translate3d(-30px, 24px, 0) scale(0.96); }
    75% { transform: translate3d(22px, 30px, 0) scale(1.03); }
}

@keyframes driftGrid {
    from { transform: translate3d(0, 0, 0); }
    to { transform: translate3d(-42px, -42px, 0); }
}

/* ==================== Navigation ==================== */
.navbar {
    position: fixed;
    top: 18px;
    left: 0;
    width: 100%;
    z-index: 1000;
    padding: 0;
}

.navbar .container {
    background: rgba(16, 18, 44, 0.75);
    backdrop-filter: blur(18px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-lg);
    box-shadow: 0 12px 40px rgba(3, 5, 20, 0.35);
}

.nav-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
    min-height: 74px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 24px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo i {
    font-size: 28px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-links {
    display: flex;
    gap: 10px;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.25s ease;
    position: relative;
    padding: 9px 14px;
    border-radius: 999px;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 5px;
    left: 14px;
    width: calc(100% - 28px);
    height: 2px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 0.25s ease;
}

.nav-link:hover,
.nav-link.active {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
}

.nav-link:hover::after,
.nav-link.active::after {
    transform: scaleX(1);
}

.search-box {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--dark-card);
    padding: 11px 18px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s;
}

.search-box:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.search-box i {
    color: var(--text-muted);
    font-size: 16px;
}

.search-box input {
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 14px;
    width: 200px;
}

.search-box input::placeholder {
    color: var(--text-muted);
}

/* ==================== Hero Section ==================== */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding-top: 132px;
}

.hero-content {
    text-align: center;
    max-width: 900px;
    margin: 0 auto;
    padding: 28px 0 10px;
}

.hero-title {
    font-size: clamp(2.6rem, 7vw, 4.8rem);
    font-weight: 900;
    margin-bottom: 18px;
    line-height: 1.05;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.gradient-text {
    background: linear-gradient(135deg, 
        var(--primary), 
        var(--accent), 
        var(--danger),
        var(--warning));
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 5s ease infinite;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.subtitle {
    font-size: clamp(1.15rem, 2.2vw, 1.9rem);
    font-weight: 600;
    color: var(--text-secondary);
}

.hero-description {
    font-size: clamp(1rem, 1.3vw, 1.12rem);
    color: var(--text-secondary);
    margin-bottom: 38px;
    line-height: 1.78;
}

.hero-stats {
    display: flex;
    gap: 24px;
    justify-content: center;
    margin-bottom: 48px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.11);
    border-radius: var(--radius-md);
    padding: 22px 28px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.28s ease;
}

.stat-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 14px 32px rgba(5, 9, 35, 0.35);
    border-color: rgba(255, 255, 255, 0.24);
}

.stat-icon {
    font-size: 32px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.stat-number {
    font-size: 32px;
    font-weight: 800;
    line-height: 1;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 4px;
}

.cta-button {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 16px 48px;
    border-radius: 999px;
    text-decoration: none;
    font-weight: 600;
    font-size: 18px;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.3);
}

.cta-button:hover {
    transform: translateY(-3px) scale(1.01);
    box-shadow: 0 14px 34px rgba(102, 126, 234, 0.44);
}

/* ==================== Most Played Section ==================== */
.most-played-section {
    padding: 90px 0 30px;
}

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

.play-count {
    margin-top: 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #ffd8a8;
    background: rgba(255, 153, 51, 0.14);
    border: 1px solid rgba(255, 153, 51, 0.25);
}

/* ==================== Games Section ==================== */
.games-section {
    padding: 70px 0 110px;
}

.section-title {
    font-size: clamp(2rem, 4.2vw, 3rem);
    font-weight: 800;
    text-align: center;
    margin-bottom: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    letter-spacing: 0.02em;
}

.title-icon {
    font-size: clamp(1.8rem, 3.6vw, 2.9rem);
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Category Filter */
.category-filter {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 44px;
}

.filter-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    padding: 10px 18px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.filter-btn:hover {
    transform: translateY(-2px) scale(1.01);
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
}

.filter-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-color: transparent;
    color: white;
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.3);
}

.filter-btn i {
    font-size: 16px;
}

.filter-btn .count {
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    border-radius: 8px;
    font-size: 12px;
    margin-left: 4px;
}

.filter-btn.active .count {
    background: rgba(255, 255, 255, 0.3);
}

/* Game Grid */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 24px;
}

.game-card {
    background: linear-gradient(165deg, rgba(255, 255, 255, 0.085), rgba(255, 255, 255, 0.03));
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-md);
    padding: 24px;
    transition: transform 0.28s ease, box-shadow 0.28s ease, border-color 0.28s ease;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: block;
    position: relative;
    overflow: hidden;
}

.game-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    transform: scaleX(0);
    transition: transform 0.28s ease;
}

.game-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 14% -20%, rgba(255, 255, 255, 0.28), transparent 40%);
    opacity: 0;
    transition: opacity 0.28s ease;
    pointer-events: none;
}

.game-card:hover::before {
    transform: scaleX(1);
}

.game-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 42px rgba(7, 10, 33, 0.42);
    border-color: rgba(255, 255, 255, 0.26);
}

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

.game-icon {
    font-size: 48px;
    margin-bottom: 16px;
    display: block;
}

.game-card[data-category="Puzzle"] .game-icon {
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.game-card[data-category="Action"] .game-icon {
    background: linear-gradient(135deg, #f093fb, #f5576c);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.game-card[data-category="Arcade"] .game-icon {
    background: linear-gradient(135deg, #feca57, #ff9ff3);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.game-card[data-category="Board"] .game-icon {
    background: linear-gradient(135deg, #48dbfb, #0abde3);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.game-card[data-category="Memory"] .game-icon {
    background: linear-gradient(135deg, #ff6348, #ee5a6f);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.game-card[data-category="Typing"] .game-icon {
    background: linear-gradient(135deg, #1dd1a1, #10ac84);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.game-card[data-category="Casual"] .game-icon {
    background: linear-gradient(135deg, #ee5a6f, #c44569);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.game-name {
    font-size: 19px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.game-category {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
}

.game-description {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.6;
}

/* ==================== Stats Section ==================== */
.stats-section {
    padding: 110px 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.01));
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

.stat-box {
    background: linear-gradient(165deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.03));
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-md);
    padding: 32px;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.stat-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
}

.puzzle-stat::before { background: linear-gradient(90deg, #667eea, #764ba2); }
.action-stat::before { background: linear-gradient(90deg, #f093fb, #f5576c); }
.arcade-stat::before { background: linear-gradient(90deg, #feca57, #ff9ff3); }
.board-stat::before { background: linear-gradient(90deg, #48dbfb, #0abde3); }
.memory-stat::before { background: linear-gradient(90deg, #ff6348, #ee5a6f); }
.typing-stat::before { background: linear-gradient(90deg, #1dd1a1, #10ac84); }
.casual-stat::before { background: linear-gradient(90deg, #ee5a6f, #c44569); }

.stat-box:hover {
    transform: translateY(-5px);
    box-shadow: 0 16px 36px rgba(8, 10, 30, 0.38);
    border-color: rgba(255, 255, 255, 0.23);
}

.stat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.stat-header i {
    font-size: 24px;
}

.puzzle-stat .stat-header i { color: #667eea; }
.action-stat .stat-header i { color: #f093fb; }
.arcade-stat .stat-header i { color: #feca57; }
.board-stat .stat-header i { color: #48dbfb; }
.memory-stat .stat-header i { color: #ff6348; }
.typing-stat .stat-header i { color: #1dd1a1; }
.casual-stat .stat-header i { color: #ee5a6f; }

.stat-header h3 {
    font-size: 18px;
    font-weight: 700;
}

.stat-box .stat-number {
    font-size: 48px;
    font-weight: 900;
    margin-bottom: 12px;
}

.puzzle-stat .stat-number { color: #667eea; }
.action-stat .stat-number { color: #f093fb; }
.arcade-stat .stat-number { color: #feca57; }
.board-stat .stat-number { color: #48dbfb; }
.memory-stat .stat-number { color: #ff6348; }
.typing-stat .stat-number { color: #1dd1a1; }
.casual-stat .stat-number { color: #ee5a6f; }

.stat-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
}

.stat-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 1s ease;
}

.puzzle-stat .stat-fill { background: linear-gradient(90deg, #667eea, #764ba2); }
.action-stat .stat-fill { background: linear-gradient(90deg, #f093fb, #f5576c); }
.arcade-stat .stat-fill { background: linear-gradient(90deg, #feca57, #ff9ff3); }
.board-stat .stat-fill { background: linear-gradient(90deg, #48dbfb, #0abde3); }
.memory-stat .stat-fill { background: linear-gradient(90deg, #ff6348, #ee5a6f); }
.typing-stat .stat-fill { background: linear-gradient(90deg, #1dd1a1, #10ac84); }
.casual-stat .stat-fill { background: linear-gradient(90deg, #ee5a6f, #c44569); }

.stat-desc {
    font-size: 14px;
    color: var(--text-muted);
}

/* ==================== Footer ==================== */
.footer {
    padding: 44px 0 30px;
    background: rgba(255, 255, 255, 0.02);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
}

.footer p {
    margin: 0;
}

.footer i {
    color: var(--danger);
}

.footer-content {
    text-align: center;
    margin-bottom: 24px;
}

.footer-logo {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-size: 24px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 12px;
}

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

.footer-social {
    display: flex;
    gap: 16px;
    justify-content: center;
}

.social-link {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s;
}

.social-link:hover {
    transform: translateY(-4px);
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-color: transparent;
    color: white;
}

.footer-bottom {
    text-align: center;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    font-size: 14px;
}

.footer-bottom i {
    color: var(--danger);
}

/* ==================== Responsive Design ==================== */
@media (max-width: 1024px) {
    .navbar {
        top: 12px;
    }

    .navbar .container {
        border-radius: 18px;
    }

    .hero-title {
        font-size: 56px;
    }
    
    .subtitle {
        font-size: 28px;
    }
    
    .games-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }

    .most-played-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 18px;
    }

    .navbar {
        top: 8px;
    }

    .navbar .container {
        border-radius: 16px;
    }

    .nav-content {
        min-height: 66px;
        gap: 14px;
    }

    .nav-links {
        display: none;
    }
    
    .search-box input {
        width: 120px;
    }
    
    .hero-title {
        font-size: 40px;
    }
    
    .subtitle {
        font-size: 20px;
    }
    
    .hero-description {
        font-size: 16px;
    }

    .hero-stats {
        flex-direction: column;
        gap: 14px;
    }

    .stat-card {
        justify-content: center;
    }
    
    .section-title {
        font-size: 36px;
    }
    
    .games-grid {
        grid-template-columns: 1fr;
    }

    .most-played-grid {
        grid-template-columns: 1fr;
    }

    .game-card {
        padding: 20px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 520px) {
    .hero {
        padding-top: 112px;
    }

    .search-box {
        padding: 10px 14px;
    }

    .search-box input {
        width: 96px;
    }

    .cta-button {
        width: 100%;
        justify-content: center;
    }
}

/* ==================== Animations ==================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.game-card {
    animation: fadeIn 0.5s ease forwards;
}

.game-card:nth-child(1) { animation-delay: 0.05s; }
.game-card:nth-child(2) { animation-delay: 0.1s; }
.game-card:nth-child(3) { animation-delay: 0.15s; }
.game-card:nth-child(4) { animation-delay: 0.2s; }
.game-card:nth-child(5) { animation-delay: 0.25s; }
.game-card:nth-child(6) { animation-delay: 0.3s; }
