In css exists media queries so tetect the input device of the user.
@media (pointer: fine) {}
can use for styles, specially for users with a mouse pointer.
@media (pointer: coarse) {}
detect touch screens with finger pointing input for example.
https://developer.mozilla.org/en-US/docs/Web/CSS/@media/pointer