Mad mystery in a gem (6)
I believe the answer is:
enigma
(Other definitions for enigma that I've seen before include "Coding device" , "Solution to mystery" , "Gamine being a bit of a puzzle" , "Mysterious or puzzling thing" , "It's mysterious, difficult to understand" .)