detect power loss

you wrap a sense wire around the mains cable a few times, connect it to a digital input and via something like a 33M resistors to ground Some experimentation required, the wire must be properly insulated as must the mains cable. The induced signal will be clamped to 0..5V

Your idea could be very dangerous for the arduino itself. AWOL idea is more safe