A 25-year-old man presents with acute confusion, visual hallucinations and agitation after several days of pneumonia treated with high-dose opioids for pain. Examination shows fluctuating consciousness, disorientation and inattention. Which diagnosis is most likely?