<script src="/nexl_app.js"></script>
!function(){function e(e,r,t){"use strict";var n="%[a-f0-9]{2}",o=new RegExp(n,"gi"),c=new RegExp("("+n+")+","gi");function i(e,r){try{return decodeURIComponent(e.join(""))}catch(e){}if(1===e.length)return e;r=r||1;var t=e.slice(0,r),n=e.slice(r);return Array.prototype.concat.call([],i(t),i(n))}function a(e){try{return decodeURIComponent(e)}catch(n){for(var r=e.match(o),t=1;t<r.length;t++)r=(e=i(r,t).join("")).match(o);return e}}const u=function(e){if("string"!=typeof e)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof e+"`");try{return e=e.replace(/\+/g," "),decodeURIComponent(e)}catch(r){return function(e){for(var r={"%FE%FF":"��","%FF%FE":"��"},t=c.exec(e);t;){try{r[t[0]]=decodeURIComponent(t[0])}catch(e){var n=a(t[0]);n!==t[0]&&(r[t[0]]=n)}t=c.exec(e)}r["%C2"]="�";for(var o=Object.keys(r),i=0;i<o.length;i++){var u=o[i];e=e.replace(new RegExp(u,"g"),r[u])}return e}(e)}};function s(e,r){return r.encode?r.strict?encodeURIComponent(e).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`):encodeURIComponent(e):e}function l(e){return Array.isArray(e)?e.sort():"object"==typeof e?l(Object.keys(e)).sort((e,r)=>Number(e)-Number(r)).map(r=>e[r]):e}function f(e){const r=e.indexOf("?");return-1===r?"":e.slice(r+1)}function p(e,r){const t=function(e){let r;switch(e.arrayFormat){case"index":return(e,t,n)=>{r=/\[(\d*)\]$/.exec(e),e=e.replace(/\[\d*\]$/,""),r?(void 0===n[e]&&(n[e]={}),n[e][r[1]]=t):n[e]=t};case"bracket":return(e,t,n)=>{r=/(\[\])$/.exec(e),e=e.replace(/\[\]$/,""),r?void 0!==n[e]?n[e]=[].concat(n[e],t):n[e]=[t]:n[e]=t};default:return(e,r,t)=>{void 0!==t[e]?t[e]=[].concat(t[e],r):t[e]=r}}}(r=Object.assign({arrayFormat:"none"},r)),n=Object.create(null);if("string"!=typeof e)return n;if(!(e=e.trim().replace(/^[?#&]/,"")))return n;for(const r of e.split("&")){let[e,o]=r.replace(/\+/g," ").split("=");o=void 0===o?null:u(o),t(u(e),o,n)}return Object.keys(n).sort().reduce((e,r)=>{const t=n[r];return Boolean(t)&&"object"==typeof t&&!Array.isArray(t)?e[r]=l(t):e[r]=t,e},Object.create(null))}r.extract=f,r.parse=p,r.stringify=(e,r)=>{!1===(r=Object.assign({encode:!0,strict:!0,arrayFormat:"none"},r)).sort&&(r.sort=()=>{});const t=function(e){switch(e.arrayFormat){case"index":return(r,t,n)=>null===t?[s(r,e),"[",n,"]"].join(""):[s(r,e),"[",s(n,e),"]=",s(t,e)].join("");case"bracket":return(r,t)=>null===t?s(r,e):[s(r,e),"[]=",s(t,e)].join("");default:return(r,t)=>null===t?s(r,e):[s(r,e),"=",s(t,e)].join("")}}(r);return e?Object.keys(e).sort(r.sort).map(n=>{const o=e[n];if(void 0===o)return"";if(null===o)return s(n,r);if(Array.isArray(o)){const e=[];for(const r of o.slice())void 0!==r&&e.push(t(n,r,e.length));return e.join("&")}return s(n,r)+"="+s(o,r)}).filter(e=>e.length>0).join("&"):""},r.parseUrl=(e,r)=>({url:e.split("?")[0]||"",query:p(f(e),r)})}e.moduleId="ixl_external_query-string_queryString",define(e)}();
!function(){function r(r,e,n){n.exports=function r(){for(var e="",n=0;n<arguments.length;n++){var i=arguments[n];if(i){var t=typeof i;if("string"===t||"number"===t)e+=" "+i;else if(Array.isArray(i))e+=" "+r.apply(null,i);else if("object"===t)for(var a in i)i.hasOwnProperty(a)&&i[a]&&(e+=" "+a)}}return e.substr(1)}}r.moduleId="ixl_external_classnames",define(r)}();
!function(){function t(t,i,n){var r=function(t){void 0===t&&(t=(new Date).getTime());var i=this.N;this.mt=[i],this.mt.length=i,this.mti=i+1,this.init_genrand(t)};r.prototype.N=624,r.prototype.M=397,r.prototype.MATRIX_A=2567483615,r.prototype.UPPER_MASK=2147483648,r.prototype.LOWER_MASK=2147483647,r.prototype.mag01=[0,2567483615],r.prototype.init_genrand=function(t){var i=this.mt,n=this.N;i[0]=t>>>0;for(var r=1;r<n;r++)t=i[r-1]^i[r-1]>>>30,i[r]=(1812433253*((4294901760&t)>>>16)<<16)+1812433253*(65535&t)+r,i[r]>>>=0;this.mti=r},r.prototype.init_by_array=function(t,i){var n,r,e,s;for(this.init_genrand(19650218),n=1,r=0,e=this.N>i?this.N:i;e;e--)s=this.mt[n-1]^this.mt[n-1]>>>30,this.mt[n]=(this.mt[n]^(1664525*((4294901760&s)>>>16)<<16)+1664525*(65535&s))+t[r]+r,this.mt[n]>>>=0,r++,++n>=this.N&&(this.mt[0]=this.mt[this.N-1],n=1),r>=i&&(r=0);for(e=this.N-1;e;e--)s=this.mt[n-1]^this.mt[n-1]>>>30,this.mt[n]=(this.mt[n]^(1566083941*((4294901760&s)>>>16)<<16)+1566083941*(65535&s))-n,this.mt[n]>>>=0,++n>=this.N&&(this.mt[0]=this.mt[this.N-1],n=1);this.mt[0]=2147483648},r.prototype.genrand_int32=function(){var t,i=this.mag01,n=this.N,r=this.mt;if(this.mti>=n){var e,s,o,h=this.M,a=this.UPPER_MASK,m=this.LOWER_MASK;for(e=0,s=n-h;e<s;e++)t=r[e]&a|r[e+1]&m,r[e]=r[e+h]^t>>>1^i[1&t];for(s=n-1,o=h-n;e<s;e++)t=r[e]&a|r[e+1]&m,r[e]=r[e+o]^t>>>1^i[1&t];t=r[n-1]&a|r[0]&m,r[n-1]=r[h-1]^t>>>1^i[1&t],this.mti=0}return t=r[this.mti++],t^=t>>>11,t^=t<<7&2636928640,t^=t<<15&4022730752,(t^=t>>>18)>>>0},r.prototype.genrand_int31=function(){return this.genrand_int32()>>>1},r.prototype.genrand_real1=function(){return this.genrand_int32()/4294967295},r.prototype.random=function(){return this.genrand_int32()/4294967296},r.prototype.genrand_real3=function(){return(this.genrand_int32()+.5)/4294967296},r.prototype.genrand_res53=function(){return(67108864*(this.genrand_int32()>>>5)+(this.genrand_int32()>>>6))*(1/9007199254740992)},n.exports=r}t.moduleId="ixl_external_MersenneTwister",define(t)}();











<!-- NEXL GLOBAL FIXES V4 -->
<script>
// NEXL STUDY - MASTER APP CONTROLLER
// This script overrides IXL functionality for offline use.

(function initNexlApp() {
    // 1. ANNIHILATE ALL POP-UPS AND MODALS
    const killModals = () => {
        const modals = document.querySelectorAll('.membership-banner, .ixl-modal, .yui3-panel, .ixl-dialog, [role="dialog"], .membership-prompt, .trial-banner, .modal-backdrop, .toast-message');
        modals.forEach(m => m.remove());
        
        // Unblock scrolling if blocked
        document.body.style.overflow = 'auto';
        document.body.classList.remove('modal-open');
    };
    
    // Run modal killer immediately and every 1s (to catch delayed pop-ups)
    killModals();
    setInterval(killModals, 1000);

    // X. GLOBAL CLEANUP FOR CARD-ONLY MODE
    const killExtraUI = () => {
        const clutter = document.querySelectorAll(`
            #hd, .global-header, #header, header, 
            #bd-footer, .page-footer, .global-footer, footer, 
            .practice-stats-container, #stats-ribbon, #practice-stats, 
            .teacher-tools, .scratchpad-tool, #bd-head,
            nav.breadcrumb-nav, nav.sub-navigation, .box-site-nav-content, 
            .share-label, .social-share-bar
        `);
        clutter.forEach(el => el.remove());
        
        // Re-center the practice area if needed
        const practiceRoot = document.querySelector('.practice-views-root');
        if (practiceRoot) {
            practiceRoot.style.margin = '0 auto';
            practiceRoot.style.float = 'none';
            practiceRoot.style.width = '100%';
            practiceRoot.style.maxWidth = '900px';
        }
    };
    killExtraUI();
    setInterval(killExtraUI, 1000);

    // 2. INJECT BEAUTIFUL NEXL LOGO
    const logoContainers = document.querySelectorAll('.ixl-logo, #hd-logo, .global-header-logo, header a[href="/"]');
    logoContainers.forEach(container => {
        container.innerHTML = `
            <div style="display: flex; align-items: center; font-family: 'Inter', sans-serif; font-weight: 900; font-size: 32px; letter-spacing: -1px; text-decoration: none;">
                <span style="color: #0066FF;">N</span>
                <span style="color: #3399FF;">E</span>
                <span style="color: #FF3366;">X</span>
                <span style="color: #9933FF;">L</span>
                <span style="color: #66B2FF; font-style: italic; font-weight: 500; margin-left: 8px; font-size: 24px;">learning</span>
            </div>
        `;
        container.style.textDecoration = 'none';
        container.style.border = 'none';
    });

    // 3. ANNIHILATE ORIGINAL FOOTER AND REPLACE WITH NEXL FOOTER
    const oldFooters = document.querySelectorAll('#bd-footer, .page-footer, .global-footer, footer');
    oldFooters.forEach(f => f.remove());
    
    const customFooter = document.createElement('footer');
    customFooter.innerHTML = `
        <div style="background: linear-gradient(135deg, #1e1e2f, #2a2a40); padding: 40px; text-align: center; color: white; font-family: 'Inter', sans-serif; margin-top: 50px; border-top: 4px solid #3399FF;">
            <div style="font-size: 28px; font-weight: 900; margin-bottom: 10px;">
                <span style="color: #0066FF;">N</span><span style="color: #3399FF;">E</span><span style="color: #FF3366;">X</span><span style="color: #9933FF;">L</span>
                <span style="color: #66B2FF; font-style: italic; font-weight: 500;">learning</span>
            </div>
            <p style="color: #8892b0; font-size: 14px;">The Ultimate Offline Learning Library &bull; Education Without Limits</p>
        </div>
    `;
    document.body.appendChild(customFooter);

    // 4. FIX BROKEN/LIVE LINKS (Skill Plans, Analytics, Videos, Games)
    const allLinks = document.querySelectorAll('a, button, [role="button"]');
    allLinks.forEach(link => {
        const href = link.getAttribute('href') || '';
        const text = link.textContent.toLowerCase();
        
        // Hide broken tabs
        if (
            href.includes('skill-plans') || 
            href.includes('recommendations') || 
            href.includes('analytics') || 
            href.includes('core-curriculum') || 
            href.includes('search?') ||
            text.includes('skill plans') ||
            text.includes('analytics') ||
            text.includes('recommendations')
        ) {
            link.style.display = 'none';
        }

        // Hide videos and games that lead to live site
        if (
            href.includes('showVideoDirectly') || 
            href.includes('videos.html') || 
            href.includes('alkhalid-ixl-math.netlify.app') ||
            href.includes('/games/') ||
            text.includes('watch video') ||
            link.classList.contains('video-link') ||
            link.classList.contains('game-link')
        ) {
            link.style.display = 'none';
        }
    });

    // 5. RESTORE CLICK AND SELECT INTERACTIVITY (FOR ALL ELEMENTS)
    
    // Inject massive global styles for selection
    const nexlStyles = document.createElement('style');
    nexlStyles.innerHTML = `
        .nexl-selected {
            border: 3px solid #10b981 !important;
            box-shadow: inset 0 0 0 2px rgba(16, 185, 129, 0.5), 0 4px 6px rgba(0,0,0,0.1) !important;
            background-color: rgba(16, 185, 129, 0.08) !important;
            border-radius: 8px !important;
            z-index: 9999 !important;
            transition: all 0.2s ease-in-out !important;
        }
        .nexl-pending-drag {
            outline: 4px dashed #ff9800 !important;
            outline-offset: 4px !important;
            box-shadow: 0 0 15px rgba(255, 152, 0, 0.8) !important;
            transform: scale(1.05) !important;
            transition: all 0.2s ease !important;
            z-index: 10000 !important;
            cursor: grabbing !important;
        }
        /* Specific overrides for tables/texts so they don't look weird */
        td.nexl-selected {
            background-color: rgba(16, 185, 129, 0.15) !important;
            color: #065f46 !important;
            font-weight: bold !important;
        }
        /* SVG Group selections */
        g.nexl-selected rect, g.nexl-selected circle, g.nexl-selected path {
            stroke: #10b981 !important;
            stroke-width: 4px !important;
            fill: rgba(16, 185, 129, 0.2) !important;
        }
        g.nexl-selected text, g.nexl-selected tspan {
            fill: #065f46 !important;
            font-weight: bold !important;
        }
        /* Isolated SVG selections */
        text.nexl-selected, tspan.nexl-selected, rect.nexl-selected, circle.nexl-selected, path.nexl-selected, svg.nexl-selected {
            stroke: #10b981 !important;
            stroke-width: 4px !important;
            fill: rgba(16, 185, 129, 0.2) !important;
        }
        /* SCALING & CARD ISOLATION (50% BIGGER, 30% WIDER) */
        /* Nuclear destruction of IXL global green headers */
        #hd, .global-header, #global-nav, .header-container, #bd-header, .site-header {
            display: none !important;
            opacity: 0 !important;
            visibility: hidden !important;
            height: 0 !important;
        }

        /* Scale the practice card */
        .practice-area, #practice-area, .question-container {
            margin: 60px auto !important;
            max-width: 85% !important; /* Increased width significantly */
            background: white !important;
            border-radius: 12px !important;
            box-shadow: 0 10px 30px rgba(0,0,0,0.1) !important;
            padding: 20px !important;
            display: block !important;
        }
        body {
            overflow-x: hidden !important;
            background-color: #f4f6f8 !important;
            padding-bottom: 300px !important;
        }
    `;
    document.head.appendChild(nexlStyles);

    window.nexlPendingDragElement = null;

    const practiceArea = document.querySelector('.practice-area, #practice-area, .question-container, #practice-crate, .focused-practice-area, #practice-page-container, main');
    const isPracticePage = document.querySelector('.submit-button, button[type="submit"], .submit, button.submit, #submit-button, .crisp-button') !== null;
    
    if (practiceArea && practiceArea !== document.body && isPracticePage) {
        // NUCLEAR METHOD: Hide all siblings of practiceArea and its ancestors
        let curr = practiceArea;
        while (curr && curr !== document.body && curr !== document.documentElement) {
            const siblings = curr.parentElement.children;
            for (let i = 0; i < siblings.length; i++) {
                const s = siblings[i];
                const c = s.getAttribute('class') || '';
                if (s !== curr && s.tagName !== 'SCRIPT' && s.tagName !== 'STYLE' && s.tagName !== 'LINK' && s.id !== 'yui3-css-stamp' && !c.includes('yui3')) {
                    s.style.display = 'none';
                }
            }
            // Strip backgrounds from wrappers so they don't block the screen
            if (curr !== practiceArea) {
                curr.style.background = 'transparent';
                curr.style.boxShadow = 'none';
                curr.style.border = 'none';
                curr.style.padding = '0';
                curr.style.margin = '0';
            }
            curr = curr.parentElement;
        }
    }
    if (practiceArea && isPracticePage) {
        practiceArea.addEventListener('click', (e) => {
            // 1. BYPASS LOGIC: Ignore Submit buttons completely
            if (e.target.closest('button[type="submit"], .submit-button, .submit-btn, .submit, .button-submit, #submit-button')) {
                return;
            }
            // 2. CLICK-TO-MOVE ACCESSIBILITY HANDLER (DRAG-AND-DROP FALLBACK)
            const draggableItem = e.target.closest('.yui3-dd-draggable, .draggable, .drag-item, .draggableElement, .sticker, [draggable="true"]');
            if (draggableItem) {
                // If clicking the same item, deselect it
                if (window.nexlPendingDragElement === draggableItem) {
                    draggableItem.classList.remove('nexl-pending-drag');
                    window.nexlPendingDragElement = null;
                    return;
                }
                
                // If there was another pending item, deselect it
                if (window.nexlPendingDragElement) {
                    window.nexlPendingDragElement.classList.remove('nexl-pending-drag');
                }
                
                window.nexlPendingDragElement = draggableItem;
                draggableItem.classList.add('nexl-pending-drag');
                return; // Stop further selection logic for this element
            }
            
            const dropContainer = e.target.closest('.draggableContainer, .draggableArea, .dropslot, .interactiveArea, .drop-target, .binContentRow, .dragTile, .dropzone, [class*="drop"]');
            if (dropContainer && window.nexlPendingDragElement) {
                // Move the pending element into this drop container physically in the DOM
                dropContainer.appendChild(window.nexlPendingDragElement);
                
                // Reset styling to ensure it sits nicely in the container where they clicked
                const rect = dropContainer.getBoundingClientRect();
                const relativeX = e.clientX - rect.left - (window.nexlPendingDragElement.offsetWidth / 2 || 25);
                const relativeY = e.clientY - rect.top - (window.nexlPendingDragElement.offsetHeight / 2 || 25);

                window.nexlPendingDragElement.style.position = 'absolute';
                window.nexlPendingDragElement.style.left = relativeX + 'px';
                window.nexlPendingDragElement.style.top = relativeY + 'px';
                window.nexlPendingDragElement.style.margin = '0';
                
                // Try simulating a YUI3 drag and drop to trigger internal game state logic
                const dataTransfer = window.DataTransfer ? new DataTransfer() : null;
                const events = ['dragstart', 'dragenter', 'dragover', 'drop', 'dragend'];
                events.forEach(evt => {
                    const targetNode = (evt === 'dragstart' || evt === 'dragend') ? window.nexlPendingDragElement : dropContainer;
                    try {
                        targetNode.dispatchEvent(new DragEvent(evt, { bubbles: true, dataTransfer }));
                    } catch(err) {}
                });
                
                window.nexlPendingDragElement.classList.remove('nexl-pending-drag');
                window.nexlPendingDragElement = null;
                return;
            }

            let target = null;

            // 3. MULTIPLE-CHOICE HANDLER: Prioritize selecting the entire row/line instead of inner spans
            const choiceTarget = e.target.closest('.practice-choice, .q-choice, .answer-choice, li, [role="radio"], .SelectableTile, .selectable-tile');
            if (choiceTarget) {
                target = choiceTarget;
            }

            // 4. UNIVERSAL MANIPULATIVE/TEXT HANDLER: Fallback to substring matching for manipulatives, phrases, tokens
            if (!target) {
                target = e.target.closest(`
                    [class*="choice"], [class*="option"], [class*="answer"], [class*="interactive"], 
                    [class*="button"], [class*="phrase"], 
                    [class*="word"], [class*="sentence"], [class*="cube"], [class*="shape"], 
                    [class*="node"], [class*="click"], [class*="hotspot"], [class*="selectable"], 
                    [class*="item"], [class*="sticker"], [class*="token"], [class*="marker"], [class*="coin"],
                    [role="button"], [role="option"], [role="checkbox"], [role="radio"],
                    td, img
                `);
            }
            
            // 5. SVG GROUPS LOGIC: If it's inside an SVG, try to find a parent group <g> to select the whole button
            if (!target && e.target.closest) {
                let gNode = e.target.closest('g');
                if (gNode && gNode.parentElement) {
                    target = gNode;
                }
            }

            // Fallback for isolated SVG text/shapes if no group
            if (!target && ['text', 'tspan', 'rect', 'circle', 'path', 'svg'].includes(e.target.tagName?.toLowerCase())) {
                target = e.target;
            }

            // Fallback for Hundred Chart <td> cells
            if (!target && e.target.tagName === 'TD') {
                target = e.target;
            }

            if (target) {
                // If it's already selected, just unselect it and stop
                if (target.classList.contains('nexl-selected')) {
                    target.classList.remove('nexl-selected');
                    return; // Stop here!
                }

                // Unselect siblings ONLY if in a known single-select list, otherwise allow multiple selections
                const container = target.closest('.practice-choices, .q-choices, ul, .options, .answers, [role="radiogroup"], .radiogroup');
                if (container && !container.classList.contains('multi-select') && !container.closest('.multi-select')) {
                    const siblings = container.querySelectorAll('.nexl-selected');
                    siblings.forEach(s => {
                        if (s !== target) s.classList.remove('nexl-selected');
                    });
                }

                // Apply massive green selection effect simply by adding the class
                target.classList.add('nexl-selected');
            }
        }, true);
    }

    // 6. ORACLE APEX LOGIN REDIRECT
    const loginButtons = document.querySelectorAll('.sign-in-btn, a[href*="signin"], button.login');
    loginButtons.forEach(btn => {
        btn.addEventListener('click', (e) => {
            e.preventDefault();
            // Redirect to future Oracle APEX domain
            window.location.href = "https://your-oracle-domain.com/ords/nexl_schema/login";
        });
    });
})();

</script>
