* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow-x: hidden; /* Permettre le scroll vertical mais pas horizontal */
    background: linear-gradient(135deg, #667eea 0%, #764ba2 25%, #f093fb 50%, #4facfe 75%, #00f2fe 100%);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    min-height: 100vh;
    height: auto;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    touch-action: pan-y; /* Permettre le scroll vertical sur mobile */
    -webkit-user-select: none;
    user-select: none;
    min-width: 500px; /* Largeur minimum sur ordinateur */
}

/* Protection contre le redimensionnement en dessous de 500px sur ordinateur */
@media (min-width: 768px) {
    body {
        min-width: 500px !important;
    }
    
    .screen {
        min-width: 500px !important;
    }
    
    .start-container, .gameover-container {
        min-width: 500px !important;
    }
    
    /* Afficher un message si la fenêtre est trop petite (détecté par JavaScript) */
    #windowSizeError {
        display: none;
    }
}

/* Permettre la sélection pour les inputs */
input {
    -webkit-user-select: text;
    user-select: text;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Particules de fond */
.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

/* Écrans */
.screen {
    position: relative;
    z-index: 10;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease;
}

/* Permettre le scroll sur la page d'accueil */
#startScreen {
    overflow-y: auto;
    overflow-x: hidden;
    align-items: flex-start;
    padding: 20px;
}

#startScreen.hidden {
    display: none;
    opacity: 0;
}

.screen.hidden {
    display: none;
    opacity: 0;
}

/* Écran de démarrage */
.start-container {
    background: rgba(255, 255, 255, 0.95);
    padding: 40px;
    border-radius: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    text-align: center;
    max-width: 600px;
    width: 100%;
    animation: slideIn 0.8s ease;
    backdrop-filter: blur(10px);
    margin: auto;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.game-title {
    font-size: 4em;
    font-weight: bold;
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1, #f093fb);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
    animation: titlePulse 2s ease-in-out infinite;
}

@keyframes titlePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.emoji {
    display: inline-block;
    animation: bounce 1s ease infinite;
}

.emoji:nth-child(2) {
    animation-delay: 0.2s;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.subtitle {
    font-size: 1.5em;
    color: #555;
    margin-bottom: 30px;
    font-style: italic;
}

/* Input container */
.input-container {
    margin: 30px 0;
}

.input-container label {
    display: block;
    font-size: 1.2em;
    color: #333;
    margin-bottom: 10px;
    font-weight: bold;
}

.input-container input {
    width: 100%;
    padding: 15px;
    font-size: 1.2em;
    border: 3px solid #667eea;
    border-radius: 15px;
    outline: none;
    transition: all 0.3s ease;
    text-align: center;
}

.input-container input:focus {
    border-color: #f093fb;
    box-shadow: 0 0 20px rgba(240, 147, 251, 0.5);
    transform: scale(1.05);
}

/* Bouton de démarrage */
.btn-start {
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
    color: white;
    font-size: 1.8em;
    font-weight: bold;
    padding: 20px 50px;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    margin: 20px 0;
}

.btn-start:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
}

.btn-start:active {
    transform: translateY(-2px) scale(1.02);
}

/* Instructions */
.instructions {
    background: linear-gradient(135deg, #667eea22, #f093fb22);
    padding: 20px;
    border-radius: 20px;
    margin: 20px 0;
    border: 2px solid #667eea;
}

.instructions h3 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.5em;
}

.instructions p {
    color: #555;
    margin: 10px 0;
    font-size: 1.1em;
    line-height: 1.6;
}

.instructions h4 {
    color: #667eea;
    margin-top: 15px;
    margin-bottom: 10px;
    font-size: 1.2em;
    font-weight: bold;
    border-bottom: 2px solid #667eea;
    padding-bottom: 5px;
}

.instructions p strong {
    color: #764ba2;
    font-weight: bold;
}

.instructions-basic {
    margin-bottom: 10px;
}

.instructions-detailed {
    margin-top: 15px;
    animation: slideDown 0.3s ease;
}

.instructions-detailed.hidden {
    display: none;
}

/* Bouton pour afficher/masquer les règles */
.btn-toggle-rules {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    font-size: 1em;
    font-weight: 600;
    padding: 10px 20px;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 15px;
    width: 100%;
    max-width: 300px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.3);
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.btn-toggle-rules:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
    border-color: rgba(255, 255, 255, 0.5);
}

.btn-toggle-rules:active {
    transform: translateY(0) scale(1.02);
}

.btn-text-show,
.btn-text-hide {
    display: inline-block;
}

.btn-text-show.hidden,
.btn-text-hide.hidden {
    display: none;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Leaderboard */
.leaderboard {
    background: linear-gradient(135deg, #ffd89b, #19547b);
    padding: 20px;
    border-radius: 20px;
    margin-top: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    margin-bottom: 20px; /* Espacement avec le bouton */
}

.leaderboard h3 {
    color: white;
    margin-bottom: 15px;
    font-size: 1.5em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

#topScores, #topScoresGameOver {
    color: white;
    font-size: 1.1em;
}

.score-entry {
    background: rgba(255, 255, 255, 0.2);
    padding: 10px;
    margin: 8px 0;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    backdrop-filter: blur(5px);
    animation: scoreSlideIn 0.5s ease;
}

@keyframes scoreSlideIn {
    from {
        transform: translateX(-30px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.score-entry.top1 {
    background: linear-gradient(90deg, #FFD700, #FFA500);
    font-weight: bold;
    transform: scale(1.05);
}

.score-rank {
    font-weight: bold;
    margin-right: 10px;
}

.score-name {
    flex: 1;
    text-align: left;
}

.score-points {
    font-weight: bold;
}

/* Écran de jeu */
#gameScreen {
    flex-direction: column;
    justify-content: flex-start;
    padding: 20px;
    overflow: hidden; /* Pas de scroll sur l'écran de jeu */
}

#gameOverScreen {
    overflow: hidden; /* Pas de scroll sur l'écran game over */
}

.game-header {
    display: flex;
    justify-content: space-around;
    width: 100%;
    max-width: 1000px;
    margin-bottom: 20px;
    gap: 20px;
}

.stat-box {
    background: rgba(255, 255, 255, 0.95);
    padding: 15px 30px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 150px;
    animation: statPop 0.5s ease;
}

@keyframes statPop {
    0% { transform: scale(0); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.stat-label {
    font-size: 0.9em;
    color: #666;
    font-weight: bold;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 2em;
    font-weight: bold;
    background: linear-gradient(45deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Canvas */
#gameCanvas {
    border: 5px solid white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    background: linear-gradient(180deg, #a8edea 0%, #fed6e3 100%);
    cursor: none;
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* Larry */
.larry {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    opacity: 1;
    transition: opacity 0.3s ease;
}

/* Larry invisible par défaut jusqu'à l'apparition */
.larry.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Animation d'apparition magique */
.larry.appearing {
    animation: magicAppear 1s ease;
}

@keyframes magicAppear {
    0% {
        opacity: 0;
        transform: translateX(-50%) scale(0.3) rotate(-180deg);
        filter: blur(10px) brightness(2);
    }
    50% {
        transform: translateX(-50%) scale(1.2) rotate(20deg);
        filter: blur(5px) brightness(1.5);
    }
    100% {
        opacity: 1;
        transform: translateX(-50%) scale(1) rotate(0deg);
        filter: blur(0px) brightness(1);
    }
}

/* Animation de disparition magique */
.larry.disappearing {
    animation: magicDisappear 1s ease;
}

@keyframes magicDisappear {
    0% {
        opacity: 1;
        transform: translateX(-50%) scale(1) rotate(0deg);
        filter: blur(0px) brightness(1);
    }
    50% {
        transform: translateX(-50%) scale(1.2) rotate(-20deg);
        filter: blur(5px) brightness(1.5);
    }
    100% {
        opacity: 0;
        transform: translateX(-50%) scale(0.3) rotate(180deg);
        filter: blur(10px) brightness(2);
    }
}

.larry img {
    width: 160px;
    height: auto;
    border-radius: 50%; /* Image arrondie */
    box-shadow: 0 0 30px rgba(102, 126, 234, 0.5);
    animation: larryBounce 1s ease-in-out infinite;
    background: linear-gradient(135deg, rgba(255,255,255,0.2), rgba(255,255,255,0.1));
    border: 3px solid rgba(255, 255, 255, 0.5);
}

/* Icône d'invincibilité en bas de l'écran */
.invincibility-icon {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(240, 248, 255, 0.9));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2em;
    cursor: pointer;
    z-index: 200;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    border: 3px solid rgba(102, 126, 234, 0.5);
    transition: all 0.3s ease;
    opacity: 0;
    pointer-events: none;
}

.invincibility-icon.available {
    opacity: 1;
    pointer-events: auto;
    animation: pulseGlow 1.5s ease-in-out infinite;
    border-color: rgba(102, 126, 234, 0.8);
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.9), rgba(255, 165, 0, 0.9));
}

.invincibility-icon.active {
    opacity: 1;
    pointer-events: auto;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.9), rgba(118, 75, 162, 0.9));
    border-color: rgba(255, 255, 255, 0.9);
    color: white;
    font-weight: bold;
    font-size: 1.2em;
}

.invincibility-icon:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 5px 20px rgba(102, 126, 234, 0.5);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 5px 30px rgba(102, 126, 234, 0.8);
        transform: scale(1.05);
    }
}

@keyframes larryBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.speech-bubble {
    position: absolute;
    bottom: 160px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #ffffff 0%, #f0f8ff 100%);
    padding: 15px 20px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3), 0 0 20px rgba(102, 126, 234, 0.3);
    min-width: 250px;
    max-width: 400px;
    border: 2px solid rgba(102, 126, 234, 0.3);
}

/* Animation pour la bulle quand Larry apparaît */
.larry.appearing .speech-bubble {
    animation: bubbleMagicAppear 1s ease 0.3s backwards;
}

@keyframes bubbleMagicAppear {
    0% { 
        opacity: 0;
        transform: translateX(-50%) scale(0) rotate(-20deg);
    }
    60% { 
        transform: translateX(-50%) scale(1.15) rotate(5deg);
    }
    100% { 
        opacity: 1;
        transform: translateX(-50%) scale(1) rotate(0deg);
    }
}

/* Animation pour la bulle quand Larry disparaît */
.larry.disappearing .speech-bubble {
    animation: bubbleMagicDisappear 1s ease;
}

@keyframes bubbleMagicDisappear {
    0% { 
        opacity: 1;
        transform: translateX(-50%) scale(1) rotate(0deg);
    }
    40% { 
        transform: translateX(-50%) scale(1.1) rotate(-5deg);
    }
    100% { 
        opacity: 0;
        transform: translateX(-50%) scale(0) rotate(20deg);
    }
}

.speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 20px solid transparent;
    border-right: 20px solid transparent;
    border-top: 20px solid white;
}

.speech-bubble p {
    color: #333;
    font-size: 1.1em;
    font-weight: bold;
    text-align: center;
    margin: 0;
}

/* Écran Game Over */
.gameover-container {
    background: rgba(255, 255, 255, 0.95);
    padding: 40px;
    border-radius: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    text-align: center;
    max-width: 600px;
    animation: gameOverShake 0.5s ease;
}

@keyframes gameOverShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.gameover-title {
    font-size: 4em;
    font-weight: bold;
    color: #ff6b6b;
    margin-bottom: 20px;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.3);
    animation: gameOverPulse 1s ease infinite;
}

@keyframes gameOverPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.final-score {
    background: linear-gradient(135deg, #667eea, #764ba2);
    padding: 30px;
    border-radius: 20px;
    margin: 20px 0;
    color: white;
}

.final-score p {
    font-size: 1.2em;
    margin-bottom: 10px;
}

.final-score span {
    font-size: 3em;
    font-weight: bold;
    display: block;
}

.player-rank {
    font-size: 1.5em;
    font-weight: bold;
    color: #667eea;
    margin: 15px 0;
    padding: 15px 25px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(240, 147, 251, 0.1));
    border-radius: 15px;
    border: 2px solid #667eea;
    animation: rankPulse 1.5s ease infinite;
}

@keyframes rankPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3); }
    50% { transform: scale(1.02); box-shadow: 0 8px 20px rgba(102, 126, 234, 0.5); }
}

.gameover-message {
    font-size: 1.3em;
    color: #555;
    margin: 20px 0;
    font-style: italic;
}

.buttons-container {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin: 30px 0;
}

.btn-action {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    font-size: 1.3em;
    font-weight: bold;
    padding: 15px 30px;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.btn-action:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
}

.btn-action:active {
    transform: translateY(-1px);
}

/* Animations de score */
@keyframes scoreIncrease {
    0% { transform: scale(1); }
    50% { transform: scale(1.5); color: #4ecdc4; }
    100% { transform: scale(1); }
}

.score-animation {
    animation: scoreIncrease 0.3s ease;
}

/* Animation de vie perdue */
@keyframes lifeLost {
    0% { transform: scale(1); }
    25% { transform: scale(0.8); color: #ff6b6b; }
    50% { transform: scale(1.2); }
    75% { transform: scale(0.9); }
    100% { transform: scale(1); }
}

.life-lost-animation {
    animation: lifeLost 0.5s ease;
}

/* Animation de vie gagnée */
@keyframes lifeGained {
    0% { transform: scale(1); }
    25% { transform: scale(1.3); color: #4ecdc4; }
    50% { transform: scale(1.5); color: #ff6b6b; }
    75% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.life-gained-animation {
    animation: lifeGained 0.5s ease;
}

/* Responsive */
@media (max-width: 1200px) {
    .game-title {
        font-size: 3em;
    }
    
    .start-container, .gameover-container {
        max-width: 90%;
        padding: 30px;
    }
}

@media (max-width: 768px) {
    .game-title {
        font-size: 2.2em;
    }
    
    .subtitle {
        font-size: 1.2em;
    }
    
    .start-container, .gameover-container {
        padding: 20px;
        margin: 10px;
        max-width: 95%;
    }
    
    .btn-start {
        font-size: 1.4em;
        padding: 15px 40px;
    }
    
    .btn-action {
        font-size: 1.1em;
        padding: 12px 25px;
    }
    
    .game-header {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 10px;
        margin-bottom: 15px;
    }
    
    .stat-box {
        padding: 10px 20px;
        min-width: 100px;
    }
    
    .stat-label {
        font-size: 0.8em;
    }
    
    .stat-value {
        font-size: 1.5em;
    }
    
    #gameCanvas {
        max-width: 95%;
        width: 95%;
        height: auto;
    }
    
    .instructions h3 {
        font-size: 1.3em;
    }
    
    .instructions p {
        font-size: 1em;
    }
    
    .leaderboard {
        padding: 15px;
    }
    
    .leaderboard h3 {
        font-size: 1.3em;
    }
    
    .larry {
        bottom: 10px;
    }
    
    .larry img {
        width: 120px;
        border-radius: 50%;
    }
    
    .invincibility-icon {
        width: 50px;
        height: 50px;
        font-size: 1.5em;
        bottom: 15px;
        right: 15px;
    }
    
    .speech-bubble {
        bottom: 130px;
        min-width: 200px;
        max-width: 90vw;
        padding: 12px 15px;
    }
    
    .speech-bubble p {
        font-size: 0.95em;
    }
    
    .gameover-title {
        font-size: 3em;
    }
    
    .final-score {
        padding: 20px;
    }
    
    .final-score span {
        font-size: 2.5em;
    }
    
    .player-rank {
        font-size: 1.3em;
        padding: 12px 20px;
    }
    
    .gameover-message {
        font-size: 1.1em;
    }
    
    .buttons-container {
        flex-direction: column;
        gap: 15px;
    }
    
    .btn-action {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .game-title {
        font-size: 1.8em;
    }
    
    .subtitle {
        font-size: 1em;
    }
    
    .btn-start {
        font-size: 1.2em;
        padding: 12px 30px;
    }
    
    .input-container input {
        font-size: 16px; /* 16px minimum pour éviter le zoom automatique sur iOS */
        padding: 12px;
    }
    
    .game-header {
        gap: 8px;
    }
    
    .stat-box {
        padding: 8px 15px;
        min-width: 80px;
    }
    
    .stat-label {
        font-size: 0.7em;
    }
    
    .stat-value {
        font-size: 1.2em;
    }
    
    .instructions {
        padding: 15px;
    }
    
    .instructions h3 {
        font-size: 1.1em;
    }
    
    .instructions p {
        font-size: 0.9em;
    }
    
    .larry img {
        width: 100px;
        border-radius: 50%;
    }
    
    .invincibility-icon {
        width: 45px;
        height: 45px;
        font-size: 1.3em;
        bottom: 10px;
        right: 10px;
    }
    
    .speech-bubble {
        bottom: 100px;
        min-width: 180px;
        padding: 10px 12px;
    }
    
    .speech-bubble p {
        font-size: 0.85em;
    }
    
    .gameover-title {
        font-size: 2.5em;
    }
    
    .final-score {
        padding: 15px;
    }
    
    .final-score p {
        font-size: 1em;
    }
    
    .final-score span {
        font-size: 2em;
    }
    
    .player-rank {
        font-size: 1.1em;
        padding: 10px 15px;
    }
    
    .leaderboard {
        padding: 12px;
    }
    
    .leaderboard h3 {
        font-size: 1.1em;
    }
    
    .score-entry {
        padding: 8px;
        font-size: 0.9em;
    }
}

/* Orientation paysage mobile */
@media (max-height: 600px) and (orientation: landscape) {
    .start-container, .gameover-container {
        padding: 15px;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .game-title {
        font-size: 2em;
        margin-bottom: 10px;
    }
    
    .subtitle {
        font-size: 1em;
        margin-bottom: 15px;
    }
    
    .instructions {
        padding: 10px;
        margin: 10px 0;
    }
    
    .leaderboard {
        padding: 10px;
        margin-top: 10px;
    }
    
    .game-header {
        margin-bottom: 10px;
    }
    
    .larry {
        bottom: 5px;
    }
    
    .larry img {
        width: 100px;
        border-radius: 50%;
    }
    
    .speech-bubble {
        bottom: 60px;
        padding: 8px 10px;
    }
    
    .speech-bubble p {
        font-size: 0.8em;
    }
}

/* Bouton pour voir les scores élevés */
.btn-high-scores {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    background-size: 200% 200%;
    animation: gradientShiftButton 3s ease infinite;
    color: white;
    font-size: 1.3em;
    font-weight: 800;
    padding: 18px 35px;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 
        0 10px 30px rgba(102, 126, 234, 0.5),
        0 5px 15px rgba(118, 75, 162, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    margin-top: 25px;
    width: 100%;
    max-width: 450px;
    text-shadow: 
        2px 2px 4px rgba(0, 0, 0, 0.4),
        0 0 10px rgba(255, 255, 255, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.4);
    display: block;
    margin-left: auto;
    margin-right: auto;
    position: relative;
    overflow: hidden;
    letter-spacing: 1px;
}

/* Animation de gradient pour le bouton */
@keyframes gradientShiftButton {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Effet de brillance au survol */
.btn-high-scores::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    transition: left 0.5s ease;
}

.btn-high-scores:hover::before {
    left: 100%;
}

.btn-high-scores:hover {
    transform: translateY(-5px) scale(1.08);
    box-shadow: 
        0 15px 40px rgba(102, 126, 234, 0.6),
        0 10px 25px rgba(118, 75, 162, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.4),
        0 0 30px rgba(240, 147, 251, 0.5);
    border-color: rgba(255, 255, 255, 0.6);
    text-shadow: 
        2px 2px 6px rgba(0, 0, 0, 0.5),
        0 0 15px rgba(255, 255, 255, 0.5);
}

.btn-high-scores:active {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 
        0 8px 25px rgba(102, 126, 234, 0.5),
        0 5px 15px rgba(118, 75, 162, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    transition: all 0.1s ease;
}

/* Animation de pulsation subtile */
@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 
            0 10px 30px rgba(102, 126, 234, 0.5),
            0 5px 15px rgba(118, 75, 162, 0.4),
            inset 0 1px 0 rgba(255, 255, 255, 0.3),
            0 0 20px rgba(102, 126, 234, 0.3);
    }
    50% {
        box-shadow: 
            0 10px 30px rgba(102, 126, 234, 0.6),
            0 5px 15px rgba(118, 75, 162, 0.5),
            inset 0 1px 0 rgba(255, 255, 255, 0.3),
            0 0 30px rgba(102, 126, 234, 0.4);
    }
}

.btn-high-scores:not(:hover):not(:active) {
    animation: pulseGlow 2s ease-in-out infinite;
}

/* S'assurer que le bouton n'apparaît pas dans la page de jeu */
#gameScreen .btn-high-scores {
    display: none !important;
}

/* Modale pour les scores élevés */
.modal {
    display: flex;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

.modal.hidden {
    display: none;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(240, 248, 255, 0.95));
    margin: auto;
    padding: 40px;
    border-radius: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    max-width: 700px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    animation: slideDown 0.3s ease;
    backdrop-filter: blur(10px);
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 25px;
    color: #667eea;
    font-size: 3em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    line-height: 0.5;
}

.modal-close:hover {
    color: #ff6b6b;
    transform: scale(1.2) rotate(90deg);
}

.modal-content h2 {
    color: #667eea;
    text-align: center;
    margin-bottom: 30px;
    font-size: 2em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.high-scores-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 60vh;
    overflow-y: auto;
    padding: 10px;
}

/* Tableau des scores */
.scores-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.scores-table thead {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.scores-table th {
    padding: 15px 10px;
    text-align: left;
    font-weight: bold;
    font-size: 1.1em;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    border-bottom: 2px solid rgba(255, 255, 255, 0.3);
}

.scores-table th:first-child {
    padding-left: 20px;
    width: 80px;
}

.scores-table th:nth-child(2) {
    width: auto;
}

.scores-table th:nth-child(3) {
    text-align: center;
    width: 120px;
}

.scores-table th:nth-child(4) {
    text-align: center;
    width: 120px;
}

.scores-table tbody tr {
    transition: all 0.3s ease;
    animation: scoreSlideIn 0.5s ease;
    animation-fill-mode: both;
}

.scores-table tbody tr:nth-child(1) { animation-delay: 0.1s; }
.scores-table tbody tr:nth-child(2) { animation-delay: 0.15s; }
.scores-table tbody tr:nth-child(3) { animation-delay: 0.2s; }
.scores-table tbody tr:nth-child(4) { animation-delay: 0.25s; }
.scores-table tbody tr:nth-child(5) { animation-delay: 0.3s; }
.scores-table tbody tr:nth-child(6) { animation-delay: 0.35s; }
.scores-table tbody tr:nth-child(7) { animation-delay: 0.4s; }
.scores-table tbody tr:nth-child(8) { animation-delay: 0.45s; }
.scores-table tbody tr:nth-child(9) { animation-delay: 0.5s; }
.scores-table tbody tr:nth-child(10) { animation-delay: 0.55s; }

.scores-table tbody tr:nth-child(even) {
    background: rgba(102, 126, 234, 0.05);
}

.scores-table tbody tr:hover {
    background: rgba(102, 126, 234, 0.15);
    transform: scale(1.02);
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.2);
}

.scores-table tbody tr.top-score {
    background: linear-gradient(90deg, rgba(255, 215, 0, 0.2), rgba(255, 165, 0, 0.2));
    font-weight: bold;
    font-size: 1.1em;
}

.scores-table tbody tr.second-score {
    background: linear-gradient(90deg, rgba(192, 192, 192, 0.2), rgba(211, 211, 211, 0.2));
    font-weight: 600;
}

.scores-table tbody tr.third-score {
    background: linear-gradient(90deg, rgba(205, 127, 50, 0.2), rgba(222, 184, 135, 0.2));
    font-weight: 600;
}

.scores-table td {
    padding: 12px 10px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.scores-table td:first-child {
    padding-left: 20px;
    font-weight: bold;
}

.scores-table .rank-cell {
    font-size: 1.1em;
}

.scores-table .name-cell {
    font-weight: 500;
    color: #333;
}

.scores-table .score-cell {
    text-align: center;
    font-weight: bold;
    color: #667eea;
    font-size: 1.1em;
}

.scores-table .date-cell {
    text-align: center;
    color: #666;
    font-size: 0.9em;
}

@keyframes scoreSlideIn {
    from {
        transform: translateX(-30px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.score-date {
    font-size: 0.9em;
    color: #666;
    font-style: italic;
    margin-left: 10px;
}

@media (max-width: 768px) {
    .modal-content {
        padding: 30px 20px;
        max-width: 95%;
    }
    
    .modal-content h2 {
        font-size: 1.5em;
    }
    
    .modal-close {
        font-size: 2.5em;
        top: 10px;
        right: 15px;
    }
    
    .btn-high-scores {
        font-size: 1.1em;
        padding: 16px 30px;
        max-width: 100%;
    }
    
    .scores-table {
        font-size: 0.9em;
    }
    
    .scores-table th {
        padding: 12px 8px;
        font-size: 1em;
    }
    
    .scores-table td {
        padding: 10px 8px;
    }
    
    .scores-table th:first-child {
        padding-left: 10px;
        width: 60px;
    }
    
    .scores-table th:nth-child(3),
    .scores-table th:nth-child(4) {
        width: 100px;
    }
}

