@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

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

body {
    background: linear-gradient(135deg, #0a0a1a 0%, #1a1a3e 50%, #0d0d2e 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Press Start 2P', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
}

/* Effet de scan lines sur le body */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.1) 0px,
        rgba(0, 0, 0, 0.1) 1px,
        transparent 1px,
        transparent 3px
    );
    pointer-events: none;
    z-index: 1000;
}

#game-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#hud {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 800px;
    padding: 12px 25px;
    background: linear-gradient(180deg, #2a2a3a 0%, #1a1a2a 50%, #0a0a1a 100%);
    color: #fff;
    font-size: 11px;
    font-weight: bold;
    border-radius: 10px 10px 0 0;
    border: 3px solid #444;
    border-bottom: 2px solid #333;
    box-shadow:
        inset 0 2px 4px rgba(255, 255, 255, 0.1),
        inset 0 -2px 4px rgba(0, 0, 0, 0.3),
        0 -5px 20px rgba(0, 0, 0, 0.5);
}

#hud > div {
    text-shadow: 2px 2px 0 #000, 0 0 10px currentColor;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 8px;
}

#score-value {
    color: #ffd700;
    text-shadow: 2px 2px 0 #000, 0 0 15px #ffd700;
    animation: scoreGlow 1.5s ease-in-out infinite;
}

@keyframes scoreGlow {
    0%, 100% { text-shadow: 2px 2px 0 #000, 0 0 10px #ffd700; }
    50% { text-shadow: 2px 2px 0 #000, 0 0 20px #ffd700, 0 0 30px #ff8c00; }
}

#lives-value {
    color: #ff6b6b;
    text-shadow: 2px 2px 0 #000, 0 0 10px #ff6b6b;
}

#level-value {
    color: #4ecdc4;
    text-shadow: 2px 2px 0 #000, 0 0 10px #4ecdc4;
}

#mute-btn {
    background: transparent;
    border: 2px solid #555;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 5px;
    transition: all 0.2s;
}

#mute-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #777;
}

#gameCanvas {
    border: 4px solid #333;
    background: #000;
    display: block;
    box-shadow:
        0 0 0 2px #222,
        0 0 0 4px #444,
        0 0 20px rgba(0, 0, 0, 0.8),
        inset 0 0 100px rgba(0, 50, 100, 0.1);
    border-radius: 3px;
    image-rendering: pixelated;
}

#message-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background:
        radial-gradient(ellipse at center, rgba(20, 20, 40, 0.98) 0%, rgba(5, 5, 15, 0.99) 100%);
    padding: 40px 50px;
    border-radius: 15px;
    text-align: center;
    border: 3px solid;
    border-image: linear-gradient(135deg, #ffd700, #ff6b6b, #4ecdc4) 1;
    z-index: 100;
    box-shadow:
        0 0 40px rgba(255, 215, 0, 0.3),
        0 0 80px rgba(255, 107, 107, 0.2),
        inset 0 0 60px rgba(0, 0, 0, 0.5);
    animation: overlayAppear 0.3s ease-out;
}

@keyframes overlayAppear {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

#message-overlay.hidden {
    display: none;
}

#message-text {
    color: #fff;
    font-size: 20px;
    margin-bottom: 30px;
    text-shadow: 2px 2px 0 #000, 0 0 20px currentColor;
    white-space: pre-line;
    line-height: 1.8;
    font-family: 'Press Start 2P', monospace;
}

#restart-btn, #start-btn {
    background: linear-gradient(180deg, #ff6b6b 0%, #e74c3c 50%, #c0392b 100%);
    color: #fff;
    border: none;
    padding: 15px 40px;
    font-size: 14px;
    font-weight: bold;
    font-family: 'Press Start 2P', inherit;
    cursor: pointer;
    border-radius: 8px;
    text-transform: uppercase;
    box-shadow:
        0 6px 0 #8b0000,
        0 8px 20px rgba(0, 0, 0, 0.4),
        inset 0 2px 0 rgba(255, 255, 255, 0.2);
    transition: all 0.1s;
    letter-spacing: 2px;
    position: relative;
    z-index: 1;
    overflow: hidden;
}

#restart-btn::before, #start-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    transition: left 0.5s;
}

#restart-btn:hover::before, #start-btn:hover::before {
    left: 100%;
}

#restart-btn:hover, #start-btn:hover {
    transform: translateY(3px);
    box-shadow:
        0 3px 0 #8b0000,
        0 5px 15px rgba(0, 0, 0, 0.4),
        inset 0 2px 0 rgba(255, 255, 255, 0.2);
    background: linear-gradient(180deg, #ff8080 0%, #e74c3c 50%, #d94444 100%);
}

#restart-btn:active, #start-btn:active {
    transform: translateY(6px);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

#start-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at center, rgba(30, 30, 60, 0.95) 0%, rgba(10, 10, 20, 0.98) 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 200;
    border-radius: 8px;
    overflow: hidden;
}

#start-screen::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(
        from 0deg,
        transparent 0deg,
        rgba(255, 215, 0, 0.03) 60deg,
        transparent 120deg,
        rgba(255, 100, 100, 0.03) 180deg,
        transparent 240deg,
        rgba(100, 200, 255, 0.03) 300deg,
        transparent 360deg
    );
    animation: rotateBackground 20s linear infinite;
}

@keyframes rotateBackground {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

#start-screen.hidden {
    display: none;
}

#start-screen h1 {
    color: #ffd700;
    font-size: 42px;
    margin-bottom: 15px;
    text-shadow:
        3px 3px 0 #c0392b,
        5px 5px 0 #000,
        0 0 30px rgba(255, 215, 0, 0.5),
        0 0 60px rgba(255, 215, 0, 0.3);
    animation: titlePulse 2s ease-in-out infinite;
    letter-spacing: 6px;
    position: relative;
    z-index: 1;
}

@keyframes titlePulse {
    0%, 100% {
        transform: scale(1);
        text-shadow:
            3px 3px 0 #c0392b,
            5px 5px 0 #000,
            0 0 30px rgba(255, 215, 0, 0.5);
    }
    50% {
        transform: scale(1.02);
        text-shadow:
            3px 3px 0 #c0392b,
            5px 5px 0 #000,
            0 0 50px rgba(255, 215, 0, 0.8),
            0 0 80px rgba(255, 215, 0, 0.4);
    }
}

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

#start-screen > p {
    color: #ccc;
    font-size: 16px;
    margin-bottom: 25px;
}

.controls-info, .game-info {
    background:
        linear-gradient(135deg, rgba(30, 30, 50, 0.8) 0%, rgba(20, 20, 40, 0.9) 100%);
    padding: 15px 25px;
    border-radius: 10px;
    margin-bottom: 12px;
    border: 2px solid rgba(78, 205, 196, 0.3);
    box-shadow:
        0 4px 15px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    position: relative;
    z-index: 1;
}

.controls-info::before, .game-info::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(78, 205, 196, 0.5), transparent);
}

.controls-info h3, .game-info h3 {
    color: #4ecdc4;
    margin-bottom: 10px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 3px;
    text-shadow: 0 0 10px rgba(78, 205, 196, 0.5);
}

.controls-info p, .game-info p {
    color: #bbb;
    font-size: 9px;
    margin-bottom: 6px;
    font-family: 'Segoe UI', sans-serif;
    letter-spacing: 0.5px;
}

.highscore {
    margin-top: 20px;
    color: #ffd700;
    font-size: 10px;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    position: relative;
    z-index: 1;
}

#highscore-value {
    font-weight: bold;
    font-size: 14px;
    animation: highscoreGlow 2s ease-in-out infinite;
}

@keyframes highscoreGlow {
    0%, 100% { color: #ffd700; text-shadow: 0 0 10px rgba(255, 215, 0, 0.5); }
    50% { color: #fff8dc; text-shadow: 0 0 20px rgba(255, 215, 0, 0.8), 0 0 30px rgba(255, 215, 0, 0.4); }
}

/* Responsive */
@media (max-width: 850px) {
    #game-container {
        transform: scale(0.9);
    }
}

@media (max-width: 750px) {
    #game-container {
        transform: scale(0.8);
    }
}

@media (max-width: 650px) {
    #game-container {
        transform: scale(0.7);
    }

    #start-screen h1 {
        font-size: 36px;
    }

    .controls-info, .game-info {
        padding: 10px 20px;
    }

    .controls-info h3, .game-info h3 {
        font-size: 12px;
    }

    .controls-info p, .game-info p {
        font-size: 11px;
    }
}
