/* === GAME PAGE LAYOUT === */
.game-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
    padding: 20px;
    background: var(--card-background);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.game-header h3 {
    color: var(--primary-color);
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

.score-display {
    background: var(--secondary-color);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 1.1rem;
}

/* === GAME CONTAINER === */
.game-container {
    background: var(--card-background);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 30px;
    min-height: 500px;
    position: relative;
    overflow: hidden;
}

/* === GAME ERROR DISPLAY === */
.game-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 400px;
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

/* === MEMORY MATCH GAME === */
.memory-match-wrapper {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 600px;
    margin: 0 auto;
}

.game-stats {
    display: flex;
    justify-content: space-around;
    background: var(--card-background);
    padding: 15px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.stat-item span:last-child {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-color);
}

.memory-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    padding: 20px;
    background: var(--background);
    border-radius: var(--border-radius);
}

.memory-card {
    aspect-ratio: 1;
    perspective: 1000px;
    cursor: pointer;
    border-radius: 8px;
    transition: transform 0.2s ease;
}

.memory-card:hover {
    transform: scale(1.05);
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.6s ease;
    border-radius: 8px;
}

.memory-card.flipped .card-inner {
    transform: rotateY(180deg);
}

.card-front,
.card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow);
    border: 2px solid transparent;
}

.card-front {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.card-back {
    background: var(--card-background);
    color: var(--text-primary);
    transform: rotateY(180deg);
    padding: 10px;
}

.card-icon {
    font-size: 2rem;
}

.card-content {
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    word-break: break-word;
    line-height: 1.2;
}

.card-type {
    font-size: 1.2rem;
    margin-top: 5px;
}

.memory-card.matched .card-back {
    background: var(--success-color);
    color: white;
    border-color: var(--success-color);
}

.memory-card.hint .card-inner {
    transform: rotateY(180deg);
    animation: hint-pulse 0.5s ease-in-out;
}

@keyframes hint-pulse {
    0%, 100% { transform: rotateY(180deg) scale(1); }
    50% { transform: rotateY(180deg) scale(1.1); }
}

/* === ANIMATIONS DE RÉUSSITE === */
@keyframes success-match {
    0% { transform: rotateY(180deg) scale(1); }
    25% { transform: rotateY(180deg) scale(1.15); }
    50% { transform: rotateY(180deg) scale(1.05); }
    75% { transform: rotateY(180deg) scale(1.1); }
    100% { transform: rotateY(180deg) scale(1); }
}

@keyframes success-glow {
    0% { box-shadow: 0 0 5px #22C55E; }
    50% { box-shadow: 0 0 20px #22C55E, 0 0 30px #22C55E; }
    100% { box-shadow: 0 0 5px #22C55E; }
}

@keyframes success-sparkle {
    0% { opacity: 0; transform: scale(0) rotate(0deg); }
    50% { opacity: 1; transform: scale(1) rotate(180deg); }
    100% { opacity: 0; transform: scale(0) rotate(360deg); }
}

.memory-card.success-animation .card-inner {
    animation: success-match 0.8s ease-in-out;
}

.memory-card.success-animation .card-back {
    animation: success-glow 1s ease-in-out;
}

/* Particules de réussite */
.success-particle {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    background: #22C55E;
    border-radius: 50%;
    pointer-events: none;
    z-index: 100;
    animation: success-sparkle 1.2s ease-out;
}

.success-particle::before {
    content: '✨';
    position: absolute;
    top: -5px;
    left: -5px;
    font-size: 20px;
    animation: success-sparkle 1s ease-out;
}

.success-particle.particle-1 { animation-delay: 0s; transform: translate(-20px, -20px); }
.success-particle.particle-2 { animation-delay: 0.1s; transform: translate(20px, -20px); }
.success-particle.particle-3 { animation-delay: 0.2s; transform: translate(-20px, 20px); }
.success-particle.particle-4 { animation-delay: 0.3s; transform: translate(20px, 20px); }

.game-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
}

/* Responsive design */
@media (max-width: 600px) {
    .memory-grid {
        gap: 10px;
        padding: 15px;
    }
    
    .card-content {
        font-size: 0.9rem;
    }
    
    .game-stats {
        flex-direction: column;
        gap: 15px;
    }
}

/* === QUIZ GAME === */
.quiz-game-wrapper {
    display: flex;
    flex-direction: column;
    gap: 25px;
    max-width: 700px;
    margin: 0 auto;
}

.quiz-progress {
    background: var(--card-background);
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--background);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 15px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 10%;
}

.progress-text {
    display: flex;
    justify-content: space-between;
    font-weight: 600;
    color: var(--text-primary);
}

.question-area {
    background: var(--card-background);
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    text-align: center;
}

.question-text {
    font-size: 1.4rem;
    color: var(--text-primary);
    line-height: 1.5;
    margin: 0;
}

.question-text strong {
    color: var(--primary-color);
    font-size: 1.6rem;
}

.options-area {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    padding: 20px;
}

.quiz-option {
    background: var(--card-background);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.quiz-option:hover:not(:disabled) {
    border-color: var(--primary-color);
    background: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.quiz-option:disabled {
    cursor: not-allowed;
}

.quiz-option.correct {
    background: var(--success-color);
    border-color: var(--success-color);
    color: white;
    animation: success-pulse 0.6s ease;
}

.quiz-option.wrong {
    background: var(--error-color);
    border-color: var(--error-color);
    color: white;
    animation: error-shake 0.6s ease;
}

.quiz-option.disabled {
    opacity: 0.5;
    background: var(--text-secondary);
    border-color: var(--text-secondary);
}

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

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

.quiz-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    align-items: center;
}

#next-btn {
    font-size: 1.1rem;
    padding: 12px 24px;
}

/* Responsive design */
@media (max-width: 600px) {
    .options-area {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 15px;
    }
    
    .quiz-option {
        padding: 15px;
        font-size: 1rem;
        min-height: 50px;
    }
    
    .question-text {
        font-size: 1.2rem;
    }
    
    .question-text strong {
        font-size: 1.4rem;
    }
    
    .progress-text {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }
}

/* === ADVENTURE READER GAME === */
.adventure-reader-wrapper {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-width: 1000px;
    margin: 0 auto;
    user-select: none;
    padding-top: 20px; /* Add space to prevent overlap with top navigation */
}

.adventure-reader-wrapper .game-hud {
    position: relative; /* Override the absolute positioning */
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--card-background);
    padding: 15px 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    border: 2px solid var(--primary-color);
    top: auto; /* Reset top positioning */
    left: auto; /* Reset left positioning */
    right: auto; /* Reset right positioning */
    height: auto; /* Allow natural height */
    z-index: auto; /* Reset z-index */
}

.hud-left {
    display: flex;
    gap: 20px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 1.1rem;
}

.stat-icon {
    font-size: 1.3rem;
}

.progress-info {
    font-weight: 500;
    color: var(--primary-color);
}

.game-map {
    position: relative;
    width: 70vw;
    height: 55vh;
    max-width: 800px;
    max-height: 500px;
    min-width: 400px;
    min-height: 300px;
    background: linear-gradient(135deg, #8fbc8f, #90ee90);
    border-radius: var(--border-radius);
    border: 3px solid var(--primary-color);
    overflow: hidden;
    cursor: crosshair;
    margin: 0 auto;
}

.player {
    position: absolute;
    width: 40px;
    height: 40px;
    font-size: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.3));
    transition: all 0.8s ease;
}

.pot, .enemy {
    position: absolute;
    width: 40px;
    height: 40px;
    font-size: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    filter: drop-shadow(1px 1px 2px rgba(0,0,0,0.3));
}

/* Invisible larger clickable area */
.pot::before, .enemy::before {
    content: '';
    position: absolute;
    top: -15px;
    left: -15px;
    right: -15px;
    bottom: -15px;
    border-radius: 50%;
    background: transparent;
    pointer-events: auto;
}

.pot:hover, .enemy:hover {
    transform: scale(1.2);
    filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.5));
}

.pot.destroyed, .enemy.defeated {
    pointer-events: none;
    animation: destruction 0.5s ease;
}

@keyframes destruction {
    0% { transform: scale(1); }
    50% { transform: scale(1.5) rotate(180deg); }
    100% { transform: scale(0.8); }
}

.enemy {
    animation: enemyFloat 2s ease-in-out infinite alternate;
}

@keyframes enemyFloat {
    0% { transform: translateY(0px); }
    100% { transform: translateY(-5px); }
}

.game-controls {
    text-align: center;
    background: var(--card-background);
    padding: 15px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
}

.instructions {
    margin-bottom: 15px;
    color: var(--text-secondary);
    font-style: italic;
}

/* Reading Modal */
.reading-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.reading-modal.show {
    opacity: 1;
}

.modal-content {
    background: var(--card-background);
    border-radius: var(--border-radius);
    max-width: 500px;
    width: 90%;
    max-height: 80%;
    overflow-y: auto;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.reading-modal.show .modal-content {
    transform: translateY(0);
}

.modal-header {
    background: var(--primary-color);
    color: white;
    padding: 20px;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    text-align: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.5rem;
}

.modal-body {
    padding: 30px;
}

.sentence-content .english-text,
.sentence-content .original-text {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 15px;
    line-height: 1.5;
}

.sentence-content .translation-text {
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-style: italic;
    line-height: 1.4;
    margin-bottom: 10px;
}

.sentence-content .pronunciation-text {
    font-size: 0.95rem;
    color: #6B7280;
    font-style: italic;
    background: rgba(107, 114, 128, 0.1);
    padding: 4px 8px;
    border-radius: 4px;
    margin-top: 5px;
}

.modal-footer {
    padding: 20px;
    text-align: center;
    background: var(--background);
    border-radius: 0 0 var(--border-radius) var(--border-radius);
}

/* Vocab Popup */
.vocab-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background: var(--success-color);
    color: white;
    padding: 20px 30px;
    border-radius: var(--border-radius);
    z-index: 500;
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-lg);
}

.vocab-popup.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.popup-content {
    text-align: center;
}

.vocab-word {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.vocab-translation {
    font-size: 1.1rem;
    opacity: 0.9;
}

.vocab-pronunciation {
    font-size: 0.95rem;
    color: #6B7280;
    font-style: italic;
    margin-top: 5px;
}

/* Responsive design */
@media (max-width: 600px) {
    .game-map {
        width: 95vw;
        height: 50vh;
        max-width: none;
    }
    
    .hud-left {
        flex-direction: column;
        gap: 10px;
    }
    
    .game-hud {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .pot, .enemy, .player {
        width: 35px;
        height: 35px;
        font-size: 25px;
    }
    
    .modal-content {
        width: 95%;
    }
    
    .modal-body {
        padding: 20px;
    }
}

/* === DECORATIVE ELEMENTS === */
.decoration {
    position: absolute;
    pointer-events: none;
    z-index: 1;
    opacity: 0.8;
    user-select: none;
}

.decoration.tree {
    z-index: 5;
    filter: drop-shadow(2px 2px 3px rgba(0,0,0,0.2));
}

.decoration.grass {
    z-index: 1;
    opacity: 0.6;
    animation: grassSway 3s ease-in-out infinite;
}

.decoration.rock {
    z-index: 2;
    opacity: 0.7;
    filter: drop-shadow(1px 1px 2px rgba(0,0,0,0.3));
}

@keyframes grassSway {
    0%, 100% { transform: rotate(-2deg); }
    50% { transform: rotate(2deg); }
}

/* Player and interactive elements should be above decorations */
.player {
    z-index: 10 !important;
}

.pot, .enemy {
    z-index: 8 !important;
}

/* Damage animation */
@keyframes damageFloat {
    0% { 
        opacity: 1; 
        transform: translate(-50%, -50%) scale(1);
    }
    100% { 
        opacity: 0; 
        transform: translate(-50%, -80px) scale(1.2);
    }
}

/* Protection animation */
@keyframes protectionFloat {
    0% { 
        opacity: 1; 
        transform: translate(-50%, -50%) scale(1);
    }
    50% { 
        opacity: 0.7; 
        transform: translate(-50%, -40px) scale(1.1);
    }
    100% { 
        opacity: 0; 
        transform: translate(-50%, -60px) scale(0.9);
    }
}

.game-error h3 {
    color: var(--error-color);
    font-size: 1.8rem;
    margin-bottom: 20px;
    font-weight: 600;
}

.game-error p {
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 15px;
    max-width: 500px;
}

.game-error .back-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    margin-top: 20px;
    transition: all 0.3s ease;
}

.game-error .back-btn:hover {
    background: #2563EB;
    transform: translateY(-1px);
}

/* === FILL THE BLANK SPECIFIC STYLES === */
.fill-blank-wrapper {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.translation-hint {
    background: #f0f9ff;
    border: 2px solid #3b82f6;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 20px;
    text-align: center;
    font-size: 1.1rem;
    color: #1e40af;
}

.translation-hint:empty {
    display: none;
}

.sentence-container {
    background: white;
    border: 3px solid #e5e7eb;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 25px;
    font-size: 1.4rem;
    line-height: 1.8;
    text-align: center;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
}

.word {
    color: var(--text-primary);
    font-weight: 500;
}

.blank-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.blank-input {
    background: #fef3c7;
    border: 2px solid #f59e0b;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 1.3rem;
    font-weight: 600;
    text-align: center;
    min-width: 60px;
    width: auto;
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.blank-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: #dbeafe;
    transform: scale(1.05);
}

.blank-input.correct {
    background: #d1fae5;
    border-color: #10b981;
    color: #065f46;
}

.blank-input.incorrect {
    background: #fee2e2;
    border-color: #ef4444;
    color: #991b1b;
    animation: shake 0.5s ease-in-out;
}

.blank-input.revealed {
    background: #f3f4f6;
    border-color: #6b7280;
    color: #374151;
    font-style: italic;
}

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

.input-area {
    margin-bottom: 25px;
    min-height: 50px;
}

.game-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
}

.control-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
}

.control-btn:hover {
    background: #2563EB;
    transform: translateY(-2px);
}

.control-btn.secondary {
    background: #6b7280;
}

.control-btn.secondary:hover {
    background: #4b5563;
}

.instruction.success {
    background: #d1fae5;
    color: #065f46;
    border: 2px solid #10b981;
}

.instruction.partial {
    background: #fef3c7;
    color: #92400e;
    border: 2px solid #f59e0b;
}

.instruction.error {
    background: #fee2e2;
    color: #991b1b;
    border: 2px solid #ef4444;
}

.instruction.info {
    background: #dbeafe;
    color: #1e40af;
    border: 2px solid #3b82f6;
}

/* Responsive pour Fill the Blank */
@media (max-width: 768px) {
    .fill-blank-wrapper {
        padding: 15px;
    }
    
    .sentence-container {
        font-size: 1.2rem;
        padding: 20px 15px;
    }
    
    .blank-input {
        font-size: 1.1rem;
        padding: 6px 10px;
        min-width: 50px;
    }
    
    .game-controls {
        flex-direction: column;
        align-items: center;
    }
    
    .control-btn {
        width: 100%;
        max-width: 200px;
    }
}

/* === WHACK-A-MOLE SPECIFIC STYLES === */
.whack-game-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px 0;
}

/* === TEXT READER STYLES === */
.text-reader-wrapper {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

.text-selection {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px;
    border-radius: 15px;
    text-align: center;
    margin-bottom: 30px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
}

.text-selector-label {
    display: block;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 15px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.text-selector {
    background: white;
    color: var(--text-primary);
    border: none;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 15px;
    width: 100%;
    max-width: 400px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}

.text-selector:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255,255,255,0.3);
    transform: translateY(-1px);
}

.text-selector:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}

.text-progress {
    font-size: 1rem;
    opacity: 0.9;
    font-weight: 500;
}

.reading-area {
    background: white;
    border: 3px solid #e5e7eb;
    border-radius: 20px;
    padding: 40px;
    margin-bottom: 30px;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.sentence-display {
    text-align: center;
    width: 100%;
}

.current-sentence {
    font-size: 1.6rem;
    line-height: 1.8;
    color: var(--text-primary);
    font-weight: 500;
    animation: fadeInUp 0.5s ease-out;
}

.full-text-display {
    width: 100%;
    text-align: left;
}

.full-text-content {
    font-size: 1.3rem;
    line-height: 1.8;
    color: var(--text-primary);
}

.full-text-content p {
    margin-bottom: 20px;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.reader-controls, .text-navigation {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.reader-controls .control-btn,
.text-navigation .control-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 140px;
}

.reader-controls .control-btn:hover,
.text-navigation .control-btn:hover {
    background: #2563EB;
    transform: translateY(-2px);
}

.reader-controls .control-btn.secondary,
.text-navigation .control-btn.secondary {
    background: #6b7280;
}

.reader-controls .control-btn.secondary:hover,
.text-navigation .control-btn.secondary:hover {
    background: #4b5563;
}

.reader-controls .control-btn:disabled,
.text-navigation .control-btn:disabled {
    background: #d1d5db;
    color: #9ca3af;
    cursor: not-allowed;
    transform: none;
}

.reader-controls .control-btn:disabled:hover,
.text-navigation .control-btn:disabled:hover {
    background: #d1d5db;
    transform: none;
}

/* Responsive pour Text Reader */
@media (max-width: 768px) {
    .text-reader-wrapper {
        padding: 15px;
    }
    
    .text-title {
        font-size: 1.4rem;
    }
    
    .reading-area {
        padding: 25px 20px;
        min-height: 150px;
    }
    
    .current-sentence {
        font-size: 1.3rem;
    }
    
    .full-text-content {
        font-size: 1.1rem;
    }
    
    .reader-controls, .text-navigation {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }
    
    .reader-controls .control-btn,
    .text-navigation .control-btn {
        width: 100%;
        max-width: 250px;
    }
}

@media (max-width: 480px) {
    .text-info {
        padding: 15px;
    }
    
    .text-progress {
        font-size: 0.8rem;
    }
    
    .current-sentence {
        font-size: 1.2rem;
    }
    
    .reading-area {
        padding: 20px 15px;
    }
}

/* === WHACK-A-MOLE HARD MODE STYLES === */
.whack-game-board.hard-mode {
    grid-template-columns: repeat(5, 1fr);
    max-width: 800px;
    gap: 15px;
}

.whack-hole {
    aspect-ratio: 1;
    background: radial-gradient(circle, #8B4513 0%, #654321 70%, #3D2817 100%);
    border-radius: 50%;
    position: relative;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: inset 0 4px 8px rgba(0,0,0,0.3);
    border: 4px solid #654321;
}

.whack-hole:hover {
    transform: scale(1.05);
}

.whack-mole {
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    height: 80%;
    background: #8B4513;
    border-radius: 50% 50% 40% 40%;
    transition: all 0.3s ease-out;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.whack-mole.active {
    bottom: 10px;
    animation: pop-up 0.3s ease-out;
}

.whack-mole.hit {
    animation: hit-animation 0.5s ease-out;
}

.whack-mole .word {
    color: white;
    font-weight: bold;
    font-size: 0.9rem;
    text-align: center;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    padding: 5px;
}

@keyframes pop-up {
    0% { bottom: -20px; transform: translateX(-50%) scale(0.8); }
    50% { transform: translateX(-50%) scale(1.1); }
    100% { bottom: 10px; transform: translateX(-50%) scale(1); }
}

@keyframes hit-animation {
    0% { transform: translateX(-50%) scale(1); }
    25% { transform: translateX(-50%) scale(1.2) rotate(5deg); }
    50% { transform: translateX(-50%) scale(0.9) rotate(-3deg); }
    75% { transform: translateX(-50%) scale(1.1) rotate(2deg); }
    100% { transform: translateX(-50%) scale(1) rotate(0deg); }
}

/* === GAME UI ELEMENTS === */
.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px 20px;
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    border-radius: var(--border-radius);
}

.game-stats {
    display: flex;
    gap: 20px;
}

.stat-item {
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.game-controls {
    display: flex;
    gap: 10px;
}

.control-btn {
    background: var(--primary-color);
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 0.9rem;
    transition: var(--transition);
}

.control-btn:hover {
    background: #2563EB;
    transform: translateY(-2px);
}

.control-btn:disabled {
    background: var(--neutral-color);
    cursor: not-allowed;
    transform: none;
}

/* === FEEDBACK ANIMATIONS === */
.score-popup {
    position: absolute;
    font-weight: bold;
    font-size: 1.2rem;
    color: var(--secondary-color);
    pointer-events: none;
    animation: score-float 1s ease-out forwards;
    z-index: 10;
}

@keyframes score-float {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-50px) scale(1.2);
    }
}

.wrong-answer {
    color: var(--error-color) !important;
}

.correct-answer {
    color: var(--secondary-color) !important;
}

/* === GAME MODES === */
.mode-selector {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background: var(--background-color);
    border-radius: var(--border-radius);
}

.mode-btn {
    background: white;
    border: 2px solid var(--neutral-color);
    color: var(--text-primary);
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 0.9rem;
    transition: var(--transition);
}

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

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

/* === RESPONSIVE GAMES === */
@media (max-width: 768px) {
    .game-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .game-container {
        padding: 20px;
        min-height: 400px;
    }
    
    .whack-game-board {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        max-width: 400px;
    }
    
    .game-info {
        flex-direction: column;
        gap: 15px;
    }
    
    .game-stats {
        justify-content: center;
    }
    
    .mode-selector {
        flex-wrap: wrap;
        gap: 10px;
    }
}

/* === GAME END OVERLAY === */
.game-end-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease-out;
}

.game-end-modal {
    background: white;
    border-radius: var(--border-radius);
    padding: 40px;
    text-align: center;
    max-width: 400px;
    margin: 20px;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease-out;
}

.game-end-modal h3 {
    color: var(--primary-color);
    font-size: 2rem;
    margin-bottom: 20px;
}

.final-score {
    font-size: 1.5rem;
    color: var(--secondary-color);
    margin-bottom: 10px;
}

.best-score {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 30px;
}

.game-end-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.restart-game-btn, .back-to-levels-btn, .back-to-games-btn {
    padding: 12px 20px;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

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

.restart-game-btn:hover {
    background: #059669;
    transform: translateY(-2px);
}

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

.back-to-levels-btn:hover {
    background: #2563EB;
    transform: translateY(-2px);
}

.back-to-games-btn {
    background: var(--neutral-color);
    color: white;
}

.back-to-games-btn:hover {
    background: #4B5563;
    transform: translateY(-2px);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 480px) {
    .whack-game-board {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        max-width: 300px;
    }

    .whack-mole .word {
        font-size: 0.8rem;
    }

    .game-header h3 {
        font-size: 1.2rem;
    }

    .score-display {
        font-size: 1rem;
        padding: 6px 12px;
    }

    .game-end-modal {
        padding: 30px 20px;
        margin: 15px;
    }

    .game-end-modal h3 {
        font-size: 1.5rem;
    }

    .game-end-buttons {
        gap: 10px;
    }
}

/* === OPTIMISATION POUR ÉCRANS LARGES 1920x1080+ === */
@media (min-width: 1440px) {
    /* Memory Match - laisser le CSS original fonctionner */

    /* Autres jeux en mode horizontal */
    .quiz-game-wrapper,
    .fill-blank-wrapper,
    .text-reader-wrapper {
        display: flex;
        justify-content: center;
        gap: 40px;
        max-width: 1400px;
        margin: 0 auto;
        align-items: flex-start;
    }

    /* Whack-a-mole en layout horizontal simple */
    .game-container:has(.whack-game-board) {
        display: flex;
        justify-content: center;
        gap: 40px;
        align-items: flex-start;
    }

    /* Board du whack-a-mole centré */
    .whack-game-board {
        flex: 0 0 auto;
        order: 1;
    }

    /* Infos whack-a-mole sur le côté */
    .game-container:has(.whack-game-board) .game-info {
        flex: 0 0 300px;
        order: 2;
        margin: 0;
        position: sticky;
        top: 80px;
    }

    /* Zone principale du jeu à gauche */
    .game-main-area {
        min-width: 0; /* Pour éviter overflow */
    }

    /* Panneau latéral à droite */
    .game-sidebar {
        background: var(--card-background);
        border-radius: var(--border-radius);
        padding: 25px;
        box-shadow: var(--shadow);
        position: sticky;
        top: 80px;
        max-height: calc(100vh - 100px);
        overflow-y: auto;
    }

    /* Memory Match - juste augmenter la grille pour 1920x1080 */
    .memory-match-wrapper {
        max-width: 900px;
    }

    .memory-grid {
        gap: 20px;
        padding: 25px;
    }

    /* Forcer la visibilité des cartes */
    .memory-card {
        min-width: 100px !important;
        min-height: 100px !important;
        width: auto !important;
        height: auto !important;
    }

    .card-front,
    .card-back {
        border: 2px solid #e5e7eb !important;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1) !important;
        background: white !important;
    }

    .card-front {
        background: linear-gradient(135deg, #3B82F6, #10B981) !important;
    }

    /* Quiz - Options en 2x2 */
    .options-area {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
        padding: 30px;
    }

    .quiz-option {
        padding: 25px;
        font-size: 1.3rem;
        min-height: 80px;
    }

    /* Questions plus grandes */
    .question-text {
        font-size: 1.8rem;
        line-height: 1.6;
    }

    /* Fill the Blank - Phrase plus grande */
    .sentence-container {
        font-size: 1.6rem;
        line-height: 2;
        padding: 40px;
        min-height: 120px;
    }

    .blank-input {
        font-size: 1.5rem;
        padding: 10px 15px;
        min-width: 80px;
    }

    /* Text Reader - Zone de lecture plus large */
    .current-sentence {
        font-size: 2rem;
        line-height: 2.2;
    }

    .reading-area {
        padding: 50px;
        min-height: 250px;
    }

    /* Adventure Reader - Carte plus grande */
    .adventure-reader-wrapper {
        max-width: 1400px;
        flex-direction: row;
        gap: 30px;
        padding-top: 20px; /* Maintain top padding on large screens */
    }

    .game-map {
        width: calc(100vw - 450px);
        height: 70vh;
        max-width: 1000px;
        max-height: 700px;
    }

    .adventure-sidebar {
        min-width: 350px;
        display: flex;
        flex-direction: column;
        gap: 20px;
    }

    /* Whack-a-mole - Trous plus petits pour mieux voir l'ensemble */
    .whack-hole {
        max-width: 100px;
        max-height: 100px;
    }

    .whack-mole .word {
        font-size: 0.8rem;
    }

    .whack-game-board {
        max-width: 500px;
        gap: 15px;
        flex: 0 0 auto;
    }

    .whack-game-board.hard-mode {
        max-width: 650px;
        gap: 12px;
    }

    /* Game header plus compact horizontalement */
    .game-header {
        padding: 20px 40px;
        margin-bottom: 20px;
    }

    .game-header h3 {
        font-size: 1.8rem;
    }

    .score-display {
        font-size: 1.3rem;
        padding: 10px 20px;
    }
}

/* Layout spécifique pour les wrappers de jeux */
@media (min-width: 1440px) {
    /* Headers restent en haut, pleine largeur */
    .memory-match-wrapper,
    .quiz-game-wrapper,
    .fill-blank-wrapper,
    .text-reader-wrapper {
        flex-direction: column;
    }

    .memory-match-wrapper > .game-main-content,
    .quiz-game-wrapper > .game-main-content,
    .fill-blank-wrapper > .game-main-content,
    .text-reader-wrapper > .game-main-content {
        display: flex;
        flex-direction: row;
        justify-content: center;
        gap: 40px;
        width: 100%;
    }

    /* Zone principale du jeu - centrée */
    .game-main-content {
        flex: 0 0 auto;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 20px;
    }

    /* Sidebar pour les infos - à droite */
    .game-sidebar-info {
        flex: 0 0 300px;
        display: flex;
        flex-direction: column;
        gap: 20px;
    }

    /* Regroupement des éléments de jeu */
    .memory-grid,
    .question-area,
    .options-area,
    .sentence-container,
    .reading-area,
    .whack-game-board {
        margin: 0 auto;
    }
}

/* === GLOBAL GAME SYSTEM STYLES === */
/* Base wrapper for all games - can be overridden by specific games */
.game-wrapper {
    height: 100vh;
    width: 100vw;
    margin: 0 auto;
    overflow: hidden;
    position: relative;
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 50%, #0f0f23 100%);
    display: flex;
    flex-direction: column;
}

/* Compact game variant - smaller viewport */
.game-wrapper.compact {
    height: 80vh;
    width: 90vw;
    max-width: 800px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* Game HUD - top information bar */
.game-hud {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 80px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    z-index: 100;
    border-bottom: 2px solid rgba(59, 130, 246, 0.3);
}

/* Compact HUD variant */
.game-wrapper.compact .game-hud {
    height: 60px;
    padding: 0 15px;
    border-radius: 20px 20px 0 0;
}

/* HUD sections */
.hud-left, .hud-center, .hud-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.game-wrapper.compact .hud-left,
.game-wrapper.compact .hud-center,
.game-wrapper.compact .hud-right {
    gap: 15px;
}

/* HUD elements */
.hud-score, .hud-level, .hud-combo, .hud-lives {
    color: white;
    font-weight: 600;
    font-size: 1rem;
}

.game-wrapper.compact .hud-score,
.game-wrapper.compact .hud-level,
.game-wrapper.compact .hud-combo,
.game-wrapper.compact .hud-lives {
    font-size: 0.9rem;
}

.hud-combo.active {
    color: #F59E0B;
    text-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
}

/* Game area - main play zone */
.game-area {
    position: absolute;
    top: 80px;
    bottom: 120px;
    left: 0;
    right: 0;
    width: 100%;
    overflow: hidden;
}

.game-wrapper.compact .game-area {
    top: 60px;
    bottom: 100px;
}

/* Answer panel - bottom interaction area */
.answer-panel {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 120px;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(15px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    border-top: 2px solid rgba(59, 130, 246, 0.3);
}

.game-wrapper.compact .answer-panel {
    height: 100px;
    border-top: 3px solid #3B82F6;
    border-radius: 0 0 20px 20px;
}

/* Answer buttons */
.answer-buttons {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.game-wrapper.compact .answer-buttons {
    gap: 15px;
}

.answer-btn {
    background: linear-gradient(135deg, #4F46E5, #7C3AED);
    color: white;
    border: 2px solid rgba(79, 70, 229, 0.5);
    padding: 15px 25px;
    border-radius: 15px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    min-width: 120px;
    text-align: center;
}

.game-wrapper.compact .answer-btn {
    border: 3px solid #FFFFFF;
    padding: 20px 30px;
    font-size: 1.2rem;
    font-weight: 700;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
    min-width: 150px;
}

.answer-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.4);
}

.game-wrapper.compact .answer-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 25px rgba(79, 70, 229, 0.4);
}

.hud-center {
    flex: 1;
    justify-content: center;
}

.score, .level, .combo, .lives {
    color: white;
    font-weight: 600;
    font-size: 1.1rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.combo.active {
    color: #F59E0B;
    text-shadow: 0 0 10px #F59E0B;
    animation: pulse 1s infinite;
}

.pause-btn {
    background: rgba(59, 130, 246, 0.2);
    border: 1px solid #3B82F6;
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.pause-btn:hover {
    background: rgba(59, 130, 246, 0.4);
    transform: scale(1.1);
}

/* Game-specific CSS moved to individual games */

@keyframes backgroundShift {
    0%, 100% { transform: translateX(0) translateY(0); }
    25% { transform: translateX(-10px) translateY(-10px); }
    50% { transform: translateX(10px) translateY(10px); }
    75% { transform: translateX(-5px) translateY(5px); }
}
