@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Rajdhani:wght@300;400;600;700&display=swap');

:root {
    /* Mechanical Color Palette */
    --primary: #1a1a2e;
    --secondary: #16213e;
    --accent: #e94560;
    --metal: #c5c6c7;
    --copper: #d4a574;
    --track: #0f3460;
    --dark-bg: #0d0d1a;
    --glow: #00d9ff;

    /* Spacing */
    --track-width: 4px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    background: #ffffff;
    color: #00d9ff;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* Animated Background Track Lines */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        repeating-linear-gradient(90deg, transparent, transparent 50px, rgba(0, 217, 255, 0.03) 50px, rgba(0, 217, 255, 0.03) 51px),
        repeating-linear-gradient(0deg, transparent, transparent 50px, rgba(0, 217, 255, 0.03) 50px, rgba(0, 217, 255, 0.03) 51px);
    pointer-events: none;
    z-index: 0;
}

/* New Header */
.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: #ffffff;
    border-bottom: 1px solid #eaeaea;
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.site-header .logo {
    font-weight: 800;
    font-size: 22px;
    color: #1a73e8;
    text-decoration: none;
    letter-spacing: 0.5px;
    text-shadow: none;
}

.search-wrap {
    flex: 1;
    display: flex;
}

#search-input {
    width: 100%;
    max-width: 520px;
    padding: 10px 14px;
    border-radius: 24px;
    border: 1px solid #e0e0e0;
    background: #f5f5f7;
    outline: none;
    font-size: 14px;
}

.header-actions {
    display: flex;
    gap: 12px;
}

.action-link {
    color: #333;
    text-decoration: none;
    font-weight: 600;
    padding: 8px 10px;
}

.category-bar {
    max-width: 1200px;
    margin: 0 auto;
    padding: 8px 16px 12px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.chip {
    display: inline-block;
    padding: 8px 14px;
    border-radius: 999px;
    background: #f3f4f6;
    color: #111827;
    text-decoration: none;
    font-weight: 600;
    border: 1px solid #e5e7eb;
}

/* Mobile category bottom panel */
.mobile-category-panel {
    display: none;
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 16px 20px;
}

.mobile-category-panel h2 {
    font-size: 16px;
    font-weight: 800;
    color: #111827;
    margin-bottom: 8px;
}

.mobile-category-panel .chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

@keyframes trackMove {
    0% {
        background-position: 0 0;
    }

    100% {
        background-position: 20px 0;
    }
}

.logo {
    font-family: 'Orbitron', sans-serif;
    font-size: 2rem;
    font-weight: 900;
    color: var(--glow);
    text-transform: uppercase;
    letter-spacing: 3px;
    text-shadow: 0 0 20px var(--glow), 0 0 40px var(--glow);
    position: relative;
}

.logo::before {
    content: '⚙';
    margin-right: 10px;
    animation: gearRotate 4s linear infinite;
    display: inline-block;
}

@keyframes gearRotate {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Navigation */
nav ul {
    display: flex;
    list-style: none;
    gap: 5px;
}

nav a {
    font-family: 'Orbitron', sans-serif;
    text-decoration: none;
    color: var(--metal);
    padding: 12px 24px;
    background: var(--track);
    border: 2px solid var(--copper);
    clip-path: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%);
    transition: all 0.3s;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
}

nav a::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(233, 69, 96, 0.3), transparent);
    transition: left 0.5s;
}

nav a:hover::before {
    left: 100%;
}

nav a:hover {
    background: var(--accent);
    color: white;
    border-color: var(--glow);
    box-shadow: 0 0 20px var(--accent);
}

/* Main Content */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 16px;
    position: relative;
    z-index: 1;
}

/* Hero Section */
.hero {
    display: none;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(45deg,
            transparent,
            transparent 10px,
            rgba(212, 165, 116, 0.05) 10px,
            rgba(212, 165, 116, 0.05) 20px);
    pointer-events: none;
}

.hero-content {
    flex: 1;
    position: relative;
    z-index: 1;
}

.hero h1 {
    font-family: 'Orbitron', sans-serif;
    font-size: 3.5rem;
    font-weight: 900;
    color: var(--glow);
    margin-bottom: 20px;
    text-transform: uppercase;
    line-height: 1.2;
    text-shadow: 0 0 10px var(--glow);
}

.hero p {
    font-size: 1.2rem;
    line-height: 1.6;
    margin-bottom: 30px;
    color: var(--metal);
}

.play-btn {
    font-family: 'Orbitron', sans-serif;
    background: var(--accent);
    color: white;
    border: 3px solid var(--copper);
    padding: 15px 40px;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    clip-path: polygon(15px 0, 100% 0, calc(100% - 15px) 100%, 0 100%);
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 2px;
    position: relative;
    overflow: hidden;
}

.play-btn::before {
    content: '▶';
    margin-right: 10px;
}

.play-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.play-btn:hover::after {
    width: 300px;
    height: 300px;
}

.play-btn:hover {
    background: var(--glow);
    color: var(--primary);
    box-shadow: 0 0 30px var(--glow);
    transform: translateY(-2px);
}

.hero-image {
    flex: 1;
    position: relative;
}

.hero-image img {
    width: 100%;
    border: 4px solid var(--copper);
    clip-path: polygon(20px 0, 100% 0, 100% calc(100% - 20px), calc(100% - 20px) 100%, 0 100%, 0 20px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

/* Trending Section */
.trending-section {
    margin-bottom: 16px;
}

.trending-section::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 0;
    width: 100%;
    height: 4px;
    background: repeating-linear-gradient(90deg,
            var(--accent) 0px,
            var(--accent) 20px,
            transparent 20px,
            transparent 40px);
    animation: trackMove 2s linear infinite;
}

.trending-section h2 {
    font-size: 20px;
    font-weight: 800;
    color: #111827;
    margin-bottom: 12px;
}

.trending-section h2::before {
    content: '⚡';
    position: absolute;
    left: 0;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.6;
        transform: scale(1.2);
    }
}

.trending-scroll {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 8px 4px;
    scroll-behavior: smooth;
}

.trending-scroll::-webkit-scrollbar {
    height: 8px;
}

.trending-scroll::-webkit-scrollbar-track {
    background: var(--track);
}

.trending-scroll::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 4px;
}

.trending-card {
    flex: 0 0 240px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
    display: block;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.trending-card::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, var(--accent), var(--glow), var(--accent));
    z-index: -1;
    opacity: 0;
    transition: opacity 0.4s;
}

.trending-card:hover::before {
    opacity: 1;
}

.trending-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}

.trending-thumb {
    width: 100%;
    height: 140px;
    object-fit: cover;
    border-bottom: 1px solid #e5e7eb;
}

.trending-info {
    padding: 12px;
}

.trending-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: #2563eb;
    color: #ffffff;
    padding: 4px 8px;
    font-weight: 700;
    font-size: 12px;
    border-radius: 6px;
}

/* Game Grid */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.game-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    text-decoration: none;
    display: block;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.game-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 217, 255, 0.2), transparent);
    transition: left 0.6s;
}

.game-card:hover::after {
    left: 100%;
}

.game-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}

.game-thumb {
    width: 100%;
    height: 140px;
    object-fit: cover;
    border-bottom: 1px solid #e5e7eb;
}

.game-info {
    padding: 12px;
    background: #ffffff;
}

.game-title {
    font-size: 14px;
    font-weight: 800;
    color: #111827;
}

/* Game Detail Page */
.game-container {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto 30px;
    background: #000;
    border: 4px solid var(--copper);
    position: relative;
    box-shadow: 0 0 40px rgba(233, 69, 96, 0.3);
}

.game-frame {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
    aspect-ratio: 16/9;
}

.game-controls {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    margin-bottom: 20px;
}

.control-btn {
    background: var(--track);
    border: 2px solid var(--copper);
    color: var(--metal);
    padding: 12px 24px;
    cursor: pointer;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    font-size: 1rem;
    transition: all 0.3s;
    clip-path: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%);
}

.control-btn:hover {
    background: var(--accent);
    color: white;
    border-color: var(--glow);
    box-shadow: 0 0 20px var(--accent);
}

.control-btn.active {
    background: var(--glow);
    color: var(--primary);
    border-color: var(--glow);
}

.game-meta {
    margin-top: 30px;
    background: var(--secondary);
    padding: 40px;
    border: 3px solid var(--track);
    border-left: 8px solid var(--accent);
}

.game-meta h1 {
    font-family: 'Orbitron', sans-serif;
    font-size: 2.5rem;
    color: var(--glow);
    margin-bottom: 20px;
    text-transform: uppercase;
}

.game-meta h3 {
    font-family: 'Orbitron', sans-serif;
    color: var(--copper);
    margin-top: 20px;
    margin-bottom: 10px;
}

.game-meta p {
    line-height: 1.8;
    font-size: 1.1rem;
}

/* Mobile Play Overlay */
.mobile-play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

/* Footer */
footer {
    background: #ffffff;
    padding: 24px 16px;
    text-align: center;
    border-top: 1px solid #eaeaea;
    margin-top: 24px;
    position: relative;
}

footer::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 0;
    width: 100%;
    height: 4px;
    background: repeating-linear-gradient(90deg,
            var(--accent) 0px,
            var(--accent) 10px,
            transparent 10px,
            transparent 20px);
    animation: trackMove 1s linear infinite reverse;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 20px;
}

.footer-links a {
    color: #374151;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: color 0.2s;
    position: relative;
}

.footer-links a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--glow);
    transition: width 0.3s;
}

.footer-links a:hover::after {
    width: 100%;
}

.footer-links a:hover {
    color: #1a73e8;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .header-inner {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        padding: 10px 12px;
    }
    .site-header .logo {
        font-size: 20px;
        color: #111827;
    }
    .header-actions {
        display: none;
    }
    .category-bar {
        display: none;
    }
    #search-input {
        max-width: none;
        width: 100%;
    }
    .mobile-category-panel {
        display: block;
    }
}

footer p {
    color: var(--copper);
    font-size: 0.9rem;
}

/* Mobile Styles */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        gap: 20px;
        padding: 20px;
    }

    nav ul {
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
    }

    nav a {
        font-size: 0.8rem;
        padding: 10px 16px;
    }

    .hero {
        flex-direction: column;
        padding: 30px 20px;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .grid-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    .grid-container.grid-3 {
        grid-template-columns: 1fr;
    }

    .grid-container.grid-9 {
        grid-template-columns: repeat(3, 1fr);
    }

    .game-container.mobile-fullscreen {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw !important;
        height: 100vh !important;
        z-index: 9999;
        border: none;
        margin: 0;
    }

    .mobile-home-btn {
        position: fixed;
        top: 20px;
        left: 20px;
        z-index: 10000;
        background: var(--accent);
        color: white;
        padding: 15px;
        border-radius: 50%;
        border: 3px solid var(--copper);
        display: none;
        cursor: pointer;
        font-size: 1.5rem;
        box-shadow: 0 0 20px var(--accent);
    }
}

/* Loading Animation */
.loading {
    text-align: center;
    padding: 50px;
    font-size: 1.5rem;
    font-family: 'Orbitron', sans-serif;
    color: var(--glow);
    animation: pulse 1.5s ease-in-out infinite;
}
