* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Comic Sans MS', 'Chalkboard', cursive, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

#game-container {
    text-align: center;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 30px;
    backdrop-filter: blur(10px);
}

#game-canvas {
    border: 8px solid #FFD700;
    border-radius: 20px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.4), 0 0 30px rgba(255,215,0,0.3);
    max-width: 100%;
    height: auto;
    background: #000;
}

#controls {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 40px;
}

.control-btn {
    width: 90px;
    height: 90px;
    font-size: 42px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(145deg, #FFD93D, #FFA500);
    box-shadow: 0 8px 0 #CC8400, 0 10px 20px rgba(0,0,0,0.3);
    cursor: pointer;
    transition: all 0.1s;
    user-select: none;
}

.control-btn:active {
    transform: translateY(8px);
    box-shadow: 0 0 0 #CC8400, 0 3px 8px rgba(0,0,0,0.3);
}

.control-btn:hover {
    background: linear-gradient(145deg, #FFE066, #FFB84D);
    transform: scale(1.05);
}

#instructions {
    margin-top: 20px;
    color: #FFF;
    font-size: 20px;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

#instructions p {
    margin: 8px 0;
}

/* Écran de victoire */
.victory-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.victory-box {
    background: linear-gradient(145deg, #FFD700, #FFA500, #FF6B6B);
    padding: 50px;
    border-radius: 40px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 50px rgba(255,215,0,0.5);
    animation: bounceIn 0.6s ease-out;
    max-width: 90%;
    width: 500px;
}

@keyframes bounceIn {
    0% { transform: scale(0.3) rotate(-10deg); opacity: 0; }
    50% { transform: scale(1.05) rotate(2deg); }
    70% { transform: scale(0.95) rotate(-1deg); }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.victory-box h1 {
    color: #FFF;
    font-size: 38px;
    text-shadow: 3px 3px 6px rgba(0,0,0,0.4);
    margin-bottom: 20px;
    animation: pulse 1.5s infinite;
}

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

.victory-box p {
    color: #333;
    font-size: 22px;
    margin-bottom: 15px;
    font-weight: bold;
}

.replay-btn {
    padding: 18px 45px;
    font-size: 26px;
    font-family: inherit;
    font-weight: bold;
    border: none;
    border-radius: 50px;
    background: linear-gradient(145deg, #FF6B6B, #EE5A5A);
    color: white;
    cursor: pointer;
    box-shadow: 0 6px 0 #CC4444, 0 8px 20px rgba(0,0,0,0.3);
    transition: all 0.2s;
    margin-top: 15px;
}

.replay-btn:hover {
    background: linear-gradient(145deg, #FF8585, #FF6B6B);
    transform: translateY(-2px);
}

.replay-btn:active {
    transform: translateY(6px);
    box-shadow: 0 0 0 #CC4444, 0 3px 8px rgba(0,0,0,0.3);
}

/* Confettis */
.confetti {
    position: fixed;
    width: 18px;
    height: 18px;
    animation: confetti-fall 3s linear forwards;
    z-index: 1001;
}

@keyframes confetti-fall {
    0% { 
        transform: translateY(-100px) rotate(0deg); 
        opacity: 1;
    }
    100% { 
        transform: translateY(100vh) rotate(720deg); 
        opacity: 0;
    }
}

/* Responsive */
@media (max-width: 850px) {
    #game-canvas {
        width: 100%;
        max-width: 600px;
    }
    
    .control-btn {
        width: 75px;
        height: 75px;
        font-size: 36px;
    }
    
    #instructions {
        font-size: 16px;
    }
    
    .victory-box {
        padding: 30px;
    }
    
    .victory-box h1 {
        font-size: 28px;
    }
    
    .victory-box p {
        font-size: 18px;
    }
    
    .replay-btn {
        padding: 14px 35px;
        font-size: 22px;
    }
}

/* Écran de démarrage */
.start-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    animation: fadeIn 0.5s ease-out;
}

.start-box {
    background: linear-gradient(145deg, #FFD700, #FFA500, #FF69B4);
    padding: 40px 50px;
    border-radius: 40px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4), 0 0 50px rgba(255,215,0,0.4);
    animation: bounceIn 0.8s ease-out;
    max-width: 90%;
    width: 600px;
}

.start-box h1 {
    color: #FFF;
    font-size: 42px;
    text-shadow: 3px 3px 6px rgba(0,0,0,0.4);
    margin-bottom: 10px;
    animation: pulse 2s infinite;
}

.start-box .story {
    background: rgba(255, 255, 255, 0.25);
    border-radius: 20px;
    padding: 20px;
    margin: 20px 0;
    color: #FFF;
    font-size: 20px;
    line-height: 1.6;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.4);
}

.start-box .story p {
    margin: 10px 0;
}

.start-box .characters {
    font-size: 60px;
    margin: 15px 0;
}

.start-btn {
    padding: 20px 50px;
    font-size: 28px;
    font-family: inherit;
    font-weight: bold;
    border: none;
    border-radius: 50px;
    background: linear-gradient(145deg, #FF6B6B, #EE5A5A);
    color: white;
    cursor: pointer;
    box-shadow: 0 8px 0 #CC4444, 0 10px 25px rgba(0,0,0,0.3);
    transition: all 0.2s;
    margin-top: 10px;
    animation: pulse 2s infinite;
}

.start-btn:hover {
    background: linear-gradient(145deg, #FF8585, #FF6B6B);
    transform: translateY(-3px) scale(1.05);
}

.start-btn:active {
    transform: translateY(8px);
    box-shadow: 0 0 0 #CC4444, 0 3px 8px rgba(0,0,0,0.3);
}

/* Transition de niveau */
.level-transition {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1500;
    animation: fadeIn 0.3s ease-out;
}

.level-transition-box {
    background: linear-gradient(145deg, #4ECDC4, #667eea);
    padding: 40px;
    border-radius: 30px;
    text-align: center;
    box-shadow: 0 15px 40px rgba(0,0,0,0.5);
    animation: bounceIn 0.5s ease-out;
}

.level-transition-box h2 {
    color: #FFF;
    font-size: 36px;
    margin-bottom: 15px;
}

.level-transition-box p {
    color: #FFF;
    font-size: 24px;
}

/* Écran d'accueil optionnel */
.level-badge {
    display: inline-block;
    background: linear-gradient(145deg, #FFD700, #FFA500);
    color: #333;
    padding: 8px 20px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 18px;
    margin-bottom: 15px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}
