Is there a way to detect pop-up window being dispayed in the Overflow menu?

Maybe a media query?
I’ve tried something like @media (max-width: 539px).
But it’s not that easy because it will “fire” even when I open normal popup (not in Overflow menu). And if I use fixed width on the body then it’s too wide for the Overflow menu.

…so frustrating!