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

body {
    margin: 0;
    padding: 0;
    background-color: #222; /* Fond sombre autour du jeu */
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    font-family: 'Press Start 2P', cursive;
    color: white;
}

#game-container {
    position: relative;
    width: 1024px;
    height: 576px;
    box-shadow: 0 0 40px rgba(0,0,0,0.8);
    border: 8px solid #444; /* Bords de borne d'arcade */
    border-radius: 4px;
    background-color: #5c94fc;
    overflow: hidden;
    image-rendering: pixelated;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
}

#victory-screen, #game-over-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.2); /* Très léger pour voir le canvas */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    z-index: 10;
}

.replay-btn {
    margin-top: 350px; /* La place pour la pancarte en bois */
}

#game-over-screen h1 {
    color: #ffd700;
    text-shadow: 3px 3px #e52521;
    font-size: 28px;
    margin-bottom: 20px;
}

button {
    font-family: 'Press Start 2P', cursive;
    background-color: #e52521;
    color: white;
    border: 4px solid #fff;
    padding: 15px 20px;
    font-size: 16px;
    cursor: pointer;
    transition: transform 0.1s;
    box-shadow: 4px 4px 0 #000;
}

button:hover {
    transform: scale(1.1);
}

button:active {
    transform: scale(0.9);
    box-shadow: 0px 0px 0 #000;
}

.hidden {
    display: none !important;
}

#finish-frame {
    position: absolute;
    width: 160px;
    height: 160px;
    border: 10px solid #FFD700; /* Belle dorure or */
    border-style: ridge; /* Effet cadre ancien */
    border-radius: 4px;
    box-shadow: 
        0 0 20px rgba(255, 215, 0, 0.6), 
        10px 10px 25px rgba(0,0,0,0.8);
    background-color: #111;
    display: none; /* Affiché dynamiquement par le JS */
    z-index: 10;
    overflow: hidden;
    transform: rotate(2deg); /* Un peu penché pour l'effet flottant */
    animation: floatFrame 3s ease-in-out infinite;
}

#finish-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

@keyframes floatFrame {
    0% { transform: translateY(0px) rotate(2deg); }
    50% { transform: translateY(-10px) rotate(-1deg); }
    100% { transform: translateY(0px) rotate(2deg); }
}

#leaderboard-container {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.8);
    border: 4px solid #FFD700;
    border-radius: 8px;
    padding: 15px;
    width: 250px;
    text-align: left;
    box-shadow: 4px 4px 0 #000;
    z-index: 100;
}

#leaderboard-container h2 {
    color: #e52521;
    font-size: 14px;
    margin-top: 0;
    text-align: center;
    text-shadow: 2px 2px #000;
}

#leaderboard-list {
    list-style-type: decimal;
    padding-left: 20px;
    color: white;
    font-size: 10px;
    line-height: 1.8;
    margin-bottom: 10px;
}

#leaderboard-list li {
    margin-bottom: 4px;
}

#leaderboard-list span.score {
    float: right;
    color: #FFD700;
}

#new-score-form {
    margin-top: 10px;
    border-top: 2px dashed #444;
    padding-top: 10px;
}

#new-score-form p {
    color: #00ff00;
    font-size: 10px;
    text-align: center;
    margin: 5px 0;
    animation: flash 1s infinite;
}

#player-name {
    width: 90%;
    font-family: 'Press Start 2P', cursive;
    font-size: 10px;
    padding: 5px;
    margin-bottom: 8px;
    background: #222;
    color: white;
    border: 2px solid #555;
}

#new-score-form button {
    padding: 8px 10px;
    font-size: 10px;
    width: 100%;
}

@keyframes flash {
    0% { opacity: 1; }
    50% { opacity: 0.2; }
    100% { opacity: 1; }
}

#title-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    cursor: pointer;
    z-index: 50;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

#press-start-text {
    color: white;
    font-size: 20px;
    margin-bottom: 20px;
    animation: flash 1.5s infinite;
}

#developer-text {
    color: #888;
    font-size: 10px;
}

#kiki-title {
    color: #F8E71C; /* Nice yellow color */
    font-size: 60px;
    margin-bottom: 40px;
    text-shadow: 4px 4px 0 #000;
    text-align: center;
    letter-spacing: 2px;
}

#mobile-block {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: #000; color: #fff;
    z-index: 9999;
    flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 20px;
}

#mobile-block h1 {
    font-size: 40px;
    color: #F8E71C;
    margin-bottom: 20px;
}

#mobile-block p {
    font-size: 18px;
    line-height: 1.5;
    margin-bottom: 10px;
}

#loading-text {
    color: #fff;
    font-size: 20px;
    margin-bottom: 20px;
    animation: flash 1s infinite;
}
