/* Fichier: updated.css */
/* ==========================================================================
   TABLE DES MATIÈRES COMPLÈTE
   ==========================================================================

   1.  VARIABLES GLOBALES
   2.  RESET CSS
   3.  STYLES DU BODY
   4.  ALERTE DE ROTATION
   5.  PADS
   6.  GAME WRAPPER
   7.  TITRES (H1)
   8.  INFORMATIONS DU JEU
   9.  BARRE DE PROGRESSION
   10. AFFICHAGE DU COMBO
   11. TRANSITION DE NIVEAU
   12. ECRAN DE COMPLETION
   13. CONTROLES
   14. SÉQUENCE DE DÉMO
   15. ALERTE DE TOUR
   16. INDICATEUR D'ÉTAPE
   17. AFFICHAGE DU GUIDE
   18. RESPONSIVE DESIGN
   19. ANIMATIONS
   20. CHARGEMENT ET OVERLAYS
   21. ACCESSIBILITÉ
   22. OPTIMISATIONS TACTILES
   23. ÉTATS SPÉCIAUX
   24. EFFETS VISUELS AVANCÉS
   25. COMPATIBILITÉ NAVIGATEUR
   26. INTERACTIONS AVEC LES IMAGES
   27. ÉLÉMENTS DE L'INTERFACE UTILISATEUR
   28. ÉCRAN D'ACCUEIL
   29. GESTION DU SCROLL
   30. FEEDBACK TACTILE
   31. ANIMATIONS FINALES
   32. DERNIÈRES OPTIMISATIONS
   ========================================================================== */

/* ==========================================================================
   1. VARIABLES GLOBALES
   ========================================================================== */
   :root {
    --primary-color: #34db69;
    --secondary-color: #e68422;
    --correct-color: #2ecc71;
    --incorrect-color: #e74c3c;
    --background-color: #2c3e50;
    --pad-size: 100px;
    --gap: 15px;
    --text-shadow: 0 2px 4px rgba(0,0,0,0.3);
  }
  
  /* ==========================================================================
     2. RESET CSS
     ========================================================================== */
  *,
  *::before,
  *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
  }
  
  /* ==========================================================================
     3. STYLES DU BODY
     ========================================================================== */
/* ==========================================================================
   3. STYLES DU BODY
   ========================================================================== */
   body {
    font-family: 'Arial Rounded MT Bold', Arial, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: linear-gradient(135deg, var(--background-color) 0%, #1a2533 100%);
    color: white;
    min-height: 100vh;
    user-select: none;
    overflow: hidden;
    box-sizing: border-box;
    width: 100vw;
    height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    overscroll-behavior: contain;
    touch-action: pan-y;
    position: relative;
    margin: 0;
    padding: 0;
    -webkit-user-select: none; /* Safari/Chrome */
    -moz-user-select: none; /* Firefox */
    -ms-user-select: none; /* IE/Edge */
}

body::after {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 50% 50%, 
                rgba(52,219,105,0.1) 0%, 
                transparent 60%);
    pointer-events: none;
    z-index: -1;
    animation: backgroundPulse 8s infinite linear;
}

  /* ==========================================================================
     4. ALERTE DE ROTATION
     ========================================================================== */
  #turn-alert {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    padding: 2rem;
    border-radius: 1rem;
    text-align: center;
    z-index: 1000;
    display: none;
  }
  
  .countdown {
    font-size: 4em;
    margin: 1rem 0;
  }
  
  /* ==========================================================================
     5. PADS
     ========================================================================== */
  #pads {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    perspective: 1000px;
    align-self: center;
    grid-template-columns: repeat(3, minmax(15vw, 1fr));
    gap: 1.5dvh;
    place-items: center;
  }
  
  #pads.level-completed::after {
    content: "✓ Niveau terminé !";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2em;
    color: #34db69;
    animation: fadeInScale 0.5s ease-out;
    text-shadow: 0 0 15px rgba(52,219,105,0.5);
  }

  #pads.level-completed {
    position: relative;
    pointer-events: none;
  }

  .pad {
    height: var(--pad-size);
    border-radius: 15px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    border: 2px solid rgba(255,255,255,0.1);
    font-weight: bold;
    text-shadow: var(--text-shadow);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transform-style: preserve-3d;
    z-index: auto !important;
    width: 100%;
    aspect-ratio: 1;
    font-size: clamp(1.2rem, 4dvh, 2.5rem);
    transform: translateZ(0);
    backface-visibility: hidden;
    background: linear-gradient(145deg, #3a555c, #2d384a);
    box-shadow: 0 8px 24px rgba(0,0,0,0.3),
                inset 0 4px 8px rgba(255,255,255,0.1);
    /* Désactiver le zoom tactile */
    touch-action: none;
    
    /* Empêcher le comportement de sélection texte/zoom */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    
    /* Désactiver le scaling forcé du navigateur */
    -webkit-text-size-adjust: none;
    text-size-adjust: none;
    
    /* Bloquer le zoom au double-tap */
    @media (pointer: coarse) {
        touch-action: manipulation;
        -ms-touch-action: manipulation;
    }
  }
  
  .pad:hover {
    filter: brightness(1.2);
    box-shadow: 0 0 1px rgba(52, 216, 219, 0.4);
  }

  .pad::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at var(--x) var(--y), 
                rgba(255,255,255,0.15) 0%, 
                transparent 70%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
  }
  
  .pad:hover::before {
    opacity: 1;
  }
  
  .pad::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, rgba(255,255,255,0) 70%);
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
  }
  
  .pad.active {
    background: linear-gradient(45deg, #ff9143, #e67d2243) !important;
    transform: scale(0.94);
    filter: brightness(1.2);
    box-shadow: 0 0 25px rgba(52, 216, 219, 0.4) !important;
  }
  
  .pad.active::after {
    width: 150%;
    height: 150%;
  }
  
  .pad.correct {
    background-color: var(--correct-color) !important;
    transform: scale(1.1);
    animation: pop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  }
  
  .pad.incorrect {
    background-color: var(--incorrect-color) !important;
    transform: scale(0.9);
  }
  
  .pad.conflict {
    background: #ff00000a !important;
    animation: conflictPulse 0.5s ease;
    box-shadow: 0 0 1px rgba(52, 216, 219, 0.4);
  }
  
  .pad.disabled {
    opacity: 0.5;
    pointer-events: none;
    filter: grayscale(100%);
    cursor: not-allowed;
  }
  
  .pad[data-sound="pad5"] {
    background: 
        linear-gradient(145deg, #3a5c3f5b, #2e2d4a61), /* Ajout d'opacité (cc = 80%) */
        url('../images/logo_gasy.png') center/cover no-repeat;
    
    /* Effet de texture supplémentaire */
    box-shadow: 0 8px 24px rgba(0,0,0,0.3), 
                inset 0 0 20px rgba(0,0,0,0.4),
                inset 0 0 40px rgba(255,255,255,0.1);
  }

  /* ==========================================================================
     6. GAME WRAPPER
     ========================================================================== */
  .game-wrapper {
    perspective: 1000px;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1;
  }
  
  .game-wrapper.overlay-active {
    position: relative;
  }
  
  .game-wrapper::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(12px);
    z-index: 999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
  }
  
  .game-wrapper.overlay-active::after {
    opacity: 0.8;
    pointer-events: auto;
    z-index: 1111;
  }
  
  .game-container {
    z-index: 1001;
    position: relative;
    width: 100%;
    display: grid;
    grid-template-rows: auto auto 1fr auto auto;
    gap: 1dvh;
    padding: 1dvh 2dvw;
    max-width: 1000px;
  }
  
  .main-game-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
  }

  /* ==========================================================================
     7. TITRES (H1)
     ========================================================================== */
  h1 {
    font-size: 2.5em;
    margin: 20px 0;
    text-shadow: var(--text-shadow);
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    background-clip: text;
    -webkit-text-fill-color: transparent;
  }
  
  /* ==========================================================================
     8. INFORMATIONS DU JEU
     ========================================================================== */
  .game-info {
    flex-direction: column;
    align-items: center;
    margin: 10px auto;
  }
  
  .game-info,
  #step-indicator,
  #controls {
    display: flex;
    justify-content: center;
  }

  .info-box {
    background: rgba(255,255,255,0.1);
    padding: 12px 25px;
    border-radius: 8px;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255,255,255,0.1);
    text-align: center;
    width: 100%;
    cursor: pointer;
    /*transition: all 0.3s ease;*/
  }
  
  #score-display {
    color: #34db69;
  }
  
  #accuracy-display {
    color: #f1c40f;
  }
  
  #step-indicator {
    gap: 10px;
    flex-wrap: wrap;
  }
  
  /* ==========================================================================
     9. BARRE DE PROGRESSION
     ========================================================================== */
  .progress-container {
    width: 80%;
    height: 10px;
    background: rgba(0,0,0,0.3);
    border-radius: 5px;
    margin: 15px 0;
    overflow: hidden;
  }
  
  .progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  }
  
  /* ==========================================================================
     10. AFFICHAGE DU COMBO
     ========================================================================== */
  .combo-display {
    position: fixed;
    top: 20px;
    left: 20px;
    font-weight: bold;
    display: none;
    background: linear-gradient(45deg, #ffd700, #9dff00);
    color: #2c3e50;
    padding: 12px 24px;
    border-radius: 30px;
    font-size: 1.6em;
    box-shadow: 0 6px 20px rgba(255,215,0,0.4);
    animation: comboPulse 0.4s ease-in-out infinite;
    border: 2px solid rgba(255,255,255,0.3);
    z-index: 100;
  }
  
  /* ==========================================================================
     11. TRANSITION DE NIVEAU
     ========================================================================== */
  .level-transition {
    position: fixed;
    top: 50%;
    left: 50%;
    font-size: small;
    transform: translate(-50%, -50%) scale(1) !important;
    padding: 15px 25px;
    border-radius: 20px;
    text-align: center;
    animation: pulse 1.5s ease-in-out infinite;
    border: 2px solid var(--primary-color);
    z-index: 2000 !important;
    pointer-events: auto;
    overflow: hidden;
    max-height: 90vh;
    width: 87vw;
    isolation: isolate;
    background: linear-gradient(325deg, #2c3e50 30%, #34495e 100%);
    backdrop-filter: blur(12px);
    box-shadow: 0 0 40px rgba(52,219,105,0.2),
                inset 0 0 20px rgba(255,255,255,0.05);
  }
  
  .level-transition .score-breakdown,
  .completion-screen .final-score {
    position: relative;
    z-index: 10010;
  }

  .confetti-particle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #fff;
    animation: confetti-fall linear forwards;
    clip-path: polygon(50% 0%, 100% 38%, 82% 100%, 18% 100%, 0% 38%);
  }
  
  .score-breakdown div {
    margin: 15px 0;
    padding: 12px;
    background: rgba(255,255,255,0.05);
    border-radius: 10px;
    font-size: 1.1em;
  }
  
  .total-score {
    font-size: 1.4em !important;
    color: var(--correct-color) !important;
    font-weight: bold;
    margin-top: 20px !important;
  }
  
  /* ==========================================================================
     12. ECRAN DE COMPLETION
     ========================================================================== */
  .completion-screen {
    position: fixed;
    cursor: pointer;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.9);
    padding: 20px 30px;
    border-radius: 20px;
    text-align: center;
    animation: glow 1s infinite alternate;
    z-index: 10000 !important;
    border: 2px solid var(--primary-color);
    max-height: 80vh;
    width: 87vw;
    overflow-y: auto;
  }
  
  .completion-screen.completed {
    pointer-events: none;
  }
  
  .completion-screen.completed .levels-list > * {
    pointer-events: auto;
  }
  
  .levels-list,
  .final-score {
    pointer-events: none;
  }
  
  .levels-list > * {
    pointer-events: auto;
  }
  
  .final-score {
    font-size: 1em;
    color: var(--correct-color);
    margin: 20px 0;
  }
  
  .level-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    margin: 10px 0;
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
    gap: 15px;
  }
  
  .level-entry span {
    flex-grow: 1;
    margin-right: 20px;
  }
  
  .retry-level-btn {
    padding: 8px 15px;
    border: none;
    border-radius: 5px;
    color: white;
    cursor: pointer;
    margin-left: 15px;
    background: #27ae60 !important;
    transition: transform 0.2s;
  }
  
  .retry-level-btn:hover {
    background: #219a52 !important;
    transform: scale(1.05);
  }
  
  .reset-btn {
    margin-top: 20px;
    padding: 12px 25px;
    background: linear-gradient(145deg, #9ab659, #59ad44);
    color: white;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s;
  }
  
  .reset-btn:hover {
    transform: scale(1.05);
  }
  
  .home-btn {
    margin-top: 20px;
    padding: 12px 25px;
    background: linear-gradient(145deg, #9b59b6, #ad448d);
    color: white;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s;
  }
  
  .home-btn:hover {
    transform: scale(1.05);
    background: #b42bc0;
  }
 
  .score-breakdown .penalty {
    color: var(--incorrect-color) !important;
    animation: shake 0.5s;
  }
  
  .score-breakdown .total-score {
    margin-top: 15px;
    border-top: 2px solid rgba(255,255,255,0.1);
    padding-top: 10px;
  }
  
  .score-breakdown div:first-child {
    font-weight: bold;
    color: var(--primary-color);
  }

  /* ==========================================================================
     13. CONTROLES
     ========================================================================== */
  #controls {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    width: 100%;
    margin: 15px auto;
    margin-top: auto;
    bottom: 20px;
    left: 50%;
    z-index: 1000;
  }
  
  #controls::-webkit-scrollbar {
    display: none;
  }
  
  .control-btn {
    cursor: pointer;
    background: linear-gradient(145deg, var(--primary-color), #2980b9);
    color: white;
    border-radius: 10px;
    transition: transform 0.2s, box-shadow 0.2s;
    width: 47%;
    flex-shrink: 0;
    padding: 12px 20px;
    font-size: clamp(0.9rem, 2vw, 1.1rem);
    white-space: nowrap;
    margin: 0 5px;
  }
  
  .control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
  }
  
  #demo-btn.playing {
    background: linear-gradient(145deg, var(--incorrect-color), #b97629);
    animation: pulseStop 1s infinite;
  }
  
  .play-btn {
    background: #2ecc71 !important;
  }
  
  .play-btn:hover {
    background: #27ae60 !important;
  }
  
  .time-progress {
    width: 95%;
    height: 10px !important;
    background: #34495e !important;
    border-radius: 4px;
    margin: 10px 0;
  }
  
  .time-bar {
    height: 100%;
    background: #34d8db !important;
    border-radius: 4px;
    transform-origin: left center;
  }

  /* ==========================================================================
     14. SÉQUENCE DE DÉMO
     ========================================================================== */
  .demo-sequence {
    opacity: 0.5 !important;
    position: relative;
    z-index: 900;
  }
  
  .player-sequence {
    position: relative;
    z-index: 950 !important;
    margin-top: 20px;
    background: rgba(255,255,255,0.1);
    padding: 10px;
    border-radius: 10px;
    transition: opacity 0.5s ease, transform 0.3s ease !important;
    pointer-events: none;
    opacity: 0;
    transform: translateY(20px);
  }
  
  .turn-alert-active .player-sequence {
    opacity: 1 !important;
    transform: translateY(0);
    pointer-events: auto;
  }
  
  .turn-alert-active .demo-sequence {
    display: none;
  }
  
/* ==========================================================================
   15. ALERTE DE TOUR
   ========================================================================== */
   .turn-alert {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    padding: 20px 40px;
    border-radius: 15px;
    font-size: 1.5em;
    display: none;
    z-index: 1001;
    text-align: center;
    border: 3px solid #fff;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    background: rgba(0, 0, 0, 0.7) !important;
    backdrop-filter: blur(5px);
    animation: pulse 1s infinite;
  }
  
  .alert-content {
    animation: bounce 0.5s infinite alternate;
  }
  
  #turn-alert[style*="display: block"] ~ #pads .pad {
    pointer-events: none !important;
    filter: brightness(0.7);
    transform: scale(0.95);
  }
  
  /* ==========================================================================
     16. INDICATEUR D'ÉTAPE
     ========================================================================== */
  .step-indicator {
    margin: 20px;
    display: flex;
    gap: 5px;
  }
  
  .step {
    width: 30px;
    height: 10px;
    background-color: #34495e;
    border-radius: 5px;
    transition: background-color 0.1s ease;
  }
  
  .step.active {
    background-color: var(--primary-color);
    transform: scale(1.3);
    box-shadow: 0 0 10px #34d8db;
    transition: all 0.1s ease;
  }
  
  /* ==========================================================================
     17. AFFICHAGE DU GUIDE
     ========================================================================== */
  #guide-display {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
    font-size: clamp(0.7rem, 2dvh, 1rem);
    margin: 15px 0;
    position: relative;
  }
  
  .guide-pad-group[data-index="0"] {
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    background: #34495e;
    color: white;
    padding: 12px 18px;
    font-size: 1.1em;
    transition: all 0.3s ease;
    flex-shrink: 0;
    scroll-snap-align: start;
    user-select: none;
    pointer-events: none;
  }
  
  .sequence-scroll-wrapper {
    display: flex;
    width: 100%;
    scroll-behavior: smooth;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    cursor: grab;
    user-select: none;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
  }

  .sequence-container {
    display: inline-flex;
    gap: 1px;
    padding: 20px 10px;
    scroll-padding: 20px;
  }
  
  .guide-pad-group {
    background: #34495e;
    color: white;
    padding: 12px 18px;
    border-radius: 8px;
    font-size: 1.1em;
    transition: all 0.3s ease;
    flex-shrink: 0;
    scroll-snap-align: start;
    pointer-events: auto;
    touch-action: pan-y;
    scroll-snap-stop: always;
    margin-right: 5px;
  }
  
  .guide-pad-group.active {
    background: var(--secondary-color);
    transform: scale(1);
  }
  
  .guide-pad-group.correct {
    background: var(--correct-color);
    /*animation: pulseSuccess 0.5s;*/
    border: 1px solid #092816 !important;
  }
  
  .guide-pad-group.incorrect {
    background: var(--incorrect-color);
    animation: shake 0.5s;
  }
  
  .guide-pad-group.good-hit {
    background: #f1c40f !important;
    box-shadow: 0 0 10px rgba(241, 196, 15, 0.4);
    transform: scale(1.5);
  }

  .demo-guide {
    opacity: 0.87;
    transform: scale(1);
    margin-right: 5px;
  }
  
  .demo-guide.active {
    background-color: var(--secondary-color) !important;
    transform: scale(1);
    opacity: 1;
  }

  .player-guide.correct {
    background-color: var(--correct-color) !important;
    transform: scale(1);
  }

  .player-guide.incorrect {
    background-color: var(--incorrect-color) !important;
    animation: shake 0.5s;
  }

  .precision-detail {
    font-size: 0.9em;
    color: #95a5a6;
    margin: 10px 0;
  }
  
  .precision-detail::before {
    content: "Détail : ";
    font-weight: bold;
    color: #3498db;
  }

  /* ==========================================================================
     18. RESPONSIVE DESIGN
     ========================================================================== */
  @media (max-width: 600px) {
    #controls {
      padding: 0 5px;
    }
    
    .control-btn {
      margin: 0 2px;
      padding: 10px 12px;
    }
  }
  
  @media (max-width: 480px) {
    :root {
      --pad-size: 80px;
      --gap: 12px;
    }
  
    .pad {
      width: 30vw;
      height: 30vw;
      font-size: 1.4em;
    }
  
    .game-info {
      width: 95%;
    }
  
    .info-box {
      font-size: 0.9em;
      padding: 8px 15px;
    }
  
    #controls {
      gap: 8px;
      padding: 0 5px;
    }
  
    .control-btn {
      font-size: 1em;
      padding: 10px 15px;
    }
  
    @media (max-width: 350px) {
      .pad {
        width: 28vw;
        height: 28vw;
      }
    }
  }
  
  @media (max-height: 500px) and (orientation: landscape) {
    #pads {
      grid-template-columns: repeat(3, 22vw);
      gap: 10px;
    }
  
    .pad {
      width: 22vw;
      height: 22vw;
      font-size: 1.3em;
    }
  }
  
  @media (min-width: 768px) {
    :root {
      --pad-size: 18vw;
      --gap: 10px;
    }
  
    #pads {
      grid-template-columns: repeat(3, 150px);
      justify-content: center;
    }
  
    .pad {
      width: 150px;
      height: 150px;
      font-size: 2.5em;
      transition: transform 0.1s, filter 0.3s;
    }
  }
  
  /* ==========================================================================
     19. ANIMATIONS
     ========================================================================== */
  @keyframes pulseStop {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
  }
  
  @keyframes confetti-fall {
    0% { transform: translateY(-100vh) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
  }
  
  @keyframes pulseSuccess {
    0% { transform: scale(1); }
    50% { transform: scale(1); }
    100% { transform: scale(1); }
  }
  
  @keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
  }
  
  @keyframes physicalFeedback {
    0% { transform: scale(1); }
    30% { transform: scale(0.95); }
    60% { transform: scale(1.1); }
    100% { transform: scale(1); }
  }
  
  @keyframes comboPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
  }
  
  @keyframes fadeInScale {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
    100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  }
  
  @keyframes pop { /* Pour l'effet de clic sur les pads */
    0% { transform: scale(1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
  }
  
  @keyframes conflictPulse { /* Feedback de conflit */
    0% { transform: scale(1); }
    50% { transform: scale(1); }
    100% { transform: scale(1); }
  }
  
  @keyframes pulse { /* Animation des alertes */
    0% { transform: translate(-50%, -50%) scale(0.95); }
    50% { transform: translate(-50%, -50%) scale(1.05); }
    100% { transform: translate(-50%, -50%) scale(0.95); }
  }
  
  @keyframes glow { /* Lueur des modales */
    0% { box-shadow: 0 0 10px var(--primary-color); }
    100% { box-shadow: 0 0 30px var(--primary-color); }
  }

  @keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
  }

  @keyframes homeEntry {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
  }
  
  @keyframes btnPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.03); }
  }

  @keyframes logoAppear {
    to { transform: translateY(0) scale(1.05); filter: blur(0); }
  }

  @keyframes zoomIn {
    0% { transform: translate(-50%, -50%) scale(0); }
    90% { transform: translate(-50%, -50%) scale(1.2); }
    100% { transform: translate(-50%, -50%) scale(1); }
  }
  
  @keyframes fadeOut {
    0% { opacity: 1; }
    100% { opacity: 0; }
  }
    
  @keyframes bounce {
    from { transform: translateY(0); }
    to { transform: translateY(-5px); }
  }

  @keyframes pad5-glow {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
  }

  /* ==========================================================================
     20. CHARGEMENT ET OVERLAYS
     ========================================================================== */
  .loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    backdrop-filter: blur(5px);
    background: rgba(0, 0, 0, 0.95);
    transition: opacity 0.5s ease-in-out;
  }
  
  .loading-content {
    text-align: center;
  }
  
  .loading-bar-container {
    max-width: 300px;
    height: 15px;
    background: transparent !important;
    border-radius: 8px;
    margin: 20px auto;
    width: 300px;
    backdrop-filter: blur(2px); /* Ajoute un léger flou à la barre elle-même */
    opacity: 1; /* Assure la visibilité */
    transition: opacity 0.5s;
    overflow: visible;
  }
  
  .loading-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    box-shadow: 0 0 15px var(--primary-color);
    transition: width 3s ease;
  }
  
  .loading-text {
    color: white;
    margin-top: 10px;
    font-size: 1.2em;
  }
  
  .loading-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
  }
  
  #loading-overlay {
    position: fixed;
    background: rgba(0, 0, 0, 0.3);
    z-index: 10000;
    transition: opacity 0.5s ease, backdrop-filter 0.5s ease;
    backdrop-filter: blur(15px) brightness(0.8);
  }

  .loading-overlay-hidden .home-screen {
    filter: none;
  }
  
  .loading-overlay-active .home-play-btn {
    pointer-events: none;
    opacity: 0.7;
  }

  .game-logo, .loading-logo {
    width: min(80vw, 400px);
    height: auto;
    margin-bottom: 30px; /* Espace sous le logo */  
    margin-top: 10px;
    transform: translateY(20px);
    max-width: 80vw;
    max-height: 50vh;
    margin: 20px 0;
    width: min(80vw, 400px);
    animation: logoAppear 5s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    animation-delay: 0.3s;
    opacity: 1 !important; /* Forcer la visibilité permanente */
    filter: blur(5px); /* Départ flou */
    }
  
  /* ==========================================================================
     21. ACCESSIBILITÉ
     ========================================================================== */
  @media (prefers-reduced-motion: reduce) {
    * {
      animation: none !important;
      transition: none !important;
    }
  }
  
  /* ==========================================================================
     22. OPTIMISATIONS TACTILES
     ========================================================================== */
  @media (hover: none) {
    .pad::before {
      display: none;
    }
  
    .pad:active {
      transform: scale(0.95);
    }
  }
  
  /* ==========================================================================
     23. ÉTATS SPÉCIAUX
     ========================================================================== */
  .level-entry.locked {
    opacity: 0.6;
    background: rgba(255,255,255,0.1);
  }
  
  .level-entry.locked button {
    display: none;
  }
  
  .locked .level-info::after {
    content: "🔒";
    margin-left: 10px;
  }
  
  /* ==========================================================================
     24. EFFETS VISUELS AVANCÉS
     ========================================================================== */
  .pad.physical-hit {
    animation: physicalFeedback 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center;
}
  
  .guide-pad-group.perfect-hit {
    background: #2ecc71 !important;
    box-shadow: 0 0 15px rgba(46, 204, 113, 0.5);
    transform: scale(1.15);
  }
  
  /* ==========================================================================
     25. COMPATIBILITÉ NAVIGATEUR
     ========================================================================== */
  @media (-ms-accelerator:true) {
    .sequence-scroll-wrapper {
      cursor: -moz-grab;
    }
    .sequence-scroll-wrapper.grabbing {
      cursor: -moz-grabbing;
    }
    .pad {
        transition: none !important;
    }
  }

  @supports (-moz-appearance:none) {
    .sequence-scroll-wrapper {
      cursor: -moz-grab;
    }
    .sequence-scroll-wrapper.grabbing {
      cursor: -moz-grabbing;
    }
  }
  
  /* ==========================================================================
     26. INTERACTIONS AVEC LES IMAGES, MODALES ET OVERLAYS
     ========================================================================== */
  img {
    pointer-events: none; /* Empêche l'interaction avec l'image */
    user-select: none; /* Empêche la sélection */
    -webkit-user-drag: none; /* Désactive le drag sur WebKit */
    -moz-user-drag: none; /* Désactive le drag sur Firefox */
    -webkit-touch-callout: none; /* Désactive l'appui long sur mobile */
  }
  
  .modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 999;
    backdrop-filter: blur(4px);
    pointer-events: none;
  }
  
  .level-transition.overlay-active,
  .completion-screen.overlay-active {
    background: rgba(140, 7, 7, 0.7) !important;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  
  body.overlay-active {
    position: relative;
  }
  
  .completion-screen,
  .level-transition,
  #turn-alert {
    z-index: 1000;
    pointer-events: auto;
  }

  /* ==========================================================================
     27. ÉLÉMENTS DE L'INTERFACE UTILISATEUR
     ========================================================================== */
  .transition-buttons {
    margin-top: 25px;
    display: flex;
    gap: 15px;
    justify-content: center;
  }
  
  .retry-btn, .play-btn {
    padding: 8px 15px;
    font-size: 0.9em;
    flex-shrink: 0;
    white-space: nowrap;
  }
  
  .retry-btn, .play-btn, .continue-btn {
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    min-width: 15vw;
    transition: transform 0.2s, opacity 0.2s;
  }

  .retry-btn {
    background: #e74c3c;
    color: white;
  }

  .retry-btn:hover {
    transform: scale(1.05);
    background: #c0392b;
  }

  .play-btn, .continue-btn {
    background: #2ecc71;
    color: white;
  }

  .continue-btn:hover {
    transform: scale(1.05);
    background: #27ae60;
  }

  #return-to-game {
    margin-top: 20px;
    background: #7f8c8d;
  }

  /* Désactiver spécifiquement sur les boutons */
  button, .btn, [role="button"] {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    
    /* Désactiver le surlignage au clic sur mobile */
    -webkit-tap-highlight-color: transparent;
  }

  /* ==========================================================================
     28. ÉCRAN D'ACCUEIL
     ========================================================================== */
  .home-screen {
    z-index: 1002;
    position: static;
    height: auto;
    min-height: 100vh;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    animation: homeEntry 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 1 !important;
    transform: none !important;
    transition: opacity 0.4s ease, filter 0.4s ease;
  }
  
  .home-play-btn {
    background: linear-gradient(145deg, var(--primary-color), var(--secondary-color));
    color: white;
    cursor: pointer;
    transition: transform 0.3s;
    margin: 20px 0;
    padding: 16px 32px;
    font-size: 1.8em;
    border-radius: 50px;
    animation: btnPulse 2s infinite;
    order: 1;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3),
                inset 0 4px 8px rgba(255,255,255,0.1);
    border: 2px solid rgba(255,255,255,0.1);
  }

  .home-play-btn:hover {
    transform: scale(1.1);
  }
  
  .home-info {
    font-size: 1.2em;
    opacity: 0.8;
    position: absolute;
    bottom: 30px;
    bottom: 0;
    text-align: center;
    width: 100%;
    transition: opacity 0.3s ease;
    order: 2;
    margin-top: auto;
    padding: 15px 25px;
    transform: none !important;
  }

  /* ==========================================================================
     29. GESTION DU SCROLL
     ========================================================================== */
    .sequence-scroll-wrapper {
        cursor: grab;
        touch-action: pan-y;
        scroll-snap-type: x mandatory;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        scroll-behavior: smooth;
        padding-bottom: 5px;
        overscroll-behavior-x: contain;
        user-select: none;
    }

    .sequence-scroll-wrapper::-webkit-scrollbar {
        display: none;
        width: 0;
        height: 0;
        background: transparent;
    }

    .sequence-scroll-wrapper.grabbing {
        cursor: grabbing;
        scroll-behavior: auto;
    }
    
    .sequence-scroll-wrapper.demo-scroll {
      cursor: grab !important;
    }
  
    .sequence-scroll-wrapper.demo-scroll.grabbing {
        cursor: grabbing !important;
    }

    #guide-display {
        overflow: hidden;
        overscroll-behavior: contain;
        scrollbar-gutter: stable;
    }

    @media (pointer: coarse) {
        .sequence-scroll-wrapper {
            scroll-padding: 15px;
            touch-action: manipulation;
        }
    }
  
  /* ==========================================================================
     30. FEEDBACK TACTILE
     ========================================================================== */
  .guide-pad-group.active-hit {
    transition: all 0.2s cubic-bezier(0.18, 0.89, 0.32, 1.28);
  }
  
  @media (pointer: coarse) {
    .guide-pad-group.active-hit {
      transform: scale(1.3) !important;
    }
  }
  
  /* ==========================================================================
     31. ANIMATIONS FINALES
     ========================================================================== */
  .go-animation {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 5em;
    font-weight: bold;
    color: #2ecc71;
    text-shadow: 0 0 30px rgba(46, 204, 113, 0.7);
    animation: 
        zoomIn 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        fadeOut 0.5s 0.3s forwards;
    z-index: 1002;
    pointer-events: none;
  }
  
  /* ==========================================================================
     32. DERNIÈRES OPTIMISATIONS
     ========================================================================== */
  body.overlay-active .pad,
  body.overlay-active .control-btn {
    opacity: 0.5;
    pointer-events: none;
    filter: grayscale(100%);
    cursor: not-allowed;
  }
  
  .level-info {
    flex: 1;
    min-width: 0; /* Permet le truncate */
    margin-right: 20px;
    font-size: clamp(0.8rem, 2vw, 1rem); /* Taille responsive */
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    line-clamp: 2; /* Limite à 2 lignes */
    -webkit-box-orient: vertical;
  }
  
  #welcome-message {
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    font-size: 1em;
    color: white;
  }
  
  /* ==========================================================================
     FIN DU FICHIER - 100% COMPLET
     ========================================================================== */

