/* Variables et réinitialisation */
:root {
    --primary-color: #6a4cff;
    --primary-light: #9e8bff;
    --primary-dark: #4a2ddb;
    --secondary-color: #ff6b6b;
    --secondary-light: #ff9e9e;
    --secondary-dark: #e04747;
    --accent-color: #4cd964;
    --accent-light: #7ee695;
    --accent-dark: #37a64a;
    --background-color: #f8f7ff;
    --card-color: #ffffff;
    --text-color: #333333;
    --text-light: #666666;
    --border-radius: 16px;
    --shadow: 0 8px 16px rgba(106, 76, 255, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Baloo 2', cursive;
}

body {
    background-color: var(--background-color);
    background-image: url('assets/background-pattern.svg');
    background-size: 200px;
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
}

/* Container principal */
.container {
    width: 100%;
    max-width: 1000px;
    margin: 20px;
    margin-bottom: 60px; /* Espace pour le footer */
    position: relative;
    overflow: hidden;
}

/* Footer */
.footer {
    text-align: center;
    padding: 15px;
    margin-top: 20px;
    color: var(--text-light);
    font-size: 14px;
    width: 100%;
    position: fixed;
    bottom: 0;
    left: 0;
    background-color: var(--background-color);
}

/* Écrans */
.screen {
    display: none;
    background-color: var(--card-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 30px;
    animation: fadeIn 0.5s ease-in-out;
}

.screen.active {
    display: block;
}

.screen-title {
    text-align: center;
    margin-bottom: 30px;
    color: var(--primary-color);
    font-size: 2.2rem;
}

/* Écran d'accueil */
#welcome-screen {
    text-align: center;
    padding: 40px;
}

.logo-container {
    margin-bottom: 30px;
}

.game-title {
    font-size: 4rem;
    color: var(--primary-color);
    text-shadow: 3px 3px 0 var(--primary-light);
    margin-bottom: 10px;
    animation: pulse 2s infinite;
}

.game-subtitle {
    font-size: 1.5rem;
    color: var(--text-light);
}

.mascot {
    margin: 20px 0;
}

.mascot img {
    width: 200px;
    height: auto;
    animation: bounce 2s infinite;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-width: 400px;
    margin: 0 auto;
}

/* Boutons */
.btn {
    padding: 15px 25px;
    border-radius: 50px;
    border: none;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    /* Amélioration pour écrans tactiles */
    min-height: 50px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* Styles généraux pour les éléments interactifs */
.interactive-element {
    cursor: pointer;
    transition: all 0.2s ease;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.interactive-element:hover {
    transform: scale(1.05);
}

/* Styles tactiles pour mobile */
@media (max-width: 480px) {
    .interactive-element:active {
        transform: scale(0.95);
        opacity: 0.9;
    }
    
    .btn:active,
    .answer-option:active,
    .category-card:active,
    .avatar:active,
    .age-btn:active {
        transform: scale(0.95);
    }
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.btn:active {
    transform: translateY(0);
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background-color: var(--secondary-dark);
}

.btn-text {
    background: none;
    color: var(--primary-color);
    padding: 10px;
    font-size: 1rem;
}

.btn-text:hover {
    color: var(--primary-dark);
    background-color: rgba(106, 76, 255, 0.05);
    transform: translateY(0);
    box-shadow: none;
}

/* Écran de saisie des joueurs */
.players-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.player-form {
    background-color: rgba(106, 76, 255, 0.05);
    border-radius: var(--border-radius);
    padding: 20px;
    width: 45%;
    transition: all 0.3s ease;
}

.solo-form {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
}

.player-form:hover {
    box-shadow: 0 5px 15px rgba(106, 76, 255, 0.1);
}

.vs-divider {
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    font-weight: bold;
    color: var(--secondary-color);
    width: 10%;
}

.avatar-selection {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.2s ease;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.avatar:hover {
    transform: scale(1.1);
}

.avatar.selected {
    border-color: var(--primary-color);
    transform: scale(1.1);
}

@media (max-width: 480px) {
    .avatar:active {
        transform: scale(0.95);
    }
}

.input-group {
    margin-bottom: 15px;
}

.input-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: var(--text-color);
}

.input-field {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

.input-field:focus {
    border-color: var(--primary-color);
    outline: none;
}

.age-selector {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 5px;
}

.age-btn {
    flex: 1;
    min-width: 40px;
    padding: 8px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.age-btn:hover {
    border-color: var(--primary-light);
}

.age-btn.selected {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

@media (max-width: 480px) {
    .age-btn:active {
        transform: scale(0.95);
    }
}

#start-game-btn, #start-solo-game-btn {
    display: block;
    margin: 0 auto 20px;
    width: 100%;
    max-width: 300px;
}

/* Écran de sélection de catégorie */
.categories-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

#start-category-game-btn {
    display: block;
    margin: 30px auto 20px;
    padding: 15px 30px;
    font-size: 1.2rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

#start-category-game-btn:hover:not(:disabled) {
    background-color: var(--primary-dark);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

#start-category-game-btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    opacity: 0.7;
}

.category-card {
    background-color: white;
    border-radius: var(--border-radius);
    padding: 20px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    cursor: pointer;
    transition: all 0.3s ease;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.category-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

@media (max-width: 480px) {
    .category-card:active {
        transform: translateY(0);
        background-color: rgba(106, 76, 255, 0.05);
    }
}

.category-card.selected {
    background-color: var(--primary-light);
    color: white;
    border: 3px solid var(--primary-dark);
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}

.category-icon {
    font-size: 2.5rem;
    margin-bottom: 15px;
    color: var(--primary-color);
}

.category-card.selected .category-icon {
    color: white;
}

.category-card h3 {
    font-size: 1.2rem;
}

/* Écran de jeu */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px dashed #e0e0e0;
    flex-wrap: wrap;
}

.solo-header {
    justify-content: center;
}

.player-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.player-avatar img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 3px solid var(--primary-color);
}

.player-details h3 {
    font-size: 1.2rem;
    margin-bottom: 5px;
}

.score-container {
    font-size: 1.1rem;
    color: var(--text-light);
}

.score-container span {
    font-weight: bold;
    color: var(--primary-color);
}

.vs-badge {
    background-color: var(--secondary-color);
    color: white;
    font-weight: bold;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 1.2rem;
}

.game-content {
    margin-bottom: 30px;
}

.question-container {
    background-color: rgba(106, 76, 255, 0.05);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 20px;
    overflow-wrap: break-word;
    word-break: break-word;
}

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.category-badge {
    background-color: var(--primary-color);
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
}

.question-number {
    color: var(--text-light);
    font-size: 0.9rem;
}

.question-text {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 20px;
    line-height: 1.4;
}

.question-image-container {
    text-align: center;
    margin-bottom: 20px;
    display: none;
}

.question-image-container img {
    max-width: 100%;
    max-height: 200px;
    border-radius: 10px;
    object-fit: contain;
}

@media (max-width: 480px) {
    .question-image-container img {
        max-height: 150px;
    }
}

.answers-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.answer-option {
    background-color: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.answer-option:hover {
    border-color: var(--primary-color);
    transform: translateY(-3px);
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.05);
}

@media (max-width: 480px) {
    .answer-option {
        padding: 12px 15px;
    }
    
    .answer-letter {
        margin-right: 10px;
    }
    
    .answer-text {
        flex: 1;
    }
}

.answer-option.selected {
    border-color: var(--primary-color);
    background-color: rgba(106, 76, 255, 0.05);
}

.answer-option.correct {
    border-color: var(--accent-color);
    background-color: rgba(76, 217, 100, 0.1);
}

.answer-option.incorrect {
    border-color: var(--secondary-color);
    background-color: rgba(255, 107, 107, 0.1);
}

.answer-letter {
    background-color: var(--primary-light);
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    margin-right: 15px;
    flex-shrink: 0;
}

.answer-text {
    font-size: 1.1rem;
}

.game-footer {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.timer-container {
    text-align: center;
}

.timer-bar {
    height: 10px;
    background-color: #e0e0e0;
    border-radius: 5px;
    margin-bottom: 5px;
    overflow: hidden;
}

.timer-progress {
    height: 100%;
    background-color: var(--primary-color);
    width: 100%;
    transition: width 1s linear;
}

.timer-text {
    font-size: 0.9rem;
    color: var(--text-light);
}

.turn-indicator {
    text-align: center;
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--primary-color);
    animation: pulse 1.5s infinite;
}

/* Écran de résultat */
.results-container {
    background-color: rgba(106, 76, 255, 0.05);
    border-radius: var(--border-radius);
    padding: 30px;
    margin-bottom: 30px;
}

.winner-announcement {
    text-align: center;
    margin-bottom: 30px;
}

.winner-crown {
    font-size: 3rem;
    color: gold;
    margin-bottom: 10px;
    animation: bounce 2s infinite;
}

.winner-text {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--primary-color);
}

.players-results {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 20px;
}

.player-result {
    text-align: center;
    padding: 20px;
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    min-width: 200px;
}

.solo-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

.solo-result {
    display: flex;
    align-items: center;
    text-align: left;
    width: 100%;
    max-width: 500px;
}

.player-result-details {
    margin-top: 15px;
}

.final-score {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.correct-answers {
    color: var(--text-light);
}

.performance-message {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--accent-color);
    text-align: center;
    padding: 15px;
    background-color: rgba(76, 217, 100, 0.1);
    border-radius: var(--border-radius);
    width: 100%;
}

.result-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
}

/* Animations et effets */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    display: none;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background-color: var(--primary-color);
    opacity: 0.8;
    animation: fall 5s linear forwards;
}

.feedback-animation {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 5rem;
    z-index: 1000;
    display: none;
    animation: zoom 0.5s ease-in-out;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

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

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

@keyframes fall {
    0% { transform: translateY(-100vh) rotate(0deg); }
    100% { transform: translateY(100vh) rotate(360deg); }
}

@keyframes zoom {
    0% { transform: translate(-50%, -50%) scale(0); }
    50% { transform: translate(-50%, -50%) scale(1.2); }
    100% { transform: translate(-50%, -50%) scale(1); }
}

/* Responsive */
/* Tablettes */
@media (max-width: 768px) {
    .container {
        margin: 10px;
        max-width: 95%;
    }

    .screen {
        padding: 20px;
    }

    .game-title {
        font-size: 3rem;
    }

    .players-container {
        flex-direction: column;
        gap: 20px;
    }

    .player-form {
        width: 100%;
    }

    .vs-divider {
        margin: 10px 0;
    }

    .categories-container {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 15px;
    }

    .answers-container {
        grid-template-columns: 1fr 1fr;
        gap: 15px;
    }

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

    .vs-badge {
        margin: 10px 0;
    }

    .players-results {
        flex-direction: column;
    }

    .result-buttons {
        flex-direction: column;
        align-items: center;
    }
}

/* Smartphones */
@media (max-width: 480px) {
    body {
        font-size: 14px;
        line-height: 1.4;
    }
    
    .footer {
        padding: 8px;
        font-size: 12px;
    }
    
    .container {
        margin: 5px;
        margin-bottom: 40px; /* Espace réduit pour le footer sur mobile */
        max-width: 100%;
    }

    .screen {
        padding: 15px;
        border-radius: 12px;
    }

    .screen-title {
        font-size: 1.8rem;
        margin-bottom: 20px;
        line-height: 1.2;
    }

    .game-title {
        font-size: 2.5rem;
        line-height: 1.1;
    }

    .game-subtitle {
        font-size: 1.2rem;
        line-height: 1.3;
        margin-bottom: 10px;
    }

    .mascot img {
        width: 150px;
    }

    /* Optimisation des boutons pour mobile */
    .btn {
        padding: 14px 20px;
        font-size: 1.1rem;
        width: 100%;
        max-width: 300px;
        margin: 5px auto;
    }

    .btn-text {
        padding: 12px;
        margin-top: 10px;
    }

    .menu-buttons {
        gap: 10px;
    }

    /* Optimisation des catégories pour mobile */
    .categories-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .category-card {
        padding: 15px 10px;
        min-height: 90px;
    }

    .category-icon {
        font-size: 1.8rem;
        margin-bottom: 5px;
    }

    .category-card h3 {
        font-size: 0.9rem;
    }

    /* Optimisation des réponses pour mobile */
    .answers-container {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .answer-option {
        padding: 15px;
        font-size: 1rem;
        min-height: 60px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .question-text {
        font-size: 1.3rem;
        padding: 12px;
        line-height: 1.4;
        margin-bottom: 10px;
        font-weight: 500;
    }
    
    .question-header {
        margin-bottom: 12px;
    }
    
    .category-badge {
        font-size: 0.9rem;
        padding: 6px 12px;
    }
    
    .question-number {
        font-size: 0.9rem;
    }

    .timer-container {
        width: 60px;
        height: 60px;
    }

    .timer-text {
        font-size: 1.5rem;
    }

    /* Optimisation des avatars et sélecteurs d'âge */
    .avatar-selection {
        flex-wrap: wrap;
        justify-content: center;
    }

    .avatar {
        width: 60px;
        height: 60px;
        margin: 5px;
    }

    .age-selector {
        flex-wrap: wrap;
        justify-content: center;
    }

    .age-btn {
        width: 45px;
        height: 45px;
        font-size: 1rem;
        margin: 4px;
    }

    /* Optimisation des formulaires */
    .input-field {
        padding: 12px;
        font-size: 1rem;
        margin-bottom: 15px;
    }

    /* Optimisation des résultats */
    .result-card {
        padding: 15px;
    }

    .result-buttons .btn {
        margin: 8px auto;
    }
}

/* Animations pour les jeunes enfants */
.young-child-animation {
    animation: colorChange 3s infinite;
}

@keyframes colorChange {
    0% { color: var(--primary-color); }
    33% { color: var(--secondary-color); }
    66% { color: var(--accent-color); }
    100% { color: var(--primary-color); }
}