body {
    font-family: 'Inter', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    background-color: #e0f2f7;
    color: #333;
    padding: 20px;
    box-sizing: border-box;
    overflow-x: hidden;
}

.game-wrapper {
    background-color: #ffffff;
    padding: 30px 10px;
    border-radius: 15px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 95%;
    width: 950px;
    position: relative;
    margin: auto;
}

.page {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 0;
}

h1 {
    color: #007bff;
    margin-top: 30px;
    margin-bottom: 15px;
    font-size: 2.2em;
    font-weight: 700;
}

p {
    font-size: 1.1em;
    color: #555;
    margin-bottom: 20px;
}

/* --- Animal Selection Grid --- */
#animal-selection-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    margin-top: 30px;
    width: 100%;
}

.animal-card {
    background-color: #ffffff;
    border: 2px solid #ddd;
    border-radius: 12px;
    padding: 10px 10px 5px 10px;
    height: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 110px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
}

.animal-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
    border-color: #007bff;
}

.animal-card img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    margin-bottom: 5px;
}

.animal-card span {
    font-weight: bold;
    font-size: 1em;
    text-align: center;
    word-wrap: break-word;
    max-width: 100%;
    color: #007bff;
}

/* --- Coloring Game Page --- */
#game-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 20px 0;
}

#current-animal-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 25px;
    width: 100%;
}

/* ✅ Nom de l'animal en arabe */
#current-animal-name {
    font-size: 2em;
    font-weight: bold;
    color: #444;
    text-align: center;
    margin-bottom: 10px;
    direction: rtl;
    font-family: 'Amiri', 'Scheherazade', serif;
}

/* ✅ Cadre du canvas */
.coloring-container {
    border: 2px solid #007bff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    margin: 0 auto 20px auto;
    width: fit-content;
    height: fit-content;
}

canvas {
    background-color: #FFFFFF;
    display: block;
    width: 100%;
    height: auto;
    max-width: 800px;
    max-height: 800px;
}

/* ✅ Palette de couleurs */
#color-palette {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin: 20px auto 30px auto;
    max-width: 600px;
}

.color-box {
    width: 40px;
    height: 40px;
    border: 2px solid #ccc;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.color-box:hover {
    transform: scale(1.1);
    border-color: #007bff;
    box-shadow: 0 0 10px rgba(0, 123, 255, 0.5);
}

.color-box.active {
    border-color: #000;
    transform: scale(1.15);
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.3);
}

/* ✅ Boutons de navigation améliorés */
.navigation-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    margin: 20px auto 0 auto;
    width: 100%;
}

.navigation-buttons button {
    background: linear-gradient(to right, #f09819, #edde5d);
    color: #333;
    font-weight: bold;
    font-size: 1.1em;
    padding: 12px 24px;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.navigation-buttons button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
    background: linear-gradient(to right, #f6d365, #fda085);
}

/* ✅ Footer */
.footer {
    margin-top: 30px;
    font-size: 0.9em;
    color: #555;
}

/* ✅ Responsive */
@media (max-width: 768px) {
    .game-wrapper {
        padding: 20px;
        width: 95%;
    }

    h1 {
        font-size: 2em;
        margin-top: 20px;
    }

    .animal-card {
        width: 100px;
        height: 130px;
        padding: 10px 10px 5px 10px;
    }

    .animal-card img {
        width: 70px;
        height: 70px;
    }

    canvas {
        max-width: 100%;
        max-height: 600px;
    }

    #color-palette {
        gap: 8px;
        max-width: 90%;
    }

    .color-box {
        width: 35px;
        height: 35px;
    }

    .navigation-buttons button {
        font-size: 1em;
        padding: 10px 20px;
    }
}

@media (max-width: 480px) {
    .game-wrapper {
        padding: 15px;
        width: 100%;
        border-radius: 0;
        box-shadow: none;
    }

    h1 {
        font-size: 1.8em;
        margin-top: 15px;
    }

    p {
        font-size: 1em;
        margin-bottom: 15px;
    }

    .animal-card {
        width: 90px;
        height: 120px;
    }

    .animal-card img {
        width: 60px;
        height: 60px;
    }

    #current-animal-name {
        font-size: 1.6em;
    }

    #color-palette {
        gap: 6px;
        max-width: 100%;
    }

    .color-box {
        width: 30px;
        height: 30px;
    }

    .navigation-buttons button {
        font-size: 0.9em;
        padding: 8px 16px;
    }
}
