#rubiks-cube {
    display: grid;
    grid-template-columns: repeat(3, clamp(3rem, 15vw, 5rem));
    grid-template-rows: repeat(3, clamp(3rem, 15vw, 5rem));
    gap: clamp(0.125rem, 1.5vw, 0.25rem);
    margin: clamp(1rem, 4vw, 2rem) auto;
    width: fit-content;
    max-width: min(90vw, 20rem);
    justify-content: center;
}

.block {
    width: clamp(3rem, 15vw, 5rem);
    height: clamp(3rem, 15vw, 5rem);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.block:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

/* Responsive adjustments for very small screens */
@media (max-width: 480px) {
    #rubiks-cube {
        grid-template-columns: repeat(3, clamp(2.5rem, 18vw, 4rem));
        grid-template-rows: repeat(3, clamp(2.5rem, 18vw, 4rem));
        gap: clamp(0.1rem, 2vw, 0.2rem);
        margin: clamp(0.75rem, 5vw, 1.5rem) auto;
    }
    
    .block {
        width: clamp(2.5rem, 18vw, 4rem);
        height: clamp(2.5rem, 18vw, 4rem);
    }
}

@media (max-width: 375px) {
    #rubiks-cube {
        grid-template-columns: repeat(3, clamp(2rem, 20vw, 3.5rem));
        grid-template-rows: repeat(3, clamp(2rem, 20vw, 3.5rem));
        gap: clamp(0.075rem, 2.5vw, 0.15rem);
        margin: clamp(0.5rem, 6vw, 1rem) auto;
    }
    
    .block {
        width: clamp(2rem, 20vw, 3.5rem);
        height: clamp(2rem, 20vw, 3.5rem);
    }
}
