Inverse-Designed Metaphotonics for Hypersensitive Detection