This single-center randomized, double-blind, sham-controlled trial will evaluate whether low-frequency repetitive transcranial magnetic stimulation (rTMS) improves postoperative inpatient sleep in adults undergoing elective thoracoscopic lung resection for primary lung cancer. A total of 220 participants will be assigned 1:1 to active or matched sham stimulation. Five sessions will be delivered during seven perioperative calendar days, with no more than one session per day. The primary outcome is each participant's mean Richards-Campbell Sleep Questionnaire (RCSQ) total score across postoperative inpatient nights 1-3, calculated from at least two eligible nights. Secondary outcomes include length of postoperative hospitalization, pain, quality of life, actigraphy-derived sleep, anxiety, depression, electroencephalographic measures, and safety.