body {
    margin: 0;
    padding: 20px;
    background: linear-gradient(135deg, #1a1a1a, #2a2a2a, #0f0f0f);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

#gameContainer {
    text-align: center;
    background: rgba(40, 40, 40, 0.3);
    padding: 20px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
    box-shadow: 0 0 30px rgba(50, 50, 50, 0.5);
    max-width: 1040px; /* 800px canvas + 200px panneau + marges */
}

.game-layout {
    display: flex;
    gap: 20px;
    justify-content: center;
    align-items: flex-start;
}

.side-panel {
    width: 200px;
    height: 600px;
    background: rgba(20, 20, 20, 0.9);
    border-radius: 12px;
    border: 3px solid #333333;
    box-shadow: 0 0 25px rgba(50, 50, 50, 0.5);
    backdrop-filter: blur(10px);
    padding: 20px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.mission-text {
    color: white;
    text-align: left;
}

.mission-text h3 {
    margin: 0 0 15px 0;
    font-size: 18px;
    color: #cccccc;
    text-align: center;
    border-bottom: 2px solid rgba(150, 150, 150, 0.3);
    padding-bottom: 8px;
}

.mission-text p {
    margin: 0 0 5px 0;
    font-size: 14px;
    line-height: 1.4;
    color: #e0e0e0;
    text-align: center;
}

.legend {
    color: white;
    margin-top: 5px;
}

.legend h4 {
    margin: 0 0 10px 0;
    font-size: 16px;
    color: #cccccc;
    text-align: center;
    border-bottom: 2px solid rgba(150, 150, 150, 0.3);
    padding-bottom: 6px;
}

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    padding: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    transition: background 0.3s ease;
}

.legend-item:hover {
    background: rgba(255, 255, 255, 0.15);
}

.legend-sprite {
    width: 32px;
    height: 32px;
    margin-right: 12px;
    border-radius: 4px;
}

.legend-item span {
    font-size: 14px;
    color: #e0e0e0;
    font-weight: 500;
}

canvas {
    border: 3px solid #333333;
    border-radius: 12px;
    box-shadow: 0 0 25px rgba(50, 50, 50, 0.5);
    background: #0a0a1e;
    outline: none;
    cursor: crosshair;
}

.ui-panel {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
    margin-bottom: 15px;
    padding: 10px 15px;
    background: rgba(20, 20, 20, 0.9);
    border-radius: 8px;
    font-weight: bold;
}

.ui-panel.hidden {
    display: none;
}

.sound-button {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    color: white;
    font-size: 18px;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.sound-button:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(50, 50, 50, 0.5);
}

.sound-button:active {
    transform: scale(0.95);
}

.controls {
    color: #cccccc;
    margin-top: 15px;
    margin-bottom: 15px;
    font-size: 14px;
    background: rgba(20, 20, 20, 0.9);
    padding: 10px;
    border-radius: 8px;
}

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

.game-controls {
    flex-shrink: 0;
}

.power-ups-info {
    display: flex;
    gap: 15px;
    flex-shrink: 0;
}

.power-up-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    color: #e0e0e0;
}

.power-up-icon {
    width: 16px;
    height: 16px;
    border-radius: 2px;
}

.footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #ffffff;
    font-size: 12px;
    margin-top: 10px;
    padding: 8px 0;
    border-top: 1px solid rgba(150, 150, 150, 0.3);
}

.footer-left, .footer-right {
    opacity: 1;
}

.footer-right {
    font-style: italic;
}

.health-bar {
    display: inline-block;
    width: 100px;
    height: 10px;
    background: #333;
    border-radius: 5px;
    overflow: hidden;
    margin-left: 10px;
    vertical-align: middle;
}

.lives-display {
    display: inline-block;
    margin-left: 10px;
    vertical-align: middle;
}

.life-icon {
    font-size: 16px;
    margin-right: 3px;
}

.health-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff4444, #ffaa00, #00ff44);
    transition: width 0.3s ease;
}

/* Animations et effets */
canvas:hover {
    box-shadow: 0 0 35px rgba(50, 50, 50, 0.5);
    transition: box-shadow 0.3s ease;
}

#gameContainer {
    animation: fadeIn 1s ease-in-out;
}

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

.ui-panel {
    transition: background 0.3s ease;
}

.ui-panel:hover {
    background: rgba(30, 30, 30, 0.9);
}

/* Responsive */
@media (max-width: 1100px) {
    body {
        padding: 10px;
    }
    
    .game-layout {
        flex-direction: column;
        align-items: center;
    }
    
    canvas {
        width: 100%;
        max-width: 800px;
        height: auto;
    }
    
    .side-panel {
        width: 100%;
        max-width: 800px;
        height: auto;
        min-height: 150px;
        margin-top: 20px;
    }
    
    #gameContainer {
        padding: 15px;
        max-width: none;
    }
    
    .ui-panel {
        flex-wrap: wrap;
        gap: 10px;
        text-align: center;
    }
    
    .health-bar {
        margin: 0 auto;
    }
    
    .sound-button {
        order: -1;
        align-self: flex-end;
    }
    
    .footer {
        justify-content: space-between;
        text-align: left;
    }
    
    .controls-content {
        flex-direction: column;
        gap: 10px;
        align-items: center;
    }
    
    .power-ups-info {
        gap: 10px;
    }
    
    .power-up-item {
        font-size: 14px;
    }
    
    .footer-left, .footer-right {
        font-size: 11px;
    }
}

/* Effets pour les notifications de score */
.score-popup {
    position: absolute;
    color: #ffff00;
    font-weight: bold;
    pointer-events: none;
    animation: scoreFloat 1s ease-out forwards;
}

@keyframes scoreFloat {
    0% {
        opacity: 1;
        transform: translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateY(-30px);
    }
}