:root {
    --bg-dark: #fafafa;
    --bg-darker: #ffffff;
    --theme-red: #cc3333; /* Red */
    --theme-red-glow: rgba(204, 51, 51, 0.5);
    --text-light: #333333;
    --text-muted: #777777;
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(204, 51, 51, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--bg-darker);
    color: var(--text-light);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow-x: hidden;
}

/* Animated Mouse-Responsive Background */
#bg-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    pointer-events: none;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

/* Header */
header {
    background: rgba(255, 255, 255, 0.9);
    padding: 20px 0;
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.logo {
    display: flex;
    align-items: center;
    gap: 15px;
    text-decoration: none;
    color: var(--text-light);
    font-weight: 800;
    font-size: 1.5rem;
    letter-spacing: 1px;
}

.logo-text span {
    color: var(--theme-red);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-search-bar {
    display: flex;
    align-items: center;
    background: rgba(204, 51, 51, 0.05);
    border: 2px solid var(--theme-red);
    border-radius: 20px;
    padding: 5px 15px;
    cursor: text;
    transition: all 0.3s ease;
    color: var(--text-light);
}

.header-search-bar:focus-within, .header-search-bar:hover {
    background: #fff;
    box-shadow: 0 0 10px rgba(204, 51, 51, 0.2);
}

.header-search-bar i {
    color: var(--theme-red);
    margin-right: 10px;
    font-size: 1.1rem;
    cursor: pointer;
}

#header-search-input {
    border: none;
    background: transparent;
    outline: none;
    color: var(--text-light);
    font-size: 0.95rem;
    width: 200px;
    transition: width 0.3s ease;
}

#header-search-input:focus {
    width: 250px;
}

.search-shortcut {
    font-size: 0.7rem;
    background: rgba(0,0,0,0.05);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--text-muted);
    margin-left: 10px;
    pointer-events: none;
}

.hamburger-btn {
    display: none;
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--text-light);
    cursor: pointer;
    padding: 5px;
    transition: color 0.3s;
}

.hamburger-btn:hover {
    color: var(--theme-red);
}

.nav-links {
    display: flex;
    gap: 15px;
    align-items: center;
}

.nav-links a {
    color: var(--text-light);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.nav-links a:hover {
    color: var(--theme-red);
}

.btn-all-games {
    background: rgba(204, 51, 51, 0.1);
    border: 2px solid var(--theme-red);
    color: var(--text-light) !important;
    padding: 8px 20px;
    border-radius: 8px;
    font-weight: bold;
    text-decoration: none;
    transition: all 0.3s ease;
}

.nav-links a.btn-all-games:hover {
    background: var(--theme-red);
    color: #fff !important;
    box-shadow: 0 0 15px rgba(204, 51, 51, 0.4);
}

.btn-upload {
    background: transparent;
    border: 2px solid var(--theme-red);
    color: var(--theme-red) !important;
    padding: 8px 12px;
    border-radius: 8px;
    font-weight: bold;
    text-decoration: none;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 0;
    overflow: hidden;
}

.upload-icon {
    font-size: 1.2rem;
    line-height: 1;
}

.upload-text {
    max-width: 0;
    opacity: 0;
    white-space: nowrap;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-links a.btn-upload:hover {
    background: var(--theme-red);
    color: #fff !important;
    box-shadow: 0 0 15px var(--theme-red-glow);
    padding: 8px 16px;
}

.nav-links a.btn-upload:hover .upload-text {
    max-width: 150px;
    opacity: 1;
    margin-left: 8px;
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 80px 20px;
    background: transparent;
}

.hero h1 {
    font-size: 3.5rem;
    font-weight: 900;
    margin-bottom: 20px;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.hero h1 span {
    color: var(--theme-red);
}

.hero p {
    font-size: 1.2rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto;
}

/* Game Grid */
.games-section {
    padding: 40px 0;
    flex: 1;
}

.section-title {
    font-size: 2rem;
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.section-title::before {
    content: '';
    display: block;
    width: 30px;
    height: 4px;
    background: var(--theme-red);
    border-radius: 2px;
}

.games-grid {
    display: grid;
    /* 4 per row means roughly 25% width minus gap. 1200px max width / 4 = 300 minus gaps ~ 240px */
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
}

.game-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
}

.game-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(204, 51, 51, 0.2);
    border-color: var(--theme-red);
}

.game-cover-container {
    width: 100%;
    aspect-ratio: 16/9;
    position: relative;
    overflow: hidden;
    background: #111; /* dark background for crossfades */
}

.game-cover-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transform: scale(1);
    transition: opacity 1s ease-in-out;
}

.game-cover-img.static-cover {
    opacity: 1;
}

.game-cover-img.active {
    opacity: 1;
    transform: scale(1.2);
    /* 4s total: 3s visibility before next slide + 1s crossfade out */
    transition: transform 4s linear, opacity 1s ease-in-out;
}

.game-cover-img.fade-out {
    opacity: 0;
    transform: scale(1.2);
    transition: opacity 1s ease-in-out, transform 4s linear;
}

.game-info {
    padding: 15px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.game-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 5px;
    color: var(--text-light);
}

.game-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.game-type {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: bold;
    text-transform: uppercase;
    background: rgba(204, 51, 51, 0.1);
    color: var(--theme-red);
    border: 1px solid var(--theme-red);
    margin-top: auto;
    align-self: flex-start;
}

/* Detail Page */
.detail-container {
    max-width: 1000px;
    margin: 40px auto;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
}
.detail-cover { width: 100%; height: 400px; object-fit: cover; background: #f0f0f0; }
.detail-content { padding: 40px; }
.detail-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; }
.detail-title { font-size: 3rem; font-weight: 900; line-height: 1.1; color: var(--text-light); }
.detail-meta-tags { display: flex; gap: 10px; margin-top: 15px; flex-wrap: wrap; }
.meta-tag { background: rgba(0,0,0,0.05); border: 1px solid rgba(0,0,0,0.1); padding: 5px 12px; border-radius: 20px; font-size: 0.85rem; color: var(--text-muted); font-weight: 500; }
.detail-description { font-size: 1.1rem; color: var(--text-light); line-height: 1.8; margin-bottom: 40px; }
.btn-primary {
    display: inline-block;
    background: var(--theme-red);
    color: #fff;
    padding: 15px 30px;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: bold;
    text-decoration: none;
    text-align: center;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}
.btn-primary:hover {
    background: #a32929;
    box-shadow: 0 5px 15px rgba(204, 51, 51, 0.4);
}

/* Footer */
footer {
    background: rgba(255, 255, 255, 0.9);
    padding: 30px 0;
    text-align: center;
    border-top: 1px solid var(--glass-border);
    margin-top: auto;
}

/* Search Overlay */
.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(15px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 10vh;
    opacity: 1;
    transition: opacity 0.3s ease;
}
.search-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}
.search-container {
    width: 90%;
    max-width: 800px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 80vh;
}
.search-input-wrapper {
    display: flex;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 1px solid var(--glass-border);
    background: #fff;
}
.search-icon-large {
    font-size: 1.5rem;
    color: var(--theme-red);
    margin-right: 15px;
}
#search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1.5rem;
    color: var(--text-light);
    background: transparent;
    width: 100%;
}
#search-input::placeholder {
    color: #ccc;
}
.search-close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 5px;
    transition: color 0.2s;
}
.search-close:hover {
    color: var(--theme-red);
}
.search-results {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.search-result-item {
    display: flex;
    gap: 20px;
    padding: 15px;
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    transition: background 0.2s, transform 0.2s;
    border: 1px solid transparent;
}
.search-result-item:hover, .search-result-item:focus {
    background: rgba(204, 51, 51, 0.05);
    border-color: rgba(204, 51, 51, 0.2);
    transform: translateY(-2px);
    outline: none;
}
.search-result-cover {
    width: 120px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    background: #eee;
    flex-shrink: 0;
}
.search-result-cover-placeholder {
    width: 120px;
    height: 80px;
    border-radius: 8px;
    background: #eee;
    color: #999;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    flex-shrink: 0;
}
.search-result-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.search-result-title {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--theme-red);
    margin-bottom: 5px;
}
.search-result-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 5px;
}
.search-result-desc {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 10px;
    line-height: 1.4;
}
.search-result-tags {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}
.search-tag {
    font-size: 0.7rem;
    padding: 3px 8px;
    border-radius: 12px;
    background: #eee;
    color: #666;
    font-weight: bold;
}
.search-tag.genre-tag {
    background: rgba(204, 51, 51, 0.1);
    color: var(--theme-red);
}
.search-loading, .search-empty, .search-error {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* Responsive Mobile Header */
@media (max-width: 768px) {
    .header-content {
        padding: 0 10px;
    }
    
    .hamburger-btn {
        display: block;
    }
    
    .nav-links {
        display: none;
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
        background: var(--bg-darker);
        padding: 20px;
        margin-top: 15px;
        border-radius: 12px;
        box-shadow: 0 10px 20px rgba(0,0,0,0.1);
        border: 1px solid var(--glass-border);
    }
    
    .nav-links.active {
        display: flex;
    }

    .nav-links a, .btn-upload {
        width: 100%;
        text-align: left;
        padding: 12px 15px;
        border: none;
        border-bottom: 1px solid var(--glass-border);
        border-radius: 0;
    }
    
    .nav-links a:last-child {
        border-bottom: none;
    }

    .games-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 20px;
    }
    
    .nav-divider {
        display: none;
    }
    
    .nav-links a {
        width: 100%;
        padding: 10px 0;
        border-bottom: 1px solid rgba(0,0,0,0.05);
    }
    
    .nav-links a:last-child {
        border-bottom: none;
    }
    
    .btn-all-games, .btn-upload {
        text-align: center;
        border: none;
        background: transparent !important;
        color: var(--text-light) !important;
        padding: 15px 0 !important;
        font-weight: bold;
    }

    .btn-all-games:hover, .btn-upload:hover {
        color: var(--theme-red) !important;
        box-shadow: none !important;
    }
    
    .lang-toggle {
        width: 100%;
        padding: 15px 0;
        justify-content: center;
        border-bottom: 1px solid rgba(0,0,0,0.05);
        margin: 0 !important;
    }
    
    .header-search-bar {
        padding: 5px 10px;
    }
    
    #header-search-input {
        width: 120px;
    }
    
    #header-search-input:focus {
        width: 150px;
    }
}

/* --- FORM & ADMIN STYLES (For Backend Accessed via goldextragames.com) --- */
.form-container {
    max-width: 600px;
    margin: 40px auto;
    background: var(--glass-bg);
    padding: 30px;
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-light);
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-light);
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--theme-red);
}

select.form-control {
    appearance: none;
}

.btn-primary {
    display: inline-block;
    background: var(--theme-red);
    color: #fff !important;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s ease;
    text-align: center;
    width: 100%;
}

.btn-primary:hover {
    background: #a32626;
    box-shadow: 0 0 15px var(--theme-red-glow);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid #ef4444;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
}

.section-title {
    font-size: 2rem;
    margin-bottom: 40px;
    display: flex;
    align-items: center;
    gap: 15px;
}
.section-title::before {
    content: '';
    display: block;
    width: 30px;
    height: 4px;
    background: var(--theme-red);
    border-radius: 2px;
}    
    .search-shortcut {
        display: none;
    }
}
