If both are being served with semantic markup, using the same markup, search engines shouldn't give a flying purple fish what the layout styling is. Especially if you practice proper separation of presentation from content.
Whilst some checks of the CSS is performed to test for mobile viability and abuse such as content cloaking, search engines don't have eyeballs! They do not care about your layout, colours, backgrounds, or any other visual aspect of your design.
Design as in actual engineering design, not the fancy artsy nonsense artists under the delusion they are designers tend to vomit up in complete ignorance of usability, accessibility, etc.
From a markup standpoint if you do things properly, the "mobile" version is just the desktop version + media queries using the same HTML. As such so long as it has the things they check for in terms of mobile compliance -- scaling to width, stripping off columns, finger sized buttons/anchors -- they do not care how you arrived at that result.
Which is why I favor desktop-first design, because we can target any mobile devices we care about supporting with media queries and it is far, far easier to strip columns off a layout once their containers are established than it is to add them after.
You know what we can't target with media queries? Legacy Desktop -- which is why you start with legacy desktop first and then progressively enhance it with media queries and features that can gracefully degrade.
But either way, that's layout and style, two things that 90%+ of which search engines flat out do not care about any more than people on screen readers (software reading the page aloud), braille readers, TTY devices, puffers, and other alternative navigation do.
Another reason to practice separation of presentation from content, if all your style is external and all your markup is semantic, just remove the CSS to "see" what a search engine really cares about and what those users with accessibility needs get!
P.S. That's two excellent questions more beginners need to be asking about in a row from you.