Only the study team can determine whether someone qualifies for participation.
Inclusion criteria
Age 18-80 years and able to understand the study and provide written informed consent.
Primary lung cancer diagnosed or suspected based on pathology and/or thoracic surgical multidisciplinary assessment, with planned elective thoracoscopic lung resection.
ASA physical status I-III, with expected awake extubation after surgery and ability to complete postoperative sleep and pain assessments.
Preoperative sleep impairment, defined as an Insomnia Severity Index (ISI) score ≥8 or a Richards-Campbell Sleep Questionnaire (RCSQ) score <70 on the most recent evaluable preoperative inpatient night.
Able to complete TMS safety screening, resting motor threshold assessment, RCSQ/ISI assessments, at least one baseline night of Lifesense HR6 monitoring, and 64-channel EEG.
The preoperative hospitalization schedule permits completion of two preoperative stimulation sessions, and postoperative hospitalization is expected to last at least three nights, allowing completion of the remaining three stimulation sessions without delaying surgery, necessary clinical care, or discharge.
Exclusion criteria
Unable to provide valid informed consent, unwilling to participate, or unable to reliably complete the primary RCSQ assessment.
History of epilepsy or unexplained seizures, active intracranial hemorrhage, significant cerebral edema, elevated intracranial pressure, recent stroke, or severe traumatic brain injury.
Intracranial ferromagnetic metal, cochlear implant, deep brain stimulator, cardiac pacemaker/implantable cardioverter-defibrillator, or other TMS-incompatible implant.
Severe scalp infection, open wound, or inability to safely position the TMS coil or EEG cap.
Pregnancy or any condition considered by the investigator to pose unacceptable risk.
Emergency surgery, planned open thoracotomy, or planned prolonged postoperative mechanical ventilation or deep sedation.
Chronic pain requiring regular preoperative opioid treatment, or pre-existing pain with an NRS score ≥3 in the target thoracic region.
Persistent delirium, respiratory distress, hemodynamic instability, active bleeding, or need for urgent reoperation after extubation.