/* Styles de base */
.barremenu {
    padding: 30px; /* Réduit pour les petits écrans */
    color: white;
    display: flex;
    justify-content: center;
    gap: 50px; /* Réduit l'espacement */
    font-size: 20px; /* Réduit la taille de la police */
    font-style: normal;
    font-weight: 200;
    font-family: "Poppins", sans-serif;
}

a {
    text-decoration: none;
    color: white;
}

.barremenu a {
    position: relative;
    text-decoration: none;
    color: white;
    transition: color 0.3s ease-in-out;
}

.barremenu a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -2px;
    left: 0;
    background-color: white;
    transition: width 0.3s ease-in-out;
}

.barremenu a:hover {
    color: white;
}

.barremenu a:hover::after {
    width: 100%;
}

.menu-container {
    position: fixed;
    top: 0;
    left: -200px;
    width: 200px;
    height: 100%;
    background-color: #2974e4;
    transition: left 0.3s ease;
    z-index: 1000;
    opacity: 95%;
}

.bouton-menu, .bouton-fermer {
    position: fixed;
    top: 10px;
    font-size: 40px;
    cursor: pointer;
    color: #fff;
    background: none;
    border: none;
    z-index: 1001;
    font-family: "Poppins", sans-serif;
    font-weight: 200;
    font-style: normal;
}

.bouton-fermer {
    left: 150px;
    display: none;
}

.choix {
    margin-top: 100px;
    font-size: 20px; /* Réduit pour les petits écrans */
    color: #fff;
    padding-left: 10px;
    font-family: "Poppins", sans-serif;
    font-weight: 200;
    font-style: normal;
}

.choix a {
    position: relative;
    text-decoration: none;
    color: white;
    transition: color 0.3s ease-in-out;
}

.choix a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -2px;
    left: 0;
    background-color: white;
    transition: width 0.3s ease-in-out;
}

.choix a:hover {
    color: white;
}

.choix a:hover::after {
    width: 100%;
}

ul {
    list-style-type: none;
    text-align: left;
    margin-left: 15px;
}

.petiteseparation {
    width: 25%;
    height: 4px;
    background-color: white;
    position: absolute;
    margin-top: 5px;
    left: 0%;
}

.petiteseparation2 {
    width: 25%;
    height: 4px;
    margin-top: 5px;
    background-color: white;
    position: absolute;
    right: 0%;
}

body {
    background: #0f1419;
    margin: 0;
    padding: 10px; /* Réduit pour les petits écrans */
    display: flex;
    flex-direction: column;
    align-items: center;
}

.main-container {
    display: flex;
    justify-content: space-between;
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    gap: 20px;
}

.game-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 2;
}

#game-container {
    position: relative;
    width: 100%; /* Remplace la largeur fixe par 100% */
    max-width: 800px; /* Limite la largeur maximale */
    height: 500px; /* Réduit la hauteur pour les petits écrans */
    border: 2px solid #1a1a1a;
    background: 
        linear-gradient(to bottom, #1c2526 0%, #2c3e50 100%);
    background-size: cover;
    overflow-x: auto;
    box-shadow: inset 0 0 50px rgba(0, 150, 255, 0.2),
                0 0 20px rgba(0, 150, 255, 0.3);
    border-radius: 10px;
}

#game-container::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 50%;
    background: linear-gradient(to top, rgba(0, 150, 255, 0.2), transparent);
    pointer-events: none;
    z-index: 0;
}

#game-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 50% 10%, rgba(0, 150, 255, 0.1), transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.dialogue-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    padding: 20px;
    padding-top: 0;
}

#player {
    position: absolute;
    width: 40px;
    height: 40px;
    bottom: 0;
    left: 50px;
    transition: left 0.2s linear, bottom 0.3s ease, transform 0.1s ease;
    z-index: 1;
}

#player.jumping {
    transform: rotate(20deg);
}

.tower {
    position: absolute;
    width: 60px;
    background: linear-gradient(135deg, #4a4a4a, #2a2a2a);
    border: 2px solid #333;
    bottom: 0;
    box-shadow: 3px 3px 5px rgba(0, 0, 0, 0.5),
                0 0 20px rgba(0, 0, 255, 0.3);
    z-index: 1;
}

.tower-label {
    position: absolute;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0);
    color: white;
    font-family: "Poppins", sans-serif;
    font-size: 12px;
    font-weight: 200;
    padding: 5px 10px;
    border-radius: 5px;
    text-align: center;
    white-space: nowrap;
}

.tower::before {
    content: '';
    position: absolute;
    width: 50px;
    height: 10px;
    background: #00f;
    top: 10px;
    left: 5px;
    border-radius: 2px;
    animation: blink 1s infinite;
    box-shadow: 0 0 10px rgba(0, 0, 255, 0.5);
}

.tower.passed::before {
    background: #ff0000;
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.5);
}

.tower::after {
    content: '';
    position: absolute;
    width: 40px;
    height: 20px;
    background: #666;
    top: 30px;
    left: 10px;
    border: 1px solid #444;
    background: repeating-linear-gradient(
        0deg,
        #666 0px,
        #666 4px,
        #555 4px,
        #555 8px
    );
}

#tower1 { height: 100px; left: 150px; }
#tower2 { height: 150px; left: 300px; }
#tower3 { height: 200px; left: 450px; }
#tower4 { height: 250px; left: 600px; }

.button-container {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    position: absolute;
    margin-top: 39rem;
    left:18rem;
}

#jump-btn, #restart-btn, #back-btn {
    padding: 10px 20px;
    font-size: 16px;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(52, 152, 219, 0.5);
    transition: transform 0.1s ease;
}

#jump-btn {
    background: linear-gradient(135deg, #3498db, #2980b9);
}

#jump-btn:disabled {
    background: linear-gradient(135deg, #666, #555);
    cursor: not-allowed;
    opacity: 0.6;
    box-shadow: none;
}

#restart-btn {
    background: linear-gradient(135deg, #e67e22, #d35400);
}

#back-btn {
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
}

#jump-btn:hover, #restart-btn:hover, #back-btn:hover {
    transform: scale(1.05);
}

#dialogue-box, #dialogue-box1, #dialogue-box2, #dialogue-box3 {
    width: 100%;
    max-width: 500px;
    padding: 20px;
    background: #1a1a1a;
    border: 2px solid #333;
    border-radius: 10px;
    color: white;
    font-family: "Poppins", sans-serif;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    display: none;
    z-index: 2;
    font-size: 14.8px;
    font-weight: 200;
    font-style: normal;
}

#dialogue-box h3, #dialogue-box1 h3, #dialogue-box2 h3, #dialogue-box3 h3 {
    margin-top: 0;
    color: #ff6b6b;
}

#dialogue-box p, #dialogue-box1 p, #dialogue-box2 p, #dialogue-box3 p {
    margin: 10px 0;
}

#dialogue-box ul, #dialogue-box1 ul, #dialogue-box2 ul, #dialogue-box3 ul {
    margin: 10px 0;
    padding-left: 20px;
}

#dialogue-box li, #dialogue-box1 li, #dialogue-box2 li, #dialogue-box3 li {
    margin-bottom: 5px;
}

.hidden {
    display: none;
}

@keyframes blink {
    0% { opacity: 1; }
    50% { opacity: 0.3; }
    100% { opacity: 1; }
}

.explication {
    color: white;
    display: flex;
    justify-content: left;
    flex-direction: column;
    width: 100%;
    max-width: 1000px;
    margin-top: 5rem;
    font-family: "Poppins", sans-serif;
    font-weight: 200;
    font-style: normal;
}

.materes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    width: 100%;
    max-width: 1000px;
    margin-top: 20px;
}

.matiere-card {
    background: #1a1a1a;
    border: 2px solid #333;
    border-radius: 10px;
    padding: 20px;
    color: white;
    font-family: "Poppins", sans-serif;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    transition: transform 0.2s ease;
}

.matiere-card h4 {
    margin: 0 0 10px 0;
    color: #ff6b6b;
    font-size: 18px;
}

.matiere-card p {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
}

.matiere-card:hover {
    transform: scale(1.02);
}

/* Media Queries pour la responsivité */

/* Tablettes (768px - 1024px) */
@media (max-width: 1024px) {
    .barremenu {
        gap: 30px; /* Réduit l'espacement */
        font-size: 18px; /* Réduit la taille de la police */
        padding: 20px;
    }

    .main-container {
        flex-direction: column; /* Empile les éléments verticalement */
        align-items: center;
    }

    .game-section {
        width: 100%;
    }

    #game-container {
        max-width: 700px; /* Réduit la largeur maximale */
        height: 350px; /* Réduit la hauteur */
    }

    .dialogue-container {
        width: 100%;
        max-width: 100%;
        padding: 10px;
    }

    #dialogue-box, #dialogue-box1, #dialogue-box2, #dialogue-box3 {
        max-width: 100%;
        font-size: 14px;
    }

    .tower {
        width: 50px; /* Réduit la largeur des tours */
    }

    #tower1 { left: 100px; }
    #tower2 { left: 200px; }
    #tower3 { left: 300px; }
    #tower4 { left: 400px; }

    .tower-label {
        font-size: 10px;
        top: 50px;
    }

    .explication {
        margin-top: 3rem;
    }

    .materes-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); /* Réduit la taille des cartes */
    }
}

/* Smartphones (< 768px) */
@media (max-width: 768px) {
    .barremenu {
        display: none; /* Masque le menu horizontal */
    }

    .bouton-menu {
        display: block; /* Affiche le bouton hamburger */
    }

    .menu-container {
        width: 150px; /* Réduit la largeur du menu hamburger */
    }

    .bouton-fermer {
        left: 110px; /* Ajuste la position du bouton fermer */
    }

    .choix {
        font-size: 18px;
        margin-top: 80px;
    }

    body {
        padding: 5px;
    }

    #game-container {
        max-width: 100%;
        height: 300px; /* Réduit encore la hauteur */
    }

    .tower {
        width: 40px; /* Réduit encore la largeur des tours */
    }

    #tower1 { height: 80px; left: 80px; }
    #tower2 { height: 120px; left: 160px; }
    #tower3 { height: 160px; left: 240px; }
    #tower4 { height: 200px; left: 320px; }

    .tower-label {
        font-size: 8px;
        top: 40px;
    }

    #player {
        width: 30px;
        height: 30px;
        left: 30px;
    }

    .button-container {
        margin-top: 10px;
        gap: 5px;
    }

    #jump-btn, #restart-btn, #back-btn {
        padding: 8px 15px;
        font-size: 14px;
    }

    .explication {
        margin-top: 2rem;
        font-size: 14px;
    }

    .materes-grid {
        grid-template-columns: 1fr; /* Une seule colonne */
        gap: 10px;
    }

    .matiere-card {
        padding: 15px;
    }

    .matiere-card h4 {
        font-size: 16px;
    }

    .matiere-card p {
        font-size: 12px;
    }

    .petiteseparation, .petiteseparation2 {
        width: 20%;
        height: 3px;
    }
}