* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Press Start 2P', cursive;
    background-color: #222;
    background-image: url('background.png');
    background-repeat: repeat;
    background-size: 200px 200px;
    image-rendering: pixelated;
    color: #eee;
    line-height: 1.8;
}

/* Header */
header {
    background-color: transparent;
    padding: 20px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto 20px;
    padding: 0 20px;
    display: flex;
    justify-content: center;
}

/* Navigation Pills */
.console-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.nav-pill {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.6rem;
    padding: 10px 20px;
    background-color: #333;
    color: #fff;
    border: 1px solid #444;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
}

.nav-pill:hover {
    background-color: #444;
    border-color: #666;
}

.nav-pill.active {
    background-color: #ff5555;
    border-color: #ff5555;
    color: #fff;
}

/* Search Bar */
.search-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.search-wrapper {
    position: relative;
    max-width: 100%;
}

.search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: #888;
}

.search-input {
    width: 100%;
    padding: 15px 15px 15px 45px;
    font-family: 'Press Start 2P', cursive;
    font-size: 0.7rem;
    border: 1px solid #444;
    background-color: #333;
    color: #fff;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.3s;
}

.search-input:focus {
    border-color: #666;
}

.search-input::placeholder {
    color: #666;
}

/* Main Content */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

.page-header {
    margin-bottom: 30px;
}

.page-header h2 {
    font-size: 0.8rem;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 1px;
}

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

.game-card {
    background-color: #333;
    border: 1px solid #444;
    border-radius: 12px;
    padding: 10px;
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.game-card:hover {
    transform: translateY(-3px);
    border-color: #666;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.game-cover-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    /* Square aspect ratio for uniformity */
    margin-bottom: 12px;
    border-radius: 8px;
    overflow: hidden;
    background-color: #222;
}

.game-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
    image-rendering: auto;
    display: block;
}

.console-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background-color: #ff9900;
    color: #fff;
    font-size: 0.5rem;
    padding: 4px 8px;
    border-radius: 4px;
    font-family: 'Press Start 2P', cursive;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    z-index: 10;
}

.game-card h3 {
    font-size: 0.6rem;
    color: #fff;
    margin-bottom: 5px;
    line-height: 1.5;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
}

.game-card p {
    display: none;
    /* Hide extra info in card view to match design */
}

/* Load More Button */
.load-more-button {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.625rem;
    padding: 15px 30px;
    background-color: #444;
    color: #fff;
    border: 1px solid #555;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    margin: 40px auto;
    display: block;
}

.load-more-button:hover {
    background-color: #555;
    transform: translateY(-2px);
}

/* Footer */
footer {
    background-color: transparent;
    border-top: 1px solid #333;
    padding: 40px 20px;
    text-align: center;
    margin-top: 40px;
}

footer p {
    font-size: 0.625rem;
    color: #666;
}

/* Loading Indicator */
.loading-indicator {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.loading-indicator.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #444;
    border-top: 5px solid #ff5555;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.loading-indicator p {
    color: #fff;
    margin-top: 20px;
    font-size: 0.75rem;
}

/* Game Detail Modal */
.game-detail-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: none;
    z-index: 10000;
    overflow-y: auto;
    padding: 20px;
}

.game-detail-modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

.game-detail-content {
    max-width: 600px;
    width: 100%;
    background-color: #333;
    border-radius: 12px;
    border: 1px solid #444;
    padding: 30px;
    position: relative;
    color: #fff;
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    font-family: 'Press Start 2P', cursive;
    font-size: 1.5rem;
    background-color: transparent;
    color: #888;
    border: none;
    cursor: pointer;
    transition: color 0.3s;
    line-height: 1;
}

.close-modal:hover {
    color: #fff;
}

.game-detail-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    margin-bottom: 25px;
    text-align: center;
}

.game-detail-cover {
    width: 200px;
    height: 200px;
    object-fit: contain;
    background-color: #222;
    border-radius: 8px;
    border: 1px solid #444;
}

.game-detail-info h2 {
    font-size: 1rem;
    color: #fff;
    margin-bottom: 10px;
    line-height: 1.6;
}

.game-detail-info p {
    font-size: 0.6rem;
    color: #aaa;
    margin-bottom: 5px;
}

.game-detail-download {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.7rem;
    padding: 15px 30px;
    background-color: #ff5555;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s;
    display: block;
    width: fit-content;
    margin: 0 auto;
    text-decoration: none;
    text-align: center;
}

.game-detail-download:hover {
    background-color: #ff3333;
}

/* Responsive */
@media (max-width: 768px) {
    .games-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .nav-pill {
        padding: 8px 12px;
        font-size: 0.5rem;
    }
}