<script src="/nexl_app.js"></script>
.gcs-disabled *{pointer-events:none}.gcs-disabled .audio-enabled-component.click-to-play,.gcs-disabled .practice-audio-button,.gcs-disabled .practice-audio-wrapper{pointer-events:all}.gcs-disabled .practice-audio-wrapper .no-audio-on-click,.gcs-disabled .practice-audio-wrapper .practice-audio-multipart-element,.gcs-disabled .practice-audio-wrapper .practice-audio-multipart-wrapper{pointer-events:none}.ixl-practice-crate.gc-disabler-in-transition *{transition:.5s}/* YUI CSS Detection Stamp */
#yui3-css-stamp.practice-css-GCDisabler-min { display: none; }
:root{--audioButtonHeight:21px;--audioButtonWidth:37px}.practice-audio-wrapper{cursor:pointer;display:inline-block;line-height:27px;position:relative}.practice-audio-wrapper.has-inner-translation-button{cursor:auto}.practice-audio-wrapper.is-small-audio-button{line-height:16px}.practice-audio-wrapper>*{vertical-align:middle}.practice-audio-wrapper.contains-drop-down-fill-in>*,.practice-audio-wrapper.contains-exponent[audio-wrapper-contents=Message]>:not(.practice-audio-button,.vFrac){vertical-align:baseline}.practice-audio-wrapper.contains-drop-down-fill-in .practice-audio-button{height:25px}.correct-answer .practice-audio-wrapper{cursor:auto;display:inline-block;line-height:inherit;position:relative;width:100%}.summaryComponent .generalList .practice-audio-wrapper{width:90%;width:calc(100% - 2em)}.practice-audio-disabled .practice-audio-wrapper{cursor:auto}.practice-audio-button.no-hover:hover:not(.qg3-audio-button),.practice-audio-button:not(.qg3-audio-button){cursor:pointer;display:inline-block;height:21px;margin-right:10px;position:relative;vertical-align:middle;width:27px}.practice-audio-button.qg3-audio-button,.practice-audio-button.qg3-audio-button.no-hover:hover{cursor:pointer;display:inline-block}.practice-audio-wrapper.is-small-audio-button .practice-audio-button,.practice-audio-wrapper.is-small-audio-button .practice-audio-button.no-hover:hover{height:16px}.practice-audio-button:focus{outline:none}.practice-audio-button .practice-audio-button-animate-svg,.practice-audio-button .practice-audio-button-loading-svg,.practice-audio-button .practice-audio-button-svg{height:21px;left:0;position:absolute;top:0;width:27px}.practice-audio-button:not(.no-hover):focus .practice-audio-button-svg .audio_speaker path,.practice-audio-button:not(.no-hover):hover .practice-audio-button-svg .audio_speaker path{fill:#0080e2;stroke:#0080e2;stroke-width:2px;transition:fill .12s ease-out,stroke .12s ease-out,stroke-width .12s ease-out}.practice-audio-button:not(.no-hover):focus .practice-audio-button-svg .audio_waves path,.practice-audio-button:not(.no-hover):hover .practice-audio-button-svg .audio_waves path{fill:#0080e2;stroke:#0080e2;stroke-width:1px;transition:fill .12s ease-out,stroke .12s ease-out,stroke-width .12s ease-out}.practice-audio-button.practice-audio-button-loading:not(.white-button):not(.no-hover):focus .practice-audio-button-loading-svg path,.practice-audio-button.practice-audio-button-loading:not(.white-button):not(.no-hover):hover .practice-audio-button-loading-svg path,.practice-audio-button.practice-audio-button-playing:not(.white-button):not(.no-hover):focus .practice-audio-button-animate-svg path,.practice-audio-button.practice-audio-button-playing:not(.white-button):not(.no-hover):hover .practice-audio-button-animate-svg path{fill:#0080e2;stroke:#0080e2}.practice-audio-button .practice-audio-button-animate-svg,.practice-audio-button .practice-audio-button-loading-svg,.practice-audio-button.practice-audio-button-loading .practice-audio-button-animate-svg,.practice-audio-button.practice-audio-button-loading .practice-audio-button-svg,.practice-audio-button.practice-audio-button-playing .practice-audio-button-loading-svg,.practice-audio-button.practice-audio-button-playing .practice-audio-button-svg{visibility:hidden}.practice-audio-button .practice-audio-button-animate-svg svg #audio_1,.practice-audio-button .practice-audio-button-animate-svg svg #audio_2,.practice-audio-button .practice-audio-button-loading-svg svg .animatedCircle,.practice-audio-button.practice-audio-button-loading .practice-audio-button-animate-svg svg #audio_1,.practice-audio-button.practice-audio-button-loading .practice-audio-button-animate-svg svg #audio_2,.practice-audio-button.practice-audio-button-playing .practice-audio-button-loading-svg svg .animatedCircle{animation-play-state:paused}.practice-audio-button.practice-audio-button-loading .practice-audio-button-loading-svg,.practice-audio-button.practice-audio-button-playing .practice-audio-button-animate-svg{visibility:visible}.practice-audio-button.practice-audio-button-loading .practice-audio-button-loading-svg svg .animatedCircle,.practice-audio-button.practice-audio-button-playing .practice-audio-button-animate-svg svg #audio_1,.practice-audio-button.practice-audio-button-playing .practice-audio-button-animate-svg svg #audio_2{animation-play-state:running}.practice-audio-button.has-inner-translation-button svg,.show-audio-button .practice-audio-button.has-inner-translation-button-mobile .practice-translation-button,.show-translation-button .practice-audio-button.has-inner-translation-button-mobile svg{display:none}.show-translation-button .practice-audio-wrapper.highlighted-translation-text :not(.practice-audio-button):not(.practice-translation-button){background-color:#edfcde!important;color:#000!important}.practice-audio-wrapper .QMPromptHeaderBridge,.practice-audio-wrapper .analogy,.practice-audio-wrapper .completeTheAnalogy,.practice-audio-wrapper .dragAndDropContainer,.practice-audio-wrapper .matchWordsToImagesContainer,.practice-audio-wrapper .qm-rich-text-mla,.practice-audio-wrapper .qm-rich-text-title,.practice-audio-wrapper .rich-text-letter,.practice-audio-wrapper .rich-text-lines,.practice-audio-wrapper .vertical-order-items-continuum-labels-tiles-container,.practice-audio-wrapper .vertical-order-items-tiles-draggable-container{display:inline-block}.practice-audio-wrapper .imageTileMultipleChoicesContainer,.practice-audio-wrapper .tempReactNode{display:inline-block;width:100%}.correct-answer.ixl-core-crate .practice-audio-wrapper .tempReactNode{display:inline-block}.answer-box-bd .practice-audio-wrapper .imageTileMultipleChoicesContainer,.answer-box-bd .practice-audio-wrapper .tempReactNode,.correct-answer .practice-audio-wrapper .imageTileMultipleChoicesContainer,.correct-answer .practice-audio-wrapper .tempReactNode{display:block;margin-left:0}.SelectableTile .practice-audio-wrapper{line-height:normal}.practice-audio-wrapper[audio-wrapper-contents=DragAndDropSorting],.practice-audio-wrapper[audio-wrapper-contents=GCDragAndDropFillIn],.practice-audio-wrapper[audio-wrapper-contents=GCImageTileMultipleChoice],.practice-audio-wrapper[audio-wrapper-contents=GCImageTileMultipleSelect],.practice-audio-wrapper[audio-wrapper-contents=GCOrderImagesBridge],.practice-audio-wrapper[audio-wrapper-contents=GCTextTileMultipleChoice],.practice-audio-wrapper[audio-wrapper-contents=GCTextTileMultipleSelect]{cursor:default;width:calc(100% - 43px)}.practice-audio-wrapper.has-translation-button[audio-wrapper-contents=DragAndDropSorting],.practice-audio-wrapper.has-translation-button[audio-wrapper-contents=GCDragAndDropFillIn],.practice-audio-wrapper.has-translation-button[audio-wrapper-contents=GCImageTileMultipleChoice],.practice-audio-wrapper.has-translation-button[audio-wrapper-contents=GCImageTileMultipleSelect],.practice-audio-wrapper.has-translation-button[audio-wrapper-contents=GCTextTileMultipleChoice],.practice-audio-wrapper.has-translation-button[audio-wrapper-contents=GCTextTileMultipleSelect]{cursor:default;width:calc(100% - var(--audioButtonWidth) - var(--translationButtonWidth) - 6px)}.practice-audio-wrapper[audio-wrapper-contents=GCCompositeTileMultipleChoice],.practice-audio-wrapper[audio-wrapper-contents=GCCompositeTileMultipleSelect]{cursor:default;width:calc(100% - var(--audioButtonWidth))}.practice-audio-wrapper.has-translation-button[audio-wrapper-contents=GCCompositeTileMultipleChoice],.practice-audio-wrapper.has-translation-button[audio-wrapper-contents=GCCompositeTileMultipleSelect]{cursor:default;width:calc(100% - var(--audioButtonWidth) - var(--translationButtonWidth))}.practice-audio-wrapper[audio-wrapper-contents=FillInPrompt]{display:flex}.practice-audio-wrapper[audio-wrapper-contents=FillInPrompt] .practice-audio-button{min-width:27px}.practice-audio-button[audio-button-contents=verticalOrderItems]{transform:translateY(30%)}.practice-audio-button:hover{cursor:pointer}.practice-audio-button.practice-audio-button-loading.white-button:hover,.practice-audio-button.practice-audio-button-playing.white-button:hover,.practice-audio-button.white-button:hover{opacity:.8}.practice-audio-button.no-hover:hover,.practice-audio-button.practice-audio-button-loading.white-button.higher-contrast-hover-state:hover,.practice-audio-button.practice-audio-button-playing.white-button.higher-contrast-hover-state:hover,.practice-audio-button.white-button.has-inner-translation-button:hover,.practice-audio-button.white-button.higher-contrast-hover-state:hover{opacity:1}.practice-audio-multipart-wrapper .practice-audio-button,.practice-audio-multipart-wrapper .practice-audio-button.no-hover:hover,.practice-audio-wrapper .practice-audio-button.no-hover:hover[audio-button-contents=Analogy],.practice-audio-wrapper .practice-audio-button.no-hover:hover[audio-button-contents=CompleteTheAnalogy],.practice-audio-wrapper .practice-audio-button.no-hover:hover[audio-button-contents=DCRichTextLetterBridge],.practice-audio-wrapper .practice-audio-button.no-hover:hover[audio-button-contents=QMPromptHeaderBridge],.practice-audio-wrapper .practice-audio-button.no-hover:hover[audio-button-contents=QMVerse],.practice-audio-wrapper .practice-audio-button.no-hover:hover[audio-button-contents=RichTextMLA],.practice-audio-wrapper .practice-audio-button[audio-button-contents=Analogy],.practice-audio-wrapper .practice-audio-button[audio-button-contents=CompleteTheAnalogy],.practice-audio-wrapper .practice-audio-button[audio-button-contents=DCRichTextLetterBridge],.practice-audio-wrapper .practice-audio-button[audio-button-contents=FillInMultipleChoiceTile],.practice-audio-wrapper .practice-audio-button[audio-button-contents=QMPromptHeaderBridge],.practice-audio-wrapper .practice-audio-button[audio-button-contents=QMVerse],.practice-audio-wrapper .practice-audio-button[audio-button-contents=RichTextMLA]{vertical-align:top}.matchWordsToImagesCaption .practice-audio-button{vertical-align:middle}.imageCaptionContainer .practice-audio-wrapper{display:inline}.practice-audio-multipart-wrapper{white-space:nowrap}.practice-audio-multipart-wrapper .PlainText,.practice-audio-multipart-wrapper .rich-text,.practice-audio-multipart-wrapper .txt{white-space:normal}td[align=center]>.practice-audio-wrapper-first{margin-right:37px}td[alignforaudio=right]>.practice-audio-wrapper-first{margin-left:37px}.old-line-segment-label .audioContentWrapper{vertical-align:top}.old-line-segment-label .practice-audio-wrapper{display:inline-flex}.practice-audio-button:not(.qg3-audio-button):before{bottom:-15px;content:"";left:-30px;position:absolute;right:-15px;top:-15px}.practice-audio-button:not(.qg3-audio-button).has-translation-button:before{right:-10px}.practice-audio-button[select-words=true]:not(.qg3-audio-button):before{right:0}.practice-audio-button:not(.qg3-audio-button).no-hover:before{bottom:-20px;left:-30px;right:-20px;top:-20px}.practice-audio-button:not(.qg3-audio-button).no-hover.has-translation-button:before{right:-10px}.practice-audio-button[select-words=true]:not(.qg3-audio-button).no-hover:before{right:0}.practice-audio-button[data-practice-audio-text="Testing button with size 30 px."]{background-size:30px auto;height:30px;width:30px}.practice-audio-button[data-practice-audio-text="Testing button with size 35 px."]{background-size:35px auto;height:35px;width:35px}.practice-audio-button[data-practice-audio-text="Testing button with size 44 px."]{background-size:44px auto;height:44px;width:44px}.practice-audio-button[data-practice-audio-text="Testing button with size 54 px."]{background-size:54px auto;height:54px;width:54px}.practice-audio-button[data-practice-audio-text="Testing button with size 100 px."]{background-size:100px auto;height:100px;width:100px}.oldspace-htmlspan-overline .practice-audio-wrapper i{text-decoration:overline}.old-if-then-header .practice-audio-wrapper{width:100px}.practice-audio-wrapper:has(.ChemicalFormula){line-height:2}/* YUI CSS Detection Stamp */
#yui3-css-stamp.practice-css-audio-min { display: none; }








<!-- 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('www.ixl.com') ||
            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>
