Keep the fearures keep the logic but improve the UI.

Give me the entire code back.

class ModernMainWindow(QtWidgets.QWidget):
    def __init__(self):
        super().__init__()
        self.settings = load_settings()
        self.setWindowTitle(f"{APPNAME} — Melvin .cheats YOLO11n UD Detection by Melvin")
        self.setGeometry(120, 120, 900, 650)
        self.setMinimumSize(750, 500)
        # Frameless window, drag from anywhere without controls/widgets
        self.setWindowFlags(
            QtCore.Qt.FramelessWindowHint |
            QtCore.Qt.Window
        )
        self._drag_pos = None
        self._dragging = False
        self.apply_theme()
        self.detection_results = ([], [], [], [])
        self.detection_fps_times = []  # For true detection FPS display!
        self.overlay = OverlayWindow(self.settings, self.get_detection_classes, main_window=self)
        self.detection_thread = DetectionThread(self.settings)
        self.detection_thread.detection_signal.connect(self.overlay.update_overlay)
        self.aim_assist_thread = AimAssistThread(self.settings, self.get_detection_targets, self.get_fov_center)
        self.aim_assist_thread.aim_active_signal.connect(self.set_aim_active)
        self.trigger_bot_thread = TriggerBotThread(self.settings, self.get_detection_targets, self.get_fov_center)
        self.recoil_thread = RecoilControlThread(self.settings)
        self.threads = [self.detection_thread, self.aim_assist_thread, self.trigger_bot_thread, self.recoil_thread]
        self.init_ui()
        self.start_detection()
        self.menu_shortcut_key = self.settings.get("menu_shortcut", "F8")
        self.shortcut_listener_thread = threading.Thread(target=self.listen_for_menu_shortcut, daemon=True)
        self.shortcut_listener_thread.start()
        # Rounded corners
        self.setAttribute(QtCore.Qt.WA_TranslucentBackground)
        self.radius = 22  # You can tweak this for more/less rounding

    # --- Frameless Dragging ---
    def mousePressEvent(self, event):
        if event.button() == QtCore.Qt.LeftButton and not self.childAt(event.pos()):
            self._drag_pos = event.globalPos() - self.frameGeometry().topLeft()
            self._dragging = True
            event.accept()
        else:
            super().mousePressEvent(event)
    def mouseMoveEvent(self, event):
        if self._dragging and event.buttons() == QtCore.Qt.LeftButton:
            self.move(event.globalPos() - self._drag_pos)
            event.accept()
        else:
            super().mouseMoveEvent(event)
    def mouseReleaseEvent(self, event):
        self._dragging = False
        super().mouseReleaseEvent(event)

    def listen_for_menu_shortcut(self):
        while True:
            try:
                if keyboard.is_pressed(self.menu_shortcut_key):
                    self.showNormal()
                    self.activateWindow()
                    self.raise_()
                    time.sleep(0.8)
            except Exception:
                pass
            time.sleep(0.15)

    def apply_theme(self):
        purple = "#B366FF"
        dark_bg = "#181A1B"
        soft_bg = "#222426"
        font = self.settings.get('ui_font', "Segoe UI")
        font_size = self.settings.get('ui_font_size', 11)
        opacity = self.settings.get('window_transparency', 0.92)
        self.setWindowOpacity(opacity)

        self.setStyleSheet(f"""
            QWidget {{
                background-color: {dark_bg};
                color: white;
                font-family: "{font}";
                font-size: {font_size}pt;
                border-radius: 12px;
            }}
            QTabBar::tab {{
                background: {soft_bg};
                padding: 8px 18px;
                border-radius: 8px;
                margin: 2px;
            }}
            QTabBar::tab:selected {{
                background: {purple};
                color: {dark_bg};
            }}
            QTabWidget::pane {{
                border: 1px solid {purple};
                border-radius: 10px;
                margin-top: 8px;
            }}
            QPushButton {{
                background-color: rgba(36,36,38,0.95);
                color: {purple};
                border: 1px solid rgba(179,102,255,0.35);
                padding: 8px 16px;
                border-radius: 8px;
            }}
            QPushButton:hover {{
                background-color: rgba(179,102,255,0.15);
                border: 1px solid {purple};
            }}
            QSlider::groove:horizontal {{
                background: #333;
                height: 8px;
                border-radius: 4px;
            }}
            QSlider::handle:horizontal {{
                background: {purple};
                border: 2px solid #fff;
                width: 14px;
                height: 14px;
                margin: -4px 0;
                border-radius: 7px;
            }}
            QCheckBox::indicator {{
                width: 16px;
                height: 16px;
                border-radius: 4px;
                border: 2px solid {purple};
                background-color: transparent;
            }}
            QCheckBox::indicator:checked {{
                background: {purple};
            }}
            QComboBox {{
                background-color: rgba(36,36,38,0.95);
                color: white;
                border: 1px solid rgba(179,102,255,0.3);
                padding: 6px 10px;
                border-radius: 6px;
            }}
            QComboBox:hover {{
                border: 1px solid {purple};
            }}
            QComboBox::drop-down {{
                border: none;
            }}
            QComboBox::down-arrow {{
                image: none;
            }}
        """)

    def set_aim_active(self, active):
        self.overlay.set_aim_active(active)

    def update_setting(self, key, value):
        self.settings[key] = value
        save_settings(self.settings)
        self.overlay.settings = self.settings
        self.detection_thread.settings = self.settings
        self.aim_assist_thread.settings = self.settings
        self.trigger_bot_thread.settings = self.settings
        self.recoil_thread.settings = self.settings
        self.apply_theme()
        self.repaint()

    def get_detection_targets(self):
        return self.detection_results[0]

    def get_detection_classes(self):
        return self.detection_results[3]

    def get_fov_center(self):
        g = QtWidgets.QApplication.primaryScreen().geometry()
        return (g.width()//2, g.height()//2)

    def start_detection(self):
        for t in self.threads:
            if not t.isRunning():
                t.start()
        self.detection_thread.detection_signal.connect(self.handle_detection_results)

    def handle_detection_results(self, boxes, labels, confidences, classes):
        self.detection_results = (boxes, labels, confidences, classes)
        # --- Track true detection FPS ---
        import time
        now = time.time()
        self.detection_fps_times.append(now)
        if len(self.detection_fps_times) > 60:
            self.detection_fps_times.pop(0)

    def closeEvent(self, event):
        for t in self.threads:
            try:
                t.stop()
            except Exception: pass
        for t in self.threads:
            try:
                t.wait(1000)
            except Exception: pass
        event.accept()

    def init_ui(self):
        main_layout = QtWidgets.QHBoxLayout(self)
        sidebar = QtWidgets.QVBoxLayout()
        sidebar.setSpacing(6)
        sidebar.setContentsMargins(18, 18, 6, 18)

        icon_paths = [
            QtGui.QIcon(r"C:\Users\belze\OneDrive\Desktop\UD Premium Lite\icons\aim.png"),
            QtGui.QIcon(r"C:\Users\belze\OneDrive\Desktop\UD Premium Lite\icons\fov.png"),
            QtGui.QIcon(r"C:\Users\belze\OneDrive\Desktop\UD Premium Lite\icons\esp.png"),
            QtGui.QIcon(r"C:\Users\belze\OneDrive\Desktop\UD Premium Lite\icons\trigger.png"),
            QtGui.QIcon(r"C:\Users\belze\OneDrive\Desktop\UD Premium Lite\icons\settings.png"),
            QtGui.QIcon(r"C:\Users\belze\OneDrive\Desktop\UD Premium Lite\icons\recoil.png"),
        ]
        self.sidebar_buttons = []
        for i in range(6):
            btn = SidebarButton(icon_paths[i], i)
            btn.setIconSize(QtCore.QSize(50, 50))
            btn.clicked.connect(lambda checked, idx=i: self.set_tab(idx))
            self.sidebar_buttons.append(btn)
            sidebar.addWidget(btn)

        discord_icon = QtGui.QIcon(r"C:\Users\belze\OneDrive\Desktop\UD Premium Lite\icons\discord.png")
        discord_btn = QtWidgets.QPushButton()
        discord_btn.setIcon(discord_icon)
        discord_btn.setIconSize(QtCore.QSize(50, 50))
        discord_btn.setFixedSize(56, 56)
        discord_btn.setStyleSheet("""
            QPushButton {
                background-color: transparent;
                border: none;
            }
            QPushButton:hover {
                background-color: #5865F2;
                border-radius: 14px;
            }
        """)
        discord_btn.clicked.connect(lambda: webbrowser.open_new_tab("https://discord.gg/q7hXusbe"))
        sidebar.addStretch(1)
        sidebar.addWidget(discord_btn)

        self.tabs = QtWidgets.QTabWidget()
        self.tabs.setStyleSheet("QTabBar::tab { min-width: 120px; font-size: 14pt; border-radius: 10px; }")
        self.tabs.addTab(self.make_aim_tab(), "AIM")
        self.tabs.addTab(self.make_fov_tab(), "FOV")
        self.tabs.addTab(self.make_esp_tab(), "ESP")
        self.tabs.addTab(self.make_trigger_tab(), "TRIGGER")
        self.tabs.addTab(self.make_settings_tab(), "SETTINGS")
        self.tabs.addTab(self.make_recoil_tab(), "RECOIL")
        self.tabs.tabBar().hide()
        container = QtWidgets.QWidget()
        content_layout = QtWidgets.QVBoxLayout(container)
        content_layout.setContentsMargins(10, 18, 18, 18)
        content_layout.addWidget(self.tabs)
        main_layout.addLayout(sidebar, 0)
        main_layout.addWidget(container, 1)
        main_layout.setSpacing(0)
        self.setLayout(main_layout)
        self.set_tab(0)

    def set_tab(self, idx):
        self.tabs.setCurrentIndex(idx)
        for i, btn in enumerate(self.sidebar_buttons):
            btn.setChecked(i == idx)

    def make_percent_slider(self, minv, maxv, value, label, slot, decimals=2, suffix='%'):
        hbox = QtWidgets.QHBoxLayout()
        slider = QtWidgets.QSlider(QtCore.Qt.Horizontal)
        slider.setMinimum(int(minv*100))
        slider.setMaximum(int(maxv*100))
        slider.setValue(int(value*100))
        percent_label = QtWidgets.QLabel(f"{int(value*100)}{suffix}")
        def update_label(v):
            percent_label.setText(f"{v}{suffix}")
            slot(round(v/100, decimals))
        slider.valueChanged.connect(lambda v: update_label(v))
        hbox.addWidget(QtWidgets.QLabel(label))
        hbox.addWidget(slider)
        hbox.addWidget(percent_label)
        w = QtWidgets.QWidget()
        w.setLayout(hbox)
        return w

    # ---- UI Tab Methods ----

    def make_aim_tab(self):
        w = QtWidgets.QWidget()
        layout = QtWidgets.QVBoxLayout(w)
        aim_enable = QtWidgets.QCheckBox("Enable Aim Assist")
        aim_enable.setChecked(self.settings['aim_enabled'])
        aim_enable.stateChanged.connect(lambda s: self.update_setting('aim_enabled', bool(s)))
        layout.addWidget(aim_enable)
        aim_hotkey_btn = HotkeyButton("Set AIM Hotkey", "aim_hotkey", self)
        layout.addWidget(QtWidgets.QLabel("Aim Assist Hotkey:"))
        layout.addWidget(aim_hotkey_btn)
        move_speed = self.make_percent_slider(0.1, 1.5, self.settings.get('aim_move_speed', 0.8), "Move Speed", lambda v: self.update_setting('aim_move_speed', v), decimals=2)
        layout.addWidget(move_speed)
        aim_smoothing = self.make_percent_slider(0.0, 1.0, self.settings.get('aim_smoothing', 0.45), "Aim Smoothing", lambda v: self.update_setting('aim_smoothing', v), decimals=2)
        layout.addWidget(aim_smoothing)
        sticky_max = self.make_percent_slider(5, 80, self.settings.get('aim_sticky_max', 35)/80, "Sticky Max", lambda v: self.update_setting('aim_sticky_max', int(v*80)), decimals=0, suffix="px")
        layout.addWidget(sticky_max)
        sticky_decay = self.make_percent_slider(0.5, 1.0, self.settings.get('aim_sticky_decay', 0.85), "Sticky Decay", lambda v: self.update_setting('aim_sticky_decay', v), decimals=2)
        layout.addWidget(sticky_decay)
        sticky_boost = self.make_percent_slider(1.0, 2.5, self.settings.get('aim_sticky_boost', 1.55), "Sticky Boost", lambda v: self.update_setting('aim_sticky_boost', v), decimals=2)
        layout.addWidget(sticky_boost)
        pred_factor = self.make_percent_slider(0.0, 1.0, self.settings.get('aim_prediction_factor', 0.1), "Prediction Factor", lambda v: self.update_setting('aim_prediction_factor', v), decimals=2)
        layout.addWidget(pred_factor)
        # --- Silent Aim ---
        silent_enable = QtWidgets.QCheckBox("Enable Silent Aim (hold key to flick to target)")
        silent_enable.setChecked(self.settings.get('silent_aim_enabled', False))
        silent_enable.stateChanged.connect(lambda s: self.update_setting('silent_aim_enabled', bool(s)))
        layout.addWidget(silent_enable)
        silent_hotkey_btn = HotkeyButton("Set Silent Aim Hotkey", "silent_aim_hotkey", self)
        layout.addWidget(QtWidgets.QLabel("Silent Aim Hotkey:"))
        layout.addWidget(silent_hotkey_btn)
        silent_speed = self.make_percent_slider(0.2, 5.0, self.settings.get('silent_aim_speed', 1.0)/5, "Silent Aim Flick Speed", lambda v: self.update_setting('silent_aim_speed', v*5), decimals=2)
        layout.addWidget(silent_speed)
        layout.addStretch(1)
        scroll = ScrollAreaNoBar()
        scroll.setWidgetResizable(True)
        w.setLayout(layout)
        scroll.setWidget(w)
        return scroll

    def make_fov_tab(self):
        w = QtWidgets.QWidget()
        layout = QtWidgets.QVBoxLayout(w)
        fov_enable = QtWidgets.QCheckBox("Show FOV Circle")
        fov_enable.setChecked(self.settings['fov_enabled'])
        fov_enable.stateChanged.connect(lambda s: self.update_setting('fov_enabled', bool(s)))
        layout.addWidget(fov_enable)
        fov_radius = self.make_percent_slider(0.1, 0.8, self.settings['fov_radius']/800, "FOV Circle Size", lambda v: self.update_setting('fov_radius', int(v*800)), decimals=2)
        layout.addWidget(fov_radius)
        fov_thick_slider = self.make_percent_slider(1, 8, self.settings.get('fov_thickness', 1)/8, "FOV Circle Thickness", lambda v: self.update_setting('fov_thickness', int(v*8)), decimals=0, suffix="px")
        layout.addWidget(fov_thick_slider)
        fov_opacity = self.make_percent_slider(0.05, 1.0, self.settings.get('fov_opacity', 0.23), "FOV Opacity", lambda v: self.update_setting('fov_opacity', v), decimals=2)
        layout.addWidget(fov_opacity)
        fov_color = ColorButton(self.settings.get('fov_color', "#B366FF"), lambda c: self.update_setting('fov_color', c))
        layout.addWidget(QtWidgets.QLabel("FOV Circle Color:"))
        layout.addWidget(fov_color)
        layout.addStretch(1)
        scroll = ScrollAreaNoBar()
        scroll.setWidgetResizable(True)
        w.setLayout(layout)
        scroll.setWidget(w)
        return scroll

    def make_esp_tab(self):
        w = QtWidgets.QWidget()
        layout = QtWidgets.QVBoxLayout(w)
        esp_enable = QtWidgets.QCheckBox("Enable ESP")
        esp_enable.setChecked(self.settings['esp_enabled'])
        esp_enable.stateChanged.connect(lambda s: self.update_setting('esp_enabled', bool(s)))
        layout.addWidget(esp_enable)
        box_color = ColorButton(self.settings.get('esp_box_color', "#B366FF"), lambda c: self.update_setting('esp_box_color', c))
        fill_color = ColorButton(self.settings.get('esp_fill_color', "#7E3FF2"), lambda c: self.update_setting('esp_fill_color', c))
        line_color = ColorButton(self.settings.get('esp_line_color', "#B366FF"), lambda c: self.update_setting('esp_line_color', c))
        layout.addWidget(QtWidgets.QLabel("ESP Box Color:"))
        layout.addWidget(box_color)
        layout.addWidget(QtWidgets.QLabel("ESP Fill Color:"))
        layout.addWidget(fill_color)
        layout.addWidget(QtWidgets.QLabel("ESP Line Color:"))
        layout.addWidget(line_color)
        esp_style = QtWidgets.QComboBox()
        esp_style.addItems(["Box", "Corner", "Filled"])
        esp_style.setCurrentText(self.settings.get('esp_box_style', "Box"))
        esp_style.currentTextChanged.connect(lambda v: self.update_setting('esp_box_style', v))
        layout.addWidget(QtWidgets.QLabel("ESP Box Style:"))
        layout.addWidget(esp_style)
        esp_lines = QtWidgets.QCheckBox("Show Lines to ESP Boxes")
        esp_lines.setChecked(self.settings.get('esp_show_lines', True))
        esp_lines.stateChanged.connect(lambda s: self.update_setting('esp_show_lines', bool(s)))
        layout.addWidget(esp_lines)
        font_size = self.make_percent_slider(8, 22, self.settings.get('esp_font_size', 12)/22, "ESP Font Size", lambda v: self.update_setting('esp_font_size', int(v*22)), decimals=0, suffix="px")
        layout.addWidget(font_size)
        esp_box_slider = self.make_percent_slider(1, 8, self.settings.get('esp_box_thickness', 1)/8, "ESP Box Thickness", lambda v: self.update_setting('esp_box_thickness', int(v*8)), decimals=0, suffix="px")
        layout.addWidget(esp_box_slider)
        esp_line_slider = self.make_percent_slider(1, 8, self.settings.get('esp_line_thickness', 1)/8, "ESP Line Thickness", lambda v: self.update_setting('esp_line_thickness', int(v*8)), decimals=0, suffix="px")
        layout.addWidget(esp_line_slider)
        layout.addStretch(1)
        scroll = ScrollAreaNoBar()
        scroll.setWidgetResizable(True)
        w.setLayout(layout)
        scroll.setWidget(w)
        return scroll

    def make_trigger_tab(self):
        w = QtWidgets.QWidget()
        layout = QtWidgets.QVBoxLayout(w)
        trigger_enable = QtWidgets.QCheckBox("Enable Trigger Bot")
        trigger_enable.setChecked(self.settings.get("trigger_enabled", False))
        trigger_enable.stateChanged.connect(lambda s: self.update_setting("trigger_enabled", bool(s)))
        layout.addWidget(trigger_enable)
        trigger_auto = QtWidgets.QCheckBox("Auto Fire (hold button down while target in center)")
        trigger_auto.setChecked(self.settings.get("trigger_auto_fire", False))
        trigger_auto.stateChanged.connect(lambda s: self.update_setting("trigger_auto_fire", bool(s)))
        layout.addWidget(trigger_auto)
        burst_enable = QtWidgets.QCheckBox("Enable Burst Mode")
        burst_enable.setChecked(self.settings.get("trigger_burst", False))
        burst_enable.stateChanged.connect(lambda s: self.update_setting("trigger_burst", bool(s)))
        layout.addWidget(burst_enable)
        hbox = QtWidgets.QHBoxLayout()
        slider = QtWidgets.QSlider(QtCore.Qt.Horizontal)
        slider.setMinimum(50)
        slider.setMaximum(1000)
        slider.setValue(self.settings.get("trigger_fire_speed", 150))
        fire_label = QtWidgets.QLabel(f"{self.settings.get('trigger_fire_speed', 150)} ms")
        def set_fire_speed(v):
            fire_label.setText(f"{v} ms")
            self.update_setting("trigger_fire_speed", int(v))
        slider.valueChanged.connect(set_fire_speed)
        hbox.addWidget(QtWidgets.QLabel("Fire Speed (ms between bursts):"))
        hbox.addWidget(slider)
        hbox.addWidget(fire_label)
        layout.addLayout(hbox)
        hbox2 = QtWidgets.QHBoxLayout()
        tol_slider = QtWidgets.QSlider(QtCore.Qt.Horizontal)
        tol_slider.setMinimum(0)
        tol_slider.setMaximum(10)
        tol_slider.setValue(self.settings.get("trigger_tolerance", 2))
        tol_label = QtWidgets.QLabel(f"{self.settings.get('trigger_tolerance', 2)} px")
        def set_tol(v):
            tol_label.setText(f"{v} px")
            self.update_setting('trigger_tolerance', int(v))
        tol_slider.valueChanged.connect(set_tol)
        hbox2.addWidget(QtWidgets.QLabel("Trigger Center Tolerance:"))
        hbox2.addWidget(tol_slider)
        hbox2.addWidget(tol_label)
        layout.addLayout(hbox2)
        hbox3 = QtWidgets.QHBoxLayout()
        burst_count_slider = QtWidgets.QSlider(QtCore.Qt.Horizontal)
        burst_count_slider.setMinimum(2)
        burst_count_slider.setMaximum(8)
        burst_count_slider.setValue(self.settings.get("trigger_burst_count", 3))
        burst_count_label = QtWidgets.QLabel(f"{self.settings.get('trigger_burst_count', 3)} shots")
        def set_burst_count(v):
            burst_count_label.setText(f"{v} shots")
            self.update_setting("trigger_burst_count", int(v))
        burst_count_slider.valueChanged.connect(set_burst_count)
        hbox3.addWidget(QtWidgets.QLabel("Burst Count:"))
        hbox3.addWidget(burst_count_slider)
        hbox3.addWidget(burst_count_label)
        layout.addLayout(hbox3)
        hbox4 = QtWidgets.QHBoxLayout()
        burst_delay_slider = QtWidgets.QSlider(QtCore.Qt.Horizontal)
        burst_delay_slider.setMinimum(20)
        burst_delay_slider.setMaximum(200)
        burst_delay_slider.setValue(self.settings.get("trigger_burst_delay", 60))
        burst_delay_label = QtWidgets.QLabel(f"{self.settings.get('trigger_burst_delay', 60)} ms")
        def set_burst_delay(v):
            burst_delay_label.setText(f"{v} ms")
            self.update_setting("trigger_burst_delay", int(v))
        burst_delay_slider.valueChanged.connect(set_burst_delay)
        hbox4.addWidget(QtWidgets.QLabel("Burst Delay (between shots):"))
        hbox4.addWidget(burst_delay_slider)
        hbox4.addWidget(burst_delay_label)
        layout.addLayout(hbox4)
        layout.addStretch(1)
        scroll = ScrollAreaNoBar()
        scroll.setWidgetResizable(True)
        w.setLayout(layout)
        scroll.setWidget(w)
        return scroll

    def make_settings_tab(self):
        w = QtWidgets.QWidget()
        layout = QtWidgets.QVBoxLayout(w)
        conf_slider = self.make_percent_slider(0.1, 0.9, self.settings.get('confidence', 0.5), "Detection Confidence", lambda v: self.update_setting('confidence', v), decimals=2)
        layout.addWidget(conf_slider)
        window_opacity_slider = self.make_percent_slider(0.1, 1.0, self.settings.get('window_transparency', 0.87), "Menu/Background Opacity", lambda v: self.update_setting('window_transparency', v), decimals=2)
        layout.addWidget(window_opacity_slider)
        hbox = QtWidgets.QHBoxLayout()
        import_btn = QtWidgets.QPushButton("Import Settings")
        export_btn = QtWidgets.QPushButton("Export Settings")
        hbox.addWidget(import_btn)
        hbox.addWidget(export_btn)
        layout.addLayout(hbox)
        import_btn.clicked.connect(lambda: self.handle_import_settings())
        export_btn.clicked.connect(lambda: export_settings(self.settings, self))
        shortcut_hbox = QtWidgets.QHBoxLayout()
        shortcut_label = QtWidgets.QLabel("Menu Shortcut Key:")
        shortcut_edit = QtWidgets.QLineEdit(self.settings.get("menu_shortcut", "F8"))
        shortcut_edit.setMaximumWidth(60)
        def set_shortcut():
            key = shortcut_edit.text().strip()
            if key:
                self.update_setting("menu_shortcut", key)
                self.menu_shortcut_key = key
        shortcut_edit.editingFinished.connect(set_shortcut)
        shortcut_hbox.addWidget(shortcut_label)
        shortcut_hbox.addWidget(shortcut_edit)
        layout.addLayout(shortcut_hbox)
        layout.addStretch(1)
        scroll = ScrollAreaNoBar()
        scroll.setWidgetResizable(True)
        w.setLayout(layout)
        scroll.setWidget(w)
        return scroll

    def make_recoil_tab(self):
        w = QtWidgets.QWidget()
        layout = QtWidgets.QVBoxLayout(w)
        recoil_enable = QtWidgets.QCheckBox("Enable Recoil Control")
        recoil_enable.setChecked(self.settings.get('recoil_enabled', False))
        recoil_enable.stateChanged.connect(lambda s: self.update_setting('recoil_enabled', bool(s)))
        layout.addWidget(recoil_enable)
        recoil_strength_slider = QtWidgets.QSlider(QtCore.Qt.Horizontal)
        recoil_strength_slider.setMinimum(0)
        recoil_strength_slider.setMaximum(100)
        recoil_strength_slider.setValue(self.settings.get('recoil_strength', 50))
        recoil_strength_label = QtWidgets.QLabel(f"{self.settings.get('recoil_strength', 50)}%")
        def set_strength(v):
            recoil_strength_label.setText(f"{v}%")
            self.update_setting('recoil_strength', v)
        recoil_strength_slider.valueChanged.connect(set_strength)
        layout.addWidget(QtWidgets.QLabel("Recoil Strength"))
        layout.addWidget(recoil_strength_slider)
        layout.addWidget(recoil_strength_label)
        recoil_jitter_slider = QtWidgets.QSlider(QtCore.Qt.Horizontal)
        recoil_jitter_slider.setMinimum(0)
        recoil_jitter_slider.setMaximum(20)
        recoil_jitter_slider.setValue(self.settings.get('recoil_jitter', 5))
        recoil_jitter_label = QtWidgets.QLabel(f"{self.settings.get('recoil_jitter', 5)} px")
        def set_jitter(v):
            recoil_jitter_label.setText(f"{v} px")
            self.update_setting('recoil_jitter', v)
        recoil_jitter_slider.valueChanged.connect(set_jitter)
        layout.addWidget(QtWidgets.QLabel("Jitter (humanization)"))
        layout.addWidget(recoil_jitter_slider)
        layout.addWidget(recoil_jitter_label)
        pattern_combo = QtWidgets.QComboBox()
        pattern_combo.addItems(["Default", "Pattern 1", "Pattern 2"])
        pattern_combo.setCurrentText(self.settings.get('recoil_pattern', "Default"))
        pattern_combo.currentTextChanged.connect(lambda v: self.update_setting('recoil_pattern', v))
        layout.addWidget(QtWidgets.QLabel("Recoil Pattern"))
        layout.addWidget(pattern_combo)
        activation_key = HotkeyButton("Set Recoil Activation Key", "recoil_activation_key", self)
        layout.addWidget(QtWidgets.QLabel("Activation Key:"))
        layout.addWidget(activation_key)
        layout.addStretch(1)
        scroll = ScrollAreaNoBar()
        scroll.setWidgetResizable(True)
        w.setLayout(layout)
        scroll.setWidget(w)
        return scroll

    def handle_import_settings(self):
        new_settings = import_settings(self)
        if new_settings:
            self.settings = new_settings
            save_settings(self.settings)
            QtWidgets.QMessageBox.information(self, "Imported", "Settings imported. Restart app for all changes.")
            
    def paintEvent(self, event):
        path = QtGui.QPainterPath()
        path.addRoundedRect(QtCore.QRectF(self.rect()), self.radius, self.radius)
        painter = QtGui.QPainter(self)
        painter.setRenderHint(QtGui.QPainter.Antialiasing)
        painter.setClipPath(path)
        painter.setPen(QtCore.Qt.NoPen)
        painter.setBrush(QtGui.QColor(24, 26, 27, 220))
        painter.drawPath(path)
        super().paintEvent(event)
        
if __name__ == "__main__":
    app = QtWidgets.QApplication(sys.argv)
    settings = load_settings()
    main_win = ModernMainWindow()
    main_win.show()
    sys.exit(app.exec_())