Solution: add this code to the header
<meta name="viewport" content="width=device-width, initial-scale=1.0">
And don't use @media (min-device-width) or (min-device-height), instead just make use of (min-width) or (min-height) and start from there. It will take a lot of headache when developing for mobile or tablets.