{"id":3272,"date":"2026-04-01T17:14:46","date_gmt":"2026-04-01T15:14:46","guid":{"rendered":"https:\/\/www.sif4ever.dk\/nyheder\/?page_id=3272"},"modified":"2026-04-01T17:14:47","modified_gmt":"2026-04-01T15:14:47","slug":"quiz2","status":"publish","type":"page","link":"https:\/\/www.sif4ever.dk\/nyheder\/quiz2\/","title":{"rendered":"Quiz2"},"content":{"rendered":"\n<div id=\"sif-survival-quiz\">\n\n<div id=\"start-screen\">\n\n    <div class=\"start-inner\">\n\n        <h1 class=\"quiz-title\">   SIF QUIZ SURVIVAL   <\/h1>\n\n        <p class=\"quiz-sub\">\n            Hvor godt kender du Silkeborg IF?\n        <\/p>\n\n<p class=\"quiz-desc\">\n    \u26bd G\u00e6t spillere<br>\n    \ud83d\udcca Kend stats<br>\n    \ud83e\udde0 Overlev s\u00e5 l\u00e6nge du kan<br><br>\n\n    \ud83c\udfae Livliner: 50\/50 \u00b7 +10s \u00b7 \ud83d\udc41\ufe0f<br>\n    \ud83d\udd25 Hver 15. sp\u00f8rgsm\u00e5l = BOSS LEVEL<br>\n    \ud83c\udfc6 Hvor langt kan din streak g\u00e5?\n<\/p>\n\n      <button id=\"start-btn\" class=\"btn-main\">START SPILLET<\/button>\n<button id=\"go-leaderboard\" class=\"btn-main\">\ud83c\udfc6 Leaderboard<\/button>\n<button onclick=\"window.location.href='https:\/\/www.sif4ever.dk\/nyheder\/quiz\/'\" \n        class=\"btn-main back-btn\">\n    \u2b05\ufe0f Tilbage til quiz\n<\/button>\n\t\t\n\t\t\n    <\/div>\n\n<\/div>\n\t\t\n\t\t<div id=\"leaderboard-page\" style=\"display:none;\">\n\n    <div class=\"lb-header\">\n        <button id=\"lb-back-btn\">\u2b05\ufe0f Tilbage<\/button>\n<button id=\"go-leaderboard\">\ud83c\udfc6 Leaderboard<\/button>\n<button onclick=\"window.location.href='https:\/\/www.sif4ever.dk\/nyheder\/quiz\/'\" class=\"btn-main\">\n    \u2b05\ufe0f Tilbage til quiz\n<\/button>\n        <h2>\ud83c\udfc6 Leaderboard<\/h2>\n    <\/div>\n\n    <div class=\"lb-tabs\">\n        <button class=\"lb-tab active\" data-mode=\"top10\">Top 10<\/button>\n        <button class=\"lb-tab\" data-mode=\"top100\">Top 100<\/button>\n        <button class=\"lb-tab\" data-mode=\"search\">S\u00f8g<\/button>\n    <\/div>\n\n    <div id=\"lb-content\"><\/div>\n\n<\/div>\n\n    <div id=\"quiz-box\" style=\"display:none;\">\n       <div id=\"quiz-top\">\n    Liv \u2764\ufe0f <span id=\"lives\">1<\/span> |\n    Streak \ud83d\udd25 <span id=\"streak\">0<\/span>\n<\/div>\n\n<div id=\"timer-bar\">\n    \u23f1\ufe0f <span id=\"timer\">10<\/span>\n<\/div>\n\n<div id=\"lifelines\">\n    <div class=\"lifeline-title\">\ud83c\udfae Livliner<\/div>\n\n    <button id=\"fifty-btn\" class=\"lifeline active\">50\/50<\/button>\n    <button id=\"time-btn\" class=\"lifeline active\">+10s (2)<\/button>\n    <button id=\"reveal-btn\" class=\"lifeline active\">\ud83d\udc41\ufe0f (2)<\/button>\n<\/div>\n\n<div id=\"question\"><\/div>\n<div id=\"year-bar\"><\/div> <!-- \ud83d\udc48 HER -->\n<div id=\"options\"><\/div>\n    <\/div>\n\t\n\t<div id=\"reward-box\" style=\"display:none;\">\n    <div class=\"reward-inner\">\n\n        <h2 class=\"reward-title\">\ud83c\udf81 V\u00c6LG DIN GAVE<\/h2>\n\n        <p class=\"reward-timer\">\n            \u23f1\ufe0f <span id=\"reward-timer\">15<\/span>\n        <\/p>\n\n        <div class=\"reward-options\">\n\n            <button class=\"reward-btn fifty\" onclick=\"chooseReward('fifty')\">\n                50\/50\n            <\/button>\n\n            <button class=\"reward-btn time\" onclick=\"chooseReward('time')\">\n                +10 sek\n            <\/button>\n\n            <button class=\"reward-btn reveal\" onclick=\"chooseReward('reveal')\">\n                \ud83d\udc41\ufe0f Vis svar\n            <\/button>\n\n        <\/div>\n\n    <\/div>\n<\/div>\n\n<div id=\"game-over\" style=\"display:none;\">\n    <h2>\ud83d\udc80 GAME OVER<\/h2>\n\n    <p>Streak: <span id=\"final-score\"><\/span><\/p>\n\n    <!-- \ud83d\udd25 NAVN INPUT -->\n    <div id=\"save-score-box\">\n     <input type=\"text\" id=\"player-name-input\" maxlength=\"50\" placeholder=\"Dit navn\">\n        <button id=\"save-score-btn\">Gem score<\/button>\n    <\/div>\n\n    <!-- \ud83d\udd25 LEADERBOARD -->\n    <div id=\"leaderboard\" style=\"display:none;\">\n        <h3>\ud83c\udfc6 Top 10<\/h3>\n        <div id=\"leaderboard-list\"><\/div>\n    <\/div>\n\n    <button onclick=\"location.reload()\">Pr\u00f8v igen<\/button>\n<\/div>\n\n<\/div>\n\n<script>\nconst ajaxurl = \"https:\/\/www.sif4ever.dk\/nyheder\/wp-admin\/admin-ajax.php\";\n\t\n\t\t\n\t\n<\/script>\n\n<script>\n\nlet currentQ = null;\nlet lives = 2;\nlet streak = 0;\nlet playerResult = null;\n\tlet fiftyCount = 2;\nlet timeBonusCount = 2;\nlet revealCount = 2;\n\tlet pendingReward = false;\nlet rewardTimer = null;\n\t\n\tlet isLocked = false;\n\tlet usedQuestions = [];\n\tlet orderSelection = [];\n\t\n\tdocument.getElementById('save-score-btn').addEventListener('click', function(){\n\n    let name = document.getElementById('player-name-input').value.trim();\n\n    if (!name){\n        name = \"Anonym\";\n    }\n\nfetch(ajaxurl, {\n    method: 'POST',\n    headers: {\n        'Content-Type': 'application\/x-www-form-urlencoded'\n    },\n    body: `action=save_quiz_score&name=${encodeURIComponent(name)}&score=${streak}`\n})\n.then(res => res.json())\n.then(data => {\n\n    playerResult = data;\n\n    document.getElementById('game-over').style.display = 'none';\n    document.getElementById('leaderboard-page').style.display = 'block';\n\n    loadTop10();\n\n    document.getElementById('save-score-btn').disabled = true;\n\n})\n.catch(err => {\n    console.log(\"SAVE ERROR:\", err);\n});\n});\n\t\nfunction showRewardChoice(){\n\n    pendingReward = true;\n\n    document.getElementById('quiz-box').style.display = 'none';\n    document.getElementById('reward-box').style.display = 'block';\n\n    \/\/ \ud83d\udd25 vibration (mobil)\n    navigator.vibrate?.([100, 50, 100]);\n\n    let time = 15;\n    document.getElementById('reward-timer').innerText = time;\n\n    rewardTimer = setInterval(() => {\n\n        time--;\n        document.getElementById('reward-timer').innerText = time;\n\n        \/\/ \ud83d\udd25 PANIK ved sidste 5 sek\n        if (time <= 5){\n            document.getElementById('reward-timer').style.color = '#ff4444';\n        }\n\n        if (time <= 0){\n            clearInterval(rewardTimer);\n            applyReward('time');\n        }\n\n    }, 1000);\n}\n\t\n\tfunction chooseReward(type){\n\n    if (!pendingReward) return;\n\n    clearInterval(rewardTimer);\n    applyReward(type);\n}\n\t\n\tfunction applyReward(type){\n\n    pendingReward = false;\n\n    if (type === 'fifty'){\n        fiftyCount++;\n    }\n\n    if (type === 'time'){\n        timeBonusCount++;\n    }\n\n    if (type === 'reveal'){\n        revealCount++;\n    }\n\n    updateFiftyUI();\n    updateTimeUI();\n    updateRevealUI();\n\n    document.getElementById('reward-box').style.display = 'none';\n    document.getElementById('quiz-box').style.display = 'block';\n\n    loadQuestion();\n}\n\t\n\tfunction getTimeLimit(q, streak){\n\n    let isBoss = (\n        q.type === 'most_games_extreme' ||\n        q.type === 'step_boss'\n    );\n\n    let isStep = (\n        q.type === 'stepstepstepstep' ||\n        q.type === 'step_boss'\n    );\n\n    \/\/ \ud83d\udd25 LEVEL 3 (90+)\n    if (streak >= 90){\n        if (isBoss) return 15;\n        if (isStep) return 10;\n        return 5;\n    }\n\n    \/\/ \ud83d\udd25 LEVEL 2 (45+)\n    if (streak >= 45){\n        if (isBoss) return 20;\n        if (isStep) return 15;\n        return 8;\n    }\n\n    \/\/ \ud83d\udd25 BASE\n    if (isBoss) return 30;\n    if (isStep) return 20;\n    return 10;\n}\n\t\nfunction isOrderQuestion(q){\n    return q && (\n        q.type === 'stepstepstepstep' ||\n        q.type === 'order' ||\n        q.type === 'most_games_extreme' ||\n        q.type === 'step_boss' \/\/ \ud83d\udd25 NY\n    );\n}\n\t\n\tlet timer = null;\nlet timeLeft = 10;\n\t\n\tlet revealUsedThisQuestion = false;\n\n\/\/ START\ndocument.getElementById('start-btn').addEventListener('click', function(){\n\t\n\tresetGame();\n\t\ndocument.getElementById('time-btn').addEventListener('click', useTimeBonus);\ndocument.getElementById('reveal-btn').addEventListener('click', useReveal);\n\n    console.log(\"START\");\n\n    let quiz = document.getElementById('sif-survival-quiz');\n    let parent = quiz.parentElement;\n\n    Array.from(parent.children).forEach(el => {\n        if (el !== quiz) el.style.display = 'none';\n    });\n\n document.getElementById('start-screen').style.display = 'none';\n    document.getElementById('quiz-box').style.display = 'block';\n\n    window.scrollTo({ top: 0, behavior: 'smooth' });\n\n    \/\/ \ud83d\udd25 RESET 50\/50\n    fiftyCount = 2;\n    updateFiftyUI(); \/\/ \ud83d\udc48 DET HER DU MANGLER\n\t\n\ttimeBonusCount = 2;\nupdateTimeUI();\n\t\n\trevealCount = 2;\nupdateRevealUI();\n\n    loadQuestion();\n});\n\t\n\tdocument.getElementById('fifty-btn').addEventListener('click', useFiftyFifty);\n\n\/\/ LOAD\nfunction loadQuestion(){\n\n    \/\/ \ud83d\udd25 reset lock + timer (failsafe)\n    isLocked = false;\n    clearInterval(timer);\n\n   fetch(ajaxurl + '?action=get_survival_question&used=' \n    + encodeURIComponent(usedQuestions.join('|')) \n    + '&count=' + streak)\n\t   \n    .then(res => res.json())\n    .then(q => {\n\n        console.log(\"Q:\", q);\n\n        if (!q || !q.question_text){\n            console.log(\"Fejl: tomt sp\u00f8rgsm\u00e5l\");\n\n            \/\/ \ud83d\udd25 fallback \u2192 pr\u00f8v igen\n            setTimeout(loadQuestion, 500);\n            return;\n        }\n\n        currentQ = q;\n        usedQuestions.push(q.question_text);\n\n        renderQuestion(q);\n    })\n    .catch(err => {\n        console.log(\"AJAX fejl:\", err);\n\n        \/\/ \ud83d\udd25 retry hvis noget g\u00e5r galt\n        setTimeout(loadQuestion, 500);\n    });\n}\n\t\n\/\/ RENDER\nfunction renderQuestion(q){\n    startTimer();\n    isLocked = false;\n\t\n\trevealUsedThisQuestion = false;\n\tupdateRevealUI();\n\t\n\tdocument.getElementById('time-btn').classList.remove('used-on-question');\nupdateTimeUI();\n\n    updateFiftyUI(); \/\/ \ud83d\udc48 LIGE HER!\n\nif (q.type === 'most_games_extreme' || q.type === 'step_boss'){\n    document.getElementById('question').innerText = \"\ud83d\udd25 BOSS ROUND \ud83d\udd25\\n\" + q.question_text;\n} else {\n    document.getElementById('question').innerText = q.question_text;\n}\n\t\n\t\/\/ \ud83d\udd25 YEAR BAR (kun for stepstep)\nif (q.type === 'stepstepstepstep' && q.years){\n\n    let bar = q.years.map(y => `<span>${y}<\/span>`).join(' \u2192 ');\n\n    document.getElementById('year-bar').innerHTML = bar;\n    document.getElementById('year-bar').style.display = 'block';\n\n} else {\n    document.getElementById('year-bar').style.display = 'none';\n}\n\n    let html = '';\n\n   let isOrder = (q.type === 'order' || q.type === 'stepstepstepstep' || q.type === 'step_boss');\n\n    q.options.forEach(opt => {\n\n        html += `\n            <div class=\"quiz-card\" data-name=\"${encodeURIComponent(opt.name)}\">\n     <img decoding=\"async\" src=\"${opt.img}\" \n     onerror=\"this.onerror=null; this.src='https:\/\/lineogmartin.dk\/wp-content\/uploads\/2026\/02\/SIF.png';\">\n                <div class=\"quiz-name\">${opt.name}<\/div>\n            <\/div>\n        `;\n    });\n\n    document.getElementById('options').innerHTML = html;\n\n    orderSelection = []; \/\/ \ud83d\udd25 reset hver gang\n\n    document.querySelectorAll('.quiz-card').forEach(card => {\n\ncard.addEventListener('click', function(){\n\n    let val = decodeURIComponent(this.dataset.name);\n\n\/\/ \ud83d\udd25 ORDER MODE\nif (isOrder){\n\n    if (isLocked) return; \/\/ \ud83d\udc48 VIGTIG\n\n    if (orderSelection.includes(val)) return;\n\n    orderSelection.push(val);\n\n    let badge = document.createElement(\"div\");\n    badge.className = \"order-badge\";\n    badge.innerText = orderSelection.length;\n\n    this.appendChild(badge);\n\n    if (orderSelection.length === q.options.length){\n        isLocked = true;\n\n        \/\/ \ud83d\udd25 lille delay (smoother + mere stabil)\n        setTimeout(() => {\n            checkOrderAnswer(q);\n        }, 200);\n    }\n\n    return;\n}\n\n    \/\/ \ud83d\udd25 NORMAL MODE\n    if (isLocked) return;\n    isLocked = true;\n\n\tclearInterval(timer);\n   let isCorrect = (val === currentQ.correct_answer);\n\nif (isCorrect){\n    streak++;\n} else {\n    lives--;\n}\n\n    updateUI();\n\nsetTimeout(() => {\n\n    if (lives <= 0){\n        endGame();\n        return;\n    }\n\n    let isBoss = (\n        currentQ.type === 'most_games_extreme' ||\n        currentQ.type === 'step_boss'\n    );\n\n    \/\/ \ud83d\udd25 KUN reward hvis korrekt boss\n    if (isBoss){\n        if (isCorrect){\n            showRewardChoice();\n        } else {\n            loadQuestion();\n        }\n    } else {\n        loadQuestion();\n    }\n\n}, 500);\n});\n\n    });\n}\n\t\nfunction useFiftyFifty(){\n\n    \/\/ \ud83d\udd12 hvis intet sp\u00f8rgsm\u00e5l endnu \u2192 stop\n    if (!currentQ) return;\n\n      \/\/ \ud83d\udeab STOP p\u00e5 order sp\u00f8rgsm\u00e5l\n    if (isOrderQuestion(currentQ)) return;\n\n    \/\/ \ud83d\udd12 ingen flere tilbage\n    if (fiftyCount <= 0) return;\n\n    \/\/ \ud83d\udd12 allerede brugt p\u00e5 dette sp\u00f8rgsm\u00e5l\n    if (document.querySelectorAll('.quiz-card[style*=\"opacity\"]').length > 0) return;\n\n    if (!currentQ.options) return;\n\n    let correct = currentQ.correct_answer;\n\n    \/\/ \ud83d\udd25 find forkerte\n    let wrong = currentQ.options\n        .map(o => o.name)\n        .filter(name => name !== correct);\n\n    if (wrong.length === 0) return;\n\n    \/\/ \ud83d\udd25 v\u00e6lg EN forkert der skal blive\n    let keepWrong = wrong[Math.floor(Math.random() * wrong.length)];\n\n    \/\/ \ud83d\udd25 fjern resten\n    document.querySelectorAll('.quiz-card').forEach(card => {\n\n        let name = decodeURIComponent(card.dataset.name);\n\n        if (name !== correct && name !== keepWrong){\n            card.style.opacity = \"0.2\";\n            card.style.pointerEvents = \"none\";\n            card.style.transition = \"0.3s\";\n            card.style.transform = \"scale(0.9)\";\n        }\n    });\n\n    \/\/ \ud83d\udd25 brug en charge\n    fiftyCount--;\n\n    let btn = document.getElementById('fifty-btn');\n\n    \/\/ \ud83d\udd04 opdater tekst\n    btn.innerText = `50\/50 (${fiftyCount})`;\n\n    \/\/ \ud83d\udd04 vis state\n    if (fiftyCount <= 0){\n        btn.classList.remove('active');\n        btn.classList.add('used');\n    }\n}\n\t\nfunction updateFiftyUI(){\n\n    let btn = document.getElementById('fifty-btn');\n    if (!btn) return;\n\n    btn.innerText = `50\/50 (${fiftyCount})`;\n\n    if (!currentQ){\n        btn.classList.remove('used');\n        btn.classList.add('active');\n        btn.style.pointerEvents = 'auto';\n        btn.style.opacity = '1';\n        return;\n    }\n\n    let isOrder = isOrderQuestion(currentQ);\n\n    if (fiftyCount <= 0 || isOrder){\n        btn.classList.remove('active');\n        btn.classList.add('used');\n        btn.style.pointerEvents = 'none';\n        btn.style.opacity = '0.5';\n    } else {\n        btn.classList.remove('used');\n        btn.classList.add('active');\n        btn.style.pointerEvents = 'auto';\n        btn.style.opacity = '1';\n    }\n}\n\t\n\tfunction startTimer(){\n\t\t\n\t\tlet el = document.getElementById('timer');\n\nel.classList.remove('panic');\nel.classList.remove('timer-shake');\n\n    clearInterval(timer);\n    timeLeft = getTimeLimit(currentQ, streak);\n\n    document.getElementById('timer').innerText = timeLeft;\n    document.getElementById('timer').classList.remove('panic');\n\n    timer = setInterval(() => {\n\n        timeLeft--;\n\n        let el = document.getElementById('timer');\n        el.innerText = timeLeft;\n\n        \/\/ \ud83d\udd25 PANIK MODE\nif (timeLeft <= 3){\n    el.classList.add('panic');\n    el.classList.add('timer-shake'); \/\/ \ud83d\udc48 KUN tallet\n    navigator.vibrate?.(100);\n}\n        \/\/ \ud83d\udc80 TIME OUT\n    if (timeLeft <= 0){\n\n    clearInterval(timer);\n\n    \/\/ \ud83d\udd25 AUTO +10 SEK hvis muligt\n    if (timeBonusCount > 0){\n\n        timeBonusCount--;\n\n        \/\/ \ud83d\udd25 reset tid\n        timeLeft = getTimeLimit(currentQ, streak);\n\n        \/\/ \ud83d\udd25 opdater UI\n        updateTimeUI();\n        document.getElementById('timer').innerText = timeLeft;\n\n        \/\/ \ud83d\udd25 lille effekt\n        let el = document.getElementById('timer');\n        el.classList.remove('panic');\n        el.classList.remove('timer-shake');\n\n        \/\/ \ud83d\udd25 start timer igen\n        startTimer();\n\n        return; \/\/ \ud83d\udc48 STOP her (meget vigtigt)\n    }\n\n    \/\/ \ud83d\udc80 ellers normal fail\n    isLocked = true;\n\n    lives--;\n    updateUI();\n\n    setTimeout(() => {\n        if (lives <= 0){\n            endGame();\n        } else {\n            loadQuestion();\n        }\n    }, 500);\n}\n\n    }, 1000);\n}\n\t\n\tfunction updateTimeUI(){\n\n    let btn = document.getElementById('time-btn');\n    if (!btn) return;\n\n    btn.innerText = `+10s (${timeBonusCount})`;\n\n    if (timeBonusCount <= 0){\n        btn.classList.remove('active');\n        btn.classList.add('used');\n        btn.style.pointerEvents = 'none';\n        btn.style.opacity = '0.5';\n    } else {\n        btn.classList.remove('used');\n        btn.classList.add('active');\n        btn.style.pointerEvents = 'auto';\n        btn.style.opacity = '1';\n    }\n}\n\t\n\tfunction useTimeBonus(){\n\n    if (timeBonusCount <= 0) return;\n    if (!currentQ) return;\n\n    \/\/ \ud83d\udd12 undg\u00e5 spam p\u00e5 samme sp\u00f8rgsm\u00e5l\n    if (document.getElementById('time-btn').classList.contains('used-on-question')) return;\n\n    timeBonusCount--;\n\n    \/\/ \ud83d\udd25 giv tid\n    timeLeft += 10;\n\n    \/\/ \ud83d\udd25 opdater UI\n    document.getElementById('timer').innerText = timeLeft;\n\n    \/\/ \ud83d\udd25 mark\u00e9r brugt p\u00e5 dette sp\u00f8rgsm\u00e5l\n    let btn = document.getElementById('time-btn');\n    btn.classList.add('used-on-question');\n\n    updateTimeUI();\n}\n\t\n\tfunction updateRevealUI(){\n\n    let btn = document.getElementById('reveal-btn');\n    if (!btn) return;\n\n    btn.innerText = `\ud83d\udc41\ufe0f (${revealCount})`;\n\n    if (!currentQ){\n        btn.classList.add('active');\n        return;\n    }\n\n    let blocked = isOrderQuestion(currentQ);\n\n    if (revealCount <= 0 || blocked){\n        btn.classList.remove('active');\n        btn.classList.add('used');\n        btn.style.pointerEvents = 'none';\n        btn.style.opacity = '0.5';\n    } else {\n        btn.classList.remove('used');\n        btn.classList.add('active');\n        btn.style.pointerEvents = 'auto';\n        btn.style.opacity = '1';\n    }\n}\n\t\n\tfunction useReveal(){\n\n    if (!currentQ) return;\n    if (revealCount <= 0) return;\n\n    \/\/ \ud83d\udeab ikke tilladt p\u00e5 order\/extreme\n    if (isOrderQuestion(currentQ)) return;\n\n    let btn = document.getElementById('reveal-btn');\n\n    \/\/ \ud83d\udd12 kun \u00e9n gang pr sp\u00f8rgsm\u00e5l\n    if (revealUsedThisQuestion) return;\n\n    let correct = currentQ.correct_answer;\n\n    document.querySelectorAll('.quiz-card').forEach(card => {\n\n        let name = decodeURIComponent(card.dataset.name);\n\n        if (name === correct){\n            card.style.border = \"4px solid #28a745\";\n            card.style.boxShadow = \"0 0 15px rgba(40,167,69,0.8)\";\n            card.style.transform = \"scale(1.05)\";\n        }\n    });\n\n    revealCount--;\n\n   revealUsedThisQuestion = true;\n\n    updateRevealUI();\n}\n\t\nfunction checkOrderAnswer(q){\n\tclearInterval(timer);\n\n    let correct = q.correct_answer.split(',').map(s => s.trim());\n\n    let isCorrect = JSON.stringify(orderSelection) === JSON.stringify(correct);\n\n    if (isCorrect){\n        streak++;\n    } else {\n        lives--;\n    }\n\n    updateUI();\n\n    setTimeout(() => {\n\n        \/\/ \ud83d\udd25 reset inden n\u00e6ste sp\u00f8rgsm\u00e5l\n        orderSelection = [];\n        isLocked = false;\n\n        if (lives <= 0){\n            endGame();\n        } else {\n            loadQuestion();\n        }\n\n    }, 600);\n}\n\n\n\/\/ UI\nfunction updateUI(){\n    document.getElementById('lives').innerText = lives;\n    document.getElementById('streak').innerText = streak;\n}\n\n\nfunction endGame(){\n\n    clearInterval(timer);\n\n    document.getElementById('quiz-box').style.display = 'none';\n    document.getElementById('game-over').style.display = 'block';\n\n    document.getElementById('final-score').innerText = streak;\n\n    \/\/ \ud83d\udd25 reset input felt\n    let input = document.getElementById('player-name-input');\n    if (input){\n        input.value = '';\n    }\n\n    \/\/ \ud83d\udd25 enable knap igen (hvis man spiller igen uden reload)\n    let btn = document.getElementById('save-score-btn');\n    if (btn){\n        btn.disabled = false;\n    }\n\n    \/\/ \ud83d\udd25 skjul leaderboard indtil score er gemt\n    let board = document.getElementById('leaderboard');\n    if (board){\n        board.style.display = 'none';\n    }\n}\n\t\n\tfunction resetGame(){\n\n    \/\/ \ud83d\udd25 core stats\n    lives = 2;\n    streak = 0;\n\n    \/\/ \ud83d\udd25 state\n    currentQ = null;\n    isLocked = false;\n    usedQuestions = [];\n    orderSelection = [];\n\n    \/\/ \ud83d\udd25 lifelines\n    fiftyCount = 2;\n    timeBonusCount = 2;\n    revealCount = 2;\n\n    \/\/ \ud83d\udd25 reward state\n    pendingReward = false;\n    clearInterval(rewardTimer);\n\n    \/\/ \ud83d\udd25 timer\n    clearInterval(timer);\n    timeLeft = 10;\n\n    \/\/ \ud83d\udd25 UI reset\n    document.getElementById('lives').innerText = lives;\n    document.getElementById('streak').innerText = streak;\n\n    updateFiftyUI();\n    updateTimeUI();\n    updateRevealUI();\n}\n\t\n\tfunction loadLeaderboard(){\n\n    fetch(ajaxurl + '?action=get_quiz_scores')\n    .then(res => res.json())\n    .then(data => {\n\n        let html = '';\n\n        data.forEach((row, i) => {\n            html += `<div>#${i+1} ${row.name} - ${row.score}<\/div>`;\n        });\n\n        document.getElementById('leaderboard-list').innerHTML = html;\n    });\n}\n\t\n\t\/\/ \ud83d\udd25 \u00c5BN leaderboard\ndocument.getElementById('go-leaderboard').addEventListener('click', () => {\n\n    document.getElementById('start-screen').style.display = 'none';\n    document.getElementById('leaderboard-page').style.display = 'block';\n\n    loadTop10();\n});\n\n\/\/ \ud83d\udd19 tilbage\ndocument.getElementById('lb-back-btn').addEventListener('click', () => {\n\nplayerResult = null;\n\n    document.getElementById('leaderboard-page').style.display = 'none';\n    document.getElementById('start-screen').style.display = 'flex';\n});\n\t\n\tdocument.querySelectorAll('.lb-tab').forEach(btn => {\n\n    btn.addEventListener('click', () => {\n\n        document.querySelectorAll('.lb-tab').forEach(b => b.classList.remove('active'));\n        btn.classList.add('active');\n\n        let mode = btn.dataset.mode;\n\n        if (mode === 'top10') loadTop10();\n        if (mode === 'top100') loadTop100();\n        if (mode === 'search') loadSearchUI();\n    });\n\n});\n\t\n\tfunction loadTop10(){\n\n    fetch(ajaxurl + '?action=get_quiz_scores&limit=10')\n    .then(res => res.json())\n    .then(data => renderLeaderboard(data));\n\n}\n\t\n\t\n\t\n\tfunction loadTop100(){\n\n    fetch(ajaxurl + '?action=get_quiz_scores&limit=100')\n    .then(res => res.json())\n    .then(data => renderLeaderboard(data));\n\n}\n\t\n\tfunction loadSearchUI(){\n\n    document.getElementById('lb-content').innerHTML = `\n        <input type=\"text\" id=\"lb-search-input\" placeholder=\"S\u00f8g navn\">\n        <button onclick=\"searchLeaderboard()\">S\u00f8g<\/button>\n        <div id=\"lb-search-results\"><\/div>\n    `;\n}\n\t\n\tfunction searchLeaderboard(){\n\n    let val = document.getElementById('lb-search-input').value;\n\n    fetch(ajaxurl + '?action=get_quiz_scores&search=' + encodeURIComponent(val))\n    .then(res => res.json())\n    .then(data => {\n\n        let html = '';\n\n        if (data.length === 0){\n            html = '<div>Ingen fundet<\/div>';\n        }\n\n        data.forEach(row => {\n            html += `<div class=\"lb-row\">#${row.ranking} ${row.name} <span>${row.score}<\/span><\/div>`;\n        });\n\n        document.getElementById('lb-search-results').innerHTML = html;\n    });\n}\n\t\nfunction renderLeaderboard(data){\n\n    let html = '';\n\n    let matchedIndexes = [];\n\n    \/\/ \ud83d\udd25 find alle matches\n    data.forEach((row, i) => {\n        if (playerResult){\n            if (row.name === playerResult.name && row.score == playerResult.score){\n                matchedIndexes.push(i);\n            }\n        }\n    });\n\n    \/\/ \ud83d\udd25 v\u00e6lg KUN den sidste (laveste placering)\n    let highlightIndex = matchedIndexes.length ? matchedIndexes[matchedIndexes.length - 1] : -1;\n\n    data.forEach((row, i) => {\n\n        let isMe = (i === highlightIndex);\n\n        html += `\n        <div class=\"lb-row ${isMe ? 'me' : ''}\">\n            <span>#${i+1} ${row.name}<\/span>\n            <span class=\"lb-score\">${row.score}<\/span>\n        <\/div>`;\n    });\n\n    \/\/ \ud83d\udd25 hvis ikke i top (samme som f\u00f8r)\n    if (playerResult && playerResult.rank > data.length){\n\n        html += `<div class=\"lb-separator\">...<\/div>`;\n\n        html += `\n        <div class=\"lb-row me outside\">\n            <span>#${playerResult.rank} ${playerResult.name}<\/span>\n            <span class=\"lb-score\">${playerResult.score}<\/span>\n        <\/div>`;\n    }\n\n    document.getElementById('lb-content').innerHTML = html;\n}\n\n<\/script>\n\n<style>\n#sif-survival-quiz {\n    width:100%;\n    max-width:1000px; \/* \ud83d\udd25 st\u00f8rre *\/\n    margin:auto;\n}\n\n#options {\n    margin-top:20px;\n}\n\n.opt {\n    display:block;\n    margin:10px auto;\n    padding:10px 20px;\n    background:#002b5c;\n    color:white;\n    border:none;\n    cursor:pointer;\n}\n\n.opt:hover {\n    background:#c8102e;\n}\n\n#options {\n    display: flex;\n    gap: 15px;\n    justify-content: center;\n}\n\n.quiz-card {\n    width: 250px;\n}\n\n.quiz-card {\n    background:#f5f5f5;\n    padding:10px;\n    border-radius:10px;\n    cursor:pointer;\n    transition:0.2s;\n}\n\n.quiz-card:hover {\n    transform: scale(1.05);\n    box-shadow:0 0 10px rgba(0,0,0,0.2);\n}\n\n.quiz-card img {\n    width:100%;\n    height:220px;\n    object-fit:contain;\n}\n\n.quiz-name {\n    margin-top:10px;\n    font-weight:bold;\n}\n\n.order-badge {\n    position:absolute;\n    top:5px;\n    right:5px;\n    background:#c8102e;\n    color:#fff;\n    width:25px;\n    height:25px;\n    border-radius:50%;\n    display:flex;\n    align-items:center;\n    justify-content:center;\n    font-weight:bold;\n}\n\n.quiz-card {\n    position:relative;\n}\n\n#year-bar {\n    margin-top:10px;\n    font-weight:bold;\n    font-size:18px;\n    color:#002b5c;\n    text-align:center;\n}\n\n#year-bar span {\n    padding:5px 10px;\n    background:#f0f0f0;\n    border-radius:6px;\n    margin:0 3px;\n}\n\n#timer-bar {\n    margin-top:10px;\n    font-size:22px;\n    font-weight:bold;\n    color:#002b5c;\n}\n\n.panic {\n    color:#c8102e;\n    font-size:28px;\n    animation: panicPulse 0.5s infinite;\n}\n\n@keyframes panicPulse {\n    0% { transform: scale(1); }\n    50% { transform: scale(1.2); }\n    100% { transform: scale(1); }\n}\n\n@keyframes timerShake {\n    0% { transform: translate(0,0); }\n    25% { transform: translate(-2px, 1px); }\n    50% { transform: translate(2px, -1px); }\n    75% { transform: translate(-2px, 1px); }\n    100% { transform: translate(0,0); }\n}\n\n.timer-shake {\n    display:inline-block; \/* vigtigt for transform *\/\n    animation: timerShake 0.15s infinite;\n}\n\n.lifeline {\n    margin-top:10px;\n    padding:8px 15px;\n    border:none;\n    border-radius:6px;\n    font-weight:bold;\n    cursor:pointer;\n}\n\n\/* \ud83d\udfe2 aktiv *\/\n.lifeline.active {\n    background:#28a745;\n    color:#fff;\n}\n\n\/* \u26aa brugt *\/\n.lifeline.used {\n    background:#ccc;\n    color:#666;\n    cursor:not-allowed;\n}\n\n#lifelines {\n    margin-top:10px;\n    display:flex;\n    justify-content:center;\n    align-items:center;\n    gap:10px;\n    flex-wrap:wrap;\n}\n\n.lifeline-title {\n    font-size:20px;\n    font-weight:bold;\n    color:#002b5c;\n    margin-right:5px; \/* \ud83d\udc48 t\u00e6ttere p\u00e5 knapper *\/\n}\n#timer-bar {\n    margin-top:10px;\n    font-size:26px;\n    font-weight:bold;\n}\n\n#question {\n    margin:20px auto;\n    padding:15px 20px;\n    background:#ffffff;\n    border-radius:12px;\n    box-shadow:0 4px 12px rgba(0,0,0,0.1);\n    font-size:30px;\n    font-weight:bold;\n    color:#002b5c;\n    max-width:450px;\n    text-align:center;\n}\n\n\/* \ud83d\udd25 OVERLAY FEEL *\/\n#reward-box {\n    position: relative;\n    text-align: center;\n    padding: 30px;\n    animation: fadeIn 0.3s ease;\n}\n\n\/* \ud83d\udd25 CONTAINER *\/\n.reward-inner {\n    background: linear-gradient(135deg, #002b5c, #c8102e);\n    border-radius: 20px;\n    padding: 25px;\n    color: #fff;\n    box-shadow: 0 0 25px rgba(0,0,0,0.4);\n}\n\n\/* \ud83d\udd25 TITLE *\/\n.reward-title {\n    font-size: 26px;\n    margin-bottom: 10px;\n    animation: pulseGlow 1.5s infinite;\n}\n\n\/* \ud83d\udd25 TIMER *\/\n.reward-timer {\n    font-size: 22px;\n    margin-bottom: 20px;\n}\n\n\/* \ud83d\udd25 BUTTON GRID *\/\n.reward-options {\n    display: flex;\n    gap: 15px;\n    justify-content: center;\n    flex-wrap: wrap;\n}\n\n\/* \ud83d\udd25 BASE BUTTON *\/\n.reward-btn {\n    padding: 14px 20px;\n    font-size: 16px;\n    font-weight: bold;\n    border: none;\n    border-radius: 12px;\n    cursor: pointer;\n    transition: 0.25s;\n    transform: scale(1);\n}\n\n\/* \ud83c\udfaf INDIVIDUELLE FARVER *\/\n.reward-btn.fifty {\n    background: #ffc107;\n}\n\n.reward-btn.time {\n    background: #28a745;\n    color: #fff;\n}\n\n.reward-btn.reveal {\n    background: #17a2b8;\n    color: #fff;\n}\n\n\/* \ud83d\udd25 HOVER *\/\n.reward-btn:hover {\n    transform: scale(1.1);\n    box-shadow: 0 0 15px rgba(255,255,255,0.6);\n}\n\n\/* \ud83d\udd25 CLICK *\/\n.reward-btn:active {\n    transform: scale(0.95);\n}\n\n\/* \ud83d\udd25 TITLE GLOW *\/\n@keyframes pulseGlow {\n    0% { text-shadow: 0 0 5px #fff; }\n    50% { text-shadow: 0 0 20px #fff; }\n    100% { text-shadow: 0 0 5px #fff; }\n}\n\n\/* \ud83d\udd25 FADE IN *\/\n@keyframes fadeIn {\n    from { opacity: 0; transform: scale(0.9);}\n    to { opacity: 1; transform: scale(1);}\n}\n\t\t \n\t\t #save-score-box {\n    margin: 15px 0;\n}\n\n#player-name-input {\n    padding: 10px;\n    border-radius: 8px;\n    border: 1px solid #ccc;\n    width: 150px;\n}\n\n#save-score-btn {\n    padding: 10px 15px;\n    margin-left: 5px;\n    background: #c8102e;\n    color: white;\n    border: none;\n    border-radius: 8px;\n    cursor: pointer;\n}\n\n#save-score-btn:hover {\n    background: #a00d25;\n}\n\n#start-screen {\n    display:flex;\n    justify-content:center;\n    align-items:center;\n\n    min-height:80vh; \/* \ud83d\udd25 fylder mere sk\u00e6rm *\/\n    padding:20px 10px;\n\n    text-align:center;\n}\n\n.start-inner {\n    position: relative;\n    background: linear-gradient(135deg, #c8102e 0%, #ffffff 100%);\n    color: #002b5c;\n\n    padding: 60px 50px;          \/* \ud83d\udd25 mere luft *\/\n    border-radius: 24px;\n\n    max-width: 720px;            \/* \ud83d\udd25 st\u00f8rre kort *\/\n    width: 90%;\n    margin: auto;\n\n    box-shadow: \n        0 20px 50px rgba(0,0,0,0.25),\n        0 0 0 1px rgba(255,255,255,0.2) inset; \/* \ud83d\udd25 premium feel *\/\n\n    overflow: hidden; \/* \ud83d\udd25 vigtig for overlay *\/\n}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t.start-inner::before {\n    content: \"\";\n    position: absolute;\n    inset: 0;\n\n    background: url('https:\/\/www.sif4ever.dk\/nyheder\/wp-content\/uploads\/2025\/12\/SIF-11-150x150-1.png')\n                center center \/ 480px no-repeat; \/* \ud83d\udd25 lidt st\u00f8rre *\/\n\n    opacity: 0.06; \/* \ud83d\udd25 lidt mere subtil *\/\n    filter: grayscale(100%) contrast(1.2);\n\n    pointer-events: none;\n}\t\n\n.quiz-title {\n    font-size: 36px;\n    margin-bottom: 10px;\n    color: #002b5c;\n    text-shadow: 0 0 10px rgba(200,16,46,0.4);\n}\n\n.quiz-sub {\n    font-size: 18px;\n    margin-bottom: 15px;\n    color: #002b5c;\n}\n\n.quiz-desc {\n    font-size: 16px;\n    margin-bottom: 25px;\n    line-height: 1.6;\n    color: #333;\n}\n\n#start-btn {\n    padding: 15px 25px;\n    font-size: 18px;\n    font-weight: bold;\n    background: #002b5c; \/* \ud83d\udd35 SIF bl\u00e5 *\/\n    color: #fff;\n    border: none;\n    border-radius: 10px;\n    cursor: pointer;\n    transition: 0.2s;\n}\n\n#start-btn:hover {\n    transform: scale(1.1);\n    box-shadow: 0 0 15px rgba(0,43,92,0.6);\n}\n\t\t\n\t\t\t\t\t\t\t\t#leaderboard-page {\n    padding:20px;\n}\n\n\/* header *\/\n.lb-header {\n    display:flex;\n    justify-content:space-between;\n    align-items:center;\n    margin-bottom:15px;\n}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t.lb-header .btn-main {\n    margin-right: 10px;\n}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t.back-btn {\n    background: #c8102e !important;\n    color: #fff !important;\n}\n\n\/* tabs *\/\n.lb-tabs {\n    display:flex;\n    gap:10px;\n    margin-bottom:15px;\n}\n\n.lb-tab {\n    flex:1;\n    padding:10px;\n    border:none;\n    border-radius:8px;\n    background:#eee;\n    cursor:pointer;\n}\n\n.lb-tab.active {\n    background:#002b5c;\n    color:#fff;\n}\n\n\/* rows *\/\n.lb-row {\n    display:flex;\n    justify-content:space-between;\n    padding:10px;\n    border-bottom:1px solid #eee;\n    font-family:monospace;\n}\n\n\/* score *\/\n.lb-score {\n    color:#c8102e;\n    font-weight:bold;\n}\n\n\/* search *\/\n#lb-search-input {\n    width:70%;\n    padding:10px;\n    margin-right:5px;\n}\n\t\t\n\t\t\t\t\t\t\t\t.btn-main {\n    padding: 15px 25px;\n    font-size: 18px;\n    font-weight: bold;\n    border: none;\n    border-radius: 10px;\n    cursor: pointer;\n    transition: 0.2s;\n\n    display: inline-block;\n}\n\t\t\n\t\t\t\t\t\t\t\t#start-btn {\n    background: #002b5c;\n    color: #fff;\n}\n\n#start-btn:hover {\n    transform: scale(1.1);\n    box-shadow: 0 0 15px rgba(0,43,92,0.6);\n}\n\n#go-leaderboard {\n    background: #c8102e;\n    color: #fff;\n}\n\n#go-leaderboard:hover {\n    transform: scale(1.1);\n    box-shadow: 0 0 15px rgba(200,16,46,0.6);\n}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t#start-btn,\n#go-leaderboard {\n    margin: 10px 8px 0 8px;\n}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t#start-btn,\n#go-leaderboard {\n    padding: 15px 25px !important;\n    font-size: 18px !important;\n    font-weight: bold !important;\n    border: none !important;\n    border-radius: 10px !important;\n    cursor: pointer;\n    transition: 0.2s;\n    display: inline-block;\n}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t#start-btn {\n    background: #002b5c !important;\n    color: #fff !important;\n}\n\n#go-leaderboard {\n    background: #c8102e !important;\n    color: #fff !important;\n}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t#start-btn:hover,\n#go-leaderboard:hover {\n    transform: scale(1.1);\n}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\/* \ud83d\udcf1 MOBIL: 2 per r\u00e6kke *\/\n@media (max-width: 768px) {\n\n    #options {\n        flex-wrap: wrap; \/* \ud83d\udd25 tillad flere linjer *\/\n        justify-content: center;\n    }\n\n    .quiz-card {\n        width: calc(50% - 10px); \/* \ud83d\udd25 2 per r\u00e6kke *\/\n        max-width: none;\n    }\n\n    .quiz-card img {\n        height: 140px; \/* \ud83d\udd25 mindre billeder p\u00e5 mobil *\/\n    }\n}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\/* \ud83d\udd34 DIN PLACERING *\/\n.lb-row.me {\n    border: 2px solid #c8102e;\n    border-radius: 8px;\n    background: rgba(200,16,46,0.08);\n    font-weight: bold;\n    transform: scale(1.02);\n}\n\n\/* \ud83d\udd25 hvis udenfor top *\/\n.lb-row.outside {\n    border-style: dashed;\n}\n\n\/* ... separator *\/\n.lb-separator {\n    text-align:center;\n    opacity:0.5;\n    margin:10px 0;\n}\n\t\t\t\t\t\t\t\t\n<\/style>\n\n\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":2,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_eb_attr":"","inline_featured_image":false,"footnotes":""},"class_list":["post-3272","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.sif4ever.dk\/nyheder\/wp-json\/wp\/v2\/pages\/3272","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sif4ever.dk\/nyheder\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.sif4ever.dk\/nyheder\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.sif4ever.dk\/nyheder\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sif4ever.dk\/nyheder\/wp-json\/wp\/v2\/comments?post=3272"}],"version-history":[{"count":1,"href":"https:\/\/www.sif4ever.dk\/nyheder\/wp-json\/wp\/v2\/pages\/3272\/revisions"}],"predecessor-version":[{"id":3275,"href":"https:\/\/www.sif4ever.dk\/nyheder\/wp-json\/wp\/v2\/pages\/3272\/revisions\/3275"}],"wp:attachment":[{"href":"https:\/\/www.sif4ever.dk\/nyheder\/wp-json\/wp\/v2\/media?parent=3272"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}