html {
    font-size: 62.5%; /* Base font size: 10px (1rem = 10px) for easier scaling */
    background: url("assets/image.png") bottom center;
    background-size: cover;
}

body, html {
    margin: 0;
    padding: 0;
    font-family: sans-serif;
    height: 100%;
}

.keys {
    color: #fff;
    display: flex;
    min-height: 100vh;
    flex-direction: row;
    gap: 0.5rem; 
    align-items: center;
    justify-content: center;
    flex-wrap: wrap; 
}

.key {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border: 0.8rem solid black; 
    border-radius: 0.5rem;
    background: rgba(0, 0, 0, 0.4);
    transition: all 0.7s ease; 
    margin: 0.5rem; 
    font-size: 1.2rem; 
    padding: 0.8rem 0.4rem; 
    width: clamp(40px, 10vw, 50px); 
    box-sizing: border-box; 
}

.playing {
    transform: scale(1.1);
    border-color: #ffc600;
    box-shadow: 0 0 1rem #ffc600;
}

.key span {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    font-size: 0.8rem; 
    text-align: center;
}

kbd {
    display: block;
    font-size: clamp(2rem, 5vw, 3rem); 
}

.sound {
    font-size: 1rem; 
    text-transform: uppercase;
    letter-spacing: 0.1rem;
    color: #ffc600;
    text-align: center;
}

/* Media Queries for Fine-Tuning Responsiveness */

/* Tablets and smaller desktops (max-width: 1024px) */
@media (max-width: 1024px) {
    html {
        font-size: 55%; /* Slightly smaller base font size */
    }

    .key {
        width: clamp(35px, 8vw, 45px); /* Adjust width */
        margin: 0.4rem;
        padding: 0.6rem 0.3rem;
        border-width: 0.6rem;
    }

    .key span {
        font-size: 0.7rem;
    }

    .sound {
        font-size: 0.9rem;
    }
}

/* Mobile devices (max-width: 768px) */
@media (max-width: 768px) {
    html {
        font-size: 50%; 
    }

    .keys {
        gap: 0.3rem;
        padding: 1rem; 
    }

    .key {
        width: clamp(30px, 12vw, 40px); /* Smaller width for mobile */
        margin: 0.3rem;
        padding: 0.5rem 0.2rem;
        border-width: 0.5rem;
        font-size: 1rem;
    }

    kbd {
        font-size: clamp(1.8rem, 6vw, 2.5rem); 
    }

    .key span {
        font-size: 0.6rem;
    }

    .sound {
        font-size: 0.8rem;
        letter-spacing: 0.05rem; 
    }
}

/* Very small screens (max-width: 480px) */
@media (max-width: 480px) {
    html {
        font-size: 45%; 
    }

    .key {
        width: clamp(25px, 15vw, 35px); /* Smallest width */
        margin: 0.2rem;
        padding: 0.4rem 0.2rem;
        border-width: 0.4rem;
    }

    kbd {
        font-size: clamp(1.5rem, 7vw, 2rem);
    }

    .key span {
        font-size: 0.5rem;
    }

    .sound {
        font-size: 0.7rem;
    }
}