The mood pyramid of cocoa, which was previously proposed as a new concept, consists of four levels (flavan-3-ols, methylxanthines, minor compounds and orosensory properties). Roasting is a crucial process for flavor development in cocoa but is likely to have a negative impact on the phytochemicals. We investigated the effect of roasting time (10-50 min) and temperature (110-160 degrees C) on the potential mood-enhancing compounds corresponding to the distinct mood pyramid levels. Phytochemicals were analyzed using UPLC-HRMS, while the flavor was mapped via aroma (HS-SPME-GC-MS) and generic descriptive analysis (trained panel). Results revealed that roasting at 130 degrees C for 30 min did not significantly affect the levels of epicatechin, procyanidin B2 and theobromine, while salsolinol significantly increased. Moreover, bitterness and astringency were reduced and the desired cocoa flavor was developed. Thus, through selection of appropriate roasting time and temperature conditions phytochemicals of interest could be retained without comprising the flavor.