I would say, you install a lightweight Linux, boot directly into your favorite distraction free editor at full screen and sync the files back to phone and big computer via something like syncthing/Nextcloud/etc.
As for which editor that is, it depends a little bit on your needs, but there are ones specifically geared towards being distraction free like https://ghostwriter.kde.org/
Although markdown may not be what you're after. I personally consider formatting another form of distraction, ao this would be a plus for me. But if you write math-heavy papers, going with something else like Typst or LATeX may be a better choice.
Thanks! Ghostwriter is a really good candidate. I mostly use iA Writer on my mac and they seem to share the same philosophy.