:root {
    --primary-color: #6c5ce7;
    --secondary-color: #a29bfe;
    --bg-dark: #1e1e2e;
    --bg-darker: #181825;
    --text-light: #cdd6f4;
    --accent: #f39c12;
}

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

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-light);
    line-height: 1.6;
}

h1, h2, h3, .logo {
    font-family: 'Press Start 2P', cursive;
    color: var(--secondary-color);
}

/* Header & Nav */
header {
    background-color: var(--bg-darker);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    font-size: 1.2rem;
    color: var(--primary-color);
    text-shadow: 2px 2px 0px #000;
}

nav a {
    color: var(--text-light);
    text-decoration: none;
    margin-left: 20px;
    font-weight: bold;
    transition: color 0.3s;
}

nav a:hover, nav a.active {
    color: var(--primary-color);
}

/* Hero Section */
#hero {
    height: 60vh;
    background: linear-gradient(rgba(0,0,0,0.7), rgba(0,0,0,0.7)), url('https://images.unsplash.com/photo-1550745165-9bc0b252726f?ixlib=rb-1.2.1&auto=format&fit=crop&w=1350&q=80');
    background-size: cover;
    background-position: center;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.hero-content h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    text-shadow: 3px 3px 0px #000;
}

.hero-content p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
}

.cta-button {
    display: inline-block;
    padding: 1rem 2rem;
    background-color: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 5px;
    font-weight: bold;
    transition: transform 0.2s, background-color 0.2s;
    font-family: 'Press Start 2P', cursive;
    font-size: 0.8rem;
}

.cta-button:hover {
    transform: scale(1.05);
    background-color: var(--secondary-color);
}

/* Games Grid */
#games {
    padding: 4rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

#games h2 {
    text-align: center;
    margin-bottom: 3rem;
    font-size: 2rem;
}

.games-grid {
    display: flex; /* Cambiato da grid a flex per centrare meglio un solo elemento */
    justify-content: center; /* Centra la card */
    flex-wrap: wrap;
    gap: 2rem;
}

.game-card {
    background-color: var(--bg-darker);
    padding: 2rem;
    border-radius: 10px;
    text-align: center;
    transition: transform 0.3s, box-shadow 0.3s;
    border: 1px solid #333;
    cursor: pointer;
    width: 300px; /* Larghezza fissa per renderla bella esteticamente */
}

.game-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.4);
    border-color: var(--primary-color);
}

.game-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.game-card h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: var(--text-light);
}

.game-card p {
    font-size: 0.9rem;
    color: #888;
    margin-bottom: 1.5rem;
}

.play-btn {
    background-color: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    padding: 0.5rem 1.5rem;
    border-radius: 5px;
    cursor: pointer;
    font-family: 'Press Start 2P', cursive;
    font-size: 0.7rem;
    transition: all 0.3s;
}

.game-card:hover .play-btn {
    background-color: var(--primary-color);
    color: white;
}

/* Game Container Overlay */
#game-container-section {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.95);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

#game-container-section.hidden {
    display: none;
}

.game-header {
    width: 800px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

#close-game {
    background: #ff4757;
    border: none;
    color: white;
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-family: 'Press Start 2P', cursive;
    font-size: 0.7rem;
    border-radius: 5px;
}

#canvas-wrapper {
    position: relative;
    width: 800px;
    height: 600px;
    box-shadow: 0 0 50px rgba(108, 92, 231, 0.3);
}

canvas {
    background-color: #000;
    display: block;
    border: 2px solid #333;
}

/* UI Sovrapposta al Canvas */
#game-ui {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Permette ai click di passare al canvas */
    display: flex;
    justify-content: center;
    align-items: center;
}

#start-screen, #game-over-screen {
    background-color: rgba(0,0,0,0.8);
    padding: 2rem;
    border-radius: 10px;
    text-align: center;
    border: 2px solid var(--primary-color);
    pointer-events: auto; /* Riabilita i click per i pulsanti */
}

#game-over-screen.hidden {
    display: none;
}

#restart-btn {
    margin-top: 1rem;
    padding: 0.8rem 1.5rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    cursor: pointer;
    font-family: 'Press Start 2P', cursive;
    font-size: 0.8rem;
}

#game-controls-info {
    margin-top: 1rem;
    color: #888;
    font-family: monospace;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem;
    background-color: var(--bg-darker);
    margin-top: 4rem;
    color: #666;
}
