html, body {
    overflow: hidden;
    height: 100%;
    touch-action: none;
}

body {
    margin: 0;
    overflow: hidden; /* Empêche les barres de défilement lorsque le canvas est déplacé */
    background-color: #333333; /* Fond plus foncé */
    display: flex;
    flex-direction: column;
    align-items: center;
    font-family: Arial, sans-serif;
}

#color-palette {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 5px;
    padding: 10px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    z-index: 100;
}

.color-button {
    width: 30px;
    height: 30px;
    border: 1px solid #ccc;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.1s ease;
}

.color-button:hover {
    transform: scale(1.1);
}

.color-button.selected {
    border: 3px solid #000;
    box-shadow: 0 0 5px rgba(0,0,0,0.5);
}

/* Canvas carré, centré, jamais déformé */
#game-canvas {
    position: fixed;
    top: 0; left: 0;
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    max-height: 100vh;
    background: #222;
    touch-action: none;
    z-index: 1;
    display: block;
    margin: 0;
    border: none;
}

#cooldown-indicator {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 20px;
    border-radius: 5px;
    font-size: 16px;
    font-weight: bold;
    color: white;
    z-index: 200;
    transition: background-color 0.3s ease;
}

#cooldown-indicator.can-place {
    background-color: rgba(0, 128, 0, 0.8); /* Vert */
}

#cooldown-indicator.cannot-place {
    background-color: rgba(255, 0, 0, 0.8); /* Rouge */
}

#cursor-coordinates {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 8px 12px;
    border-radius: 5px;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.2);
    font-size: 14px;
    color: #333;
    z-index: 200;
}

canvas {
    touch-action: none;
}

@media (max-width: 600px) {
    #color-palette {
        bottom: 4vw;
        padding: 4vw 2vw;
        max-width: 95vw;
        overflow-x: auto;
        flex-wrap: nowrap;
    }
    .color-button {
        width: 8vw;
        height: 8vw;
        min-width: 32px;
        min-height: 32px;
        flex: 0 0 auto;
    }
    #cooldown-indicator, #cursor-coordinates {
        font-size: 4vw;
        min-width: 90px;
        max-width: 90vw;
        padding: 8px 12px;
        border-radius: 6px;
        box-shadow: 0 1px 5px rgba(0,0,0,0.15);
        background: rgba(255,255,255,0.95);
        color: #222;
        z-index: 200;
        text-align: center;
    }
    #cooldown-indicator {
        top: 10px;
    }
    #cursor-coordinates {
        top: 60px;
        right: 10px;
        left: auto;
        font-size: 3.5vw;
        min-width: 70px;
        max-width: 80vw;
    }
}