diff --git a/Motus/Case.qml b/Motus/Case.qml
index 4dfb9c13e08c18b45f4ea53212dd908fb4590239..8d33d699fbec36709964d64e107f65ca711e9b8b 100644
--- a/Motus/Case.qml
+++ b/Motus/Case.qml
@@ -2,8 +2,8 @@ import QtQuick
 
 Item {
     id: _item
-    width: 70
-    height: 70
+    width: 50
+    height: 50
     property alias rectangleBorderColor: rectangle.border.color
     property alias rectangleColor: rectangle.color
 
@@ -18,8 +18,8 @@ Item {
 
     Rectangle {
         id: rectangle
-        width: 70
-        height: 70
+        width: 50
+        height: 50
         color: "#323232"
         radius: 5
         border.color: "#ffffff"
@@ -29,12 +29,12 @@ Item {
 
         Text {
             id: _text
-            width: 70
-            height: 70
+            width: 50
+            height: 50
             color: "#ffffff"
             text: qsTr("")
             anchors.verticalCenter: parent.verticalCenter
-            font.pixelSize: 50
+            font.pixelSize: 40
             horizontalAlignment: Text.AlignHCenter
             verticalAlignment: Text.AlignVCenter
             font.family: "Tahoma"
diff --git a/Motus/Choosebutton.qml b/Motus/Choosebutton.qml
index db666880cd38ec7d277ac76165c4426f5ae0fc2a..f7f4327dc816b27852de64cb3e1c781854269ca6 100644
--- a/Motus/Choosebutton.qml
+++ b/Motus/Choosebutton.qml
@@ -3,29 +3,23 @@ import QtQuick.Controls 2.15
 
 Item {
     width: 300
-    height: 200
+    height: 120
     property alias _textText: _text.text
 
     Rectangle {
         id: rectangle
-        x: 0
-        y: 0
-        width: 300
-        height: 200
         color: "#323232"
         radius: 10
         border.color: "#ffffff"
         border.width: 5
+        anchors.fill: parent
 
         Text {
             id: _text
-            x: 0
-            y: 0
-            width: 300
-            height: 200
             color: "#ffffff"
             text: qsTr("Bouton")
-            font.pixelSize: 40
+            anchors.fill: parent
+            font.pixelSize: 35
             horizontalAlignment: Text.AlignHCenter
             verticalAlignment: Text.AlignVCenter
             font.family: "Tahoma"
diff --git a/Motus/Main.qml b/Motus/Main.qml
index 33dc0ab0bea279c6250aefffe58dd118049ecd61..ff64d40b75d68f28bf2218156853ae819422a1eb 100644
--- a/Motus/Main.qml
+++ b/Motus/Main.qml
@@ -11,15 +11,15 @@ Window {
     visibility: Window.Maximized
     title: qsTr("Motus")
 
-    // Propriétés de gestion
-    property int indice_case: 0
-    property int current_essai: 0
+    // Les propriétés nb_lettres et nb_essais sont reliées aux propriétés C++ de motusGame.
+    // Ainsi, dès que motusGame.letterNumber ou motusGame.tryTotal évoluent, l'interface se met à jour.
+    property int nb_lettres: 5
+    property int nb_essais: 6
     property var caseArray: []   // Rempli lors de la création de la grille
     property var case_focus: null
+    property int current_essai: 0
+    property int indice_case: 0
 
-    property int nb_lettres: 5
-    property var arrayTry: [5,6,6,7,7,8,8,8,8]
-    property int nb_essais: arrayTry[nb_lettres - 4]
     property string mot: ""
     property var mot_split: []
 
@@ -41,10 +41,9 @@ Window {
 
     // Fonction pour rafraîchir l'affichage de l'overlay de statistiques
     function refreshStatsDisplay() {
-        // Ici, vous pouvez actualiser les Text avec les vraies statistiques via motusGame
-        // Par exemple, si vous exposez une propriété "globalGames", faites :
-        // globalGamesText.text = "Parties jouées : " + motusGame.globalGames;
-        // Pour cet exemple, les valeurs restent "0".
+        // Mettez ici à jour vos Text via les propriétés/méthodes de motusGame
+        // Par exemple :
+        // globalGamesText.text = "Parties jouées : " + motusGame.getGlobalStats("globalGames");
     }
 
     // Fonction de mise à jour des statistiques à la fin d'une partie
@@ -63,7 +62,7 @@ Window {
     Rectangle {
         id: statsOverlay
         anchors.fill: parent
-        color: "#323232AA"   // Fond identique à la fenêtre principale avec transparence
+        color: "#323232AA"   // Fond avec transparence
         visible: statsOverlayVisible
         z: 100
         onVisibleChanged: {
@@ -116,7 +115,7 @@ Window {
                     }
                 }
 
-                // Statistiques Globales (exemple, à remplacer par vos appels réels)
+                // Statistiques Globales (à remplacer par vos appels réels)
                 GroupBox {
                     title: "Statistiques Globales"
                     Layout.fillWidth: true
@@ -141,9 +140,30 @@ Window {
                     ComboBox {
                         id: letterSelector
                         model: [4,5,6,7,8,9,10,11,12]
-                        currentIndex: nb_lettres - 4
+                        currentIndex: 1
                         onCurrentIndexChanged: {
-                            selectedLetterForStats = model[currentIndex];
+                            if (currentIndex === 9){
+                                nb_lettres = motusGame.getRandomNum();
+                            }
+                            else{
+                                nb_lettres = model[currentIndex];
+                            }
+                            console.log(nb_lettres);
+                            if (nb_lettres == 4){
+                                nb_essais = 5;
+                            }
+                            else if (nb_lettres == 5 || nb_lettres == 6){
+                                nb_essais = 6;
+                            }
+                            else if (nb_lettres == 7 || nb_lettres == 8){
+                                nb_essais = 7;
+                            }
+                            else{
+                                nb_essais = 8;
+                            }
+                            caseRepeater.model = nb_lettres*nb_essais;
+                            console.log(caseRepeater.model);
+                            console.log(caseArray);
                         }
                         font.pixelSize: 20
                     }
@@ -154,7 +174,7 @@ Window {
                     }
                 }
 
-                // Statistiques Locales (exemple, à remplacer par vos appels réels)
+                // Statistiques Locales (à remplacer par vos appels réels)
                 GroupBox {
                     title: "Statistiques Locales (" + selectedLetterForStats + " lettres)"
                     Layout.fillWidth: true
@@ -176,7 +196,7 @@ Window {
                     contentItem: RowLayout {
                         id: histogramRow
                         spacing: 10
-                        // Exemple d'histogramme : on utilise un tableau dummy "data" à remplacer par vos données réelles.
+                        // Exemple d'histogramme : à remplacer par vos données réelles.
                         property var data: [0, 0, 0, 0, 0, 0]
                         property int maxValue: {
                             var maxVal = 0;
@@ -190,11 +210,9 @@ Window {
                             model: data.length
                             delegate: ColumnLayout {
                                 spacing: 2
-                                // Item vide pour aligner les barres en bas
                                 Item { Layout.fillHeight: true }
                                 Rectangle {
                                     width: 20
-                                    // Hauteur proportionnelle, minimum 10 px
                                     height: maxValue > 0 ? Math.max(10, 200 * (data[index] / maxValue)) : 10
                                     color: index === (data.length - 1) ? "#28a745" : "#4a4a4a"
                                     border.width: 1
@@ -223,6 +241,7 @@ Window {
         focus: true
 
         Keys.onPressed: function(event) {
+            // On vérifie que le jeu est en cours (ni gagné, ni perdu)
             if (mot !== "" && !motusGame.loosetry && !motusGame.win && !motusGame.loosetime) {
                 if (/^[a-zA-Z]$/.test(event.text)) {
                     if (indice_case < nb_lettres) {
@@ -239,6 +258,7 @@ Window {
                         event.accepted = true;
                     }
                 } else if (event.key === Qt.Key_Return) {
+                    console.log("coucou");
                     if (indice_case === nb_lettres) {
                         var candidate = [];
                         for (var i = 0; i < nb_lettres; i++){
@@ -286,6 +306,9 @@ Window {
                                     case_verif.rectangleBorderColor = resultColors[i];
                                     changeKeyColor(candidate[i], resultColors[i]);
                                 }
+                                else{
+                                    changeKeyColor(candidate[i], "#323232");
+                                }
                             }
                             if (current_essai < nb_essais - 1) {
                                 current_essai++;
@@ -335,21 +358,21 @@ Window {
                 id: leftColumn
                 width: 400
                 height: 850
-                spacing: 20
+                spacing: 50
                 anchors.verticalCenter: parent.verticalCenter
                 anchors.left: parent.left
                 anchors.leftMargin: 0.05 * Window.width
 
+                Case {
+                    id: case3
+                    anchors.horizontalCenter: parent.horizontalCenter
+                    _textText: "mot test"
+                }
+
                 Choosebutton {
                     id: choosebutton
                     anchors.horizontalCenter: parent.horizontalCenter
                     _textText: "Generate a word"
-                    Case {
-                        id: case3
-                        x: 131
-                        y: 8
-                        _textText: "mot test"
-                    }
                     MouseArea {
                         anchors.fill: parent
                         cursorShape: Qt.PointingHandCursor
@@ -357,6 +380,7 @@ Window {
                         onClicked: {
                             current_essai = 0;
                             indice_case = 0;
+                            // Réinitialisation de la grille et des touches
                             for (var i = 0; i < caseArray.length; i++) {
                                 caseArray[i]._textText = "";
                                 caseArray[i].rectangleColor = "#323232";
@@ -366,6 +390,7 @@ Window {
                                 keysArray[j].keyColor = "#808080";
                             }
                             motusGame.debut = true;
+                            // Utilisation de la propriété nb_lettres (mappée sur motusGame.letterNumber)
                             mot = motusGame.getRandomWord(nb_lettres);
                             motusGame.setLoosetrybool(false);
                             motusGame.setLoosetimebool(false);
@@ -378,14 +403,15 @@ Window {
                     }
                 }
 
+
                 Rectangle {
                     id: big_rectangle_langue
-                    width: 250
+                    width: 300
                     height: 300
                     color: "#323232"
                     radius: 10
                     border.color: "#ffffff"
-                    border.width: 3
+                    border.width: 5
                     anchors.horizontalCenter: parent.horizontalCenter
 
                     Column {
@@ -410,6 +436,7 @@ Window {
                             _textText: "Français"
                             rectangleColor: "#7a7a7a"
                             MouseArea {
+                                enabled: motusGame && (motusGame.win || motusGame.loosetry || motusGame.loosetime || !motusGame.debut)
                                 anchors.fill: parent
                                 cursorShape: Qt.PointingHandCursor
                                 onClicked: {
@@ -419,7 +446,7 @@ Window {
                                     choosebutton._textText = "Générer un mot";
                                     text_langue.text = "Langage";
                                     text_choix_nb_lettres.text = "Nombre de lettres";
-                                    numberLetterBtn.firstItemText = "Aléatoire";
+                                    numberLetterBtn.firstItemText = "5";
                                 }
                             }
                         }
@@ -430,6 +457,7 @@ Window {
                             _textText: "English"
                             rectangleColor: "green"
                             MouseArea {
+                                enabled: motusGame && (motusGame.win || motusGame.loosetry || motusGame.loosetime || !motusGame.debut)
                                 anchors.fill: parent
                                 cursorShape: Qt.PointingHandCursor
                                 onClicked: {
@@ -439,27 +467,29 @@ Window {
                                     choosebutton._textText = "Generate a word;";
                                     text_langue.text = "Language";
                                     text_choix_nb_lettres.text = "Number of letters";
-                                    numberLetterBtn.firstItemText = "Random";
+                                    numberLetterBtn.firstItemText = "5";
                                 }
                             }
                         }
                     }
                 }
 
+
                 Rectangle {
                     id: big_rectangle_nb_lettres
-                    width: 250
-                    height: 300
+                    width: 300
+                    height: 130
                     color: "#323232"
                     radius: 10
                     border.color: "#ffffff"
-                    border.width: 3
+                    border.width: 5
                     anchors.horizontalCenter: parent.horizontalCenter
 
                     Column {
                         id: colonne_nb_lettres
-                        anchors.fill: parent
-                        spacing: 50
+                        anchors.verticalCenter: parent.verticalCenter
+                        anchors.horizontalCenter: parent.horizontalCenter
+                        spacing: 20
 
                         Text {
                             id: text_choix_nb_lettres
@@ -469,24 +499,150 @@ Window {
                             color: "white"
                         }
 
-                        NumberLetterButton {
-                            id: numberLetterBtn
-                            firstItemText: "Random"
-                            width: parent.width
-                            height: 60
+                        ComboBox {
+                            id: comboBox
+                            width: 250
+                            height: 50
+                            anchors.horizontalCenter: parent.horizontalCenter
+                            currentIndex: 1
+
+                            model: ["4", "5", "6", "7", "8", "9", "10","11","12", "Aléatoire"]
+                            flat: true
+                            enabled: motusGame && (motusGame.win || motusGame.loosetry || motusGame.loosetime || !motusGame.debut)
+
+
+                            // Le contenu affiché (texte sélectionné)
+                            contentItem: Text {
+                                width: 200
+                                text: comboBox.displayText
+                                font.pixelSize: 18
+                                font.bold: true
+                                color: "white"
+                                verticalAlignment: Text.AlignVCenter
+                                horizontalAlignment: Text.AlignLeft
+                                elide: Text.ElideRight
+                                anchors.verticalCenter: parent.verticalCenter
+                                anchors.left: parent.left
+                                anchors.leftMargin: 20
+                            }
+
+                            // Fond personnalisé
+                            background: Rectangle {
+                                radius: 10
+                                color: "#7a7a7a"
+                                border.color: "white"
+                                border.width: 5
+                            }
+
+                            // Petite flèche personnalisée
+                            indicator: Rectangle {
+                                width: 20
+                                height: 20
+                                anchors.verticalCenter: parent.verticalCenter
+                                anchors.right: parent.right
+                                anchors.rightMargin: 10
+                                color: "transparent"
+
+                                // Triangle (flèche vers le bas)
+                                Canvas {
+                                    anchors.fill: parent
+                                    onPaint: {
+                                        var ctx = getContext("2d");
+                                        ctx.clearRect(0, 0, width, height);
+                                        ctx.beginPath();
+                                        ctx.moveTo(4, 6);
+                                        ctx.lineTo(width - 4, 6);
+                                        ctx.lineTo(width / 2, height - 4);
+                                        ctx.closePath();
+                                        ctx.fillStyle = "white";
+                                        ctx.fill();
+                                    }
+                                }
+                            }
+
+                            // Liste déroulante
+                            delegate: ItemDelegate {
+                                width: comboBox.width
+                                contentItem: Text {
+                                    text: modelData
+                                    font.pixelSize: 16
+                                    color: "black"
+                                }
+                            }
+
+                            onCurrentIndexChanged: {
+                                if (currentIndex === 9){
+                                    nb_lettres = motusGame.getRandomNum();
+                                }
+                                else{
+                                    nb_lettres = model[currentIndex];
+                                }
+                                console.log(nb_lettres);
+                                if (nb_lettres == 4){
+                                    nb_essais = 5;
+                                }
+                                else if (nb_lettres == 5 || nb_lettres == 6){
+                                    nb_essais = 6;
+                                }
+                                else if (nb_lettres == 7 || nb_lettres == 8){
+                                    nb_essais = 7;
+                                }
+                                else{
+                                    nb_essais = 8;
+                                }
+                                caseRepeater.model = nb_lettres*nb_essais;
+                                console.log(caseRepeater.model);
+                                caseArray = [];
+                                for (var i = 0; i < caseRepeater.count; i++) {
+                                    caseArray.push(caseRepeater.itemAt(i));
+                                }
+                                if (caseArray.length > 0) {
+                                    case_focus = caseArray[0];
+                                }
+                                indice_case=0;
+                                current_essai=0;
+                                mainRect.focus = true;
+                            }
                         }
                     }
                 }
 
-                Button {
-                    id: statsButton
-                    text: "Statistiques"
+                Rectangle {
+                    id: stats_rect
+                    width: 250
+                    height: 100
+                    color: "#323232"
+                    radius: 10
+                    border.color: "#ffffff"
+                    border.width: 5
                     anchors.horizontalCenter: parent.horizontalCenter
-                    font.pixelSize: 20
-                    onClicked: {
-                        updateGameStats();  // Met à jour et sauvegarde les stats à la fin de la partie
-                        statsOverlayVisible = true;
-                        selectedLetterForStats = nb_lettres;
+
+                    Text {
+                        id: _text
+                        color: "#ffffff"
+                        text: qsTr("Abandonner")
+                        anchors.left: parent.left
+                        anchors.top: parent.top
+                        anchors.bottom: parent.bottom
+                        font.pixelSize: 35
+                        horizontalAlignment: Text.AlignHCenter
+                        verticalAlignment: Text.AlignVCenter
+                        anchors.horizontalCenter: parent.horizontalCenter
+                        font.family: "Tahoma"
+
+                        MouseArea {
+                            anchors.left: parent.left
+                            anchors.top: parent.top
+                            anchors.bottom: parent.bottom
+                            anchors.horizontalCenter: parent.horizontalCenter
+                            cursorShape: Qt.PointingHandCursor
+                            enabled: !(motusGame && (motusGame.win || motusGame.loosetry || motusGame.loosetime || !motusGame.debut))
+                            onClicked: {
+                                updateGameStats();
+                                statsOverlayVisible = true;
+                                selectedLetterForStats = nb_lettres;
+                            }
+                        }
                     }
                 }
             }
@@ -505,6 +661,8 @@ Window {
                     id: column1
                     width: 326
                     height: 850
+                    anchors.verticalCenter: parent.verticalCenter
+                    anchors.horizontalCenter: parent.horizontalCenter
                     spacing: 30
 
                     MotusTimer {
@@ -513,26 +671,86 @@ Window {
                         height: 100
                         anchors.horizontalCenter: parent.horizontalCenter
                     }
-                    Button {
-                        id: statsButtonRight
-                        text: "Statistiques"
-                        icon.color: "#ffffff"
+                    Rectangle {
+                        id: abandon_rect
+                        width: 250
+                        height: 100
+                        color: "#323232"
+                        radius: 10
+                        border.color: "#ffffff"
+                        border.width: 5
                         anchors.horizontalCenter: parent.horizontalCenter
-                        font.pixelSize: 20
-                        onClicked: {
-                            updateGameStats();
-                            statsOverlayVisible = true;
-                            selectedLetterForStats = nb_lettres;
+
+                        Text {
+                            id: text_abandon
+                            color: "#ffffff"
+                            text: qsTr("Statistiques")
+                            anchors.left: parent.left
+                            anchors.top: parent.top
+                            anchors.bottom: parent.bottom
+                            font.pixelSize: 35
+                            horizontalAlignment: Text.AlignHCenter
+                            verticalAlignment: Text.AlignVCenter
+                            anchors.horizontalCenter: parent.horizontalCenter
+                            font.family: "Tahoma"
+
+                            MouseArea {
+                                anchors.left: parent.left
+                                anchors.top: parent.top
+                                anchors.bottom: parent.bottom
+                                anchors.horizontalCenter: parent.horizontalCenter
+                                cursorShape: Qt.PointingHandCursor
+                                enabled: motusGame && (motusGame.win || motusGame.loosetry || motusGame.loosetime || !motusGame.debut)
+                                onClicked: {
+                                    motusGame.setLoosetrybool(true);
+                                    console.log("loosetry=true");
+                                    updateGameStats();
+                                }
+                            }
                         }
                     }
+
+                    Text {
+                        visible: motusGame && motusGame.loosetime
+                        color: "red"
+                        text: "Temps écoulé ! Mot : "
+                        font.pixelSize: 30
+                        horizontalAlignment: Text.AlignHCenter
+                        verticalAlignment: Text.AlignVCenter
+                        font.bold: true
+                        anchors.horizontalCenter: parent.horizontalCenter
+                    }
+
+                    Text {
+                        visible: motusGame && motusGame.loosetry
+                        color: "red"
+                        text: "Nombre d'essais maximum atteint ! \n Mot : " + mot.toUpperCase()
+                        font.pixelSize: 30
+                        horizontalAlignment: Text.AlignHCenter
+                        verticalAlignment: Text.AlignVCenter
+                        font.bold: true
+                        anchors.horizontalCenter: parent.horizontalCenter
+                    }
+
+                    Text {
+                        text: "Gagné !"
+                        visible: motusGame && motusGame.win
+                        color: "green"
+                        font.pixelSize: 30
+                        horizontalAlignment: Text.AlignHCenter
+                        verticalAlignment: Text.AlignVCenter
+                        font.bold: true
+                        anchors.horizontalCenter: parent.horizontalCenter
+                    }
                 }
             }
         }
 
+        // Zone de grille : ici la grille est désormais dynamique selon nb_lettres et nb_essais
         Rectangle {
             id: rectangle_center
             width: 700
-            height: 900
+            height: 1000
             color: "#323232"
             border.width: 0
             anchors.verticalCenter: parent.verticalCenter
@@ -540,75 +758,70 @@ Window {
 
             Column {
                 id: center_column
-                x: 0
-                y: 36
                 width: 716
-                height: 864
-                spacing: 30
+                height: 900
+                anchors.verticalCenter: parent.verticalCenter
+                anchors.horizontalCenter: parent.horizontalCenter
+                spacing: 20
 
                 Rectangle {
                     id: rectangle_titre
-                    width: 200
-                    height: 70
+                    width: 300
+                    height: 120
                     color: "#323232"
-                    border.width: 0
+                    radius: 20
+                    border.color: "#ffffff"
+                    border.width: 5
                     anchors.horizontalCenter: parent.horizontalCenter
 
                     Text {
                         id: _text2
                         text: qsTr("MOTUS")
                         anchors.verticalCenter: parent.verticalCenter
-                        font.pixelSize: 50
+                        font.pixelSize: 70
                         color: "white"
                         font.family: "Tahoma"
                         font.bold: true
                         horizontalAlignment: Text.AlignHCenter
+                        verticalAlignment: Text.AlignVCenter
                         anchors.horizontalCenter: parent.horizontalCenter
-                        anchors.top: parent.top
                     }
                 }
 
+                // Grille de jeu dynamique
                 Rectangle {
                     id: rectangle_grid
                     width: 450
                     height: 500
                     color: "#323232"
                     border.width: 0
-                    anchors.verticalCenter: rectangle_titre.verticalCenter
-                    anchors.left: rectangle_titre.right
-                    anchors.right: rectangle_titre.left
-                    anchors.top: rectangle_titre.bottom
-                    anchors.bottom: rectangle_titre.top
-                    anchors.leftMargin: -325
-                    anchors.rightMargin: -325
-                    anchors.topMargin: 112
-                    anchors.bottomMargin: -682
-                    anchors.horizontalCenter: rectangle_titre.horizontalCenter
+                    anchors.horizontalCenter: parent.horizontalCenter
 
+                    // Grille dynamique : nombre de colonnes = nb_lettres et nombre de cases = nb_lettres * nb_essais
                     Grid {
                         id: grid
-                        x: -553
-                        y: -430
-                        anchors.left: parent.left
-                        anchors.right: parent.right
-                        anchors.top: parent.top
-                        anchors.bottom: parent.bottom
-                        anchors.leftMargin: 39
-                        anchors.rightMargin: -39
-                        anchors.topMargin: -80
-                        anchors.bottomMargin: 80
+                        height: nb_essais*50 + (nb_essais-1)*5
+                        anchors.verticalCenter: parent.verticalCenter
+                        width: nb_lettres*50 + (nb_lettres-1)*5
+                        anchors.horizontalCenter: parent.horizontalCenter
                         spacing: 5
-                        rows: 6
-                        columns: 5
-
+                        columns: nb_lettres
                         Repeater {
                             id: caseRepeater
-                            model: 30
+                            model: nb_lettres * nb_essais
                             delegate: Case {
                                 objectName: "caseDelegate"
                             }
                         }
                     }
+
+                    MouseArea {
+                        id: mouseArea
+                        anchors.fill: parent
+                        onClicked: {
+                            rectangle_grid.focus = true;
+                        }
+                    }
                 }
 
                 Rectangle {
@@ -620,8 +833,6 @@ Window {
                     radius: 10
                     border.color: "#ffffff"
                     border.width: 5
-                    anchors.bottom: parent.bottom
-                    anchors.bottomMargin: 50
 
                     Column {
                         anchors.fill: parent
@@ -773,31 +984,4 @@ Window {
             case_focus = caseArray[0];
         }
     }
-
-    Text {
-        y: 32
-        text: "Temps écoulé ! Mot : " + mot
-        visible: motusGame && motusGame.loosetime
-        color: "red"
-        font.pixelSize: 30
-        anchors.horizontalCenter: parent.horizontalCenter
-    }
-
-    Text {
-        y: 32
-        text: "Nombre d'essais maximum atteint ! Mot : " + mot
-        visible: motusGame && motusGame.loosetry
-        color: "red"
-        font.pixelSize: 30
-        anchors.horizontalCenter: parent.horizontalCenter
-    }
-
-    Text {
-        y: 32
-        text: "Gagné !"
-        visible: motusGame && motusGame.win
-        color: "green"
-        font.pixelSize: 30
-        anchors.horizontalCenter: parent.horizontalCenter
-    }
 }
diff --git a/Motus/NumberLetterButton.qml b/Motus/NumberLetterButton.qml
index 0bc5c9b05f43803ace4873f3426125956f31a808..4944ac0af4e73f9a6d505a8bb3f746ad5f0c7b8a 100644
--- a/Motus/NumberLetterButton.qml
+++ b/Motus/NumberLetterButton.qml
@@ -5,17 +5,15 @@ import QtQuick.Layouts 1.15
 Item {
     width: 240
     height: 100
-    property string firstItemText;
 
     ComboBox {
         id: comboBox
         anchors.centerIn: parent
         width: 250
         height: 100
+        currentIndex: 1
 
-
-
-        model: [firstItemText, "6", "7", "8", "9", "10","11","12"]
+        model: ["4", "5", "6", "7", "8", "9", "10","11","12", "Aléatoire"]
         flat: true
 
         // Le contenu affiché (texte sélectionné)
@@ -75,5 +73,30 @@ Item {
                 color: "black"
             }
         }
+
+        onCurrentIndexChanged: {
+            if (currentIndex === 9){
+                nb_lettres = motusGame.getRandomNum();
+            }
+            else{
+                nb_lettres = model[currentIndex];
+            }
+            console.log(nb_lettres);
+            if (nb_lettres == 4){
+                nb_essais = 5;
+            }
+            else if (nb_lettres == 5 || nb_lettres == 6){
+                nb_essais = 6;
+            }
+            else if (nb_lettres == 7 || nb_lettres == 8){
+                nb_essais = 7;
+            }
+            else{
+                nb_essais = 8;
+            }
+            caseRepeater.model = nb_lettres*nb_essais;
+            console.log(caseRepeater.model);
+            console.log(caseArray);
+        }
     }
 }
diff --git a/Motus/motusgame.cpp b/Motus/motusgame.cpp
index 48926c7498e4b955263eae675ef7cf48edc0eb8a..6a70580a8b1c4a8f168c168d5888176d497f0f2b 100644
--- a/Motus/motusgame.cpp
+++ b/Motus/motusgame.cpp
@@ -161,21 +161,25 @@ int MotusGame::getLetterNumber() const {
 void MotusGame::setLetterNumber(int value) {
     if (letterNumber != value) {
         letterNumber = value;
+        // Mettre à jour le nombre d'essais en fonction du nombre de lettres
+        if (value == 4)
+            tryTotal = 5;
+        else if (value == 5 || value == 6)
+            tryTotal = 6;
+        else if (value == 7 || value == 8)
+            tryTotal = 7;
+        else
+            tryTotal = 8;
         emit letterNumberChanged();
-        qDebug() << "🔤 Nouvelle valeur de letterNumber :" << letterNumber;
+        emit tryTotalChanged(); // Signal pour notifier l'UI que le nombre d'essais a changé
+        qDebug() << "Nouvelle valeur de letterNumber :" << letterNumber << ", tryTotal mis à jour à" << tryTotal;
     }
 }
 
-bool MotusGame::getRandomizeLetterNumber() const {
-    return randomizeletterNumber;
-}
-
-void MotusGame::setRandomizeLetterNumber(bool value) {
-    if (randomizeletterNumber != value) {
-        randomizeletterNumber = value;
-        emit randomizeLetterNumberChanged();
-        qDebug() << "🎲 randomizeLetterNumber =" << randomizeletterNumber;
-    }
+int MotusGame::getRandomNum() {
+    QList<int> essaisPossibles = {5, 6, 6, 7, 7, 8, 8, 8, 8};
+    int index = QRandomGenerator::global()->bounded(essaisPossibles.size());
+    return essaisPossibles[index];
 }
 
 bool MotusGame::getLoosetrybool() const {
@@ -325,4 +329,10 @@ void MotusGame::updateStats(int letterCount, const QString &language, bool win,
         }
     }
     qDebug() << "Statistiques mises à jour pour" << language << "avec" << letterCount << "lettres, victoire:" << win;
+
+    // Sauvegarde immédiate dans le fichier texte
+    saveStats();
+
+    // Émettre un signal pour notifier à l'UI que les stats ont changé
+    emit statsChanged();
 }
diff --git a/Motus/motusgame.h b/Motus/motusgame.h
index 7aaa25eb37404d3741e59905378a1064ce7c4773..432a8822bc55a7b3e533c6e797641892b58306ed 100644
--- a/Motus/motusgame.h
+++ b/Motus/motusgame.h
@@ -34,7 +34,6 @@ class MotusGame : public QObject {
     Q_PROPERTY(QString dictionnaryChoosed READ getDictionnaryChoosed WRITE setDictionnaryChoosed NOTIFY dictionnaryChoosedChanged)
     Q_PROPERTY(int remainingTime READ getRemainingTime NOTIFY timerUpdated)
     Q_PROPERTY(int letterNumber READ getLetterNumber WRITE setLetterNumber NOTIFY letterNumberChanged)
-    Q_PROPERTY(bool randomizeLetterNumber READ getRandomizeLetterNumber WRITE setRandomizeLetterNumber NOTIFY randomizeLetterNumberChanged)
     Q_PROPERTY(bool loosetry READ getLoosetrybool WRITE setLoosetrybool NOTIFY loosetryChanged)
     Q_PROPERTY(bool loosetime READ getLoosetimebool WRITE setLoosetimebool NOTIFY loosetimeChanged)
     Q_PROPERTY(bool win READ getWinbool WRITE setWinbool NOTIFY winChanged)
@@ -52,8 +51,7 @@ public:
 
     int getLetterNumber() const;
     void setLetterNumber(int value);
-    bool getRandomizeLetterNumber() const;
-    void setRandomizeLetterNumber(bool value);
+    Q_INVOKABLE int getRandomNum();
 
     bool getLoosetrybool() const;
     Q_INVOKABLE void setLoosetrybool(bool value);
@@ -69,6 +67,8 @@ public:
     Q_INVOKABLE void saveStats();  // Sauvegarder les stats dans le fichier
     Q_INVOKABLE void updateStats(int letterCount, const QString &language, bool win, int attemptsUsed, int gameTime);
 
+    int getTryTotal() const { return tryTotal; }
+
 private:
     QStringList words;
     QString motChoisi;
@@ -97,10 +97,11 @@ signals:
     void dictionnaryChoosedChanged();
     void timerUpdated();
     void letterNumberChanged();
-    void randomizeLetterNumberChanged();
     void loosetryChanged();
     void loosetimeChanged();
     void winChanged();
+    void statsChanged();       // Signal pour informer que les statistiques ont changé
+    void tryTotalChanged();    // Signal pour informer que le nombre d'essais a changé
 };
 
 #endif // MOTUSGAME_H