Found a very nice solution on https://habr.com/en/sandbox/163605/ - seems to work very well if only required within CSS.

@media (pointer: coarse)  {
    /* mobile device */
}

@media (pointer: fine), (pointer: none) {
    /* desktop */
}

@media (pointer: fine) and (any-pointer: coarse) {
    /* touch desktop */
}

Check out https://habr.com/en/sandbox/163605/ for further information.