I don't know enough about Italian to know the answer to whether both varieties should be accepted; I do think that duoLingo's recommending English "Goodnight" (i.e. as a single word) as the translation seems a bit misguided. https://jasondrexler.wordpress.com/2012/03/26/say-good-night-to-goodnight/
When you meet somebody late you can say: ciao, salve, buonasera, never buonanotte
When you or someone else leaves, you can say buonanotte, but only if you or the other person goes to bed (even if you have to go home first).
if somebody goes away saying "I leave you, I have to go to work", you cannot say him/her buonanotte (even if it's two at night)
you can say: ciao, salve, buonasera, buona nottata, buon lavoro, ...
yes, but only before going to bed.
if you are going to sleep, you can always say "buonanotte" (also at 7am).
if you say me "buonanotte" at midnight, but I'm not going to sleep, I could answer:
• Non vado a dormire, vado alla festa di Paul (I don't go to sleep, I go to Paul's party)
• Magari(1), devo ancora fare i compiti (?????, I still have to do my homework)
• Guarda(2) che sto andando a lavorare (????? I'm going to work)
(1) I wish it were so, but it is not
(2) it's not what you think