        /* Base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
.footer-info {
    margin-top: 20px;
    font-size: 12px;
    font-weight: 500;
    color: gray;
    text-align: center;
}


body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    margin-top:-20px;
}

.game-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    padding: 32px;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    
}

/* Game header */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    padding: 0 20px;
}

.score-display, .timer-display, .lives-display, .wpm-display, .accuracy-display {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 24px;
    font-weight: bold;
    padding: 10px 20px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.score-display i { color: #f59e0b; }
.timer-display i { color: #3b82f6; }
.lives-display i { color: #ef4444; }
.wpm-display i { color: #10b981; }
.accuracy-display i { color: #8b5cf6; }

/* Word display */
.word-display {
    background-color: #46474a;
    padding: 40px;
    border-radius: 8px;
    margin-bottom: 24px;
    min-height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

#current-word {
    text-align: center;
    width: 100%;
    font-size: 48px;
    letter-spacing: 2px;
}

.letter {
    display: inline-block;
    margin: 0 3px;
    transition: all 0.2s ease;
    position: relative;
}

.letter.correct { 
    color: #22c55e;
    transform: scale(1.1);
}

.letter.incorrect { 
    color: #ef4444;
    animation: shake 0.2s ease-in-out;
}

.letter.waiting { 
    color: white;
}

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

/* Input field */
#word-input {
    width: 80%;
    max-width: 800px;
    padding: 20px;
    font-size: 24px;
    border: 3px solid #d1d5db;
    border-radius: 12px;
    margin: 0 auto 24px;
    display: block;
    text-align: center;
    transition: all 0.3s ease;
}

#word-input:focus {
    outline: none;
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

#word-input.correct {
    border-color: #22c55e;
    background-color: rgba(34, 197, 94, 0.1);
}

/* Stats display */
.stats-container {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
}



.state-box {
    background: #f3f4f6;
    padding: 15px 25px;
    border-radius: 8px;
    text-align: center;
}

/* Buttons */
.button-container {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
}

button {
    background-color: #10b981;
    color: white;
    border: none;
    padding: 16px 32px;
    font-size: 18px;
    font-weight: bold;
    border-radius: 9999px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

button:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

button.practice {
    background-color: #8b5cf6;
}

button.practice:hover {
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.2);
}

/* Progress bar */
.progress-bar {
    width: 100%;
    height: 8px;
    background-color: #e5e7eb;
    border-radius: 9999px;
    overflow: hidden;
    margin-top: 24px;
}

.progress-fill {
    height: 100%;
    background-color: #7c3aed;
    width: 0;
    transition: all 0.3s ease;
}

/* Animations */
.level-up-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(124, 58, 237, 0.9);
    color: white;
    padding: 20px 40px;
    border-radius: 12px;
    font-size: 32px;
    font-weight: bold;
    animation: fadeInOut 2s ease-in-out forwards;
    z-index: 1000;
}

.high-score-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(245, 158, 11, 0.9);
    color: white;
    padding: 20px 40px;
    border-radius: 12px;
    font-size: 32px;
    font-weight: bold;
    animation: fadeInOut 2s ease-in-out forwards;
    z-index: 1000;
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
    20% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
    80% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
}

/* Timer warning animation */
.timer-display.warning {
    animation: pulse 1s ease-in-out infinite;
    color: #ef4444;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Responsive design */
@media (max-width: 768px) {
    .game-container {
        padding: 16px;
    }

    .game-header {
        flex-direction: column;
        gap: 10px;
    }

    #current-word {
        font-size: 32px;
    }

    #word-input {
        width: 95%;
        font-size: 20px;
    }

    .button-container {
        flex-direction: column;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .game-container {
        background: #1f2937;
        color: white;
    }

    .word-display {
        background-color: #374151;
    }

    #word-input {
        background-color: #374151;
        color: white;
        border-color: #4b5563;
    }

    #word-input:focus {
        border-color: #8b5cf6;
    }

    
}

/* Responsive design */
/* Pour les grands écrans */
@media (min-width: 1920px) {
    .game-container {
        transform: scale(0.9);  /* Augmenté de 0.8 */
        margin-top: 3vh;
    }
}

/* Pour les écrans moyens */
@media (max-width: 1600px) {
    .game-container {
        transform: scale(0.8);  /* Augmenté de 0.7 */
        margin-top: -10vh;
    }
}

/* Pour les écrans plus petits */
@media (max-width: 1366px) {
    .game-container {
        transform: scale(0.75);  /* Augmenté de 0.65 */
        margin-top: -12vh;
    }
}

/* Pour les écrans encore plus petits */
@media (max-width: 1024px) {
    .game-container {
        transform: scale(0.7);  /* Augmenté de 0.6 */
        margin-top: -15vh;
    }
}

/* Pour les tablettes */
@media (max-width: 768px) {
    .game-container {
        transform: scale(0.65);  /* Augmenté de 0.55 */
        margin-top: -18vh;
        padding: 16px;
    }
    .game-header {
        flex-direction: column;
        gap: 8px;
    }
    #current-word {
        font-size: 28px;
    }
    #word-input {
        width: 95%;
        font-size: 18px;
    }
    .button-container {
        flex-direction: column;
    }
}

/* Pour les petites tablettes et grands téléphones */
@media (max-width: 600px) {
    .game-container {
        transform: scale(0.6);  /* Augmenté de 0.5 */
        margin-top: -20vh;
    }
}

/* Pour les téléphones */
@media (max-width: 480px) {
    .game-container {
        transform: scale(0.55);  /* Augmenté de 0.45 */
        margin-top: -25vh;
    }
}

/* Ajustements pour différentes hauteurs d'écran */
@media (max-height: 900px) {
    .game-container {
        transform: scale(0.7);  /* Augmenté de 0.6 */
        margin-top: -15vh;
    }
}

@media (max-height: 700px) {
    .game-container {
        transform: scale(0.6);  /* Augmenté de 0.5 */
        margin-top: -20vh;
    }
}

@media (max-height: 600px) {
    .game-container {
        transform: scale(0.55);  /* Augmenté de 0.45 */
        margin-top: -25vh;
        max-width:1286px;
        width:100%;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .game-container {
        background: #1f2937;
        color: white;
    }
    .word-display {
        background-color: #374151;
    }
    #word-input {
        background-color: #374151;
        color: white;
        border-color: #4b5563;
    }
    #word-input:focus {
        border-color: #8b5cf6;
    }
   
    
 
}

.category-select {
   margin: 0 auto 20px;
   width: 80%;
   max-width: 400px;
   display: flex;
   justify-content: center;
   align-items: center;
}

.category-dropdown {
   width: 100%;
   padding: 12px 15px;
   border-radius: 8px;
   font-size: 22px;
   background: linear-gradient(135deg, #7c3aed, #4c1d95); /* Violet gradient */
   border: 2px solid #6d28d9;
   color: white;
   text-align: center;
   transition: all 0.3s ease;
   cursor: pointer;
   outline: none;
   box-shadow: 0 4px 6px rgba(0,0,0,0.1);
   height: 71px;
}

.category-dropdown:hover {
   background: linear-gradient(135deg, #6b21a8, #4c1d95); /* Darker violet on hover */
   border-color: #5b21b6;
}

.category-dropdown:focus {
   border-color: #8b5cf6;
   box-shadow: 0 0 0 4px rgba(139,92,246,0.3);
}

.category-dropdown option {
   padding: 8px;
   font-size: 15px;
   color: white;
   background: #4c1d95; /* Same background as dropdown */
   text-align: center;
}



.stats-container {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
}

.stat-box {
    background: linear-gradient(135deg, #7c3aed, #4c1d95); /* Violet dégradé */
    padding: 20px 30px;
    border-radius: 10px;
    text-align: center;
    color: white; /* Texte blanc */
    font-weight: bold; /* Texte en gras */
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); /* Ombre légère */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-box h3 {
    font-size: 18px;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-box p {
    font-size: 24px;
    margin: 0;
}

.stat-box:hover {
    transform: scale(1.05); /* Zoom léger au survol */
    box-shadow: 0 6px 10px rgba(0, 0, 0, 0.2); /* Ombre plus prononcée */
}




</style>
<script>
const GAME_CONFIG = <?php echo isset($_SESSION['user_id']) ? json_encode([
    'userId' => $_SESSION['user_id'],
    'username' => $_SESSION['username']
]) : '{}'; ?>;
</script>
</head>
<body>

<script>

</script>
<!-- Add modal HTML -->
<?php if ($showModal): ?>
<div id="loginModal" class="modal">
   <div class="modal-content">
       <span class="close">&times;</span>
       <p>Veuillez vous inscrire et connectez vous afin de pouvoir jouer à iKateli !</p>
   </div>
</div>
<?php endif; ?>

<style>
.modal {
   display: flex;
   position: fixed;
   top: 0;
   left: 0;
   width: 100%;
   height: 100%;
   background-color: rgba(0,0,0,0.7);
   align-items: center;
   justify-content: center;
   z-index: 1000;
}

.modal-content {
   background: linear-gradient(to bottom, #6b4fbb, #563d99);
   color: white;
   padding: 25px 35px;
   border-radius: 8px;
   text-align: center;
   position: relative;
   max-width: 450px;
   box-shadow: 0 4px 15px rgba(0,0,0,0.2);

}

.close {
   position: absolute;
   right: 12px;
   top: 8px;
   font-size: 22px;
   color: #fff;
   cursor: pointer;
   opacity: 0.8;
   transition: opacity 0.2s;
}

.close:hover {
   opacity: 1;
}

.modal p {
   font-size: 16px;
   line-height: 1.5;
   margin: 10px 0;
}

/* Styles pour la visite guidée */
#guide-overlay {
    display: none; /* Masqué par défaut */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7); /* Fond semi-transparent */
    z-index: 1000; /* Au-dessus de tout le contenu */
    pointer-events: none; /* Permet de cliquer à travers l'overlay */
}

#guide-content {
    background-color: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    max-width: 400px;
    width: 90%;
    text-align: center;
    position: absolute; /* Position absolue pour un positionnement dynamique */
    z-index: 1001; /* Au-dessus de l'overlay */
    pointer-events: auto; /* Permet d'interagir avec la visite guidée */
}

#guide-title {
    font-size: 24px;
    font-weight: bold;
    color: #4c1d95; /* Couleur violette pour correspondre au thème */
    margin-bottom: 10px;
}

#guide-text {
    font-size: 16px;
    color: #333;
    margin-bottom: 20px;
}

.guide-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.guide-buttons button {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#next-button {
    background-color: #4CAF50; /* Vert */
    color: white;
}

#next-button:hover {
    background-color: #45a049; /* Vert plus foncé au survol */
}

#quit-button {
    background-color: #f44336; /* Rouge */
    color: white;
}

#quit-button:hover {
    background-color: #e53935; /* Rouge plus foncé au survol */
}

/* Mise en évidence de l'élément visité */
.highlight {
    position: relative;
    z-index: 1002; /* Au-dessus de l'overlay et de la visite guidée */
    border: 2px solid #4CAF50; /* Bordure verte */
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.5); /* Ombre verte */
    border-radius: 8px;
}
