{"id":7218,"date":"2026-12-01T22:28:00","date_gmt":"2026-12-01T21:28:00","guid":{"rendered":"https:\/\/povijest.net\/hpp\/?p=7218"},"modified":"2026-12-02T13:07:56","modified_gmt":"2026-12-02T12:07:56","slug":"online-igra-spust-niz-piramidu","status":"publish","type":"post","link":"https:\/\/povijest.net\/hpp\/2026\/online-igra-spust-niz-piramidu\/","title":{"rendered":"ONLINE IGRA: Spust niz piramidu"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><strong>\u010ceka te prava pustolovina u starom Egiptu!<\/strong> Usko\u010di u drvena kola na \u010detiri kota\u010da i spusti se niz veliku egipatsku piramidu! Na stazi te \u010dekaju kamene prepreke, ali i skriveno blago.<\/p>\n\n\n\n<!--more-->\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Kako igrati?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Skre\u0107i lijevo i desno<\/strong> (strelicama \u2190 \u2192, tipkama A \/ D ili gumbima na ekranu) i <strong>izbjegavaj veliko kamenje<\/strong>.<\/li>\n\n\n\n<li><strong>Pokupi vre\u0107e s blagom<\/strong> \u2013 u svakoj vo\u017enji na stazi ih je izme\u0111u 4 i 8.<\/li>\n\n\n\n<li><strong>Rije\u0161i zadatak:<\/strong> prije nego \u0161to uzme\u0161 vre\u0107u, to\u010dno pretvori prikazanu godinu u stolje\u0107e. Dobro pogledaj pi\u0161e li uz godinu <strong>pr. n. e.<\/strong> (prije na\u0161e ere) ili je godina iz na\u0161e ere!<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Poka\u017ei koliko vje\u0161to upravlja\u0161 kolima i koliko sigurno ra\u010duna\u0161 stolje\u0107a. Sretan spust!<\/p>\n\n\n\n<p class=\"has-text-align-center wp-block-paragraph\">\ud83d\udca1 <strong>Mali podsjetnik:<\/strong> Godine od 1. do 100. pripadaju <strong>1. stolje\u0107u<\/strong>. Ako godina zavr\u0161ava na dvije nule (npr. <em>400. g.<\/em>), to je <strong>4. stolje\u0107e<\/strong>, a ina\u010de odbaci zadnje dvije znamenke i dodaj 1 (npr. <em>476. g.<\/em> \u2192 4 + 1 = <strong>5. stolje\u0107e<\/strong>).<\/p>\n\n\n\n<style>\n  #piramida-igra-wrap {\n    --sand-light: #f4dfb6;\n    --sand-mid: #d9a86c;\n    --sand-dark: #8c5828;\n    --stone-dark: #3b2614;\n    --gold: #f5c236;\n    --lapis: #1b4965;\n    --crimson: #b5372b;\n\n    position: relative;\n    width: 100%;\n    max-width: 900px;\n    aspect-ratio: 16 \/ 10;\n    margin: 24px auto;\n    background: #2b1b0e;\n    border: 4px solid var(--gold);\n    border-radius: 12px;\n    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.45);\n    overflow: hidden;\n    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;\n    color: var(--stone-dark);\n    line-height: 1.4;\n    user-select: none;\n    -webkit-user-select: none;\n  }\n\n  #piramida-igra-wrap *,\n  #piramida-igra-wrap *::before,\n  #piramida-igra-wrap *::after {\n    box-sizing: border-box;\n  }\n\n  #piramida-igra-wrap canvas {\n    display: block;\n    width: 100% !important;\n    height: 100% !important;\n    max-width: none !important;\n    margin: 0;\n  }\n\n  #pir-hud {\n    position: absolute;\n    top: 0;\n    left: 0;\n    right: 0;\n    padding: 10px 14px;\n    display: flex;\n    justify-content: space-between;\n    align-items: center;\n    gap: 10px;\n    pointer-events: none;\n    z-index: 5;\n  }\n\n  #piramida-igra-wrap .pir-hud-box {\n    background: rgba(36, 22, 10, 0.84);\n    border: 2px solid var(--gold);\n    border-radius: 8px;\n    padding: 6px 12px;\n    color: var(--sand-light);\n    font-weight: 700;\n    font-size: 0.92rem;\n    display: flex;\n    align-items: center;\n    gap: 8px;\n    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);\n  }\n\n  #piramida-igra-wrap .pir-progress-wrap {\n    flex: 1;\n    max-width: 280px;\n    display: flex;\n    flex-direction: column;\n    gap: 4px;\n  }\n\n  #piramida-igra-wrap .pir-progress-label {\n    display: flex;\n    justify-content: space-between;\n    font-size: 0.76rem;\n    color: var(--gold);\n    width: 100%;\n  }\n\n  #piramida-igra-wrap .pir-progress-bar {\n    width: 100%;\n    height: 10px;\n    background: #2b1b0e;\n    border: 1px solid var(--sand-mid);\n    border-radius: 5px;\n    overflow: hidden;\n  }\n\n  #pir-progress-fill {\n    width: 0%;\n    height: 100%;\n    background: linear-gradient(90deg, var(--gold), #ff9f1c);\n    transition: width 0.08s linear;\n  }\n\n  #pir-mute-btn {\n    pointer-events: auto;\n    cursor: pointer;\n    background: rgba(36, 22, 10, 0.85);\n    border: 2px solid var(--gold);\n    color: var(--gold);\n    border-radius: 8px;\n    padding: 6px 10px;\n    font-size: 0.9rem;\n    font-weight: 700;\n    line-height: 1.2;\n    text-transform: none;\n  }\n\n  #pir-touch-controls {\n    position: absolute;\n    bottom: 14px;\n    left: 16px;\n    right: 16px;\n    display: flex;\n    justify-content: space-between;\n    pointer-events: none;\n    z-index: 5;\n  }\n\n  #piramida-igra-wrap .pir-ctrl-btn {\n    pointer-events: auto;\n    background: rgba(36, 22, 10, 0.65);\n    border: 2px solid rgba(245, 194, 54, 0.75);\n    color: var(--gold);\n    font-size: 1.05rem;\n    font-weight: 800;\n    padding: 10px 20px;\n    border-radius: 12px;\n    cursor: pointer;\n    touch-action: manipulation;\n    line-height: 1.2;\n    text-transform: none;\n  }\n\n  #piramida-igra-wrap .pir-ctrl-btn:active,\n  #piramida-igra-wrap .pir-ctrl-btn.active {\n    background: rgba(245, 194, 54, 0.35);\n    transform: scale(0.96);\n  }\n\n  #piramida-igra-wrap .pir-overlay {\n    position: absolute;\n    inset: 0;\n    background: rgba(20, 12, 6, 0.78);\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    padding: 16px;\n    z-index: 10;\n  }\n\n  #piramida-igra-wrap .pir-hidden {\n    display: none !important;\n  }\n\n  #piramida-igra-wrap .pir-card {\n    background: linear-gradient(165deg, #fbf1da 0%, #ecd4a4 100%);\n    border: 4px solid var(--sand-dark);\n    outline: 3px solid var(--gold);\n    border-radius: 14px;\n    max-width: 540px;\n    width: 100%;\n    padding: 20px 24px;\n    text-align: center;\n    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.75);\n    max-height: 94%;\n    overflow-y: auto;\n  }\n\n  #piramida-igra-wrap .pir-trim {\n    height: 8px;\n    background: repeating-linear-gradient(\n      90deg,\n      var(--lapis) 0px,\n      var(--lapis) 16px,\n      var(--gold) 16px,\n      var(--gold) 32px,\n      var(--crimson) 32px,\n      var(--crimson) 48px\n    );\n    border-radius: 4px;\n    margin-bottom: 12px;\n  }\n\n  #piramida-igra-wrap h2,\n  #piramida-igra-wrap h3 {\n    margin: 0 0 10px 0;\n    padding: 0;\n    color: #4a280a;\n    font-size: 1.45rem;\n    font-weight: 800;\n    line-height: 1.25;\n  }\n\n  #piramida-igra-wrap p {\n    margin: 8px 0;\n    padding: 0;\n    line-height: 1.45;\n    color: #3f2712;\n    font-size: 0.96rem;\n  }\n\n  #piramida-igra-wrap .pir-btn-primary {\n    margin-top: 14px;\n    background: linear-gradient(180deg, #f7cb45, #d49617);\n    border: 2px solid #5c360d;\n    color: #2c1604;\n    font-size: 1.05rem;\n    font-weight: 800;\n    padding: 11px 26px;\n    border-radius: 10px;\n    cursor: pointer;\n    box-shadow: 0 4px 0 #70430f;\n    line-height: 1.2;\n    text-transform: none;\n  }\n\n  #piramida-igra-wrap .pir-btn-primary:hover {\n    filter: brightness(1.06);\n  }\n\n  #piramida-igra-wrap .pir-year-badge {\n    display: inline-block;\n    margin: 8px 0 12px;\n    padding: 9px 22px;\n    background: var(--lapis);\n    color: var(--gold);\n    border: 3px solid var(--gold);\n    border-radius: 10px;\n    font-size: 1.65rem;\n    font-weight: 900;\n    letter-spacing: 1px;\n  }\n\n  #pir-answers-grid {\n    display: grid;\n    grid-template-columns: 1fr 1fr;\n    gap: 10px;\n    margin-top: 10px;\n  }\n\n  #piramida-igra-wrap .pir-answer-btn {\n    background: #fff7e4;\n    border: 2px solid var(--sand-dark);\n    color: var(--stone-dark);\n    font-size: 1.02rem;\n    font-weight: 700;\n    padding: 11px 10px;\n    border-radius: 9px;\n    cursor: pointer;\n    line-height: 1.2;\n    text-transform: none;\n  }\n\n  #piramida-igra-wrap .pir-answer-btn:hover:not(:disabled) {\n    background: #f5dc9f;\n    border-color: var(--lapis);\n  }\n\n  #piramida-igra-wrap .pir-answer-btn.correct {\n    background: #2a9d8f;\n    color: #fff;\n    border-color: #175c54;\n  }\n\n  #piramida-igra-wrap .pir-answer-btn.wrong {\n    background: #b5372b;\n    color: #fff;\n    border-color: #6b1a12;\n  }\n\n  #pir-question-feedback {\n    margin-top: 12px;\n    font-weight: 700;\n    font-size: 0.96rem;\n    min-height: 22px;\n  }\n\n  #piramida-igra-wrap .pir-stats-grid {\n    display: grid;\n    grid-template-columns: 1fr 1fr;\n    gap: 10px;\n    margin: 12px 0;\n    text-align: left;\n  }\n\n  #piramida-igra-wrap .pir-stat-item {\n    background: rgba(140, 88, 40, 0.12);\n    border: 1px solid rgba(140, 88, 40, 0.35);\n    border-radius: 8px;\n    padding: 8px 12px;\n  }\n\n  #piramida-igra-wrap .pir-stat-label {\n    font-size: 0.75rem;\n    color: #6e451d;\n    font-weight: 700;\n    text-transform: uppercase;\n  }\n\n  #piramida-igra-wrap .pir-stat-val {\n    font-size: 1.15rem;\n    font-weight: 800;\n    color: #361d08;\n  }\n\n  #piramida-igra-wrap .pir-controls-hint {\n    display: inline-block;\n    background: rgba(140, 88, 40, 0.15);\n    border: 1px solid var(--sand-dark);\n    border-radius: 8px;\n    padding: 7px 12px;\n    margin-top: 6px;\n    font-size: 0.88rem;\n  }\n\n  @media (max-width: 600px) {\n    #piramida-igra-wrap {\n      aspect-ratio: 4 \/ 5;\n    }\n    #piramida-igra-wrap .pir-hud-box {\n      font-size: 0.74rem;\n      padding: 4px 7px;\n    }\n    #piramida-igra-wrap .pir-card {\n      padding: 14px;\n    }\n    #piramida-igra-wrap .pir-year-badge {\n      font-size: 1.3rem;\n    }\n    #pir-answers-grid {\n      grid-template-columns: 1fr;\n    }\n  }\n<\/style>\n\n<div id=\"piramida-igra-wrap\">\n  <canvas id=\"pir-canvas\"><\/canvas>\n\n  <div id=\"pir-hud\" class=\"pir-hidden\">\n    <div class=\"pir-hud-box\">\n      <span>\ud83d\udcb0 Blago: <span id=\"pir-hud-score\">0<\/span><\/span>\n    <\/div>\n\n    <div class=\"pir-hud-box pir-progress-wrap\">\n      <div class=\"pir-progress-label\">\n        <span>Vrh<\/span>\n        <span id=\"pir-hud-time\">0.0 s<\/span>\n        <span>Podno\u017eje<\/span>\n      <\/div>\n      <div class=\"pir-progress-bar\">\n        <div id=\"pir-progress-fill\"><\/div>\n      <\/div>\n    <\/div>\n\n    <div class=\"pir-hud-box\">\n      <span>\ud83c\udf92 Vre\u0107e: <span id=\"pir-hud-bags\">0<\/span>\/<span id=\"pir-hud-total-bags\">4<\/span><\/span>\n    <\/div>\n\n    <button id=\"pir-mute-btn\" type=\"button\" title=\"Uklju\u010di\/isklju\u010di zvuk\">\ud83d\udd0a<\/button>\n  <\/div>\n\n  <div id=\"pir-touch-controls\" class=\"pir-hidden\">\n    <button id=\"pir-btn-left\" type=\"button\" class=\"pir-ctrl-btn\">\u25c0 LIJEVO<\/button>\n    <button id=\"pir-btn-right\" type=\"button\" class=\"pir-ctrl-btn\">DESNO \u25b6<\/button>\n  <\/div>\n\n  <div id=\"pir-menu-overlay\" class=\"pir-overlay\">\n    <div class=\"pir-card\">\n      <div class=\"pir-trim\"><\/div>\n      <h2>\ud83c\udffa Spust niz piramidu<\/h2>\n      <p>\n        Juri\u0161 niz drevnu egipatsku piramidu u drvenim kolima na 4 kota\u010da!\n        Duljina staze i broj vre\u0107a s blagom (od <strong>4 do 8<\/strong>) mijenjaju se pri svakoj vo\u017enji.\n      <\/p>\n      <p>\n        Izbjegavaj <strong>veliko kamenje<\/strong> i pokupi vre\u0107e s blagom.\n        Prije svake vre\u0107e mora\u0161 to\u010dno pretvoriti prikazanu godinu u stolje\u0107e!\n      <\/p>\n      <div class=\"pir-controls-hint\">\n        \u2328\ufe0f Upravljanje: <strong>\u2190 \/ \u2192<\/strong> ili <strong>A \/ D<\/strong> (ili gumbi na ekranu)\n      <\/div>\n      <br \/>\n      <button id=\"pir-start-btn\" type=\"button\" class=\"pir-btn-primary\">Zapo\u010dni spust<\/button>\n    <\/div>\n  <\/div>\n\n  <div id=\"pir-question-overlay\" class=\"pir-overlay pir-hidden\">\n    <div class=\"pir-card\">\n      <div class=\"pir-trim\"><\/div>\n      <h3>\ud83c\udf92 Vre\u0107a s blagom!<\/h3>\n      <p>Prije nego \u0161to pokupi\u0161 blago, odredi u kojem je stolje\u0107u bila ova godina:<\/p>\n      <div class=\"pir-year-badge\" id=\"pir-question-year\">476. g.<\/div>\n      <div id=\"pir-answers-grid\"><\/div>\n      <div id=\"pir-question-feedback\"><\/div>\n      <button id=\"pir-continue-btn\" type=\"button\" class=\"pir-btn-primary pir-hidden\">Nastavi spust<\/button>\n    <\/div>\n  <\/div>\n\n  <div id=\"pir-end-overlay\" class=\"pir-overlay pir-hidden\">\n    <div class=\"pir-card\">\n      <div class=\"pir-trim\"><\/div>\n      <h2>\ud83c\udfc1 Stigao si do podno\u017eja!<\/h2>\n      <p id=\"pir-end-rank\" style=\"font-weight: 700; color: #1b4965; font-size: 1.05rem;\"><\/p>\n\n      <div class=\"pir-stats-grid\">\n        <div class=\"pir-stat-item\">\n          <div class=\"pir-stat-label\">Ukupno blago<\/div>\n          <div class=\"pir-stat-val\" id=\"pir-stat-score\">0<\/div>\n        <\/div>\n        <div class=\"pir-stat-item\">\n          <div class=\"pir-stat-label\">Trajanje vo\u017enje<\/div>\n          <div class=\"pir-stat-val\" id=\"pir-stat-time\">0.0 s<\/div>\n        <\/div>\n        <div class=\"pir-stat-item\">\n          <div class=\"pir-stat-label\">To\u010dni odgovori<\/div>\n          <div class=\"pir-stat-val\" id=\"pir-stat-correct\">0 \/ 4<\/div>\n        <\/div>\n        <div class=\"pir-stat-item\">\n          <div class=\"pir-stat-label\">Udarci u kamenje<\/div>\n          <div class=\"pir-stat-val\" id=\"pir-stat-hits\">0<\/div>\n        <\/div>\n      <\/div>\n\n      <button id=\"pir-restart-btn\" type=\"button\" class=\"pir-btn-primary\">Igraj ponovno<\/button>\n    <\/div>\n  <\/div>\n<\/div>\n\n<script>\n(() => {\n  const wrapper = document.getElementById('piramida-igra-wrap');\n  const canvas = document.getElementById('pir-canvas');\n  if (!wrapper || !canvas) return;\n  const ctx = canvas.getContext('2d');\n\n  const hudEl = document.getElementById('pir-hud');\n  const hudScoreEl = document.getElementById('pir-hud-score');\n  const hudTimeEl = document.getElementById('pir-hud-time');\n  const hudBagsEl = document.getElementById('pir-hud-bags');\n  const hudTotalBagsEl = document.getElementById('pir-hud-total-bags');\n  const progressFillEl = document.getElementById('pir-progress-fill');\n  const muteBtn = document.getElementById('pir-mute-btn');\n  const touchControlsEl = document.getElementById('pir-touch-controls');\n\n  const menuOverlay = document.getElementById('pir-menu-overlay');\n  const questionOverlay = document.getElementById('pir-question-overlay');\n  const endOverlay = document.getElementById('pir-end-overlay');\n\n  const startBtn = document.getElementById('pir-start-btn');\n  const restartBtn = document.getElementById('pir-restart-btn');\n  const continueBtn = document.getElementById('pir-continue-btn');\n\n  const questionYearEl = document.getElementById('pir-question-year');\n  const answersGridEl = document.getElementById('pir-answers-grid');\n  const questionFeedbackEl = document.getElementById('pir-question-feedback');\n\n  const btnLeft = document.getElementById('pir-btn-left');\n  const btnRight = document.getElementById('pir-btn-right');\n\n  let audioCtx = null;\n  let isMuted = false;\n\n  function ensureAudio() {\n    if (!audioCtx) {\n      const AudioContext = window.AudioContext || window.webkitAudioContext;\n      if (AudioContext) audioCtx = new AudioContext();\n    }\n    if (!(!(audioCtx) || !(audioCtx.state === 'suspended'))) audioCtx.resume();\n  }\n\n  function playTone(freq, duration, type = 'triangle', volume = 0.15, slideTo = null) {\n    if (isMuted || !audioCtx) return;\n    const osc = audioCtx.createOscillator();\n    const gain = audioCtx.createGain();\n    osc.type = type;\n    osc.frequency.setValueAtTime(freq, audioCtx.currentTime);\n    if (slideTo) osc.frequency.exponentialRampToValueAtTime(slideTo, audioCtx.currentTime + duration);\n    gain.gain.setValueAtTime(volume, audioCtx.currentTime);\n    gain.gain.exponentialRampToValueAtTime(0.001, audioCtx.currentTime + duration);\n    osc.connect(gain);\n    gain.connect(audioCtx.destination);\n    osc.start();\n    osc.stop(audioCtx.currentTime + duration);\n  }\n\n  function playHitSound() { playTone(130, 0.22, 'sawtooth', 0.22, 45); }\n  function playBagFoundSound() {\n    playTone(523.25, 0.14, 'sine', 0.15);\n    setTimeout(() => playTone(659.25, 0.18, 'sine', 0.15), 90);\n  }\n  function playCorrectSound() {\n    playTone(523.25, 0.12, 'triangle', 0.16);\n    setTimeout(() => playTone(659.25, 0.12, 'triangle', 0.16), 90);\n    setTimeout(() => playTone(783.99, 0.24, 'triangle', 0.18), 180);\n  }\n  function playWrongSound() {\n    playTone(240, 0.18, 'sawtooth', 0.14, 150);\n    setTimeout(() => playTone(165, 0.28, 'sawtooth', 0.14, 110), 140);\n  }\n  function playWinSound() {\n    [523.25, 659.25, 783.99, 1046.5].forEach((n, i) => {\n      setTimeout(() => playTone(n, 0.25, 'triangle', 0.16), i * 110);\n    });\n  }\n\n  muteBtn.addEventListener('click', () => {\n    isMuted = !isMuted;\n    muteBtn.textContent = isMuted ? '\ud83d\udd07' : '\ud83d\udd0a';\n  });\n\n  const BC_YEARS = [2560, 1750, 1274, 776, 753, 509, 500, 490, 400, 323, 218, 202, 100, 44, 31];\n  const AD_YEARS = [33, 100, 313, 476, 800, 925, 1000, 1102, 1492, 1500, 1683, 1789, 1900, 1991, 2000, 2001];\n\n  function shuffle(arr) {\n    const copy = [...arr];\n    for (let i = copy.length - 1; i > 0; i--) {\n      const j = Math.floor(Math.random() * (i + 1));\n      [copy[i], copy[j]] = [copy[j], copy[i]];\n    }\n    return copy;\n  }\n\n  function formatCentury(century, isBC) {\n    return isBC ? `${century}. st. pr. n. e.` : `${century}. st.`;\n  }\n\n  function formatYear(year, isBC) {\n    return isBC ? `${year}. g. pr. n. e.` : `${year}. g.`;\n  }\n\n  function generateRunQuestions(count) {\n    const bcCount = Math.random() < 0.5 ? Math.floor(count \/ 2) : Math.ceil(count \/ 2);\n    const adCount = count - bcCount;\n\n    const pickedBC = shuffle(BC_YEARS).slice(0, bcCount).map(y => ({ year: y, isBC: true }));\n    const pickedAD = shuffle(AD_YEARS).slice(0, adCount).map(y => ({ year: y, isBC: false }));\n    const combined = shuffle([...pickedBC, ...pickedAD]);\n\n    return combined.map(item => {\n      const correctCentury = Math.ceil(item.year \/ 100);\n      const correctLabel = formatCentury(correctCentury, item.isBC);\n\n      const options = shuffle([\n        { label: correctLabel, isCorrect: true },\n        { label: formatCentury(correctCentury + 1, item.isBC), isCorrect: false },\n        { label: formatCentury(correctCentury > 1 ? correctCentury - 1 : correctCentury + 2, item.isBC), isCorrect: false },\n        { label: formatCentury(correctCentury, !item.isBC), isCorrect: false }\n      ]);\n\n      return {\n        yearText: formatYear(item.year, item.isBC),\n        correctLabel,\n        options\n      };\n    });\n  }\n\n  const BASE_SPEED = 50;\n  const VISIBLE_DISTANCE = 260;\n\n  let state = 'MENU';\n  let width = 900;\n  let height = 562;\n  const keys = { left: false, right: false };\n  let run = {};\n\n  function resetRun() {\n    const questionCount = 4 + Math.floor(Math.random() * 5);\n    const trackLength = 120 + questionCount * 220;\n    const questions = generateRunQuestions(questionCount);\n\n    const firstBagDist = 180;\n    const lastBagDist = trackLength - 140;\n    const step = (lastBagDist - firstBagDist) \/ (questionCount - 1);\n\n    const bags = [];\n    for (let i = 0; i < questionCount; i++) {\n      bags.push({\n        id: i,\n        dist: firstBagDist + i * step,\n        x: Math.random() * 1.15 - 0.575,\n        collected: false,\n        answered: false,\n        question: questions[i]\n      });\n    }\n\n    const rocks = [];\n    let d = 75;\n    while (d < trackLength - 55) {\n      const nearBag = bags.find(b => Math.abs(b.dist - d) < 38);\n      const rockCount = Math.random() < 0.35 ? 2 : 1;\n\n      for (let i = 0; i < rockCount; i++) {\n        let rx = Math.random() * 1.72 - 0.86;\n        if (!(!(nearBag) || !(Math.abs(rx - nearBag.x) < 0.45))) {\n          rx = nearBag.x > 0 ? nearBag.x - 0.55 : nearBag.x + 0.55;\n          rx = Math.max(-0.88, Math.min(0.88, rx));\n        }\n        rocks.push({\n          dist: d + i * 8,\n          x: rx,\n          size: 0.85 + Math.random() * 0.45,\n          hit: false\n        });\n      }\n      d += 36 + Math.random() * 22;\n    }\n\n    run = {\n      questionCount,\n      trackLength,\n      dist: 0,\n      elapsed: 0,\n      speed: BASE_SPEED,\n      cartX: 0,\n      cartVx: 0,\n      cartTilt: 0,\n      wheelAngle: 0,\n      score: 0,\n      bagsFound: 0,\n      correctAnswers: 0,\n      rockHits: 0,\n      stunTimer: 0,\n      graceTimer: 0,\n      shakeTimer: 0,\n      bags,\n      rocks,\n      particles: [],\n      activeBag: null\n    };\n\n    updateHUD();\n  }\n\n  function resizeCanvas() {\n    const rect = wrapper.getBoundingClientRect();\n    if (!rect.width || !rect.height) return;\n    const dpr = Math.min(window.devicePixelRatio || 1, 2);\n    width = rect.width;\n    height = rect.height;\n    canvas.width = Math.floor(width * dpr);\n    canvas.height = Math.floor(height * dpr);\n    ctx.setTransform(dpr, 0, 0, dpr, 0, 0);\n  }\n\n  window.addEventListener('resize', resizeCanvas);\n  if (window.ResizeObserver) {\n    new ResizeObserver(resizeCanvas).observe(wrapper);\n  }\n  resizeCanvas();\n\n  window.addEventListener('keydown', (e) => {\n    if (state === 'PLAYING') {\n      if (e.key === 'ArrowLeft' || e.key === 'a' || e.key === 'A') {\n        if (e.key === 'ArrowLeft') e.preventDefault();\n        keys.left = true;\n      }\n      if (e.key === 'ArrowRight' || e.key === 'd' || e.key === 'D') {\n        if (e.key === 'ArrowRight') e.preventDefault();\n        keys.right = true;\n      }\n    } else if (state === 'QUESTION') {\n      if (!(!((e.key === 'Enter' || e.key === ' ')) || !(!continueBtn.classList.contains('pir-hidden')))) {\n        e.preventDefault();\n        continueBtn.click();\n      }\n    }\n  });\n\n  window.addEventListener('keyup', (e) => {\n    if (e.key === 'ArrowLeft' || e.key === 'a' || e.key === 'A') keys.left = false;\n    if (e.key === 'ArrowRight' || e.key === 'd' || e.key === 'D') keys.right = false;\n  });\n\n  function bindTouchButton(el, dir) {\n    const down = (e) => {\n      e.preventDefault();\n      keys[dir] = true;\n      el.classList.add('active');\n    };\n    const up = () => {\n      keys[dir] = false;\n      el.classList.remove('active');\n    };\n    el.addEventListener('mousedown', down);\n    el.addEventListener('touchstart', down, { passive: false });\n    window.addEventListener('mouseup', up);\n    window.addEventListener('touchend', up);\n    window.addEventListener('touchcancel', up);\n  }\n\n  bindTouchButton(btnLeft, 'left');\n  bindTouchButton(btnRight, 'right');\n\n  function startGame() {\n    ensureAudio();\n    resetRun();\n    state = 'PLAYING';\n    menuOverlay.classList.add('pir-hidden');\n    endOverlay.classList.add('pir-hidden');\n    questionOverlay.classList.add('pir-hidden');\n    hudEl.classList.remove('pir-hidden');\n    touchControlsEl.classList.remove('pir-hidden');\n  }\n\n  startBtn.addEventListener('click', startGame);\n  restartBtn.addEventListener('click', startGame);\n\n  function triggerBagQuestion(bag) {\n    state = 'QUESTION';\n    keys.left = false;\n    keys.right = false;\n    run.activeBag = bag;\n    bag.answered = true;\n    playBagFoundSound();\n\n    const q = bag.question;\n    questionYearEl.textContent = q.yearText;\n    questionFeedbackEl.textContent = '';\n    questionFeedbackEl.style.color = '#3f2712';\n    continueBtn.classList.add('pir-hidden');\n    answersGridEl.innerHTML = '';\n\n    q.options.forEach((opt) => {\n      const btn = document.createElement('button');\n      btn.type = 'button';\n      btn.className = 'pir-answer-btn';\n      btn.textContent = opt.label;\n      btn.addEventListener('click', () => handleAnswer(btn, opt, q));\n      answersGridEl.appendChild(btn);\n    });\n\n    questionOverlay.classList.remove('pir-hidden');\n  }\n\n  function handleAnswer(clickedBtn, opt, q) {\n    const allBtns = answersGridEl.querySelectorAll('.pir-answer-btn');\n    allBtns.forEach(b => (b.disabled = true));\n\n    if (opt.isCorrect) {\n      clickedBtn.classList.add('correct');\n      run.score += 100;\n      run.bagsFound += 1;\n      run.correctAnswers += 1;\n      run.activeBag.collected = true;\n      questionFeedbackEl.style.color = '#1b6e64';\n      questionFeedbackEl.textContent = `To\u010dno! ${q.yearText} je ${q.correctLabel} (+100 blaga!)`;\n      playCorrectSound();\n    } else {\n      clickedBtn.classList.add('wrong');\n      allBtns.forEach((b, idx) => {\n        if (q.options[idx].isCorrect) b.classList.add('correct');\n      });\n      questionFeedbackEl.style.color = '#9e261b';\n      questionFeedbackEl.textContent = `Neto\u010dno! ${q.yearText} je ${q.correctLabel} Vre\u0107a je ispala!`;\n      playWrongSound();\n    }\n\n    updateHUD();\n    continueBtn.classList.remove('pir-hidden');\n  }\n\n  continueBtn.addEventListener('click', () => {\n    questionOverlay.classList.add('pir-hidden');\n    run.graceTimer = 1.0;\n    state = 'PLAYING';\n  });\n\n  function finishRun() {\n    state = 'FINISHED';\n    keys.left = false;\n    keys.right = false;\n    hudEl.classList.add('pir-hidden');\n    touchControlsEl.classList.add('pir-hidden');\n    playWinSound();\n\n    document.getElementById('pir-stat-score').textContent = `${run.score} \ud83d\udcb0`;\n    document.getElementById('pir-stat-time').textContent = `${run.elapsed.toFixed(1)} s`;\n    document.getElementById('pir-stat-correct').textContent = `${run.correctAnswers} \/ ${run.questionCount}`;\n    document.getElementById('pir-stat-hits').textContent = `${run.rockHits}`;\n\n    const ratio = run.correctAnswers \/ run.questionCount;\n    let rank = 'U\u010denik pustinjskih staza';\n    if (!(!(run.correctAnswers === run.questionCount) || !(run.rockHits === 0))) {\n      rank = '\ud83d\udc51 Vrhovni faraon piramida (Savr\u0161ena vo\u017enja!)';\n    } else if (!(!(ratio >= 0.75) || !(run.score >= run.questionCount * 60))) {\n      rank = '\ud83e\udd85 Kraljevski pisar i voza\u010d';\n    } else if (ratio >= 0.5) {\n      rank = '\ud83d\udc2a Hrabri pustinjski istra\u017eiva\u010d';\n    }\n    document.getElementById('pir-end-rank').textContent = rank;\n\n    endOverlay.classList.remove('pir-hidden');\n  }\n\n  function updateHUD() {\n    hudScoreEl.textContent = run.score;\n    hudTimeEl.textContent = `${run.elapsed.toFixed(1)} s`;\n    hudBagsEl.textContent = run.bagsFound;\n    hudTotalBagsEl.textContent = run.questionCount;\n    const pct = Math.min(100, (run.dist \/ run.trackLength) * 100);\n    progressFillEl.style.width = `${pct}%`;\n  }\n\n  function update(dt) {\n    if (state !== 'PLAYING') return;\n\n    run.elapsed += dt;\n    if (run.stunTimer > 0) run.stunTimer = Math.max(0, run.stunTimer - dt);\n    if (run.graceTimer > 0) run.graceTimer = Math.max(0, run.graceTimer - dt);\n    if (run.shakeTimer > 0) run.shakeTimer = Math.max(0, run.shakeTimer - dt);\n\n    const targetSpeed = run.stunTimer > 0 ? BASE_SPEED * 0.55 : BASE_SPEED;\n    run.speed += (targetSpeed - run.speed) * Math.min(1, dt * 6);\n    run.dist += run.speed * dt;\n    run.wheelAngle += run.speed * dt * 0.35;\n\n    const steerInput = (keys.right ? 1 : 0) - (keys.left ? 1 : 0);\n    const maxVx = 1.65;\n    if (steerInput !== 0) {\n      run.cartVx += steerInput * 6.5 * dt;\n    } else {\n      run.cartVx *= Math.pow(0.015, dt);\n    }\n    run.cartVx = Math.max(-maxVx, Math.min(maxVx, run.cartVx));\n    run.cartX += run.cartVx * dt;\n    run.cartX = Math.max(-0.88, Math.min(0.88, run.cartX));\n    run.cartTilt += (run.cartVx * 0.14 - run.cartTilt) * Math.min(1, dt * 10);\n\n    if (Math.random() < 0.7) {\n      [-0.08, 0.08].forEach(offset => {\n        run.particles.push({\n          x: run.cartX + offset + (Math.random() - 0.5) * 0.04,\n          yOffset: 0,\n          vx: (Math.random() - 0.5) * 0.15,\n          vy: 30 + Math.random() * 35,\n          life: 0.45,\n          maxLife: 0.45,\n          size: 3 + Math.random() * 4\n        });\n      });\n    }\n\n    run.particles.forEach(p => {\n      p.life -= dt;\n      p.x += p.vx * dt;\n      p.yOffset += p.vy * dt;\n    });\n    run.particles = run.particles.filter(p => p.life > 0);\n\n    for (const bag of run.bags) {\n      if (!bag.answered) {\n        const relDist = bag.dist - run.dist;\n        if (!(!(relDist < 18) || !(relDist > -12) || !(Math.abs(bag.x - run.cartX) < 0.28))) {\n          triggerBagQuestion(bag);\n          return;\n        }\n      }\n    }\n\n    if (run.graceTimer <= 0) {\n      for (const rock of run.rocks) {\n        if (!rock.hit) {\n          const relDist = rock.dist - run.dist;\n          const hitRadius = 0.16 * rock.size + 0.12;\n          if (!(!(relDist < 12) || !(relDist > -10) || !(Math.abs(rock.x - run.cartX) < hitRadius))) {\n            rock.hit = true;\n            run.rockHits += 1;\n            run.score = Math.max(0, run.score - 50);\n            run.stunTimer = 0.75;\n            run.shakeTimer = 0.35;\n            run.graceTimer = 0.65;\n            playHitSound();\n            break;\n          }\n        }\n      }\n    }\n\n    updateHUD();\n\n    if (run.dist >= run.trackLength) finishRun();\n  }\n\n  function getHorizonY() { return height * 0.24; }\n\n  function project(relDist, normX) {\n    const clamped = Math.max(-25, Math.min(VISIBLE_DISTANCE, relDist));\n    const t = clamped \/ VISIBLE_DISTANCE;\n    const p = 1 \/ (1 + t * 4.2);\n\n    const horizonY = getHorizonY();\n    const cartScreenY = height * 0.83;\n    const y = horizonY + (cartScreenY - horizonY) * p;\n\n    const halfWidthAtCart = width * 0.44;\n    const halfWidthAtHorizon = width * 0.095;\n    const halfW = halfWidthAtHorizon + (halfWidthAtCart - halfWidthAtHorizon) * p;\n    const x = width * 0.5 + normX * halfW;\n\n    return { x, y, scale: p, halfW };\n  }\n\n  function drawBackground() {\n    const horizonY = getHorizonY();\n    const skyGrad = ctx.createLinearGradient(0, 0, 0, horizonY);\n    skyGrad.addColorStop(0, '#c86428');\n    skyGrad.addColorStop(0.55, '#eb9f48');\n    skyGrad.addColorStop(1, '#f8d78e');\n    ctx.fillStyle = skyGrad;\n    ctx.fillRect(0, 0, width, horizonY);\n\n    ctx.fillStyle = '#fff1b8';\n    ctx.beginPath();\n    ctx.arc(width * 0.78, horizonY * 0.45, Math.min(width, height) * 0.065, 0, Math.PI * 2);\n    ctx.fill();\n\n    ctx.fillStyle = '#d9a45b';\n    ctx.fillRect(0, horizonY - 8, width, 12);\n\n    const drawDistantPyramid = (cx, baseW, h, shadeLeft, shadeRight) => {\n      ctx.fillStyle = shadeLeft;\n      ctx.beginPath();\n      ctx.moveTo(cx, horizonY - h);\n      ctx.lineTo(cx - baseW * 0.5, horizonY);\n      ctx.lineTo(cx + baseW * 0.08, horizonY);\n      ctx.closePath();\n      ctx.fill();\n\n      ctx.fillStyle = shadeRight;\n      ctx.beginPath();\n      ctx.moveTo(cx, horizonY - h);\n      ctx.lineTo(cx + baseW * 0.08, horizonY);\n      ctx.lineTo(cx + baseW * 0.5, horizonY);\n      ctx.closePath();\n      ctx.fill();\n    };\n\n    drawDistantPyramid(width * 0.17, width * 0.14, height * 0.11, '#b67836', '#8d5721');\n    drawDistantPyramid(width * 0.28, width * 0.09, height * 0.075, '#c2843f', '#9c6228');\n    drawDistantPyramid(width * 0.87, width * 0.12, height * 0.095, '#b67836', '#8d5721');\n\n    [0.62, 0.65, 0.68].forEach(px => {\n      const x = width * px;\n      ctx.strokeStyle = '#5a3a18';\n      ctx.lineWidth = 2;\n      ctx.beginPath();\n      ctx.moveTo(x, horizonY);\n      ctx.quadraticCurveTo(x + 3, horizonY - 12, x + 1, horizonY - 20);\n      ctx.stroke();\n\n      ctx.fillStyle = '#3b5e2b';\n      for (let a = -2; a <= 2; a++) {\n        ctx.beginPath();\n        ctx.ellipse(x + 1 + a * 4, horizonY - 20 + Math.abs(a), 5, 2, a * 0.3, 0, Math.PI * 2);\n        ctx.fill();\n      }\n    });\n\n    ctx.fillStyle = '#9e6830';\n    ctx.fillRect(0, horizonY, width, height - horizonY);\n\n    const topLeft = project(VISIBLE_DISTANCE, -1.0);\n    const topRight = project(VISIBLE_DISTANCE, 1.0);\n    const botLeft = project(-25, -1.0);\n    const botRight = project(-25, 1.0);\n\n    const slopeGrad = ctx.createLinearGradient(0, horizonY, 0, height);\n    slopeGrad.addColorStop(0, '#e5b874');\n    slopeGrad.addColorStop(1, '#c98e47');\n    ctx.fillStyle = slopeGrad;\n\n    ctx.beginPath();\n    ctx.moveTo(topLeft.x, topLeft.y);\n    ctx.lineTo(topRight.x, topRight.y);\n    ctx.lineTo(botRight.x, botRight.y);\n    ctx.lineTo(botLeft.x, botLeft.y);\n    ctx.closePath();\n    ctx.fill();\n\n    const stepSpacing = 22;\n    const firstStep = Math.floor(run.dist \/ stepSpacing) * stepSpacing;\n    for (let sd = firstStep; sd < run.dist + VISIBLE_DISTANCE; sd += stepSpacing) {\n      const rel = sd - run.dist;\n      if (rel < -20) continue;\n      const leftP = project(rel, -1.0);\n      const rightP = project(rel, 1.0);\n\n      ctx.strokeStyle = `rgba(110, 65, 22, ${0.22 + 0.25 * leftP.scale})`;\n      ctx.lineWidth = Math.max(1, 2.5 * leftP.scale);\n      ctx.beginPath();\n      ctx.moveTo(leftP.x, leftP.y);\n      ctx.lineTo(rightP.x, rightP.y);\n      ctx.stroke();\n\n      const rowSeed = Math.round(sd \/ stepSpacing);\n      const cols = 5;\n      for (let c = 1; c < cols; c++) {\n        const nx = -1 + (2 \/ cols) * c + ((rowSeed % 2) * 0.12 - 0.06);\n        const p1 = project(rel, nx);\n        const p2 = project(Math.min(VISIBLE_DISTANCE, rel + stepSpacing), nx);\n        ctx.beginPath();\n        ctx.moveTo(p1.x, p1.y);\n        ctx.lineTo(p2.x, p2.y);\n        ctx.stroke();\n      }\n    }\n\n    ctx.strokeStyle = '#6b3e14';\n    ctx.lineWidth = 6;\n    ctx.beginPath();\n    ctx.moveTo(topLeft.x, topLeft.y);\n    ctx.lineTo(botLeft.x, botLeft.y);\n    ctx.moveTo(topRight.x, topRight.y);\n    ctx.lineTo(botRight.x, botRight.y);\n    ctx.stroke();\n\n    const finishRel = run.trackLength - run.dist;\n    if (!(!(finishRel < VISIBLE_DISTANCE) || !(finishRel > -25))) {\n      const fl = project(finishRel, -1.0);\n      const fr = project(finishRel, 1.0);\n      const gateH = 75 * fl.scale;\n\n      ctx.fillStyle = '#f5c236';\n      ctx.fillRect(fl.x, fl.y - 4 * fl.scale, fr.x - fl.x, 8 * fl.scale);\n\n      ctx.fillStyle = '#1b4965';\n      ctx.fillRect(fl.x - 10 * fl.scale, fl.y - gateH, 18 * fl.scale, gateH);\n      ctx.fillRect(fr.x - 8 * fl.scale, fr.y - gateH, 18 * fl.scale, gateH);\n\n      ctx.fillStyle = '#b5372b';\n      ctx.fillRect(fl.x, fl.y - gateH, fr.x - fl.x, 22 * fl.scale);\n      ctx.fillStyle = '#f5c236';\n      ctx.font = `bold ${Math.max(10, Math.round(16 * fl.scale))}px sans-serif`;\n      ctx.textAlign = 'center';\n      ctx.fillText('CILJ', (fl.x + fr.x) \/ 2, fl.y - gateH + 16 * fl.scale);\n    }\n  }\n\n  function drawRock(rock) {\n    const rel = rock.dist - run.dist;\n    if (rel < -18 || rel > VISIBLE_DISTANCE) return;\n    const p = project(rel, rock.x);\n    const r = 26 * rock.size * p.scale;\n\n    ctx.save();\n    ctx.translate(p.x, p.y);\n\n    ctx.fillStyle = 'rgba(40, 22, 6, 0.35)';\n    ctx.beginPath();\n    ctx.ellipse(0, r * 0.35, r * 1.1, r * 0.42, 0, 0, Math.PI * 2);\n    ctx.fill();\n\n    ctx.fillStyle = rock.hit ? '#7a5230' : '#6c5846';\n    ctx.strokeStyle = '#33251a';\n    ctx.lineWidth = Math.max(1, 2.2 * p.scale);\n    ctx.beginPath();\n    ctx.moveTo(-r * 0.95, r * 0.2);\n    ctx.lineTo(-r * 0.72, -r * 0.65);\n    ctx.lineTo(-r * 0.1, -r * 0.95);\n    ctx.lineTo(r * 0.65, -r * 0.72);\n    ctx.lineTo(r * 0.98, r * 0.15);\n    ctx.lineTo(r * 0.45, r * 0.42);\n    ctx.lineTo(-r * 0.45, r * 0.44);\n    ctx.closePath();\n    ctx.fill();\n    ctx.stroke();\n\n    ctx.fillStyle = '#8b745f';\n    ctx.beginPath();\n    ctx.moveTo(-r * 0.55, -r * 0.5);\n    ctx.lineTo(-r * 0.08, -r * 0.8);\n    ctx.lineTo(r * 0.4, -r * 0.55);\n    ctx.lineTo(0, -r * 0.1);\n    ctx.closePath();\n    ctx.fill();\n\n    ctx.restore();\n  }\n\n  function drawBag(bag) {\n    if (bag.collected) return;\n    const rel = bag.dist - run.dist;\n    if (rel < -18 || rel > VISIBLE_DISTANCE) return;\n\n    const p = project(rel, bag.x);\n    const s = 26 * p.scale;\n    const bob = Math.sin(performance.now() * 0.006 + bag.id) * 4 * p.scale;\n\n    ctx.save();\n    ctx.translate(p.x, p.y + bob);\n\n    const aura = ctx.createRadialGradient(0, -s * 0.2, s * 0.1, 0, -s * 0.2, s * 1.45);\n    aura.addColorStop(0, 'rgba(245, 194, 54, 0.7)');\n    aura.addColorStop(1, 'rgba(245, 194, 54, 0)');\n    ctx.fillStyle = aura;\n    ctx.beginPath();\n    ctx.arc(0, -s * 0.2, s * 1.45, 0, Math.PI * 2);\n    ctx.fill();\n\n    ctx.fillStyle = 'rgba(40, 22, 6, 0.3)';\n    ctx.beginPath();\n    ctx.ellipse(0, s * 0.45 - bob, s * 0.8, s * 0.28, 0, 0, Math.PI * 2);\n    ctx.fill();\n\n    ctx.fillStyle = '#d49a3a';\n    ctx.strokeStyle = '#5c3810';\n    ctx.lineWidth = Math.max(1.2, 2.2 * p.scale);\n    ctx.beginPath();\n    ctx.moveTo(-s * 0.3, -s * 0.65);\n    ctx.quadraticCurveTo(-s * 0.9, -s * 0.05, -s * 0.65, s * 0.35);\n    ctx.quadraticCurveTo(0, s * 0.55, s * 0.65, s * 0.35);\n    ctx.quadraticCurveTo(s * 0.9, -s * 0.05, s * 0.3, -s * 0.65);\n    ctx.closePath();\n    ctx.fill();\n    ctx.stroke();\n\n    ctx.fillStyle = '#e8b95b';\n    ctx.beginPath();\n    ctx.moveTo(-s * 0.35, -s * 0.65);\n    ctx.lineTo(-s * 0.48, -s * 0.98);\n    ctx.lineTo(0, -s * 0.85);\n    ctx.lineTo(s * 0.48, -s * 0.98);\n    ctx.lineTo(s * 0.35, -s * 0.65);\n    ctx.closePath();\n    ctx.fill();\n    ctx.stroke();\n\n    ctx.strokeStyle = '#b5372b';\n    ctx.lineWidth = Math.max(1.5, 3 * p.scale);\n    ctx.beginPath();\n    ctx.moveTo(-s * 0.33, -s * 0.62);\n    ctx.lineTo(s * 0.33, -s * 0.62);\n    ctx.stroke();\n\n    ctx.fillStyle = '#fff5c0';\n    ctx.font = `bold ${Math.max(9, Math.round(s * 0.72))}px sans-serif`;\n    ctx.textAlign = 'center';\n    ctx.textBaseline = 'middle';\n    ctx.fillText('?', 0, -s * 0.08);\n\n    ctx.restore();\n  }\n\n  function drawWoodenWheel(cx, cy, rx, ry, angle) {\n    ctx.save();\n    ctx.translate(cx, cy);\n\n    ctx.fillStyle = '#5a3212';\n    ctx.strokeStyle = '#2b1506';\n    ctx.lineWidth = 2.5;\n    ctx.beginPath();\n    ctx.ellipse(0, 0, rx, ry, 0, 0, Math.PI * 2);\n    ctx.fill();\n    ctx.stroke();\n\n    ctx.fillStyle = '#8b5122';\n    ctx.beginPath();\n    ctx.ellipse(0, 0, rx * 0.72, ry * 0.72, 0, 0, Math.PI * 2);\n    ctx.fill();\n\n    ctx.strokeStyle = '#3b1e08';\n    ctx.lineWidth = 2;\n    for (let i = 0; i < 4; i++) {\n      const a = angle + (i * Math.PI) \/ 4;\n      ctx.beginPath();\n      ctx.moveTo(-Math.cos(a) * rx * 0.7, -Math.sin(a) * ry * 0.7);\n      ctx.lineTo(Math.cos(a) * rx * 0.7, Math.sin(a) * ry * 0.7);\n      ctx.stroke();\n    }\n\n    ctx.fillStyle = '#d99b38';\n    ctx.beginPath();\n    ctx.ellipse(0, 0, rx * 0.25, ry * 0.25, 0, 0, Math.PI * 2);\n    ctx.fill();\n\n    ctx.restore();\n  }\n\n  function drawCart() {\n    if (!(!(run.graceTimer > 0) || !(Math.floor(run.graceTimer * 16) % 2 === 0))) {\n      ctx.globalAlpha = 0.55;\n    }\n\n    const p = project(0, run.cartX);\n    const bounce = Math.sin(run.wheelAngle * 1.4) * 2.2;\n    const s = Math.min(width, height) * 0.00175;\n\n    ctx.save();\n    ctx.translate(p.x, p.y + bounce);\n    ctx.scale(s, s);\n    ctx.rotate(run.cartTilt);\n\n    ctx.fillStyle = 'rgba(30, 15, 4, 0.38)';\n    ctx.beginPath();\n    ctx.ellipse(0, 26, 72, 18, 0, 0, Math.PI * 2);\n    ctx.fill();\n\n    drawWoodenWheel(-44, -22, 11, 18, run.wheelAngle);\n    drawWoodenWheel(44, -22, 11, 18, run.wheelAngle);\n\n    ctx.fillStyle = '#6c3c16';\n    ctx.strokeStyle = '#331906';\n    ctx.lineWidth = 2.5;\n    ctx.fillRect(-44, -28, 88, 10);\n\n    ctx.fillStyle = '#9c5a25';\n    ctx.beginPath();\n    ctx.moveTo(-38, -28);\n    ctx.lineTo(38, -28);\n    ctx.lineTo(48, 12);\n    ctx.lineTo(-48, 12);\n    ctx.closePath();\n    ctx.fill();\n    ctx.stroke();\n\n    ctx.strokeStyle = '#5c310f';\n    ctx.lineWidth = 2;\n    ctx.beginPath();\n    ctx.moveTo(-22, -28);\n    ctx.lineTo(-27, 12);\n    ctx.moveTo(0, -28);\n    ctx.lineTo(0, 12);\n    ctx.moveTo(22, -28);\n    ctx.lineTo(27, 12);\n    ctx.stroke();\n\n    ctx.fillStyle = '#f4ebd0';\n    ctx.strokeStyle = '#472c12';\n    ctx.lineWidth = 2;\n    ctx.beginPath();\n    ctx.moveTo(-16, -2);\n    ctx.lineTo(-12, -32);\n    ctx.lineTo(12, -32);\n    ctx.lineTo(16, -2);\n    ctx.closePath();\n    ctx.fill();\n    ctx.stroke();\n\n    ctx.fillStyle = '#f5c236';\n    ctx.beginPath();\n    ctx.ellipse(0, -29, 13, 6, 0, 0, Math.PI);\n    ctx.fill();\n\n    ctx.fillStyle = '#1b4965';\n    ctx.beginPath();\n    ctx.moveTo(0, -56);\n    ctx.lineTo(-20, -28);\n    ctx.lineTo(-8, -24);\n    ctx.lineTo(8, -24);\n    ctx.lineTo(20, -28);\n    ctx.closePath();\n    ctx.fill();\n    ctx.stroke();\n\n    ctx.strokeStyle = '#f5c236';\n    ctx.lineWidth = 2;\n    ctx.beginPath();\n    ctx.moveTo(-14, -36);\n    ctx.lineTo(14, -36);\n    ctx.moveTo(-10, -44);\n    ctx.lineTo(10, -44);\n    ctx.stroke();\n\n    ctx.fillStyle = '#7e4418';\n    ctx.strokeStyle = '#2e1606';\n    ctx.lineWidth = 2.5;\n    ctx.fillRect(-48, -6, 96, 22);\n    ctx.strokeRect(-48, -6, 96, 22);\n\n    ctx.fillStyle = '#f5c236';\n    ctx.fillRect(-34, 1, 68, 6);\n\n    drawWoodenWheel(-56, 12, 13, 24, run.wheelAngle);\n    drawWoodenWheel(56, 12, 13, 24, run.wheelAngle);\n\n    ctx.restore();\n    ctx.globalAlpha = 1;\n  }\n\n  function drawParticles() {\n    run.particles.forEach(part => {\n      const p = project(0, part.x);\n      const alpha = (part.life \/ part.maxLife) * 0.55;\n      ctx.fillStyle = `rgba(235, 198, 135, ${alpha})`;\n      ctx.beginPath();\n      ctx.arc(p.x, p.y + 18 + part.yOffset * 0.4, part.size, 0, Math.PI * 2);\n      ctx.fill();\n    });\n  }\n\n  function render() {\n    ctx.clearRect(0, 0, width, height);\n\n    ctx.save();\n    if (run.shakeTimer > 0) {\n      const mag = run.shakeTimer * 18;\n      ctx.translate((Math.random() - 0.5) * mag, (Math.random() - 0.5) * mag);\n    }\n\n    drawBackground();\n\n    const items = [];\n    run.rocks.forEach(r => {\n      const rel = r.dist - run.dist;\n      if (!(!(rel >= -18) || !(rel <= VISIBLE_DISTANCE))) items.push({ type: 'rock', rel, obj: r });\n    });\n    run.bags.forEach(b => {\n      const rel = b.dist - run.dist;\n      if (!(!(!b.collected) || !(rel >= -18) || !(rel <= VISIBLE_DISTANCE))) items.push({ type: 'bag', rel, obj: b });\n    });\n    items.sort((a, b) => b.rel - a.rel);\n\n    items.forEach(item => {\n      if (item.type === 'rock') drawRock(item.obj);\n      else drawBag(item.obj);\n    });\n\n    drawParticles();\n    drawCart();\n\n    ctx.restore();\n  }\n\n  let lastTime = performance.now();\n  resetRun();\n\n  function loop(now) {\n    const rawDt = (now - lastTime) \/ 1000;\n    lastTime = now;\n    const dt = Math.min(rawDt, 0.05);\n\n    update(dt);\n    render();\n    requestAnimationFrame(loop);\n  }\n\n  requestAnimationFrame(loop);\n})();\n<\/script>\n\n\n\n<div style=\"height:50px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u010ceka te prava pustolovina u starom Egiptu! Usko\u010di u drvena kola na \u010detiri kota\u010da i spusti se niz veliku egipatsku piramidu! Na stazi te \u010dekaju kamene prepreke, ali i skriveno blago.<\/p>\n","protected":false},"author":1,"featured_media":7222,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[1363,1638,224],"class_list":["post-7218","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-5r","tag-kronologija","tag-online-igre","tag-os5"],"_links":{"self":[{"href":"https:\/\/povijest.net\/hpp\/wp-json\/wp\/v2\/posts\/7218","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/povijest.net\/hpp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/povijest.net\/hpp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/povijest.net\/hpp\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/povijest.net\/hpp\/wp-json\/wp\/v2\/comments?post=7218"}],"version-history":[{"count":5,"href":"https:\/\/povijest.net\/hpp\/wp-json\/wp\/v2\/posts\/7218\/revisions"}],"predecessor-version":[{"id":7225,"href":"https:\/\/povijest.net\/hpp\/wp-json\/wp\/v2\/posts\/7218\/revisions\/7225"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/povijest.net\/hpp\/wp-json\/wp\/v2\/media\/7222"}],"wp:attachment":[{"href":"https:\/\/povijest.net\/hpp\/wp-json\/wp\/v2\/media?parent=7218"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/povijest.net\/hpp\/wp-json\/wp\/v2\/categories?post=7218"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/povijest.net\/hpp\/wp-json\/wp\/v2\/tags?post=7218"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}