:root {
    --primary-color: #00ff9d;
    --secondary-color: #ff00ff;
    --background-color: #0a0a0a;
    --card-bg: #1a1a1a;
    --text-color: #ffffff;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    position: relative;
}

.particles-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
}

header {
    text-align: center;
    padding: 3rem 1rem;
    background: linear-gradient(180deg, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.4) 100%);
    position: relative;
    z-index: 1;
}

.logo h1 {
    font-family: 'Press Start 2P', cursive;
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.neon-text {
    color: var(--primary-color);
    text-shadow: 0 0 5px var(--primary-color),
                 0 0 10px var(--primary-color),
                 0 0 20px var(--primary-color);
}

.subtitle {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    color: var(--secondary-color);
}

.description {
    font-size: 1.2rem;
    opacity: 0.8;
}

main {
    position: relative;
    z-index: 1;
}

.search-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 2rem;
}

.search-bar {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

.search-bar input {
    width: 100%;
    padding: 1rem 3rem 1rem 1.5rem;
    background: var(--card-bg);
    border: 2px solid transparent;
    border-radius: 10px;
    color: var(--text-color);
    font-size: 1.1rem;
    transition: all 0.3s ease;
}

.search-bar input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 15px rgba(0, 255, 157, 0.2);
}

.search-bar input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.search-icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary-color);
    font-size: 1.2rem;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.game-card {
    display: flex;
    align-items: flex-start; /* Changed from center to flex-start for better alignment */
    background: var(--card-bg);
    border-radius: 10px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 0 15px rgba(0, 255, 157, 0.1);
    padding: 1rem;
    position: relative;
    min-height: 100px;
    gap: 1rem; /* Consistent spacing between thumbnail and content */
    cursor: pointer; /* Show pointer cursor to indicate clickable */
}

.game-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0 25px rgba(0, 255, 157, 0.4);
    border: 1px solid var(--primary-color); /* Add border on hover */
}

.game-thumbnail {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 10px;
    flex-shrink: 0; /* Prevent thumbnail from shrinking */
}

.title-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    gap: 1rem; /* Ensure minimum spacing between title and icons */
}

.game-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0; /* Enable text truncation */
    justify-content: space-between;
    padding: 0 0.5rem; /* Reduced padding since icons are now in title container */
}

.game-title {
    font-size: 1.2rem;
    color: var(--text-color);
    margin: 0; /* Remove margin since it's handled by title-container */
    flex: 1; /* Allow title to take available space */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; /* Add ellipsis for long titles */
}

.game-author {
    font-size: 0.9rem;
    color: var(--secondary-color);
    margin-bottom: 0.5rem;
}

.game-description {
    font-size: 0.9rem;
    color: var(--text-color);
    opacity: 0.8;
    margin-top: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.game-icons {
    display: flex;
    gap: 0.8rem;
    align-items: center;
    position: static; /* Remove absolute positioning */
    transform: none;
    flex-shrink: 0; /* Prevent icons from shrinking */
}

.game-icons i {
    font-size: 1.2rem;
    color: var(--text-color);
    transition: color 0.3s ease;
}

.game-icons i:hover {
    color: var(--primary-color);
}

.game-rating {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 1rem;
    color: #ffd700;
    margin-top: 0.5rem;
}

.game-rating i {
    font-size: 1rem;
}

.download-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1rem;
}

.download-btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 5px;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.3s ease;
}

.download-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(0, 255, 157, 0.3);
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 1000;
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: var(--text-color);
    background: rgba(0, 0, 0, 0.9);
    padding: 2rem;
    border-radius: 15px;
    border: 1px solid var(--primary-color);
    box-shadow: 0 0 20px rgba(0, 255, 157, 0.3);
}

.loader {
    width: 80px;
    height: 80px;
    border: 4px solid transparent;
    border-radius: 50%;
    margin: 0 auto 1.5rem;
    position: relative;
    animation: rotate 1s linear infinite;
}

.loader::before,
.loader::after {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border-radius: 50%;
    border: 4px solid transparent;
    border-top-color: var(--primary-color);
    border-bottom-color: var(--secondary-color);
    animation: rotate 2s linear infinite reverse;
}

.loader::after {
    border-top-color: var(--secondary-color);
    border-bottom-color: var(--primary-color);
    animation-duration: 3s;
}

@keyframes rotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#loadingText {
    font-size: 1.4rem;
    font-weight: 600;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: textPulse 1.5s ease-in-out infinite;
    text-shadow: 0 0 10px rgba(0, 255, 157, 0.3);
}

@keyframes textPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

@keyframes glow {
    0% { box-shadow: 0 0 15px rgba(0, 255, 157, 0.3); }
    50% { box-shadow: 0 0 30px rgba(0, 255, 157, 0.7); }
    100% { box-shadow: 0 0 15px rgba(0, 255, 157, 0.3); }
}

footer {
    padding: 2rem;
    text-align: center;
    background: linear-gradient(0deg, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.4) 100%);
    margin-top: 3rem;
}

/* Class to prevent scrolling when popup is active */
body.popup-active {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
    height: 100% !important;
}

.download-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    color: var(--text-color);
    padding: 12px 25px;
    border-radius: 5px;
    text-decoration: none;
    margin-top: 15px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 16px;
}

.download-button:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 0 15px rgba(0, 255, 157, 0.3);
}

.download-button svg {
    width: 20px;
    height: 20px;
    margin-left: 8px;
    fill: currentColor;
}

.download-button span {
    margin-left: 5px;
}

/* English Version Styles */
.en .browser-alert {
    direction: ltr;
}

.en .download-button svg {
    margin-left: 0;
    margin-right: 8px;
}

.en .download-button span {
    margin-left: 0;
    margin-right: 5px;
}

.footer-link {
    color: var(--text-color);
    text-decoration: none;
    margin: 0 1rem;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.footer-link:hover {
    opacity: 1;
}

@media (max-width: 768px) {
    .logo h1 {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1.4rem;
    }
    
    .games-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        padding: 1rem;
    }

    .game-card {
        padding: 1rem;
        min-height: 100px;
    }

    .game-thumbnail {
        width: 70px;
        height: 70px;
    }

    .title-container {
        gap: 0.8rem;
    }

    .game-info {
        padding: 0 0.3rem;
        min-width: 0; /* Allow text truncation to work */
    }

    .game-title {
        font-size: 1.1rem;
    }

    .game-icons {
        gap: 0.5rem;
    }

    .game-icons i {
        font-size: 1.1rem;
    }

    .game-description {
        font-size: 0.8rem;
        margin-bottom: 0.3rem;
    }

    .game-rating {
        font-size: 0.9rem;
        margin-top: 0.3rem;
    }

    .search-container {
        padding: 1rem;
    }
    
    .search-bar input {
        font-size: 1rem;
        padding: 0.8rem 2.5rem 0.8rem 1rem;
    }
}

/* Add styles for extra small screens */
@media (max-width: 380px) {
    .game-card {
        padding: 0.8rem;
    }

    .game-thumbnail {
        width: 60px;
        height: 60px;
    }

    .game-info {
        padding: 0 2.5rem 0 0.6rem;
    }

    .game-title {
        font-size: 1rem;
    }

    .game-icons i {
        font-size: 1rem;
    }

    .title-container {
        gap: 0.3rem;
    }
}



/* Popup Modal Styles */
.popup-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 1000;
}

.popup-modal.game-popup {
    z-index: 10000 !important; /* Even higher z-index to ensure it's above everything else */
    display: block !important; /* Force display */
    border: none !important;
    outline: none !important;
}

.popup-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--background-color);
    padding: 2rem;
    border-radius: 10px;
    width: 90%;
    max-width: 400px;
    text-align: center;
    color: var(--text-color);
    z-index: 10000;
    display: block;
}

/* Specific styles for game popup content */
.game-popup .popup-content {
    border: 1px solid var(--primary-color);
    box-shadow: 0 0 30px rgba(0, 255, 157, 0.5);
}

.popup-content img {
    width: 150px;
    height: 150px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 1rem;
    display: inline-block; /* Ensure image is visible */
}

.popup-content .game-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    margin-bottom: 1.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
}

.popup-content .platform-icons {
    display: flex;
    gap: 1rem;
}

.popup-content .platform-icons i {
    font-size: 1.4rem;
    color: var(--primary-color);
}

.popup-content .rating {
    font-size: 1.2rem;
    color: #ffd700;
}

.popup-content .downloads {
    font-size: 1.2rem;
    color: var(--primary-color);
}

.popup-content .game-details {
    text-align: center;
}

.popup-content .game-icons {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.popup-content .game-icons i {
    font-size: 1.2rem;
}

.popup-content .rating {
    font-size: 1.2rem;
    color: #ffd700;
}

.popup-content .downloads {
    font-size: 1.2rem;
    color: #00ff9d;
}

.popup-content h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.popup-content p {
    margin-bottom: 1rem;
}

.popup-content .download-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.popup-content .download-btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 5px;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.3s ease;
}

.popup-content .download-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(0, 255, 157, 0.3);
}

.popup-content .close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-color);
}

.popup-content .download-ready {
    font-size: 1.2rem;
    color: #00ff9d;
    margin-bottom: 0.5rem;
}

.popup-content .game-details {
    margin-top: 1rem;
}