#main-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    width: 100%;
    box-sizing: border-box;
    padding: 20px 0;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    position: relative;
}

#main-container::-webkit-scrollbar {
    display: none;
}

#main-games-view {
    display: block;
    width: 100%;
    box-sizing: border-box;
}

#main-games-view.hidden {
    display: none !important;
}

#main-games-view h1 {
    text-align: center;
    color: var(--color-accent);
    margin: 20px 0;
}

#main-games-view #game-search {
    width: calc(100% - 2em);
    max-width: 900px;
    padding: 0.8em 1em;
    margin: 1em auto;
    display: block;
    border: 1px solid var(--color-primary);
    border-radius: 5px;
    background-color: var(--color-secondary);
    color: var(--color-text);
    font-family: 'Press Start 2P', cursive;
    font-size: 1em;
    box-sizing: border-box;
}

#main-games-view #game-search::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.game-card {
    background-color: var(--color-tertiary);
    border-radius: 0.2em;
    padding: 1em;
    text-align: center;
    transition: all 0.2s ease-in-out;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
    border: 5px solid transparent;
}

.game-card:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
}

/* Immagine nella card */
.game-card img {
    width: 180px;
    height: 180px;
    object-fit: contain;
    border-radius: 0.3em;
    margin-bottom: 0.5em;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.game-card h3 {
    font-size: 1.1em;
    line-height: 1.2em;
    color: var(--color-text);
    font-family: 'BlockCraftMedium-PVLzd';
    height: 2.6em;
    /* 2 righe di testo max */
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    margin: 0.5em 0;
}

.game-card p {
    font-size: 1em;
    line-height: 1.2em;
    color: var(--color-text);
    font-family: 'Rajdhani Regular', sans-serif;
    display: none;
    /* Nascosto di default, mostrato solo su toggle */
}

/* Rilascio e genere */
.game-card .release-date,
.game-card .genre {
    font-size: 0.9em;
    color: var(--color-text);
}

.play-button {
    background-color: transparent;
    color: var(--cyan);
    padding: 0.6em 1.2em;
    border: 2px solid var(--cyan);
    border-radius: 8px;
    font-family: 'Press Start 2P', cursive;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0;
    pointer-events: none;
    margin-top: 0.5em;
    box-shadow: 0 0 8px var(--cyan), 0 0 16px var(--cyan);
}

.game-card:hover .play-button {
    opacity: 1;
    pointer-events: auto;
    background-color: rgba(0, 191, 255, 0.1);
    box-shadow: 0 0 12px var(--cyan), 0 0 24px var(--cyan);
    transform: scale(1.05);
}

/* Contenitore per l'Iframe del gioco e il carosello vuoto */
#game-iframe-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    /* Sfondo nero quando mostra l'emulatore */
    z-index: 50;
    /* Sopra main-games-view */
    display: none;
    /* Importante: nascosto di default */
    justify-content: center;
    align-items: center;
    overflow: hidden;
    /* Nasconde scrollbar indesiderate */
}

#game-iframe-container.visible {
    display: flex !important;
}

/* Stili per il contenuto quando il container del gioco è vuoto */
#empty-game-container {
    width: 100%;
    height: 100%;
    display: flex;
    /* attivo quando il container è visibile */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    position: relative;
    z-index: 0;
    overflow: hidden;
}

#empty-content {
    text-align: center;
    z-index: 2;
    padding: 20px;
    background-color: rgba(0, 0, 0, 0.7);
    border-radius: 10px;
    width: 96%;
    height: 96%;
    box-shadow: 0 0 20px rgba(0, 191, 255, 0.5);
    animation: fade-in 1.2s ease-out;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    box-sizing: border-box;
    position: relative;
}

/* Elementi interni del carosello */
#random-game-video,
#random-game-image-wrapper.fill-space {
    opacity: 0;
    /* Inizia nascosto per transizione */
}

/* Transizioni */
#random-game-image-wrapper,
#random-game-image,
#random-game-video,
#random-game-title,
#arcade-message,
#random-game-button {
    transition: opacity 0.5s ease-in-out;
}

/* Keyframes */
@keyframes fade-in {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes image-fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

#random-game-image {
    max-width: 100%;
    max-height: 100%;
    height: auto;
    width: auto;
    display: block;
    border: 2px solid var(--color-accent);
    box-shadow: 0 0 15px var(--color-accent);
    object-fit: contain;
    animation: image-fade-in 0.8s ease-out;
    margin: 0;
}

#random-game-image-wrapper {
    width: 150px;
    height: 120px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 15px auto;
    flex-shrink: 0;
    order: 2;
    position: relative;
    z-index: 1;
}

#random-game-image-wrapper.fill-space {
    width: 100%;
    height: 100%;
    margin: 0;
    position: absolute;
    /* Copre tutto il container */
    top: 0;
    left: 0;
    display: flex;
    z-index: 1;
}

#random-game-image-wrapper.fill-space #random-game-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border: none;
    box-shadow: none;
    margin: 0;
    position: static;
}

#random-game-video {
    width: 100%;
    height: 100%;
    object-fit: fill;
}

#main-games-view #game-grid {
    max-width: none;
    margin-left: auto;
    margin-right: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 2rem;
    padding: 1rem;
    width: 100%;
    box-sizing: border-box;
}

#main-games-view .game-card {
    background: var(--card-bg);
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid transparent;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 1em;
    text-align: center;
    position: relative;
}

#main-games-view .game-card:hover {
    transform: translateY(-10px);
    box-shadow:
        0 0 8px var(--cyan),
        0 0 16px var(--cyan),
        0 0 32px var(--cyan),
        0 0 48px var(--cyan);
    border: 2px solid var(--cyan);
}

/* ===== Modale (versione attuale mantenuta) ===== */

/* Overlay Modale */
#game-modal-overlay {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Contenitore Modale */
.game-modal {
    background-color: var(--color-primary);
    color: var(--color-text);
    border: 2px solid var(--color-accent);
    border-radius: 16px;
    width: 70vw;
    height: 70vh;
    max-width: 700px;
    max-height: 600px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

/* Pulsante chiudi modale */
.game-modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    color: var(--color-text);
    font-size: 1.8rem;
    cursor: pointer;
    z-index: 10000;
}

/* Titolo Modale */
.game-modal-title {
    font-family: 'Press Start 2P', cursive;
    font-size: 1em;
    text-align: center;
    color: var(--color-accent);
    margin-bottom: 0.5rem;
}

/* Area immagine/video */
.modal-card {
    width: 100%;
    height: 40%;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1rem;
}

.modal-card img,
.modal-card video {
    /*position: absolute;*/
    inset: 0;
    width: auto;
    height: 100%;
    object-fit: contain;
    transition: opacity 0.5s ease;
}

/* Contenuto descrizione scrollabile */
.game-modal-content {
    flex-grow: 1;
    overflow-y: auto;
    font-size: 0.8rem;
    line-height: 1.2rem;
    text-align: center;
    padding: 0.5rem 1rem;
    color: var(--color-text);
    margin-top: 0.5rem;
}

/* Bottone verde pressable */
.round-green-button {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #00ff88, #009944);
    box-shadow:
        inset -4px -4px 10px rgba(255, 255, 255, 0.3),
        inset 4px 4px 10px rgba(0, 0, 0, 0.4),
        0 4px 8px rgba(0, 0, 0, 0.6);
    border: none;
    cursor: pointer;
    transition: transform 0.2s ease;
    margin: 1rem auto;
    display: block;
}

.round-green-button:active {
    transform: translateY(3px);
    box-shadow:
        inset -2px -2px 6px rgba(255, 255, 255, 0.2),
        inset 2px 2px 6px rgba(0, 0, 0, 0.4),
        0 2px 4px rgba(0, 0, 0, 0.8);
}

.pressable {
    margin: 0 auto;
}

/* Bottone Gioca Ora in stile login */
.play-now-button {
    background: linear-gradient(to right, var(--color-neon-pink), var(--color-neon-blue));
    color: #FFFFAA;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
    padding: 12px 25px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 5px;
    cursor: pointer;
    font-family: 'Press Start 2P', cursive;
    font-size: 1em;
    transition: all 0.3s ease;
    margin-top: 1.5em;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
    text-transform: uppercase;
    width: 100%;
    max-width: 250px;
}

.play-now-button:active {
    background: linear-gradient(to right, var(--color-neon-blue), var(--color-neon-pink));
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    transform: translateY(1px);
}

.round-red-button {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #ff4d4d, #a50000);
    box-shadow:
        inset -4px -4px 10px rgba(255, 255, 255, 0.3),
        inset 4px 4px 10px rgba(0, 0, 0, 0.4),
        0 4px 8px rgba(0, 0, 0, 0.6);
    border: 2px solid #fff3;
    cursor: pointer;
    transition: transform 0.2s ease;
    display: block;
    margin: 2em auto 0 auto;
    padding: 0;
}

.round-red-button:active {
    transform: translateY(3px);
    box-shadow:
        inset -2px -2px 6px rgba(255, 255, 255, 0.2),
        inset 2px 2px 6px rgba(0, 0, 0, 0.4),
        0 2px 4px rgba(0, 0, 0, 0.8);
}

/* ===== Filtri ===== */
#filters-bar {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: center;
    margin: 14px 0 18px;
}

.alpha-filter {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
}

.alpha-filter .alpha-btn {
    font-family: 'Press Start 2P', cursive;
    font-size: .65rem;
    padding: 6px 8px;
    border: 1px solid var(--color-accent);
    background: transparent;
    color: var(--color-accent);
    border-radius: 6px;
    cursor: pointer;
    opacity: .8;
    transition: .15s ease;
}

.alpha-filter .alpha-btn:hover,
.alpha-filter .alpha-btn.active {
    opacity: 1;
    transform: translateY(-1px);
    background: rgba(0, 255, 255, .08);
}

/* ===== Sezioni per core ===== */
#game-sections {
    display: grid;
    gap: 28px;
}

/* --- Contenitore del Titolo (adattato per la griglia) --- */
.contenitore-titolo {
    /* ✨ LA SOLUZIONE: Fai in modo che questa "cella" occupi tutte le colonne della griglia */
    grid-column: 1 / -1;

    /* Ora che occupa tutto lo spazio, possiamo centrare il suo contenuto */
    text-align: center;
    margin: 1rem 0; /* Un po' di spazio verticale */
}

/* --- Stile del titolo con riquadro (il tuo codice è già perfetto) --- */
/* ================================================= */
/* === FORZATURA CENTRATURA TITOLO DI SEZIONE === */
/* ================================================= */

/* ================================================= */
/* === FORZATURA CENTRATURA TITOLO DI SEZIONE === */
/* ================================================= */

.core-title {
    /* 1. Diciamo al titolo di occupare tutta la larghezza della griglia */
    grid-column: 1 / -1 !important; 
    
    /* 2. Usiamo Flexbox per centrare il contenuto INTERNO */
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;

    /* 3. Stile del riquadro */
    font-family: 'VT323', monospace;
    color: #FFFFFF;
    font-size: 1.4rem;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.7); /* Alone bianco sul testo */
    border: 3px solid #e11af3; /* Il tuo bordo viola */
    border-radius: 8px;
    background-color: rgba(0, 0, 0, 0.5);

    /* 4. Padding e larghezza */
    padding: 10px 20px !important;
    width: fit-content !important;
    
    /* 5. Centratura del blocco */
    margin: 1rem auto !important;

    /* ✨ --- NUOVO EFFETTO GLOW BLU-ORO --- ✨ */
    box-shadow: 
        /* Ombra interna blu, più vicina e definita */
        0 0 8px 2px rgba(0, 191, 255, 0.6),
        
        /* Ombra esterna dorata, più ampia e soffusa */
        0 0 20px 8px rgba(255, 215, 0, 0.4);
    
    transition: all 0.3s ease; /* Aggiunge una transizione fluida per l'hover */
}

/* Opzionale: intensifica l'effetto al passaggio del mouse */
.core-title:hover {
    transform: scale(1.03);
    box-shadow: 
        /* Ombra interna blu più intensa */
        0 0 12px 4px rgba(0, 191, 255, 0.8),
        
        /* Ombra esterna dorata più vibrante */
        0 0 25px 12px rgba(255, 215, 0, 0.6);
}


.game-row {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    padding: 6px 4px 2px;
    scroll-snap-type: x mandatory;
}

.game-row .game-card {
    scroll-snap-align: start;
}

/* === FIX layout desktop: wrap + 6 per riga === */
#game-sections .game-row {
    display: grid;
    gap: 14px;
    /* coerente con lo spacing attuale */
    grid-template-columns: repeat(2, minmax(0, 1fr));
    /* base */
    overflow-x: visible;
    /* elimina lo scroll orizzontale */
    scroll-snap-type: none;
    /* disattiva lo snap usato per lo scroll */
}

/* breakpoints progressivi */
@media (min-width: 768px) {
    #game-sections .game-row {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1024px) {
    #game-sections .game-row {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (min-width: 1280px) {
    #game-sections .game-row {
        grid-template-columns: repeat(5, 1fr);
    }
}

@media (min-width: 1440px) {
    #game-sections .game-row {
        grid-template-columns: repeat(6, 1fr);
    }
}

#game-sections .game-row .game-card {
    width: 100%;
}

/* la card occupa la colonna */

/* 2) Griglia principale: limita a 6 colonne sugli schermi grandi */
@media (min-width: 1440px) {
    #main-games-view #game-grid {
        grid-template-columns: repeat(6, minmax(0, 1fr));
        gap: 22px;
    }
}

/* === GAME CARD: ridimensionamento e spazi === */
@media (min-width: 1440px) {
    #game-sections .game-row {
        gap: 22px;
    }
}

#game-sections .game-row .game-card,
#main-games-view #game-grid .game-card {
    width: 100%;
    max-width: 220px;
    /* evita card troppo larghe in 6-colonne */
    aspect-ratio: 2 / 3;
    /* formato copertina verticale */
    overflow: hidden;
    /* taglia glow/bordi interni */
    box-sizing: border-box;
    justify-self: center;
    /* centra dentro la colonna */
    align-self: start;
}

#game-sections .game-row .game-card img,
#main-games-view #game-grid .game-card img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

@media (min-width: 1440px) {

    #game-sections .game-row .game-card,
    #main-games-view #game-grid .game-card {
        transform: scale(.96);
        transform-origin: center;
    }
}
