body {
    font-family: sans-serif;
    /* Ancien fond dégradé */
    /* background-image: linear-gradient(to bottom right, #2c3e50, #3498db); */
    
    /* Nouveau fond motif Tetris CSS */
    background-color: #1a1a2e; /* Couleur de base sombre */
    background-image: 
        /* Lignes verticales fines */
        repeating-linear-gradient(to right, transparent, transparent 29px, rgba(255, 255, 255, 0.02) 30px, rgba(255, 255, 255, 0.02) 31px, transparent 32px),
        /* Lignes horizontales fines */
        repeating-linear-gradient(to bottom, transparent, transparent 29px, rgba(255, 255, 255, 0.02) 30px, rgba(255, 255, 255, 0.02) 31px, transparent 32px),
        /* Quelques 'blocs' de couleur très discrets */
        radial-gradient(circle at 10% 20%, rgba(0, 200, 255, 0.05) 5%, transparent 20%),
        radial-gradient(circle at 80% 70%, rgba(255, 100, 100, 0.05) 5%, transparent 20%),
        radial-gradient(circle at 50% 50%, rgba(100, 255, 100, 0.04) 8%, transparent 25%);
        
    background-size: cover, cover, 200px 200px, 250px 250px, 180px 180px; /* Taille pour chaque couche */
    background-repeat: no-repeat, no-repeat, repeat, repeat, repeat; /* Répétition pour les motifs */
    background-attachment: fixed;
    color: #eee;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
}

.container {
    text-align: center;
}

.game-area {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
}

.game-area {
    display: flex;
    justify-content: center; /* Centre horizontalement */
    align-items: stretch;  /* Fait en sorte que les enfants aient la même hauteur */
    gap: 20px; /* Ajoute un espace entre la grille et le panneau */
    position: relative; /* Ajout pour le positionnement des confettis */
}

.main-game-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

#tetris-canvas {
    border: 3px solid #555;
    background-color: #000;
}

.side-panel {
    width: 200px; /* Légère réduction de la largeur */
    padding: 15px; /* Réduction du padding */
    background-color: rgba(0, 0, 0, 0.35); /* Légèrement plus opaque */
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    display: flex; /* Garde flex pour l'organisation interne */
    flex-direction: column; /* Organisation interne verticale */
    text-align: center;
    margin-left: 20px;
    box-sizing: border-box; /* Ajout pour inclure padding/border dans la hauteur */
}

.side-panel h2 {
    margin-top: 0;
    color: #00bcd4; /* Cyan pour les titres */
    text-shadow: 0 0 6px #00bcd4; /* Ombre réduite */
    border-bottom: 1px solid rgba(0, 188, 212, 0.4);
    padding-bottom: 6px; /* Padding réduit */
    font-size: 1.1em; /* Taille de police standard */
    margin-bottom: 18px; /* Augmentation de l'espace après le titre */
    display: flex; /* Pour aligner l'icône et le texte */
    align-items: center; /* Alignement vertical */
}

/* Styles pour les icônes dans les titres du panneau latéral */
.icon-score,
.icon-level,
.icon-lines,
.icon-robot { /* Ajout de l'icône robot ici */
    width: 1em; /* Taille basée sur la police du parent */
    height: 1em;
    vertical-align: -0.15em; /* Ajuste l'alignement vertical avec le texte */
    margin-right: 0.4em; /* Espace entre l'icône et le texte */
    fill: currentColor; /* Utilise la couleur du texte parent (pour .icon-robot) */
    flex-shrink: 0; /* Empêche l'icône de rétrécir */
}

/* Style pour la zone d'affichage de la prochaine pièce */
#next-piece-canvas {
    display: block; /* Pour pouvoir appliquer les marges auto */
    width: 80px;    /* Taille réduite */
    height: 80px;   /* Taille réduite */
    margin: 10px auto 15px auto; /* Marges: haut 10px, auto horizontal, bas 15px */
    background-color: rgba(0, 0, 0, 0.2); /* Léger fond pour la distinguer */
    border: 1px solid rgba(255, 255, 255, 0.05); /* Bordure très discrète */
    border-radius: 4px;
}

.side-panel p {
    margin: 10px 0; /* Marge réduite */
    font-size: 1em; /* Taille standard pour le texte */
    line-height: 1.3;
}

#score, #level, #lines {
    font-weight: bold;
    color: #ffeb3b; /* Jaune pour les chiffres importants */
    text-shadow: 0 0 4px #ffeb3b; /* Ombre réduite */
    font-size: 0.9em; /* Taille encore plus réduite */
    margin-bottom: 10px; /* Ajout d'un petit espace sous les chiffres */
}

.score-info {
    position: relative;
    z-index: 2; /* S'assurer que le texte est au-dessus du canvas de fond */
}

#score-bg-canvas {
    position: absolute;
    left: 0; top: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    opacity: 0.68;
    filter: blur(0.5px) brightness(1.15);
}

#victory-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background-color: rgba(40, 40, 80, 0.9);
    color: #fff;
    padding: 40px 60px;
    border-radius: 15px;
    border: 3px solid #ffd700;
    text-align: center;
    font-size: 2.5em;
    font-weight: bold;
    z-index: 100; /* Au-dessus de tout */
    box-shadow: 0 0 30px #ffd700, 0 0 50px rgba(255, 215, 0, 0.5);
    opacity: 0;
    transition: opacity 0.5s ease-in-out, transform 0.5s ease-in-out;
    pointer-events: none; /* N'interfère pas avec les clics */
    text-shadow: 0 0 10px #fff, 0 0 20px #ffd700;
}

#victory-message:not(.hidden) {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    pointer-events: all;
}

#restart-button {
    display: block;
    margin: 20px auto;
    padding: 12px 25px;
    font-size: 1.1em;
    background-color: #4CAF50; /* Vert */
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.1s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

#restart-button:hover {
    background-color: #45a049;
}

#restart-button:active {
    transform: translateY(2px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

#restart-button.hidden {
    display: none;
}

.rainbow-piece svg path,
.rainbow-piece svg rect,
.rainbow-piece svg circle,
.rainbow-piece svg ellipse {
    animation: rainbow-fill 0.6s linear infinite;
}

@keyframes rainbow-fill {
    0% { fill: #ff6b6b; }
    17% { fill: #ffb36b; }
    34% { fill: #ffff6b; }
    51% { fill: #6bff6b; }
    68% { fill: #6bffff; }
    85% { fill: #b36bff; }
    100% { fill: #ff6b6b; }
}

.score-wave {
    animation: score-wave-anim 0.65s ease-out;
}

@keyframes score-wave-anim {
    0% { transform: scale(1); color: white; text-shadow: 0 0 5px #fff, 0 0 10px #fff, 0 0 15px #007bff; }
    50% { transform: scale(1.3); color: #ffe066; text-shadow: 0 0 8px #ffe066, 0 0 15px #ffe066, 0 0 25px #ff8c00; }
    100% { transform: scale(1); color: white; text-shadow: 0 0 5px #fff, 0 0 10px #fff, 0 0 15px #007bff; }
}

#score-bg-canvas {
    filter: blur(3px) brightness(0.8);
    opacity: 0.6;
}

.robot-idle {
    animation: robot-idle-anim 4s infinite ease-in-out;
}

@keyframes robot-idle-anim {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    20% { transform: translateY(-3px) rotate(-1deg); }
    50% { transform: translateY(0) rotate(0deg); }
    70% { transform: translateY(-3px) rotate(1deg); }
}

.robot-victory {
    animation: robot-victory-anim 1s ease-in-out infinite alternate;
}

@keyframes robot-victory-anim {
    from { transform: scale(1) rotate(-5deg); }
    to   { transform: scale(1.1) rotate(5deg); }
}

.hidden {
    display: none !important;
}

.game-over-text {
    color: #ff4d4d;
    font-size: 1.8em;
    font-weight: bold;
    text-align: center;
    margin-top: 20px;
    text-shadow: 0 0 10px #ff4d4d, 0 0 20px #ff0000;
}

.shake {
    animation: shake-anim 0.3s linear;
}

@keyframes shake-anim {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    50% { transform: translateX(8px); }
    75% { transform: translateX(-8px); }
}

.flash {
    /* Géré via JS en changeant brièvement la couleur de remplissage */
    transition: fill 0.05s linear;
}

footer {
    text-align: center;
    margin-top: 40px;
    padding: 15px;
    color: #aaa;
    font-size: 0.9em;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Style pour SLAG62 */
#slag62 {
    margin-top: auto; /* Pousse cet élément vers le bas */
    padding-top: 15px; /* Espace au-dessus */
    font-size: 1.2em; /* Plus grand */
    font-weight: bold; /* En gras */
    color: #e0e0e0; /* Couleur blanche/grise claire */
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.5); /* Légère ombre portée */
    text-align: center;
    display: flex; /* Pour aligner l'icône et le texte */
    justify-content: center; /* Centrage horizontal */
}
