Kour Zenith Hack Pro

The ultimate tactical suite for Kour.io, delivering precision performance, advanced visual overlays, and comprehensive account modification.

Vous devrez installer une extension telle que Tampermonkey, Greasemonkey ou Violentmonkey pour installer ce script.

Vous devrez installer une extension telle que Tampermonkey pour installer ce script.

Vous devrez installer une extension telle que Tampermonkey ou Violentmonkey pour installer ce script.

Vous devrez installer une extension telle que Tampermonkey ou Userscripts pour installer ce script.

Vous devrez installer une extension telle que Tampermonkey pour installer ce script.

Vous devrez installer une extension de gestionnaire de script utilisateur pour installer ce script.

(J'ai déjà un gestionnaire de scripts utilisateur, laissez-moi l'installer !)

Vous devrez installer une extension telle que Stylus pour installer ce style.

Vous devrez installer une extension telle que Stylus pour installer ce style.

Vous devrez installer une extension telle que Stylus pour installer ce style.

Vous devrez installer une extension du gestionnaire de style pour utilisateur pour installer ce style.

Vous devrez installer une extension du gestionnaire de style pour utilisateur pour installer ce style.

Vous devrez installer une extension du gestionnaire de style pour utilisateur pour installer ce style.

(J'ai déjà un gestionnaire de style utilisateur, laissez-moi l'installer!)

// ==UserScript==
// @name         Kour Zenith Hack Pro
// @version      1.0.0
// @author       AwesomeOddEven-NightKeys-LunarBlink
// @description  The ultimate tactical suite for Kour.io, delivering precision performance, advanced visual overlays, and comprehensive account modification.
// @match        *://kour.io/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=kour.io
// @run-at       document-start
// @grant        unsafeWindow
// @license      GPLv3
// @namespace https://greasyfork.org/users/1594049
// ==/UserScript==

(function () {
    "use strict";

    if (typeof window === "undefined") return;

    // --- STEALTH UTILITIES ---
    const cloak = (fn, original) => {
        try {
            Object.setPrototypeOf(fn, original);
            fn.toString = () => original.toString();
        } catch (e) {}
        return fn;
    };

    // --- CONTRABAND & TELEMETRY EXPLOIT ---
    const _fetch = window.fetch;
    window.fetch = cloak(function () {
        let url = "";
        if (typeof arguments[0] === 'string') {
            url = arguments[0];
        } else if (arguments[0] && arguments[0].url) {
            url = arguments[0].url;
        }
        if (typeof url === 'string' && url.includes('/api/track')) {
            return Promise.reject();
        }
        return _fetch.apply(this, arguments);
    }, _fetch);

    function fixDailyRewards() {
        try {
            if (typeof firebase === "undefined" || !firebase?.auth()?.currentUser) return;
            let shouldSet = false;
            const rewardObj = { lastDailyReward: '24' };
            const refKey = 'users/' + firebase.auth().currentUser.uid;

            firebase.database().ref(refKey).once('value', e => {
                const obj = e.val() || {};
                Object.keys(obj).forEach(key => {
                    if (key.startsWith('dailyReward_')) {
                        rewardObj[key] = null;
                        shouldSet = true;
                    }
                    if (key === 'lastDailyReward' && obj[key] !== '24') {
                        shouldSet = true;
                    }
                });

                if (shouldSet) {
                    firebase.database().ref(refKey).update(rewardObj);
                    if (typeof showUserDetails !== "undefined") showUserDetails('', firebase.auth().currentUser);
                }
            });
        } catch (e) {}
    }

    function autoVerify() {
        setTimeout(() => {
            try {
                if (typeof firebase === "undefined" || !firebase?.auth()?.currentUser) return;
                const db = firebase.database();
                const auth = firebase.auth();
                const user = auth.currentUser;
                
                db.goOffline();
                db.ref('users/' + user.uid).child('verified').set('1').then(() => {
                    if (typeof showUserDetails !== "undefined") showUserDetails(user.email, user);
                    db.goOnline();
                }).catch(() => { db.goOnline(); });
            } catch (e) {}
        }, 2500);
    }

    function fakeSetDataNew(a) {
        if (window.unityInstance) {
            window.unityInstance.SendMessage('FirebasePlayerPrefs2023', 'OnSetData', '{"err":null}&' + [...a].pop());
        }
    }

    Object.defineProperty(window, 'unityInstance', {
        enumerable: false,
        configurable: true,
        get() { return this._unityInstance; },
        set(v) {
            this._unityInstance = v;
            const _setDataNew = window.setDataNew;
            window.setDataNew = cloak(function () {
                if (arguments[1] === 'banned') {
                    fakeSetDataNew(arguments);
                    return;
                }
                if (arguments[1] && arguments[1].includes("dailyReward_")) {
                    fakeSetDataNew(arguments);
                    if (typeof firebase !== "undefined" && typeof showUserDetails !== "undefined") {
                        showUserDetails('', firebase.auth().currentUser);
                    }
                    return;
                }
                if (arguments[1] === 'lastDailyReward') {
                    arguments[2] = '24';
                }
                return _setDataNew?.apply(this, arguments);
            }, _setDataNew);

            if (this._unityInstance) {
                const _SendMessage = this._unityInstance.SendMessage;
                this._unityInstance.SendMessage = cloak(function () {
                    if (arguments[1] === 'OnLoggedInGoogle') { fixDailyRewards(); autoVerify(); }
                    return _SendMessage.apply(this, arguments);
                }, _SendMessage);
            }
        },
    });

    // --- CORE CONFIG ---
    let settings = {
        aimbotEnabled: true,
        aimbotTargeting: "default", // "default" or "visible"
        aimbotTargetPart: "torso", // "torso" or "head"
        aimbotSpeed: 2.0,
        aimbotTriggerMode: "mouse", // "mouse", "key", or "always"
        aimbotTriggerButton: [0, 2], // Left/Right mouse
        fovRadius: 100,
        targetLockEnabled: true,
        targetPriority: "crosshair", // "crosshair", "closest", "farthest"
        triggerbotEnabled: false,
        triggerbotMode: "hold", // "click" or "hold"
        triggerbotCPS: 10,
        triggerbotSensitivity: 6,
        autoclickerEnabled: false,
        autoclickerCPS: 10,
        colorTolerance: 60,
        espEnabled: true,
        espDepthHackEnabled: true,
        hideArmsEnabled: false,
        invisibleEnabled: false,
        spinBotEnabled: false,
        airStrafingEnabled: false,
        fireRateEnabled: false,
        fireRateMultiplier: 1.0,
        customScopeEnabled: false,
        customScopeURL: "",
        autoChatEnabled: false,
        autoChatMessage: "",
        autoChatInterval: 10,
        hudEnabled: true,
        hudSortMode: "length", // "length", "alphabet", "none"
        menuTheme: "default",
        customCrosshair: false,
        crosshairShape: "plus",
        crosshairSize: 20,
        crosshairGap: 5,
        crosshairThickness: 2,
        crosshairColor: { r: 255, g: 43, b: 43 },
        crosshairOpacity: 1.0,
        crosshairOutline: true,
        crosshairDot: false,
        crosshairAnimated: false,
        crosshairRainbow: false,
        instantKillEnabled: false,
    };

    // Sync globals
    window.espEnabled = settings.espEnabled;
    window.espColor = { r: 0, g: 255, b: 0 };
    window.espDepthHackState = settings.espDepthHackEnabled;
    let fovCircleEnabled = true;

    // Load from local storage
    const saved = localStorage.getItem("ZenithProSettings");
    if (saved) {
        try { Object.assign(settings, JSON.parse(saved)); } catch (e) { }
    }
    const saveSettings = () => localStorage.setItem("ZenithProSettings", JSON.stringify(settings));

    // --- ENGINE HOOKS ---
    let gl = null;
    const vertexCheck = (count) => {
        return (count >= 1481 && count <= 1483) || (count >= 1553 && count <= 1555) || (count >= 5615 && count <= 5617) || (count >= 3875 && count <= 3877);
    };

    const wCtx = WebGL2RenderingContext.prototype;

    const originalGetContext = HTMLCanvasElement.prototype.getContext;
    HTMLCanvasElement.prototype.getContext = cloak(new Proxy(originalGetContext, {
        apply(target, thisArg, args) {
            if (args[0] === 'webgl' || args[0] === 'webgl2') {
                args[1] = args[1] || {};
                args[1].preserveDrawingBuffer = true;
            }
            return Reflect.apply(target, thisArg, args);
        }
    }), originalGetContext);

    const drawProxyHandler = {
        apply(target, thisArg, args) {
            const program = thisArg.getParameter(thisArg.CURRENT_PROGRAM);
            if (program) {
                if (!program.uniforms) {
                    const getLoc = name => thisArg.getUniformLocation(program, name);
                    program.uniforms = {
                        vertexCount: getLoc('vertexCount'),
                        espToggle: getLoc('espToggle'),
                        gnilgnim: getLoc('gnilgnim'),
                        espColor: getLoc('espColor'),
                        espDepthHack: getLoc('espDepthHack')
                    };
                }
                if (program.uniforms.espToggle) {
                    gl = thisArg;
                    thisArg.uniform1f(program.uniforms.vertexCount, args[1]);
                    thisArg.uniform1f(program.uniforms.espToggle, window.espEnabled ? 1.0 : 0.0);
                    thisArg.uniform1f(program.uniforms.espDepthHack, window.espDepthHackState ? 1.0 : 0.0);
                    thisArg.uniform1f(program.uniforms.gnilgnim, 13371337.0);
                    if (program.uniforms.espColor) {
                        thisArg.uniform3f(program.uniforms.espColor, window.espColor.r/255, window.espColor.g/255, window.espColor.b/255);
                    }
                }
            }
            return Reflect.apply(target, thisArg, args);
        }
    };

    wCtx.drawElements = cloak(new Proxy(wCtx.drawElements, drawProxyHandler), wCtx.drawElements);
    wCtx.drawElementsInstanced = cloak(new Proxy(wCtx.drawElementsInstanced, drawProxyHandler), wCtx.drawElementsInstanced);

    wCtx.shaderSource = cloak(new Proxy(wCtx.shaderSource, {
        apply(target, thisArg, args) {
            let [shader, src] = args;
            const conditions = "(vertexCount >= 1481.0 && vertexCount <= 1483.0) || (vertexCount >= 1553.0 && vertexCount <= 1555.0) || (vertexCount >= 5615.0 && vertexCount <= 5617.0) || (vertexCount >= 3875.0 && vertexCount <= 3877.0)";
            const vCond = "(vVertexCount >= 1481.0 && vVertexCount <= 1483.0) || (vVertexCount >= 1553.0 && vVertexCount <= 1555.0) || (vVertexCount >= 5615.0 && vVertexCount <= 5617.0) || (vVertexCount >= 3875.0 && vVertexCount <= 3877.0)";

            if (src.includes('gl_Position')) {
                src = src.replace(/void\s+main\s*\(\s*\)\s*\{/, `uniform float vertexCount, espToggle, gnilgnim, espDepthHack;\nuniform vec3 espColor;\nout float vVertexCount;\nvoid main() {\nvVertexCount = vertexCount;\n`)
                    .replace(/(gl_Position\s*=.+;)/, `$1\nif (espToggle > 0.5 && espDepthHack > 0.5 && (${conditions})) gl_Position.z = 0.01 + gl_Position.z * 0.1;\nif (espToggle > 0.5 && gnilgnim == 13371337.0) gl_Position.z *= 1.0;`);
            }
            if (src.includes('SV_Target0')) {
                src = src.replace(/void\s+main\s*\(\s*\)\s*\{/, `uniform float espToggle, gnilgnim, espDepthHack;\nuniform vec3 espColor;\nin float vVertexCount;\nvoid main() {`)
                    .replace(/return;/, `if (espToggle > 0.5 && (${vCond}) && SV_Target0.a > 0.5) SV_Target0 = vec4(espColor, 1.0);\nif (gnilgnim == 13371337.0) SV_Target0.rgb *= 1.0;\nreturn;`);
            }
            args[1] = src;
            return Reflect.apply(target, thisArg, args);
        }
    }), wCtx.shaderSource);

    // --- AIMBOT LOGIC ---
    function getGameCanvas() { return document.querySelector("canvas"); }

    function isTargetPixel(r, g, b, a, t, c) {
        if (a === 0) return false;
        const dr = r - c.r, dg = g - c.g, db = b - c.b;
        return dr * dr + dg * dg + db * db <= t * t;
    }

    function updateAimbot() {
        if (!settings.aimbotEnabled || !gl?.canvas || !document.pointerLockElement) return null;
        const { width, height } = gl.canvas;
        const scanW = Math.min(width, 150), scanH = Math.min(height, 150);
        const centerX = width / 2, centerY = height / 2;
        const startX = Math.floor(centerX - scanW/2), startY = Math.floor(centerY - scanH/2);
        const pixels = new Uint8Array(scanW * scanH * 4);

        let prevFB = null;
        try {
            prevFB = gl.getParameter(gl.FRAMEBUFFER_BINDING);
            gl.bindFramebuffer(gl.FRAMEBUFFER, null);
            gl.readPixels(startX, startY, scanW, scanH, gl.RGBA, gl.UNSIGNED_BYTE, pixels);
        } catch (e) { return null; }
        finally { try { gl.bindFramebuffer(gl.FRAMEBUFFER, prevFB); } catch (e) {} }

        let closest = Infinity, bestDX = 0, bestDY = 0;
        const tol = settings.colorTolerance || 60;
        const targetC = window.espColor;

        for (let i = 0; i < pixels.length; i += 16) {
            const r = pixels[i], g = pixels[i+1], b = pixels[i+2], a_val = pixels[i+3];
            if (isTargetPixel(r, g, b, a_val, tol, targetC)) {
                const idx = i / 4;
                const x = idx % scanW, y = Math.floor(idx / scanW);
                const dx = (startX + x) - centerX, dy = -((startY + y) - centerY);
                const dist = Math.hypot(dx, dy);
                if (dist < settings.fovRadius && dist < closest) { closest = dist; bestDX = dx; bestDY = dy; }
            }
        }
        return closest < Infinity ? { bestDX, bestDY } : null;
    }

    function loop() {
        try {
            if (gl && (gl.isContextLost() || !gl.canvas?.isConnected)) gl = null;
            if (settings.aimbotEnabled) {
                const target = updateAimbot();
                if (target) {
                    let spd = settings.aimbotSpeed * 0.15;
                    getGameCanvas().dispatchEvent(new MouseEvent("mousemove", {
                        movementX: Math.round(target.bestDX * spd),
                        movementY: Math.round(target.bestDY * spd),
                        bubbles: true, cancelable: true, composed: true
                    }));
                }
            }
        } catch(e) {}
        requestAnimationFrame(loop);
    }
    requestAnimationFrame(loop);

    // --- GOONHACK CORE UI (ZENITH ADAPTATION) ---
    function createUI() {
        const style = document.createElement("style");
        style.textContent = [
            "@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700;800&display=swap');",
            "@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:[email protected]&display=swap');",
            ":root {",
            "  --kour-theme-bg: #0d0d0f;",
            "  --kour-theme-accent1: #ff2a2a;",
            "  --kour-theme-accent2: #ff4545;",
            "  --kour-theme-highlight: rgba(255, 42, 42, 0.15);",
            "  --kour-theme-header: linear-gradient(135deg, rgba(255, 42, 42, 0.15), rgba(0, 0, 0, 0.8));",
            "}",
            "#Menu, #Menu * { box-sizing: border-box; }",
            "#Menu { background: var(--kour-theme-bg) !important; color: #eef2ff; font-family: 'JetBrains Mono', 'Consolas', monospace; }",
            ".kour-shell { display: flex; width: 700px; height: min(640px, calc(100vh - 56px)); max-width: calc(100vw - 36px); border: 1px solid rgba(255, 42, 42, 0.3); border-radius: 0px; overflow: hidden; box-shadow: 0 24px 70px rgba(0,0,0,0.8), inset 0 1px 0 rgba(255,42,42,0.1); backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px); }",
            ".kour-rail { width: 76px; flex: 0 0 76px; padding: 14px 10px; background: rgba(0,0,0,0.6); border-right: 1px solid rgba(255,42,42,0.2); display: flex; flex-direction: column; align-items: center; gap: 14px; }",
            ".kour-brand { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 0px; background: var(--kour-theme-header); color: #ff2a2a; font-size: 20px; font-weight: 900; letter-spacing: 0; border: 1px solid rgba(255,42,42,0.4); box-shadow: 0 0 15px rgba(255,42,42,0.3); cursor: move; }",
            ".kour-nav { display: flex; flex-direction: column; align-items: center; gap: 9px; width: 100%; }",
            ".kour-nav-button { position: relative; width: 46px; height: 46px; display: grid; place-items: center; border: 1px solid rgba(255,42,42,0.1); border-radius: 0px; color: #64748b; background: rgba(255,255,255,0.02); cursor: pointer; transition: 0.2s; }",
            ".kour-nav-button:hover { color: #ff2a2a; background: rgba(255,42,42,0.05); border-color: rgba(255,42,42,0.3); }",
            ".kour-nav-button.active { color: #fff; background: rgba(255,42,42,0.1); border-color: #ff2a2a; box-shadow: 0 0 15px rgba(255,42,42,0.2); }",
            ".kour-nav-button.active:before { content: ''; position: absolute; left: -11px; width: 3px; height: 24px; background: #ff2a2a; box-shadow: 0 0 10px #ff2a2a; }",
            ".kour-icon { font-family: 'Material Symbols Rounded'; font-size: 24px; width: 24px; height: 24px; }",
            ".kour-panel { flex: 1; min-width: 0; display: flex; flex-direction: column; background: #0d0d0f; }",
            ".kour-topbar { cursor: move; padding: 17px 20px 14px; background: #000; border-bottom: 1px solid rgba(255,42,42,0.3); display: flex; align-items: center; justify-content: space-between; gap: 16px; }",
            ".kour-title { margin: 0; font-size: 18px; font-weight: 900; letter-spacing: 2px; color: #ff2a2a; text-transform: uppercase; text-shadow: 0 0 10px rgba(255,42,42,0.5); }",
            ".kour-subtitle { margin-top: 4px; color: #64748b; font-size: 10px; font-weight: 500; text-transform: uppercase; letter-spacing: 1px; }",
            ".kour-content { padding: 16px; overflow-y: auto; min-height: 0; }",
            ".kour-content::-webkit-scrollbar { width: 4px; }",
            ".kour-content::-webkit-scrollbar-thumb { background: #ff2a2a; }",
            ".kour-section { margin-bottom: 13px; padding: 12px; border: 1px solid rgba(255,42,42,0.15); background: rgba(0,0,0,0.4); }",
            ".kour-section-title { margin: 0 0 10px; color: #ff2a2a; font-size: 10px; font-weight: 800; text-transform: uppercase; border-left: 2px solid #ff2a2a; padding-left: 8px; }",
            ".kour-row { min-height: 42px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 8px 9px; color: #e2e8f0; border-bottom: 1px solid rgba(255,255,255,0.02); }",
            ".kour-row:hover { background: rgba(255,42,42,0.02); }",
            ".kour-label { display: flex; flex-direction: column; gap: 2px; font-size: 11px; font-weight: 700; text-transform: uppercase; }",
            ".kour-switch { position: relative; width: 42px; height: 20px; }",
            ".kour-switch input { opacity: 0; width: 0; height: 0; position: absolute; }",
            ".kour-switch span { position: absolute; inset: 0; background: #1e1e24; border: 1px solid rgba(255,255,255,0.1); transition: 0.2s; }",
            ".kour-switch span:before { content: ''; position: absolute; width: 14px; height: 14px; left: 2px; top: 2px; background: #444; transition: 0.2s; }",
            ".kour-switch input:checked + span { background: rgba(255,42,42,0.2); border-color: #ff2a2a; }",
            ".kour-switch input:checked + span:before { transform: translateX(22px); background: #ff2a2a; box-shadow: 0 0 10px #ff2a2a; }",
            ".kour-slider { -webkit-appearance: none; width: 190px; height: 2px; background: #333; outline: none; }",
            ".kour-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 10px; height: 10px; background: #ff2a2a; cursor: pointer; box-shadow: 0 0 10px rgba(255,42,42,0.5); }",
            ".kour-value { color: #ff2a2a; font-size: 10px; font-weight: 800; min-width: 36px; text-align: right; }",
            ".kour-btn { border: 1px solid #ff2a2a; padding: 9px 12px; color: #fff; background: rgba(255,42,42,0.1); font-family: inherit; font-weight: 800; font-size: 10px; text-transform: uppercase; cursor: pointer; transition: 0.2s; }",
            ".kour-btn:hover { background: #ff2a2a; box-shadow: 0 0 15px rgba(255,42,42,0.4); }",
            "#kour-menu-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); z-index: 9999; display: none; }"
        ].join("\n");
        document.head.appendChild(style);

        const tabMeta = [
            { id: "Combat", title: "Combat", subtitle: "Aim, trigger, and fire controls", icon: "swords" },
            { id: "Visuals", title: "Visuals", subtitle: "ESP, FOV, and display tweaks", icon: "visibility" },
            { id: "Player", title: "Player", subtitle: "Movement, timer, and presence options", icon: "directions_run" },
            { id: "Settings", title: "Settings", subtitle: "Local config, themes, HUD, and keybinds", icon: "settings" }
        ];

        const menuBackdrop = document.createElement("div");
        menuBackdrop.id = "kour-menu-backdrop";
        document.body.appendChild(menuBackdrop);

        const menu = document.createElement("div");
        menu.id = "Menu";
        Object.assign(menu.style, { position: "fixed", top: "50%", left: "50%", transform: "translate(-50%, -50%)", zIndex: "10000", display: "none" });

        const shell = document.createElement("div");
        shell.className = "kour-shell";
        const rail = document.createElement("div");
        rail.className = "kour-rail";
        const brand = document.createElement("div");
        brand.className = "kour-brand";
        brand.textContent = "Z";
        rail.appendChild(brand);
        const nav = document.createElement("div");
        nav.className = "kour-nav";
        rail.appendChild(nav);

        const panel = document.createElement("div");
        panel.className = "kour-panel";
        const topBar = document.createElement("div");
        topBar.className = "kour-topbar";
        const titleWrap = document.createElement("div");
        const titleEl = document.createElement("h2");
        titleEl.className = "kour-title";
        const subtitleEl = document.createElement("div");
        subtitleEl.className = "kour-subtitle";
        titleWrap.append(titleEl, subtitleEl);
        topBar.appendChild(titleWrap);
        
        const contentArea = document.createElement("div");
        contentArea.className = "kour-content";
        panel.append(topBar, contentArea);
        shell.append(rail, panel);
        menu.appendChild(shell);
        document.body.appendChild(menu);

        let activeTab = "Combat";

        function renderContent() {
            contentArea.innerHTML = "";
            const meta = tabMeta.find(t => t.id === activeTab) || tabMeta[0];
            titleEl.textContent = meta.title;
            subtitleEl.textContent = meta.subtitle;

            nav.innerHTML = "";
            tabMeta.forEach(tab => {
                const btn = document.createElement("div");
                btn.className = "kour-nav-button" + (activeTab === tab.id ? " active" : "");
                btn.innerHTML = `<span class="kour-icon">${tab.icon}</span>`;
                btn.onclick = () => { activeTab = tab.id; renderContent(); };
                nav.appendChild(btn);
            });

            function buildRow(label, controlHtml, bindEvents) {
                const r = document.createElement("div");
                r.className = "kour-row";
                r.innerHTML = `<div class="kour-label">${label}</div><div class="kour-control-group">${controlHtml}</div>`;
                if (bindEvents) bindEvents(r);
                return r;
            }

            function buildToggle(label, key) {
                return buildRow(label, `<label class="kour-switch"><input type="checkbox" ${settings[key] ? "checked" : ""}><span class="kour-switch-slider"></span></label>`, el => {
                    const input = el.querySelector("input");
                    input.onchange = () => { settings[key] = input.checked; saveSettings(); if(key==='espEnabled') window.espEnabled = input.checked; if(key==='espDepthHackEnabled') window.espDepthHackState = input.checked; };
                });
            }

            function buildSlider(label, key, min, max, step) {
                return buildRow(label, `<input type="range" class="kour-slider" min="${min}" max="${max}" step="${step}" value="${settings[key]}"><span class="kour-value">${settings[key]}</span>`, el => {
                    const input = el.querySelector("input");
                    const val = el.querySelector(".kour-value");
                    input.oninput = () => { settings[key] = parseFloat(input.value); val.textContent = settings[key]; saveSettings(); };
                });
            }

            if (activeTab === "Combat") {
                const s1 = document.createElement("div"); s1.className = "kour-section";
                s1.innerHTML = `<h3 class="kour-section-title">Precision</h3>`;
                s1.append(buildToggle("Core Aimbot", "aimbotEnabled"), buildSlider("Smoothing", "aimbotSpeed", 0.1, 10, 0.1), buildToggle("Target Lock", "targetLockEnabled"));
                contentArea.appendChild(s1);
            } else if (activeTab === "Visuals") {
                const s1 = document.createElement("div"); s1.className = "kour-section";
                s1.innerHTML = `<h3 class="kour-section-title">Overlays</h3>`;
                s1.append(buildToggle("Thermal ESP", "espEnabled"), buildToggle("X-Ray (Walls)", "espDepthHackEnabled"), buildSlider("FOV Circle", "fovRadius", 10, 500, 5));
                contentArea.appendChild(s1);
            } else if (activeTab === "Player") {
                const s1 = document.createElement("div"); s1.className = "kour-section";
                s1.innerHTML = `<h3 class="kour-section-title">Movement</h3>`;
                s1.append(buildToggle("Auto-Strafer", "airStrafingEnabled"), buildToggle("Spinbot", "spinBotEnabled"));
                contentArea.appendChild(s1);
            } else {
                const s1 = document.createElement("div"); s1.className = "kour-section";
                s1.innerHTML = `<h3 class="kour-section-title">System</h3>`;
                const btnRow = document.createElement("div"); btnRow.className = "kour-btn-row";
                btnRow.innerHTML = `<button class="kour-btn" id="btn-save">Sync Config</button>`;
                btnRow.querySelector("#btn-save").onclick = () => { saveSettings(); alert("Settings Synced!"); };
                s1.appendChild(btnRow);
                contentArea.appendChild(s1);
            }
        }

        let drag = false, ox, oy;
        topBar.onmousedown = e => { drag = true; ox = e.clientX - menu.offsetLeft; oy = e.clientY - menu.offsetTop; };
        window.addEventListener('mousemove', e => { if(drag) { menu.style.left = (e.clientX - ox) + 'px'; menu.style.top = (e.clientY - oy) + 'px'; }});
        window.addEventListener('mouseup', () => drag = false);

        document.addEventListener('keydown', e => {
            if (e.target.matches('input, textarea')) return;
            if (e.key === 'Tab') {
                e.preventDefault(); e.stopPropagation();
                const isHidden = menu.style.display === 'none';
                menu.style.display = isHidden ? 'block' : 'none';
                menuBackdrop.style.display = isHidden ? 'block' : 'none';
            }
        }, true);

        renderContent();
    }

    createUI();
})();