Yes and yes.
The online bit is easy, one system could authenticate you and another record your vote. Designed with no way to tie the two together. Whether anyone would, or maybe everyone, would believe that is another matter.
The harder bit is how to give you a unique code without it being crackable but far enough in advance, but allowing that not everyone will want to use it. If you are issued with a code, risk system gets cracked one person could generate multiple codes. Let people register online and risk ID impersonation .
Imagine if we did have secure easy and universal electronic voting. We could have a true democracy, rather than just democratic parliament. The government could hold referenda easily.