癇 points to a word originally with meanings like convulsions, fits and more recent epilepsy. 疒 is illness q.v. and 閒 (a variant of 間) acts as phonetic. In Classical Chinese 閒 stood for a word with a range of meanings such as: moving slowly, leisure, peace. In that way 癇 could have expressed: an illness whereby one is moving slowly or at peace (though admittedly, that seems a somewhat unconvincing way of expressing having convulsions or having a fit). In Japanese 癇 also has meanings regarding losing one’s temper or being irritable. Suggest taking 閒 as 門 door and 月 moon.
Mnemonic: Moon sick he has a fit and falls through the door
癇 (pointing to a word/morpheme in Mandarin xián and Sino-Japanese kan) consists of the signific 疒 illness (dicussed here) and 閒 which acts as phonetic. In Japanese 閒 is no longer used on its own. Instead it’s often written as 間. Henshall (92) explains that moon 月 and sun 日 perform identical roles in 閒 /間, but nevertheless in Chinese 閒 and 間 don’t seem entirely interchangeable. To make matters a bit confusing, ‘leisure’ 閒 can also be written with 閑. Note that there is a theory that the meaning of ‘leisure’ (閒 /閑 xián) may be related to the meaning of ‘to be in the middle; be inserted; crevice; interstice’ (閒 /間 jiān) via interstice time→leisure (speculative, Schuessler, p. 529).
While 癇 and 閒 in Mandarin Chinese both conveniently connect to words/morphemes pronounced xián it seems to me not certain that as phonetic 閒 lent more than its sound. Unless the meanings that Schuessler (p. 528) gives (‘be moving slowly; leisure; peace’) originally suggested in 癇 someone who was mostly unconscious, and as such moved limbs only slightly (i.e. did not have a violent fit) - which is somewhat probable.
Specifically about 閒 and 間 as characters, both Henshall (92) and Wieger (64 H) analyse 閒 and 間 as the same ideograph: (sun/moon)light streaming through a gap in the door, suggesting ‘a gap; space; interval; interstice’. And as mentioned earlier, interstice time→leisure might account for the meaning of ‘leisure’ that 閒 still has in Chinese. However, often that meaning is now covered with 閑. Henshall suggests that using 閑 instead of 閒 arose from a ‘confusion with space 閒 /間 which once had an associated meaning of free time’ (1109).
Was it ‘confusion’ or perhaps deliberate? At some time 閑 pointed to a different word (which probably sounded the same as ‘leisure’ 閒 ) that originally had meanings like ‘barrier, bar; obstruct; protect’ (Schuessler, p. 529). (閑 depicts door 門 and wood 木 , suggesting a wooden bar or latch). Then, for some reason the scribes started to use ‘bar’ 閑 to write ‘leisure’...
It could be that the scribes wanted to use 閒 /間 exclusively for ‘space; gap; interval’, and therefore needed a way to separate the (possibly extended) meaning of ‘leisure’ and borrowed 閑 solely as a glyph with the same sound. Anyway, both in Japan and PRC China leisure 閒 is now usually 閑 (simplified as 闲 in mainland China) but outside those two countries words can still be written with 閒.