body {
    position: relative;
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 100vh;
    margin: 0;
    /* Utilisation d'une police pixelisée pour le style 80s */
    font-family: 'Press Start 2P', cursive; /* Pensez à inclure cette police via Google Fonts */
    overflow: auto;
    /* Fond à dégradé radial rappelant l'ambiance rétro */
    background: radial-gradient(circle at center, #1a0033, #000);
    font-size: 16px; /* base text size */
    line-height: 1.5;
}

/* Ensure consistent sizing across elements */
*, *::before, *::after {
    box-sizing: border-box;
}

body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('assets/images/boards/protons_board_360.png');
    background-size: 50%;
    background-position: center;
    background-repeat: repeat;
    /* Flou uniquement sur l'arrière-plan */
    filter: blur(4px);
    opacity: 0.5;
    z-index: -1;
}

/* Conteneurs principaux avec bordures néon */
.container, .title-container {
    width: 90%;
    max-width: 1200px;
    background-color: rgba(0, 0, 0, 0.85);
    padding: 20px;
    border-radius: 8px;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    margin-bottom: 20px;
    border: 2px solid #ff00ff;
    box-shadow: 0 0 20px #ff00ff;
    z-index: 1;
}

/* Fluid media */
img, iframe, video {
    max-width: 100%;
    height: auto;
}

/* Language switcher styling */
.language-switcher {
    text-align: center;
    margin-top: 15px;
    font-size: 12px;
}

.lang-link {
    color: #00ffff;
    text-decoration: none;
    padding: 5px 8px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.lang-link:hover {
    background-color: rgba(0, 255, 255, 0.2);
    color: #fff;
}

.lang-link.active {
    background-color: rgba(255, 0, 255, 0.3);
    color: #fff;
    font-weight: bold;
}

/* En-tête centré */
.title-container {
    text-align: center;
    margin-bottom: 10px;
}

.title-container h1 {
    /* Appliquer un dégradé néon */
    background: linear-gradient(90deg, #ff00ff, #ff00ff, #00ffff, #ff00ff, #ff00ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0;
    /* Ajout d'un effet néon */
    text-shadow: 0 0 15px rgba(255, 0, 255, 0.5), 0 0 10px rgba(0, 255, 255, 0.5);
    /* Responsive font size */
    font-size: clamp(1.25rem, 2.5vw + 0.5rem, 2.25rem);
}

/* Headings scale */
h2 {
    font-size: clamp(1.05rem, 1.4vw + 0.6rem, 1.4rem);
}

h3 {
    font-size: clamp(0.95rem, 1.2vw + 0.45rem, 1.2rem);
}

h4 {
    font-size: clamp(0.9rem, 1vw + 0.4rem, 1.05rem);
}

/* Responsive header navigation */
.title-container nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px; /* primary spacing between buttons */
    justify-content: center;
    margin: 12px 0 0;
}

.title-container nav a.button,
.title-container nav a.button.secondary {
    flex: 0 1 auto;
    margin: 4px; /* fallback spacing if gap isn't supported */
}

.subtitle {
    margin-top: 6px;
    line-height: 1.4;
}

/* Game container centré */
#game-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

/* Message de chargement avec couleur néon */
#loading {
    font-size: 24px;
    color: #ff00ff;
    text-shadow: 0 0 5px #00ffff;
}

/* Section de contenu */
#content {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Conteneur de l'image de jeu */
#image-container {
    width: 100%;
    max-width: 600px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #00ffff;
    border-radius: 8px;
    overflow: hidden;
    background-color: #000;
    box-shadow: 0 0 15px #00ffff;
}

/* Image de jeu */
.game-image {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
}

/* Contrôles avec boutons style arcade */
#controls {
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 20px;
}

#controls button {
    padding: 10px 16px;
    font-size: clamp(0.85rem, 0.8vw + 0.5rem, 1rem);
    border: 2px solid #ff00ff;
    border-radius: 4px;
    background-color: #000;
    color: #ff00ff;
    cursor: pointer;
    transition: all 0.3s;
    margin: 0 10px;
    box-shadow: 0 0 10px #ff00ff;
}

#controls button:hover {
    background-color: #ff00ff;
    color: #000;
    box-shadow: 0 0 20px #00ffff;
}

/* Score */
#score {
    width: 100%;
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 50px;
    font-size: 14px;
}

#score p {
    margin: 10px;
}

/* Résultat */
#result {
    font-size: 18px;
    margin-top: 20px;
    min-height: 60px;
}

/* Utilitaires et adaptabilité */
.responsive-iframe {
    width: 100%;
    height: auto;
    aspect-ratio: 16/9;
}

.grid {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

.image-box {
    flex: 1 1 45%;
    max-width: 45%;
    text-align: center;
    margin: 10px;
}

.image-box img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

@media (max-width: 900px) {
    .container, .title-container {
        width: 94%;
        padding: 16px;
    }
}

@media (max-width: 768px) {
    html { font-size: 15px; }

    p, li { font-size: 0.95rem; }

    .title-container nav a.button,
    .title-container nav a.button.secondary {
        flex: 1 1 45%;
        margin: 4px 6px; /* maintain spacing when wrapping */
    }
    .image-box {
        flex: 1 1 100%;
        max-width: 100%;
    }

    #controls {
        flex-wrap: wrap;
    }

    #controls button {
        flex: 1 1 45%;
        margin: 0;
    }

    #score {
        flex-direction: column;
        align-items: center;
    }
}

@media (max-width: 520px) {
    html { font-size: 14px; }

    .title-container nav {
        flex-direction: column;
        align-items: stretch;
    }

    .title-container nav a.button,
    .title-container nav a.button.secondary {
        width: 100%;
        flex: 1 1 100%;
        margin: 6px 0; /* vertical spacing between stacked buttons */
    }

    .subtitle {
        font-size: 0.85rem;
    }

    .container, .title-container {
        padding: 14px;
    }

    p, li {
        font-size: 0.9rem;
    }

    #controls button {
        padding: 8px 12px;
        font-size: 0.9rem;
    }
}