
<!DOCTYPE html>
<html lang="en">

<head>
  <script>
    (function (c, l, a, r, i, t, y) {
      c[a] = c[a] || function () { (c[a].q = c[a].q || []).push(arguments) };
      t = l.createElement(r); t.async = 1; t.src = "https://www.clarity.ms/tag/" + i;
      y = l.getElementsByTagName(r)[0]; y.parentNode.insertBefore(t, y);
    })(window, document, "clarity", "script", "u5w207ij6i");
  </script>

  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta name="description" content="Explore AI-driven sports predictions on www.5minutes-caledonie.com. Get forecast insights based on data analysis and statistics for upcoming sports events. Start predicting today!">

  <meta property="og:title" content="AI Sports Predictions – Insights and Forecasts at www.5minutes-caledonie.com">
  <meta property="og:description" content="Explore AI-driven sports predictions on www.5minutes-caledonie.com. Get forecast insights based on data analysis and statistics for upcoming sports events. Start predicting today!">
  <meta property="og:image" content="/assets/puhgRimg/puhgRlogo.svg">
  <meta property="og:url" content="//rss.php?c=canada">
  <meta property="og:type" content="article">
  <meta property="og:site_name" content="www.5minutes-caledonie.com">

  <meta name="twitter:card" content="summary_large_image">
  <meta name="twitter:site" content="www.5minutes-caledonie.com">
  <meta name="twitter:title" content="AI Sports Predictions – Insights and Forecasts at www.5minutes-caledonie.com">
  <meta name="twitter:description" content="Explore AI-driven sports predictions on www.5minutes-caledonie.com. Get forecast insights based on data analysis and statistics for upcoming sports events. Start predicting today!">
  <meta name="twitter:image" content="/assets/puhgRimg/puhgRlogo.svg">

  <link rel="canonical" href="/rss.php?c=canada">
  <title>
    AI Sports Predictions – Insights and Forecasts at aigamepredict.com  </title>
	<style>
		*{padding:0;margin:0;border:none}*,::after,::before{box-sizing:border-box}a,a:link,a:visited{text-decoration:none}header,main,section{display:block}h1,h2{font-size:inherit;font-weight:inherit}ul{list-style:none}img{vertical-align:top}img,svg{max-width:100%;height:auto}button{font-family:inherit;font-size:inherit;color:inherit;background-color:transparent}button{display:inline-block;box-shadow:none;background-color:transparent;background:0 0}button::-moz-focus-inner{padding:0;border:0}@font-face{font-family:ubuntu;font-display:swap;src:url("/assets/puhgRfonts/puhgRubuntu-medium.woff2") format("woff2"),url("/assets/puhgRfonts/puhgRubuntu-medium.woff") format("woff");font-weight:500;font-style:normal}:root{--container-width:1440px;--container-padding:100px;--container-padding-tablet:16px;--background:#000B1E;--font-color:rgba(255, 255, 255, .82);--font-size:clamp(0.875rem, 0.8317307692rem + 0.1923076923vw, 1rem);--font-family:poppins,OpenSans,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;font-synthesis:none;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;--laptop-size:1199px;--tablet-size:959px;--mobile-size:599px;--btn-font-size:1rem;--btn-font-weight:600;--btn-padding:.938em 1.2em;--btn-bg:#7FFF2F;--btn-bg-hover:rgba(127, 255, 47, 0);--btn-color:var(--background);--btn-color-hover:#fff;--btn-radius:2rem;--btn-shadow:inset -100px 0px 80px -10px #89FFD4;--btn-shadow-hover:inset -100px 0px 80px -10px rgba(137, 255, 212, 0),0 4px 12px rgba(46, 204, 113, 0.4);--accent-gradient:linear-gradient(97deg, #7FFF2F 1.93%, #89FFD4 99.04%)}h1,h2{font-weight:400;overflow-wrap:break-word;word-break:break-word;line-height:1.2;font-weight:500;color:#fff;font-family:ubuntu}h1{font-size:clamp(2.625rem,2.0625rem + 2.5vw,4.25rem)}h2{font-size:clamp(1.5rem,.9807692308rem + 2.3076923077vw,3rem)}html{scroll-behavior:smooth;background:var(--background)}body{background:var(--background);color:var(--font-color);font-family:var(--font-family);font-size:var(--font-size);font-weight:400}body,html{min-height:100vh;display:flex;flex-direction:column}a,button{color:inherit}img{display:block;object-fit:cover}.visually-hidden{position:absolute;width:1px;height:1px;margin:-1px;border:0;padding:0;white-space:nowrap;clip-path:inset(100%);clip:rect(0 0 0 0);overflow:hidden}.main section{padding-block:50px}.btn{touch-action:manipulation;display:flex;align-items:center;justify-content:center;gap:6px;font-size:var(--btn-font-size);font-weight:var(--btn-font-weight);padding:var(--btn-padding);color:var(--btn-color);background-color:var(--btn-bg);border-radius:var(--btn-radius);text-decoration:none;box-shadow:var(--btn-shadow);line-height:1;white-space:nowrap;text-transform:capitalize;width:max-content;border:1.5px solid #7fff35;min-width:200px;position:relative;overflow:hidden;height:48px}.btn .icon-wrapper{width:32px;height:32px;display:grid;place-items:center;border-radius:50%;background:linear-gradient(90deg,rgba(109,255,69,.2),rgba(97,255,158,.2));flex-shrink:0;position:absolute;top:50%;right:8px;transform:translateY(-50%)}.btn .icon-wrapper svg{width:20px;aspect-ratio:1}.btn .icon-wrapper--light{background:var(--accent-gradient);color:var(--background)}.btn .icon-wrapper--light svg{width:16px}.center{text-align:center}#toTopBtn{position:fixed;bottom:130px;right:var(--container-padding);background:var(--accent-gradient);color:var(--background);width:48px;aspect-ratio:1;border-radius:50%;opacity:0;visibility:hidden;z-index:100;border:1.5px solid #7fff35;display:grid;place-items:center}#toTopBtn svg{width:16px;aspect-ratio:1}.loader{width:90px;aspect-ratio:1;--_c:no-repeat radial-gradient(farthest-side, #6DFF45 92%, #0000);background:var(--_c) top,var(--_c) left,var(--_c) right,var(--_c) bottom;background-size:24px 24px;animation:1s infinite l7;margin:auto;grid-column:1/-1}@keyframes l7{to{transform:rotate(.5turn)}}.container{display:flex;flex-direction:column;gap:40px;margin:0 auto;padding:0 var(--container-padding);max-width:var(--container-width);width:100%}@media (max-width:1220px){#toTopBtn{right:var(--container-padding-tablet)}.container{padding:0 var(--container-padding-tablet);gap:20px}}.modal{display:flex;position:fixed;top:0;left:0;width:100%;height:100%;backdrop-filter:blur(3px);background:rgba(0,0,0,.8);justify-content:center;align-items:center;z-index:999}.modal-content{background:var(--background);max-width:1240px;animation:.45s cubic-bezier(.01,.8,.03,1) fadeIn;padding:28px;max-height:90vh}@media (max-width:820px){.main section{padding-block:25px}.btn.btn--mobile-mini{width:max-content;text-indent:-220px;font-size:0;max-width:48px;height:48px;padding-right:0}.btn.btn--mobile-mini .icon-wrapper{width:30px;height:30px}.modal-content{padding:16px}}#modalInner{overflow-y:auto;max-height:90vh}#modalInner::-webkit-scrollbar{width:6px}#modalInner::-webkit-scrollbar-track{background:rgba(255,255,255,.05);border-radius:4px}#modalInner::-webkit-scrollbar-thumb{background:rgba(255,255,255,.25);border-radius:4px}#modalInner{scrollbar-width:thin;scrollbar-color:rgba(255,255,255,0.25) transparent}.close{position:absolute;top:0;right:1rem;font-size:1.5rem;z-index:1}.modal{display:none}@keyframes fadeIn{from{opacity:0;transform:scale(0)}to{opacity:1;transform:scale(1)}}.swiper{position:relative;margin-left:auto;margin-right:auto;overflow:hidden;list-style:none;padding:0;display:flex;width:100%;padding-bottom:50px}.swiper-wrapper{display:flex;align-items:center}.swiper-button-next,.swiper-button-prev{color:#fff;position:absolute;z-index:2;top:calc(50% - 30px);transform:translateY(-50%);width:16px;height:31px;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='20' viewBox='0 0 11 20' fill='none'%3E%3Cpath d='M0.38296 20.0762C0.111788 19.805 0.111788 19.3654 0.38296 19.0942L9.19758 10.2796L0.38296 1.46497C0.111788 1.19379 0.111788 0.754138 0.38296 0.482966C0.654131 0.211794 1.09379 0.211794 1.36496 0.482966L10.4341 9.55214C10.8359 9.9539 10.8359 10.6053 10.4341 11.007L1.36496 20.0762C1.09379 20.3474 0.654131 20.3474 0.38296 20.0762Z' fill='%23fff'/%3E%3C/svg%3E");background-repeat:no-repeat;background-size:contain}@media (max-width:1440px){.swiper-button-next,.swiper-button-prev{display:none}}.swiper-button-prev{left:0;transform:rotate(180deg)}.swiper-button-next{right:0}.swiper-pagination{position:absolute;bottom:0;left:50%;transform:translateX(-50%);text-align:center;z-index:10;flex-wrap:nowrap}select option{color:var(--background)}::placeholder{color:#fff}.banner{background-image:linear-gradient(0deg,transparent 0,#000b1e 100%),url("/assets/puhgRimg/banner.png");background-position:center bottom;background-size:cover;background-repeat:no-repeat;position:relative}.banner h1 span{background:var(--accent-gradient);background-clip:text;-webkit-background-clip:text;-webkit-text-fill-color:transparent}.banner .container{position:relative}.banner .swiper{min-height:508px}.header{padding-block:20px}@media (max-width:820px){.banner .swiper{min-height:404px}.header{padding-block:10px}}.header__row{display:flex;justify-content:space-between;align-items:center}.logo{display:flex;align-items:center;gap:8px;font-size:clamp(.875rem,.7884615385rem + .3846153846vw,1.125rem);text-transform:uppercase;width:max-content}.logo img{width:181px;aspect-ratio:6.96/1;object-fit:contain}.wrapper{border-radius:20px;background:linear-gradient(117deg,rgba(0,29,80,.6) 19.78%,rgba(0,29,80,.36) 81.64%);backdrop-filter:blur(5px);display:flex;flex-direction:column;gap:14px;position:relative;z-index:1;width:100%;will-change:transform}.wrapper::before{content:"";position:absolute;inset:0;z-index:-1;border-radius:inherit;padding:2px;background:linear-gradient(180deg,rgba(100,152,255,.3) 0,rgba(0,36,108,.3) 100%) content-box,linear-gradient(#fff 0 0)}.match-list .match-list-items{display:grid;grid-template-columns:repeat(3,1fr);gap:40px;min-height:992px}@media (max-width:1220px){.match-list .match-list-items{grid-template-columns:repeat(2,1fr);gap:20px}}@media (max-width:820px){.match-list .match-list-items{grid-template-columns:1fr}}
	</style>

  <noscript>
    <link rel="stylesheet" href="/assets/puhgRcss/puhgRmain.css">
  </noscript>

  <link rel="preload" href="/assets/puhgRcss/puhgRmain.css" as="style" onload="this.rel='stylesheet'">
  <link rel="icon" type="image/x-icon" href="/assets/puhgRimg/puhgRfavicons/puhgRfavicon.svg">

  <link rel="preload" as="image" href="/assets/puhgRimg/puhgRbanner.avif" type="image/avif" fetchpriority="high">
	<link rel="preload" href="/assets/puhgRfonts/puhgRpoppins-regular.woff2" as="font" type="font/woff2" crossorigin="anonymous">
	<link rel="preload" href="/assets/puhgRfonts/puhgRpoppins-semibold.woff2" as="font" type="font/woff2" crossorigin="anonymous">
	<link rel="preload" href="/assets/puhgRfonts/puhgRubuntu-medium.woff2" as="font" type="font/woff2" crossorigin="anonymous">

	  <script type="application/ld+json">
          {
            "@context": "https://schema.org",
            "@graph": [
              {
                "@type": "WebPage",
                "@id": "//#webpage",
                "url": "//",
                "name": "AI Sports Predictions – Insights and Forecasts at aigamepredict.com",
                "description": "Explore AI-driven sports predictions on aigamepredict.com. Get forecast insights based on data analysis and statistics for upcoming sports events. Start predicting today!",
                "inLanguage": "en",
                "isPartOf": {
                  "@id": "//#website"
                },
                "breadcrumb": {
                  "@id": "//#breadcrumb"
                },
                "primaryImageOfPage": {
                  "@type": "ImageObject",
                  "url": "/assets/puhgRimg/puhgRlogo.svg",
                  "width": 512,
                  "height": 512
                },
                "datePublished": "14.11.2025",
                "dateModified": "14.11.2025"
              },
              {
                "@type": "Organization",
                "@id": "//#organization",
                "name": "aigamepredict.com",
                "url": "//",
                "logo": {
                  "@type": "ImageObject",
                  "url": "/assets/puhgRimg/puhgRlogo.svg",
                  "width": 512,
                  "height": 512
                },
              }
            ]
          }
    </script>
  </head>
<body>
	<header class="header">
    <div class="container">
        <div class="header__row">
            <a href="/" class="logo" title="www.5minutes-caledonie.com">
                <img width="181" height="26" src="/assets/puhgRimg/puhgRlogo.svg" alt="logo" title="www.5minutes-caledonie.com">
            </a>
            <a target="_blank" href="https://t.me/" class="btn btn--mobile-mini visually-hidden" title="
                Join telegram chanel
                
                    
                        
                            
                                
                                
                            
                        
                        
                    
                
            ">
                Join telegram chanel
                <span class="icon-wrapper">
                    <svg xmlns="http://www.w3.org/2000/svg" width="20" height="16" viewBox="0 0 20 16"
                        aria-hidden="true">
                        <defs>
                            <linearGradient id="g" x1="0" y1="2.66" x2="21.39" y2="6.16" gradientUnits="userSpaceOnUse">
                                <stop offset="0%" stop-color="#88FF3D" />
                                <stop offset="1" stop-color="#D2FF85" />
                            </linearGradient>
                        </defs>
                        <path fill="url(#g)"
                            d="M.35 7.68l4.6 1.57 1.79 5.29c.08.36.55.43.87.22l2.57-1.93c.24-.21.63-.21.95 0l4.59 3.07c.31.21.78.07.86-.3L19.99.6c.08-.36-.32-.72-.7-.56L.35 6.75c-.47.14-.47.78 0 .93zM6.51 8.47l9.04-5.08c.16-.07.31.15.15.23L8.3 9.97c-.23.21-.47.5-.47.86l-.23 1.72c0 .21-.39.28-.47 0L6.2 9.4c-.23-.36-.07-.79.31-.94z" />
                    </svg>
                </span>
            </a>
        </div>
    </div>
</header>	<main class="main">
		<section class="banner">
    <div class="container init-zapros">
        <h1 class="center" title="AI Sports Predictions"><span>AI</span> Sports Predictions</h1>

        <div class="swiper match-slider">
            <div class="loader"></div>
            <ul class="swiper-wrapper match-slider-card">

            </ul>

            <div class="swiper-pagination"></div>
            <button class="swiper-button-prev"></button>
            <button class="swiper-button-next"></button>
        </div>

        <a href="#how" class="btn" style="margin-inline: auto;" title="
            how it works
            
                
                    
                
            
        ">
            how it works
            <span class="icon-wrapper icon-wrapper--light">
                <svg xmlns="http://www.w3.org/2000/svg" width="15" height="14" viewBox="0 0 15 14" fill="none">
                    <path
                        d="M8.36401 1C8.36401 0.447715 7.9163 -4.82823e-08 7.36401 0C6.81173 4.82823e-08 6.36401 0.447715 6.36401 1L7.36401 1L8.36401 1ZM6.65691 13.7071C7.04743 14.0976 7.6806 14.0976 8.07112 13.7071L14.4351 7.34315C14.8256 6.95262 14.8256 6.31946 14.4351 5.92893C14.0446 5.53841 13.4114 5.53841 13.0209 5.92893L7.36401 11.5858L1.70716 5.92893C1.31664 5.53841 0.683471 5.53841 0.292946 5.92893C-0.0975781 6.31946 -0.097578 6.95262 0.292946 7.34315L6.65691 13.7071ZM7.36401 1L6.36401 1L6.36401 13L7.36401 13L8.36401 13L8.36401 1L7.36401 1Z"
                        fill="currentColor" />
                </svg>
            </span>
        </a>
    </div>
</section>
		<section class="match-list">
    <div class="container">
        <h2 class="visually-hidden" title="Match list">Match list</h2>
        <ul class="match-list-items">
            <li class="loader"></li>
        </ul>
        <button class="btn" id="show-more">
            Show more sports predictions
            <span class="icon-wrapper icon-wrapper--light">
                <svg xmlns="http://www.w3.org/2000/svg" width="15" height="14" viewBox="0 0 15 14" fill="none">
                    <path
                        d="M8.36401 1C8.36401 0.447715 7.9163 -4.82823e-08 7.36401 0C6.81173 4.82823e-08 6.36401 0.447715 6.36401 1L7.36401 1L8.36401 1ZM6.65691 13.7071C7.04743 14.0976 7.6806 14.0976 8.07112 13.7071L14.4351 7.34315C14.8256 6.95262 14.8256 6.31946 14.4351 5.92893C14.0446 5.53841 13.4114 5.53841 13.0209 5.92893L7.36401 11.5858L1.70716 5.92893C1.31664 5.53841 0.683471 5.53841 0.292946 5.92893C-0.0975781 6.31946 -0.097578 6.95262 0.292946 7.34315L6.65691 13.7071ZM7.36401 1L6.36401 1L6.36401 13L7.36401 13L8.36401 13L8.36401 1L7.36401 1Z"
                        fill="currentColor" />
                </svg>
            </span>
        </button>
    </div>
</section>
		<section class="match-list">
    <div class="container">
        <h2 class="center" title="Past predictions">Past predictions</h2>
        <ul class="match-list-items-predictions">
            <li class="loader"></li>
        </ul>
        <button class="btn" id="show-more-predictions">
            Show more past predictions
            <span class="icon-wrapper icon-wrapper--light">
                <svg xmlns="http://www.w3.org/2000/svg" width="15" height="14" viewBox="0 0 15 14" fill="none">
                    <path
                        d="M8.36401 1C8.36401 0.447715 7.9163 -4.82823e-08 7.36401 0C6.81173 4.82823e-08 6.36401 0.447715 6.36401 1L7.36401 1L8.36401 1ZM6.65691 13.7071C7.04743 14.0976 7.6806 14.0976 8.07112 13.7071L14.4351 7.34315C14.8256 6.95262 14.8256 6.31946 14.4351 5.92893C14.0446 5.53841 13.4114 5.53841 13.0209 5.92893L7.36401 11.5858L1.70716 5.92893C1.31664 5.53841 0.683471 5.53841 0.292946 5.92893C-0.0975781 6.31946 -0.097578 6.95262 0.292946 7.34315L6.65691 13.7071ZM7.36401 1L6.36401 1L6.36401 13L7.36401 13L8.36401 13L8.36401 1L7.36401 1Z"
                        fill="currentColor" />
                </svg>
            </span>
        </button>
    </div>
</section>
		
		<div class="service">
    <div class="service-wrapper">
        <div class="container">
            <p>Try our service now while it's still free! Don't miss out on the opportunity to experience all the
                features
                at no cost.</p>
        </div>
    </div>
    <div class="container">
        <a href="#contacts" class="btn" title="
            Order Prediction
            
                
                    
                
            
        ">
            Order Prediction
            <span class="icon-wrapper icon-wrapper--light">
                <svg xmlns="http://www.w3.org/2000/svg" width="15" height="14" viewBox="0 0 15 14" fill="none">
                    <path
                        d="M8.36401 1C8.36401 0.447715 7.9163 -4.82823e-08 7.36401 0C6.81173 4.82823e-08 6.36401 0.447715 6.36401 1L7.36401 1L8.36401 1ZM6.65691 13.7071C7.04743 14.0976 7.6806 14.0976 8.07112 13.7071L14.4351 7.34315C14.8256 6.95262 14.8256 6.31946 14.4351 5.92893C14.0446 5.53841 13.4114 5.53841 13.0209 5.92893L7.36401 11.5858L1.70716 5.92893C1.31664 5.53841 0.683471 5.53841 0.292946 5.92893C-0.0975781 6.31946 -0.097578 6.95262 0.292946 7.34315L6.65691 13.7071ZM7.36401 1L6.36401 1L6.36401 13L7.36401 13L8.36401 13L8.36401 1L7.36401 1Z"
                        fill="currentColor" />
                </svg>
            </span>
        </a>
    </div>
</div>
		<section class="how wrap" id="how">
    <div class="container">
        <div class="inner center">
            <h2 title="How it Works">How it Works</h2>
            <p>
                Our service uses artificial intelligence and machine learning to generate accurate and objective
                predictions
                for sports
                events. Here's how it works:
            </p>
            <button class="btn open-hidden">
                how it works
                <span class="icon-wrapper icon-wrapper--light">
                    <svg xmlns="http://www.w3.org/2000/svg" width="15" height="14" viewBox="0 0 15 14" fill="none">
                        <path
                            d="M8.36401 1C8.36401 0.447715 7.9163 -4.82823e-08 7.36401 0C6.81173 4.82823e-08 6.36401 0.447715 6.36401 1L7.36401 1L8.36401 1ZM6.65691 13.7071C7.04743 14.0976 7.6806 14.0976 8.07112 13.7071L14.4351 7.34315C14.8256 6.95262 14.8256 6.31946 14.4351 5.92893C14.0446 5.53841 13.4114 5.53841 13.0209 5.92893L7.36401 11.5858L1.70716 5.92893C1.31664 5.53841 0.683471 5.53841 0.292946 5.92893C-0.0975781 6.31946 -0.097578 6.95262 0.292946 7.34315L6.65691 13.7071ZM7.36401 1L6.36401 1L6.36401 13L7.36401 13L8.36401 13L8.36401 1L7.36401 1Z"
                            fill="currentColor" />
                    </svg>
                </span>
            </button>
        </div>

        <div class="hidden">
            <ul class="how-list">
                <li class="wrapper">
                    <h3 title="Data Collection">Data Collection</h3>
                    <div>
                        <p>
                            Every day, we automatically gather and update thousands of data points on teams, players,
                            and
                            matches, including:
                        </p>
                        <ul class="ul-list">
                            <li>Match statistics (goals, corners, shots, possession, etc.)</li>
                            <li>Physical condition and form of players</li>
                            <li>Head-to-head history</li>
                            <li>Weather conditions</li>
                            <li>Injury and suspension information</li>
                            <li>Bookmaker odds and line movements</li>
                        </ul>
                    </div>
                </li>
                <li class="wrapper">
                    <h3 title="AI Processing">AI Processing</h3>
                    <div>
                        <p>
                            The collected data is analyzed using a trained neural network, built on historical results
                            and
                            behavioral models of
                            teams. The system determines:
                        </p>
                        <ul class="ul-list">
                            <li>The likelihood of outcomes (win, draw, total goals, etc.)</li>
                            <li>The "value" of predictions</li>
                            <li>Identifies undervalued markets</li>
                        </ul>
                    </div>
                </li>
                <li class="wrapper">
                    <h3 title="Predictions and Insights">Predictions and Insights</h3>
                    <div>
                        <p>
                            After the analysis, we provide:
                        </p>
                        <ul class="ul-list">
                            <li>Predicted outcomes with probabilities (e.g., Team A Win — 61%)</li>
                            <li>Suggested markets: totals, handicaps, outcomes, BTTS, and more</li>
                            <li>Confidence level for each prediction (from 1 to 5 stars)</li>
                        </ul>
                    </div>
                </li>
                <li class="wrapper">
                    <h3 title="Continuous Learning">Continuous Learning</h3>
                    <p>
                        Our model continuously updates itself. After each round, game, or tournament, it compares
                        results
                        with the predictions
                        and learns from any mistakes, improving accuracy with each iteration.
                    </p>
                </li>
            </ul>

            <div class="inner center">
                <h3 title="No Emotions. Just Data">No Emotions. Just Data</h3>
                <p>
                    AI is not influenced by emotions and doesn’t "favor" any team. It works solely with data to provide
                    an
                    objective
                    prediction.
                </p>
            </div>
        </div>
    </div>
</section>
		<section class="favorite">
    <div class="container">
        <div class="inner center">
            <h2 title="Vote for Your Favorite Team!">Vote for Your Favorite Team!</h2>
            <p>
                Take part in the poll and see how many people support your team!
            </p>
        </div>

        <div class="swiper custom-match-slider">
            <div class="loader"></div>
            <ul class="swiper-wrapper voting-slider-card">
            </ul>
            <div class="swiper-pagination"></div>
        </div>

    </div>
</section>
		<section class="contacts" id="contacts">
    <div class="container">
        <h2 class="center" title="Order a prediction right now">Order a prediction right now</h2>
        <form class="form" method="POST" action="#" name="Contacts form" autocomplete="off"
              aria-label="Contacts form">
            <input id="name" name="name" type="text" placeholder="Name">
            <input id="contact" name="contact" type="text" placeholder="E-mail/Telegram" required>
            <select id="sport" name="sport" aria-label="Sport type">
                <option value="other">Other Sport Type</option>
                <option value="football">Football</option>
                <option value="basketball">Basketball</option>
                <option value="tennis">Tennis</option>
            </select>
            <textarea id="message" name="text" rows="3" placeholder="Message" required></textarea>
            <p class="warning">Success! Email sent, thank you for your feedback.</p>
            <button type="submit" class="btn">Order Prediction</button>
        </form>
    </div>
</section>
	</main>
	<footer class="footer">
    <div class="container">
        <div class="inner">
            <a href="/" class="logo" title="www.5minutes-caledonie.com">
                <img width="181" height="26" src="/assets/puhgRimg/puhgRlogo.svg" alt="logo" title="www.5minutes-caledonie.com">
            </a>

            <p>© 2025 AIMatchPredict.com &minus; All rights reserved.</p>
        </div>

        <div class="disclaimer">
            <p>
                <strong>Disclaimer:</strong> This website is intended solely for educational and
                informational purposes and is used for
                market research.
                It does not provide financial advice, recommendations, or any guarantees of results.
                Investing involves risk, and any
                decisions should be made independently or with the support of a licensed financial advisor.
            </p>
            <nav>
                <ul class="link" aria-label="Navigation">
                    <li><a href="/tickets" title="Tickets">Tickets</a></li>
                    <li><a href="/policy" title="Privacy Policy">Privacy Policy</a></li>
                    <li><a href="/terms" title="Terms of Use">Terms of Use</a></li>
                    <li><a href="/cookie" title="Cookie Policy">Cookie Policy</a></li>
                </ul>
            </nav>
        </div>
    </div>
</footer>

<button id="toTopBtn">
    <svg xmlns="http://www.w3.org/2000/svg" width="15" height="14" viewBox="0 0 15 14" fill="none"
        aria-label="Back to top">
        <path
            d="M8.36401 13C8.36401 13.5523 7.9163 14 7.36401 14C6.81173 14 6.36401 13.5523 6.36401 13L7.36401 13L8.36401 13ZM6.65691 0.292893C7.04743 -0.0976315 7.6806 -0.0976314 8.07112 0.292893L14.4351 6.65685C14.8256 7.04738 14.8256 7.68054 14.4351 8.07107C14.0446 8.46159 13.4114 8.46159 13.0209 8.07107L7.36401 2.41421L1.70716 8.07107C1.31664 8.46159 0.683471 8.46159 0.292946 8.07107C-0.0975781 7.68054 -0.097578 7.04738 0.292946 6.65685L6.65691 0.292893ZM7.36401 13L6.36401 13L6.36401 1L7.36401 1L8.36401 1L8.36401 13L7.36401 13Z"
            fill="currentColor" />
    </svg>
</button>

<div class="modal" id="globalModal">
    <div class="modal-content wrapper">
        <button class="close modal-close" id="closeModal" aria-label="Close button">&times;</button>
        <div id="modalInner"></div>
    </div>
</div>

<!-- scripts -->
<script src="/assets/puhgRjs/puhgRindex.bundle.js" defer></script>
<script src="/assets/puhgRjs/puhgRswiper.js" defer></script>
<script type="module">
    let todaysAllDate = new Date();

    let todayDatesIsDay = todaysAllDate.getDate();
    let todayDatesIsMonth = todaysAllDate.getMonth();
    let todayDatesIsYear = todaysAllDate.getFullYear();

    let todayDay = todayDatesIsDay < 10 ? "0" + todayDatesIsDay : todayDatesIsDay;
    let todayMonth = (todayDatesIsMonth + 1) < 10 ? "0" + (todayDatesIsMonth + 1) : (todayDatesIsMonth + 1);
    let todayYear = todayDatesIsYear;

    let todayDate = todayYear + "-" + todayMonth + "-" + todayDay;

    let initBunder = document.querySelector(".init-zapros");

    let listHero = document.querySelector(".match-slider-card");
    let listItems = document.querySelector(".match-list-items");

    let listVoting = document.querySelector(".custom-match-slider");
    let listItems2 = document.querySelector(".voting-slider-card");

    let showMoreBtn = document.getElementById('show-more');

    let cardInfoArray = []

    // Голосование
    function initVotingLogic() {
        let voteCards = document.querySelectorAll('.vote-card-wrapper');

        voteCards.forEach(card => {
            let voteButton = card.querySelector('.vote-btn');
            let inputs = card.querySelectorAll('.vote-input');
            let thanksMsg = card.querySelector('.thanks-msg');
            let voteText = card.querySelector('.vote-text');

            if (!voteButton) return;

            // Активация кнопки при выборе
            inputs.forEach(input => {
                input.addEventListener('change', () => {
                    voteButton.disabled = false;
                });
            });

            // Клик по кнопке Vote
            voteButton.addEventListener('click', (e) => {
                e.preventDefault();
                voteButton.setAttribute('disabled', 'true'); // Скрыть кнопку

                // Отключить инпуты
                inputs.forEach(inp => inp.disabled = true);

                // Показать проценты и прогресс-бары
                card.querySelectorAll('.percentage').forEach(el => el.style.display = 'block');
                card.querySelectorAll('.result').forEach(el => el.style.display = 'block');

                // Сообщения
                if (voteText) voteText.style.display = 'none';
                if (thanksMsg) thanksMsg.style.display = 'block';
            });
        });
    }


    // if (initBunder) {

    //     async function loadBundesliga(page = 1) {

    //         try {
    //             let res = await fetch(`https://aigamepredict.com/api/bets?date_from=${todayDate}&service=todayfootball&c=Canada`);

    //             if (!res.ok) throw new Error(`Error loading Bundesliga: ${res.statusText}`);
    //             let data = await res.json();
    //             console.log('Data loaded:', data);

    //             cardInfoArray = data.results;

    //             if (cardInfoArray.length === 0) throw new Error("No data available");

    //             const allCardsHTML = [];

    //             cardInfoArray.slice(0, 21).forEach((matchData) => {
    //                 let eventDate = new Date(matchData.event_date);
    //                 let day = eventDate.getDate() < 10 ? eventDate.getDate() : eventDate.getDate();
    //                 let month = (eventDate.getMonth() + 1) < 10 ? (eventDate.getMonth() + 1) : (eventDate.getMonth() + 1);
    //                 let year = eventDate.getFullYear();
    //                 let formattedDate = `${day}. ${month}. ${year}`;

    //                 let formattedTime = "--:--";

    //                 // sada

    //                 if (matchData.event_time) {
    //                     let timeParts = matchData.event_time.split(":");
    //                     formattedTime = `${timeParts[0]}:${timeParts[1]}`;
    //                 }

    //                 // baseCard 1
    //                 let q1x2, ou25, bts;

    //                 if (matchData.predictions.today_football) {
    //                     let preds = matchData.predictions.today_football;

    //                     if (preds.probability_1x2) {
    //                         q1x2 = `
    //                     <div class="prediction-row">
    //                         <span class="prediction-label">1x2</span>
    //                         <div class="prediction-values">
    //                             <strong>${matchData.team_home.name}</strong>
    //                             <span class="prediction-percent">${preds.probability_1x2}%</span>
    //                         </div>
    //                     </div>`;
    //                     }

    //                     if (preds.probability_ou25) {
    //                         ou25 = `
    //                     <div class="prediction-row">
    //                         <span class="prediction-label">Total Over 2.5</span>
    //                         <div class="prediction-value">
    //                             <span class="prediction-percent">${preds.probability_ou25}%</span>
    //                         </div>
    //                     </div>`;
    //                     }

    //                     if (preds.prediction_bts) {
    //                         bts = `
    //                     <div class="prediction-row">
    //                         <span class="prediction-label">Both Teams to Score</span>
    //                         <div class="prediction-value">
    //                             ${preds.prediction_bts}
    //                             <span class="prediction-percent">${preds.probability_bts}%</span>
    //                         </div>
    //                     </div>`;
    //                     }
    //                 }

    //                 let baseCard = `
    //             <li class="swiper-slide">
    //                 <div class="match-card" data-id-away="${matchData.team_away.id}" data-id-home="${matchData.team_home.id}" data-description="${matchData.description}" data-league="${matchData.league}">
    //                     <div class="match-teams">
    //                         <div class="team">
    //                             <img class="team-logo" width="120" height="120" src="${matchData.team_away.logo}" alt="${matchData.team_away.name}" title="no img" loading="lazy" // onerror="this.onerror=null; this.src='/assets/puhgRimg/puhgRno-img.svg'">
    //                             <strong class="team-name">${matchData.team_away.name}</strong>
    //                         </div>
    //                         <div class="match-date-time">
    //                             <span class="match-date">${formattedDate}</span>
    //                             <span class="match-time">${formattedTime}</span>
    //                             <strong class="vs">VS</strong>
    //                         </div>
    //                         <div class="team">
    //                             <img class="team-logo" width="120" height="120" src="${matchData.team_home.logo}" alt="${matchData.team_home.name}" title="no img" loading="lazy" // onerror="this.onerror=null; this.src='/assets/puhgRimg/puhgRno-img.svg'">
    //                             <strong class="team-name">${matchData.team_home.name}</strong>
    //                         </div>
    //                     </div>

    //                     <div class="predictions">
    //                         ${q1x2 ?? '<div class="prediction-row"><span class="prediction-label">1x2</span><div class="prediction-values"><strong></strong><span class="prediction-percent">No data</span></div></div>'}
    //                         ${ou25 ?? '<div class="prediction-row"><span class="prediction-label">Total Over 2.5</span><div class="prediction-value"><span class="prediction-percent">No data</span></div></div>'}
    //                         ${bts ?? '<div class="prediction-row"><span class="prediction-label">Both Teams to Score</span><div class="prediction-value"><span class="prediction-percent">No data</span></div></div>'}
    //                     </div>

    //                     <div class="match-actions">
    //                         <a href="/best-sites" class="btn" style="width: 100%" title="Best Sites">Best Sites</a>
    //                         <div class="btn-group">
    //                             <a target="_blank" href="/" class="btn btn--mobile-mini" title="Watch Live" style="display: none;">
    //                                 Watch Live
    //                                 <span class="icon-wrapper">
    //                                     <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20"
    //                                         viewBox="0 0 20 20" fill="none">
    //                                         <path
    //                                             d="M12.3385 9.09752L9.79932 7.63169C9.47182 7.44169 9.08265 7.44252 8.75682 7.63169C8.43098 7.82002 8.23682 8.15669 8.23682 8.53336V11.4659C8.23682 11.8417 8.43098 12.18 8.75682 12.3675C8.92015 12.4625 9.09932 12.5092 9.27765 12.5092C9.45682 12.5092 9.63598 12.4625 9.79932 12.3675L12.3385 10.9025C12.6643 10.7134 12.8593 10.3759 12.8593 10C12.8593 9.62336 12.6643 9.28586 12.3385 9.09752Z"
    //                                             fill="url(#g1)" />
    //                                         <path
    //                                             d="M13.9733 6.02248C13.7292 5.77998 13.3325 5.78081 13.0892 6.02664C12.8467 6.27164 12.8483 6.66748 13.0933 6.90998C13.92 7.72914 14.375 8.82664 14.375 9.99998C14.375 11.1733 13.92 12.2708 13.0933 13.09C12.8483 13.3325 12.8467 13.7283 13.0892 13.9741C13.2117 14.0966 13.3725 14.1583 13.5333 14.1583C13.6925 14.1583 13.8517 14.0983 13.9733 13.9775C15.0383 12.9225 15.625 11.5091 15.625 9.99998C15.625 8.48998 15.0383 7.07831 13.9733 6.02248Z"
    //                                             fill="url(#g2)" />
    //                                         <path
    //                                             d="M6.91 6.02664C6.66667 5.78081 6.27083 5.77998 6.02583 6.02248C4.96083 7.07831 4.375 8.49081 4.375 9.99998C4.375 11.51 4.96083 12.9225 6.02583 13.9783C6.1475 14.0983 6.30667 14.1583 6.46583 14.1583C6.62667 14.1583 6.78833 14.0966 6.91 13.9741C7.15333 13.7283 7.15167 13.3325 6.90583 13.09C6.07917 12.2708 5.625 11.1733 5.625 9.99998C5.625 8.82664 6.07917 7.72914 6.90583 6.91081C7.15167 6.66748 7.15333 6.27164 6.91 6.02664Z"
    //                                             fill="url(#g3)" />
    //                                         <path
    //                                             d="M16.3334 3.66665C16.0892 3.42248 15.6934 3.42248 15.4492 3.66665C15.2051 3.91081 15.2051 4.30665 15.4492 4.55081C16.9059 6.00748 17.7084 7.94248 17.7084 9.99998C17.7084 12.0575 16.9059 13.9933 15.4492 15.45C15.2051 15.6941 15.2051 16.09 15.4492 16.3341C15.5717 16.4558 15.7317 16.5166 15.8917 16.5166C16.0517 16.5166 16.2117 16.4558 16.3334 16.3341C18.0259 14.6408 18.9584 12.3908 18.9584 9.99998C18.9584 7.60831 18.0259 5.35915 16.3334 3.66665Z"
    //                                             fill="url(#g4)" />
    //                                         <path
    //                                             d="M2.29175 9.99998C2.29175 7.94248 3.09342 6.00665 4.55008 4.54998C4.79425 4.30581 4.79425 3.91081 4.55008 3.66665C4.30592 3.42248 3.91092 3.42248 3.66675 3.66665C1.97425 5.35915 1.04175 7.60831 1.04175 9.99998C1.04175 12.3908 1.97425 14.6408 3.66675 16.3341C3.78842 16.4558 3.94841 16.5166 4.10841 16.5166C4.26841 16.5166 4.42842 16.4558 4.55008 16.3341C4.79425 16.09 4.79425 15.6941 4.55008 15.45C3.09342 13.9933 2.29175 12.0575 2.29175 9.99998Z"
    //                                             fill="url(#g5)" />

    //                                         <defs>
    //                                             <linearGradient id="g1" x1="8.23682" y1="8.32612" x2="13.2399"
    //                                                 y2="8.9281" gradientUnits="userSpaceOnUse">
    //                                                 <stop offset="0%" stop-color="#88FF3D" />
    //                                                 <stop offset="1" stop-color="#D2FF85" />
    //                                             </linearGradient>
    //                                             <linearGradient id="g2" x1="12.9084" y1="7.22758" x2="15.8858"
    //                                                 y2="7.35465" gradientUnits="userSpaceOnUse">
    //                                                 <stop offset="0%" stop-color="#88FF3D" />
    //                                                 <stop offset="1" stop-color="#D2FF85" />
    //                                             </linearGradient>
    //                                             <linearGradient id="g3" x1="4.375" y1="7.22758" x2="7.35213"
    //                                                 y2="7.35463" gradientUnits="userSpaceOnUse">
    //                                                 <stop offset="0%" stop-color="#88FF3D" />
    //                                                 <stop offset="1" stop-color="#D2FF85" />
    //                                             </linearGradient>
    //                                             <linearGradient id="g4" x1="15.2661" y1="5.65571" x2="19.3147"
    //                                                 y2="5.80557" gradientUnits="userSpaceOnUse">
    //                                                 <stop offset="0%" stop-color="#88FF3D" />
    //                                                 <stop offset="1" stop-color="#D2FF85" />
    //                                             </linearGradient>
    //                                             <linearGradient id="g5" x1="1.04175" y1="5.65571" x2="5.08941"
    //                                                 y2="5.8055" gradientUnits="userSpaceOnUse">
    //                                                 <stop offset="0%" stop-color="#88FF3D" />
    //                                                 <stop offset="1" stop-color="#D2FF85" />
    //                                             </linearGradient>
    //                                         </defs>
    //                                     </svg>
    //                                 </span>
    //                             </a>
    //                             <button class="btn btn--mobile-mini btn--statistics open-modal is-open-modal" data-target="id-${matchData.id}">
    //                                 More Statistics
    //                                 <span class="icon-wrapper">
    //                                     <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20"
    //                                         viewBox="0 0 20 20" fill="none">
    //                                         <path
    //                                             d="M17.5 18.9584H2.5C2.15833 18.9584 1.875 18.675 1.875 18.3334C1.875 17.9917 2.15833 17.7084 2.5 17.7084H17.5C17.8417 17.7084 18.125 17.9917 18.125 18.3334C18.125 18.675 17.8417 18.9584 17.5 18.9584Z"
    //                                             fill="url(#paint0_linear_448_489)" />
    //                                         <path
    //                                             d="M4.66665 16.4584H3.33333C2.53333 16.4584 1.875 15.8001 1.875 15.0001V7.81673C1.875 7.01673 2.53333 6.3584 3.33333 6.3584H4.66665C5.46665 6.3584 6.12498 7.01673 6.12498 7.81673V15.0001C6.12498 15.8001 5.46665 16.4584 4.66665 16.4584ZM3.33333 7.60006C3.21667 7.60006 3.125 7.69172 3.125 7.80839V15.0001C3.125 15.1167 3.21667 15.2084 3.33333 15.2084H4.66665C4.78331 15.2084 4.87498 15.1167 4.87498 15.0001V7.81673C4.87498 7.70007 4.78331 7.6084 4.66665 7.6084H3.33333V7.60006Z"
    //                                             fill="url(#paint1_linear_448_489)" />
    //                                         <path
    //                                             d="M10.6668 16.4583H9.3335C8.5335 16.4583 7.87517 15.7999 7.87517 14.9999V5.15828C7.87517 4.35828 8.5335 3.69995 9.3335 3.69995H10.6668C11.4668 3.69995 12.1251 4.35828 12.1251 5.15828V14.9999C12.1251 15.7999 11.4668 16.4583 10.6668 16.4583ZM9.3335 4.94995C9.21683 4.94995 9.12517 5.04162 9.12517 5.15828V14.9999C9.12517 15.1166 9.21683 15.2083 9.3335 15.2083H10.6668C10.7835 15.2083 10.8751 15.1166 10.8751 14.9999V5.15828C10.8751 5.04162 10.7835 4.94995 10.6668 4.94995H9.3335Z"
    //                                             fill="url(#paint2_linear_448_489)" />
    //                                         <path
    //                                             d="M16.6666 16.4583H15.3333C14.5333 16.4583 13.8749 15.8 13.8749 15V2.49996C13.8749 1.69996 14.5333 1.04163 15.3333 1.04163H16.6666C17.4666 1.04163 18.1249 1.69996 18.1249 2.49996V15C18.1249 15.8 17.4666 16.4583 16.6666 16.4583ZM15.3333 2.29163C15.2166 2.29163 15.1249 2.38329 15.1249 2.49996V15C15.1249 15.1166 15.2166 15.2083 15.3333 15.2083H16.6666C16.7832 15.2083 16.8749 15.1166 16.8749 15V2.49996C16.8749 2.38329 16.7832 2.29163 16.6666 2.29163H15.3333Z"
    //                                             fill="url(#paint3_linear_448_489)" />
    //                                         <defs>
    //                                             <linearGradient id="paint0_linear_448_489" x1="1.875" y1="17.9167"
    //                                                 x2="6.46736" y2="25.7173" gradientUnits="userSpaceOnUse">
    //                                                 <stop offset="0%" stop-color="#88FF3D" />
    //                                                 <stop offset="1" stop-color="#D2FF85" />
    //                                             </linearGradient>
    //                                             <linearGradient id="paint1_linear_448_489" x1="1.875" y1="8.04173"
    //                                                 x2="6.5274" y2="8.29753" gradientUnits="userSpaceOnUse">
    //                                                 <stop offset="0%" stop-color="#88FF3D" />
    //                                                 <stop offset="1" stop-color="#D2FF85" />
    //                                             </linearGradient>
    //                                             <linearGradient id="paint2_linear_448_489" x1="7.87517" y1="5.82634"
    //                                                 x2="12.5328" y2="6.02906" gradientUnits="userSpaceOnUse">
    //                                                 <stop offset="0%" stop-color="#88FF3D" />
    //                                                 <stop offset="1" stop-color="#D2FF85" />
    //                                             </linearGradient>
    //                                             <linearGradient id="paint3_linear_448_489" x1="13.8749" y1="3.61107"
    //                                                 x2="18.5353" y2="3.77894" gradientUnits="userSpaceOnUse">
    //                                                 <stop offset="0%" stop-color="#88FF3D" />
    //                                                 <stop offset="1" stop-color="#D2FF85" />
    //                                             </linearGradient>
    //                                         </defs>
    //                                     </svg>
    //                                 </span>
    //                             </button>
    //                         </div>
    //                     </div>
    //                 </div>
    //             </li>`;

    //                 if (listHero) listHero.insertAdjacentHTML('beforeend', baseCard);
    //                 allCardsHTML.push(baseCard);

    //                 // baseCard 2 - Voting
    //                 let votingCard = `
    //             <li class="swiper-slide">
    //                 <div class="match-card vote-card-wrapper">
    //                     <div class="match-teams vote-card">
    //                         <div class="team">
    //                             <img class="team-logo" width="120" height="120" src="${matchData.team_away.logo}" alt="${matchData.team_away.name}" title="no img" loading="lazy" // onerror="this.onerror=null; this.src='/assets/puhgRimg/puhgRno-img.svg'">
    //                             <strong class="team-name"">${matchData.team_away.name}</strong>
    //                         </div>
    //                         <div class="match-date-time">
    //                             <span class="match-date">${formattedDate}</span>
    //                             <span class="match-time">${formattedTime}</span>
    //                             <strong class="vs">VS</strong>
    //                         </div>
    //                         <div class="team">
    //                             <img class="team-logo" width="120" height="120" src="${matchData.team_home.logo}" alt="${matchData.team_home.name}" title="no img" loading="lazy" // onerror="this.onerror=null; this.src='/assets/puhgRimg/puhgRno-img.svg'">
    //                             <strong class="team-name"">${matchData.team_home.name}</strong>
    //                         </div>
    //                     </div>

    //                     <ul class="vote-options">
    //                         <li class="vote-option">
    //                             <input type="radio" name="vote-${matchData.id}-1" class="vote-input" id="vote-${matchData.id}-1">
    //                             <label for="vote-${matchData.id}-1" class="custom-radio-label"></label>
    //                             <div class="option-content">
    //                                 <div class="option-line">
    //                                     <span class="option-text">${matchData.team_away.name}</span>
    //                                     <span class="percentage" style="display:none;">${Math.max(matchData.predictions.ai_goalie?.win_confidence, 0)}%</span>
    //                                 </div>
    //                                 <div class="result" style="display: none;">
    //                                     <div class="progress-bar"><span class="progress" style="width: ${Math.max(matchData.predictions.ai_goalie?.win_confidence, 0)}%;"></span></div>
    //                                 </div>
    //                             </div>
    //                         </li>

    //                         <li class="vote-option">
    //                             <input type="radio" name="vote-${matchData.id}-2" class="vote-input" id="vote-${matchData.id}-2">
    //                             <label for="vote-${matchData.id}-2" class="custom-radio-label"></label>
    //                             <div class="option-content">
    //                                 <div class="option-line">
    //                                     <span class="option-text">${matchData.team_home.name}</span>
    //                                     <span class="percentage" style="display:none;">${Math.max(matchData.predictions.ai_goalie?.win_confidence - 10, 0)}%</span>
    //                                 </div>
    //                                 <div class="result" style="display: none;">
    //                                     <div class="progress-bar"><span class="progress" style="width: ${Math.max(matchData.predictions.ai_goalie?.win_confidence - 10, 0)}%;"></span></div>
    //                                 </div>
    //                             </div>
    //                         </li>

    //                         <li class="vote-option">
    //                             <input type="radio" name="vote-${matchData.id}-3" class="vote-input" id="vote-${matchData.id}-3">
    //                             <label for="vote-${matchData.id}-3" class="custom-radio-label"></label>
    //                             <div class="option-content">
    //                                 <div class="option-line">
    //                                     <span class="option-text">Draw</span>
    //                                     <span class="percentage" style="display:none;">${Math.max(matchData.predictions.ai_goalie?.win_confidence - 20, 0)}%</span>
    //                                 </div>
    //                                 <div class="result" style="display: none;">
    //                                     <div class="progress-bar"><span class="progress" style="width: ${Math.max(matchData.predictions.ai_goalie?.win_confidence - 20, 0)}%;"></span></div>
    //                                 </div>
    //                             </div>
    //                         </li>
    //                     </ul>

    //                     <button class="vote-btn btn" disabled>Vote</button>

    //                     <p class="thanks-msg center" style="display: none; color: #88FF3D;"><small>Thanks for your vote!</small></p>
    //                     <p class="vote-text center"><small>Vote to see the result</small></p>
    //                 </div>
    //             </li>`;

    //                 if (listItems2) listItems2.insertAdjacentHTML('beforeend', votingCard);
    //             });

    //             // 1. Init Hero Slider
    //             let sliderHero = document.querySelector(".match-slider");
    //             if (sliderHero) {
    //                 new Swiper(sliderHero, {
    //                     observer: true,
    //                     observeParents: true,
    //                     slidesPerView: 1,
    //                     spaceBetween: 20,
    //                     speed: 1000,
    //                     autoplay: {
    //                         delay: 3500,
    //                         pauseOnMouseEnter: true,
    //                         disableOnInteraction: false
    //                     },
    //                     navigation: {
    //                         nextEl: '.swiper-button-next',
    //                         prevEl: '.swiper-button-prev'
    //                     },
    //                     pagination: {
    //                         el: '.swiper-pagination',
    //                         type: 'bullets',
    //                         clickable: true,
    //                         dynamicBullets: true
    //                     },
    //                     breakpoints: {
    //                         820: {
    //                             slidesPerView: 2
    //                         },
    //                         1220: {
    //                             slidesPerView: 3,
    //                             spaceBetween: 40
    //                         }
    //                     },
    //                     a11y: {
    //                         enabled: false
    //                     }
    //                 });
    //             }

    //             // 2. Logic for listItems
    //             let itemsShown = 0;
    //             let itemsPerPage = 6;
    //             let renderNextItems = () => {
    //                 let nextBatch = allCardsHTML.slice(itemsShown, itemsShown + itemsPerPage);
    //                 nextBatch.forEach(cardHtml => {
    //                     if (listItems) {
    //                         listItems.insertAdjacentHTML('beforeend', cardHtml)
    //                     }
    //                 });
    //                 itemsShown += itemsPerPage;
    //                 if (itemsShown >= allCardsHTML.length && showMoreBtn) {
    //                     showMoreBtn.style.display = 'none';
    //                 }
    //             };
    //             if (listItems) renderNextItems();
    //             if (showMoreBtn) showMoreBtn.addEventListener('click', renderNextItems);


    //             // 3. Init Voting Slider
    //             if (listVoting) {
    //                 new Swiper(listVoting, {
    //                     observer: true,
    //                     observeParents: true,
    //                     slidesPerView: 1,
    //                     spaceBetween: 20,
    //                     speed: 1000,
    //                     autoplay: {
    //                         delay: 3500,
    //                         pauseOnMouseEnter: true,
    //                         disableOnInteraction: false
    //                     },
    //                     pagination: {
    //                         el: '.swiper-pagination',
    //                         clickable: true,
    //                         dynamicBullets: true
    //                     },
    //                     breakpoints: {
    //                         820: {
    //                             slidesPerView: 2
    //                         },
    //                         1220: {
    //                             slidesPerView: 3,
    //                             spaceBetween: 40
    //                         }
    //                     },
    //                     a11y: {
    //                         enabled: false
    //                     }
    //                 });
    //             }

    //             initVotingLogic();

    //         } catch (e) {
    //             console.error('Error loading Bundesliga:', e);
    //             // alert('Error loading forecast!'); 
    //         } finally {
    //             let allLoaders = document.querySelectorAll('.loader');
    //             allLoaders.forEach(loader => {
    //                 loader.style.display = 'none';
    //             });
    //         }
    //     }

    //     await loadBundesliga();

    // }

    if (initBunder) {

        async function loadBundesliga(page = 1) {

            const listPastPredictions = document.querySelector('.match-list-items-predictions');
            const showMorePastBtn = document.querySelector('#show-more-predictions');

            try {
                let res = await fetch(`https://aigamepredict.com/api/bets?date_from=${todayDate}&service=todayfootball&c=Canada`);

                if (!res.ok) throw new Error(`Error loading Bundesliga: ${res.statusText}`);
                let data = await res.json();
                console.log('Data loaded:', data);

                cardInfoArray = data.results;

                if (cardInfoArray.length === 0) throw new Error("No data available");

                const allCardsHTML = [];

                const generateCardHTML = (matchData) => {
                    let eventDate = new Date(matchData.event_date);
                    let day = eventDate.getDate() < 10 ? eventDate.getDate() : eventDate.getDate();
                    let month = (eventDate.getMonth() + 1) < 10 ? (eventDate.getMonth() + 1) : (eventDate.getMonth() + 1);
                    let year = eventDate.getFullYear();
                    let formattedDate = `${day}. ${month}. ${year}`;

                    let formattedTime = "--:--";

                    if (matchData.event_time) {
                        let timeParts = matchData.event_time.split(":");
                        formattedTime = `${timeParts[0]}:${timeParts[1]}`;
                    }

                    // Predictions Logic
                    let q1x2, ou25, bts;

                    if (matchData.predictions.today_football) {
                        let preds = matchData.predictions.today_football;

                        if (preds.probability_1x2) {
                            q1x2 = `
                        <div class="prediction-row">
                            <span class="prediction-label">1x2</span>
                            <div class="prediction-values">
                                <strong>${matchData.team_home.name}</strong>
                                <span class="prediction-percent">${preds.probability_1x2}%</span>
                            </div>
                        </div>`;
                        }

                        if (preds.probability_ou25) {
                            ou25 = `
                        <div class="prediction-row">
                            <span class="prediction-label">Total Over 2.5</span>
                            <div class="prediction-value">
                                <span class="prediction-percent">${preds.probability_ou25}%</span>
                            </div>
                        </div>`;
                        }

                        if (preds.prediction_bts) {
                            bts = `
                        <div class="prediction-row">
                            <span class="prediction-label">Both Teams to Score</span>
                            <div class="prediction-value">
                                ${preds.prediction_bts}
                                <span class="prediction-percent">${preds.probability_bts}%</span>
                            </div>
                        </div>`;
                        }
                    }

                    return `
                <li class="swiper-slide">
                    <div class="match-card" data-id-away="${matchData.team_away.id}" data-id-home="${matchData.team_home.id}" data-description="${matchData.description}" data-league="${matchData.league}">
                        <div class="match-teams">
                            <div class="team">
                                <img class="team-logo" width="120" height="120" src="${matchData.team_away.logo}" alt="${matchData.team_away.name}" title="no img" loading="lazy" onerror="this.onerror=null; this.src='/assets/puhgRimg/puhgRno-img.svg'">
                                <strong class="team-name">${matchData.team_away.name}</strong>
                            </div>
                            <div class="match-date-time">
                                <span class="match-date">${formattedDate}</span>
                                <span class="match-time">${formattedTime}</span>
                                <strong class="vs">VS</strong>
                            </div>
                            <div class="team">
                                <img class="team-logo" width="120" height="120" src="${matchData.team_home.logo}" alt="${matchData.team_home.name}" title="no img" loading="lazy" onerror="this.onerror=null; this.src='/assets/puhgRimg/puhgRno-img.svg'">
                                <strong class="team-name">${matchData.team_home.name}</strong>
                            </div>
                        </div>

                        <div class="predictions">
                            ${q1x2 ?? '<div class="prediction-row"><span class="prediction-label">1x2</span><div class="prediction-values"><strong></strong><span class="prediction-percent">No data</span></div></div>'}
                            ${ou25 ?? '<div class="prediction-row"><span class="prediction-label">Total Over 2.5</span><div class="prediction-value"><span class="prediction-percent">No data</span></div></div>'}
                            ${bts ?? '<div class="prediction-row"><span class="prediction-label">Both Teams to Score</span><div class="prediction-value"><span class="prediction-percent">No data</span></div></div>'}
                        </div>

                        <div class="match-actions">
                            <a href="/best-sites" class="btn" style="width: 100%" title="Best Sites">Best Sites</a>
                            <div class="btn-group">
                                <button class="btn btn--mobile-mini btn--statistics open-modal is-open-modal" data-target="id-${matchData.id}">
                                    More Statistics
                                    <span class="icon-wrapper">
                                       <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none"><path d="M17.5 18.9584H2.5C2.15833 18.9584 1.875 18.675 1.875 18.3334C1.875 17.9917 2.15833 17.7084 2.5 17.7084H17.5C17.8417 17.7084 18.125 17.9917 18.125 18.3334C18.125 18.675 17.8417 18.9584 17.5 18.9584Z" fill="#88FF3D"/><path d="M4.66665 16.4584H3.33333C2.53333 16.4584 1.875 15.8001 1.875 15.0001V7.81673C1.875 7.01673 2.53333 6.3584 3.33333 6.3584H4.66665C5.46665 6.3584 6.12498 7.01673 6.12498 7.81673V15.0001C6.12498 15.8001 5.46665 16.4584 4.66665 16.4584ZM3.33333 7.60006C3.21667 7.60006 3.125 7.69172 3.125 7.80839V15.0001C3.125 15.1167 3.21667 15.2084 3.33333 15.2084H4.66665C4.78331 15.2084 4.87498 15.1167 4.87498 15.0001V7.81673C4.87498 7.70007 4.78331 7.6084 4.66665 7.6084H3.33333V7.60006Z" fill="#88FF3D"/><path d="M10.6668 16.4583H9.3335C8.5335 16.4583 7.87517 15.7999 7.87517 14.9999V5.15828C7.87517 4.35828 8.5335 3.69995 9.3335 3.69995H10.6668C11.4668 3.69995 12.1251 4.35828 12.1251 5.15828V14.9999C12.1251 15.7999 11.4668 16.4583 10.6668 16.4583ZM9.3335 4.94995C9.21683 4.94995 9.12517 5.04162 9.12517 5.15828V14.9999C9.12517 15.1166 9.21683 15.2083 9.3335 15.2083H10.6668C10.7835 15.2083 10.8751 15.1166 10.8751 14.9999V5.15828C10.8751 5.04162 10.7835 4.94995 10.6668 4.94995H9.3335Z" fill="#88FF3D"/><path d="M16.6666 16.4583H15.3333C14.5333 16.4583 13.8749 15.8 13.8749 15V2.49996C13.8749 1.69996 14.5333 1.04163 15.3333 1.04163H16.6666C17.4666 1.04163 18.1249 1.69996 18.1249 2.49996V15C18.1249 15.8 17.4666 16.4583 16.6666 16.4583ZM15.3333 2.29163C15.2166 2.29163 15.1249 2.38329 15.1249 2.49996V15C15.1249 15.1166 15.2166 15.2083 15.3333 15.2083H16.6666C16.7832 15.2083 16.8749 15.1166 16.8749 15V2.49996C16.8749 2.38329 16.7832 2.29163 16.6666 2.29163H15.3333Z" fill="#88FF3D"/></svg>
                                    </span>
                                </button>
                            </div>
                        </div>
                    </div>
                </li>`;
                };


                cardInfoArray.slice(0, 21).forEach((matchData) => {
                    let baseCard = generateCardHTML(matchData);

                    if (listHero) listHero.insertAdjacentHTML('beforeend', baseCard);
                    allCardsHTML.push(baseCard);

                    let eventDate = new Date(matchData.event_date);
                    let day = eventDate.getDate() < 10 ? eventDate.getDate() : eventDate.getDate();
                    let month = (eventDate.getMonth() + 1) < 10 ? (eventDate.getMonth() + 1) : (eventDate.getMonth() + 1);
                    let year = eventDate.getFullYear();
                    let formattedDate = `${day}. ${month}. ${year}`;
                    let formattedTime = matchData.event_time ? `${matchData.event_time.split(":")[0]}:${matchData.event_time.split(":")[1]}` : "--:--";

                    let votingCard = `
                <li class="swiper-slide">
                    <div class="match-card vote-card-wrapper">
                        <div class="match-teams vote-card">
                            <div class="team">
                                <img class="team-logo" width="120" height="120" src="${matchData.team_away.logo}" alt="${matchData.team_away.name}" title="no img" loading="lazy" onerror="this.onerror=null; this.src='/assets/puhgRimg/puhgRno-img.svg'">
                                <strong class="team-name"">${matchData.team_away.name}</strong>
                            </div>
                            <div class="match-date-time">
                                <span class="match-date">${formattedDate}</span>
                                <span class="match-time">${formattedTime}</span>
                                <strong class="vs">VS</strong>
                            </div>
                            <div class="team">
                                <img class="team-logo" width="120" height="120" src="${matchData.team_home.logo}" alt="${matchData.team_home.name}" title="no img" loading="lazy" onerror="this.onerror=null; this.src='/assets/puhgRimg/puhgRno-img.svg'">
                                <strong class="team-name"">${matchData.team_home.name}</strong>
                            </div>
                        </div>

                        <ul class="vote-options">
                            <li class="vote-option">
                            <input type="radio" name="vote-${matchData.id}" class="vote-input" id="vote-${matchData.id}-1">
                                <label for="vote-${matchData.id}-1" class="custom-radio-label"></label>
                                <div class="option-content">
                                    <div class="option-line">
                                        <span class="option-text">${matchData.team_away.name}</span>
                                        <span class="percentage" style="display:none;">${Math.max(matchData.predictions.today_football?.probability_bts, 0)}%</span>
                                    </div>
                                    <div class="result" style="display: none;">
                                        <div class="progress-bar"><span class="progress" style="width: ${Math.max(matchData.predictions.today_football?.probability_bts, 0)}%;"></span></div>
                                    </div>
                                </div>
                            </li>

                            <li class="vote-option">
                                <input type="radio" name="vote-${matchData.id}" class="vote-input" id="vote-${matchData.id}-2">
                                <label for="vote-${matchData.id}-2" class="custom-radio-label"></label>
                                <div class="option-content">
                                    <div class="option-line">
                                        <span class="option-text">${matchData.team_home.name}</span>
                                        <span class="percentage" style="display:none;">${Math.max(matchData.predictions.today_football?.probability_bts - 10, 0)}%</span>
                                    </div>
                                    <div class="result" style="display: none;">
                                        <div class="progress-bar"><span class="progress" style="width: ${Math.max(matchData.predictions.today_football?.probability_bts - 10, 0)}%;"></span></div>
                                    </div>
                                </div>
                            </li>

                            <li class="vote-option">
                                <input type="radio" name="vote-${matchData.id}" class="vote-input" id="vote-${matchData.id}-3">
                                <label for="vote-${matchData.id}-3" class="custom-radio-label"></label>
                                <div class="option-content">
                                    <div class="option-line">
                                        <span class="option-text">Draw</span>
                                        <span class="percentage" style="display:none;">${Math.max(matchData.predictions.today_football?.probability_bts - 20, 0)}%</span>
                                    </div>
                                    <div class="result" style="display: none;">
                                        <div class="progress-bar"><span class="progress" style="width: ${Math.max(matchData.predictions.today_football?.probability_bts - 20, 0)}%;"></span></div>
                                    </div>
                                </div>
                            </li>
                        </ul>

                        <button class="vote-btn btn" disabled>Vote</button>

                        <p class="thanks-msg center" style="display: none; color: #88FF3D;"><small>Thanks for your vote!</small></p>
                        <p class="vote-text center"><small>Vote to see the result</small></p>
                    </div>
                </li>`;

                    if (listItems2) listItems2.insertAdjacentHTML('beforeend', votingCard);
                });

                // Init Hero Slider
                let sliderHero = document.querySelector(".match-slider");
                if (sliderHero) {
                    new Swiper(sliderHero, {
                        observer: true,
                        observeParents: true,
                        slidesPerView: 1,
                        spaceBetween: 20,
                        speed: 1000,
                        autoplay: { delay: 3500, pauseOnMouseEnter: true, disableOnInteraction: false },
                        navigation: { nextEl: '.swiper-button-next', prevEl: '.swiper-button-prev' },
                        pagination: { el: '.swiper-pagination', type: 'bullets', clickable: true, dynamicBullets: true },
                        breakpoints: { 820: { slidesPerView: 2 }, 1220: { slidesPerView: 3, spaceBetween: 40 } },
                        a11y: { enabled: false }
                    });
                }

                // Logic for listItems (First Load More)
                let itemsShown = 0;
                let itemsPerPage = 6;
                let renderNextItems = () => {
                    let nextBatch = allCardsHTML.slice(itemsShown, itemsShown + itemsPerPage);
                    nextBatch.forEach(cardHtml => {
                        if (listItems) listItems.insertAdjacentHTML('beforeend', cardHtml);
                    });
                    itemsShown += itemsPerPage;
                    if (itemsShown >= allCardsHTML.length && showMoreBtn) {
                        showMoreBtn.style.display = 'none';
                    }
                };
                if (listItems) renderNextItems();
                if (showMoreBtn) showMoreBtn.addEventListener('click', renderNextItems);

                // Init Voting Slider
                if (listVoting) {
                    new Swiper(listVoting, {
                        observer: true,
                        observeParents: true,
                        slidesPerView: 1,
                        spaceBetween: 20,
                        speed: 1000,
                        autoplay: { delay: 3500, pauseOnMouseEnter: true, disableOnInteraction: false },
                        pagination: { el: '.swiper-pagination', clickable: true, dynamicBullets: true },
                        breakpoints: { 820: { slidesPerView: 2 }, 1220: { slidesPerView: 3, spaceBetween: 40 } },
                        a11y: { enabled: false }
                    });
                }

                initVotingLogic();

                // Past Predictions Logic
                if (listPastPredictions) {
                    try {
                        let resPast = await fetch(`https://aigamepredict.com/api/past-predictions?bets?date_from=${todayDate}&service=todayfootball&c=Canada`);

                        if (resPast.ok) {
                            let dataPast = await resPast.json();
                            let pastResults = dataPast.results || [];
                            console.log('Past Predictions loaded:', pastResults);

                            const allPastCardsHTML = [];

                            // Template for past predictions cards
                            const predictionsCard = (matchData) => {
                                let eventDate = new Date(matchData.event_date);
                                let day = eventDate.getDate() < 10 ? eventDate.getDate() : eventDate.getDate();
                                let month = (eventDate.getMonth() + 1) < 10 ? (eventDate.getMonth() + 1) : (eventDate.getMonth() + 1);
                                let year = eventDate.getFullYear();
                                let formattedDate = `${day}. ${month}. ${year}`;
                                let formattedTime = matchData.event_time ? `${matchData.event_time.split(":")[0]}:${matchData.event_time.split(":")[1]}` : "--:--";

                                let q1x2, ou25, bts;
                                if (matchData.predictions && matchData.predictions.today_football) {
                                    let preds = matchData.predictions.today_football;
                                    if (preds.probability_1x2) {
                                        q1x2 = `
                                        <div class="prediction-row">
                                            <span class="prediction-label">1x2</span>
                                            <div class="prediction-values">
                                                <strong>${matchData.team_home.name}</strong>
                                                <span class="prediction-percent">${preds.probability_1x2}%</span>
                                            </div>
                                        </div>`;
                                    }
                                    if (preds.probability_ou25) {
                                        ou25 = `
                                        <div class="prediction-row">
                                            <span class="prediction-label">Total Over 2.5</span>
                                            <div class="prediction-value">
                                                <span class="prediction-percent">${preds.probability_ou25}%</span>
                                            </div>
                                        </div>`;
                                    }
                                    if (preds.prediction_bts || preds.probability_bts) {
                                        bts = `
                                        <div class="prediction-row">
                                            <span class="prediction-label">Both Teams to Score</span>
                                            <div class="prediction-value">
                                                ${preds.prediction_bts || ''}
                                                <span class="prediction-percent">${preds.probability_bts ?? ''}%</span>
                                            </div>
                                        </div>`;
                                    }
                                }

                                // fix score ("2:2" -> "2 - 2")
                                let score = '';
                                if (matchData.score || matchData.score === 0) {
                                    score = String(matchData.score).replace(/:/g, ' - ');
                                }

                                return `
                                <li class="swiper-slide">
                                    <div class="match-card prediction-card">
                                        <div class="match-teams">
                                            <div class="team">
                                                <img class="team-logo" width="80" height="80" src="${matchData.team_away.logo}" alt="${matchData.team_away.name}" title="no img" loading="lazy" onerror="this.onerror=null; this.src='/assets/puhgRimg/puhgRno-img.svg'">
                                                <strong class="team-name">${matchData.team_away.name}</strong>
                                            </div>
                                            <div class="match-date-time">
                                                <span class="match-date">${formattedDate}</span>
                                                <span class="match-time">${formattedTime}</span>
                                                <strong class="vs">VS</strong>
                                            </div>
                                            <div class="team">
                                                <img class="team-logo" width="80" height="80" src="${matchData.team_home.logo}" alt="${matchData.team_home.name}" title="no img" loading="lazy" onerror="this.onerror=null; this.src='/assets/puhgRimg/puhgRno-img.svg'">
                                                <strong class="team-name">${matchData.team_home.name}</strong>
                                            </div>
                                        </div>

                                        <div class="predictions">
                                            ${q1x2 ?? '<div class="prediction-row"><span class="prediction-label">1x2</span><div class="prediction-values"><strong></strong><span class="prediction-percent">No data</span></div></div>'}
                                            ${ou25 ?? '<div class="prediction-row"><span class="prediction-label">Total Over 2.5</span><div class="prediction-value"><span class="prediction-percent">No data</span></div></div>'}
                                            ${bts ?? '<div class="prediction-row"><span class="prediction-label">Both Teams to Score</span><div class="prediction-value"><span class="prediction-percent">No data</span></div></div>'}

                                            <div class="prediction-row">
                                                <span class="prediction-label">${matchData.sport}</span>
                                                <div class="prediction-values"><span class="prediction-percent">${matchData.league}</span></div>
                                            </div>
                                            <div class="prediction-row">
                                                <span class="prediction-label">Score</span>
                                                <div class="prediction-values"><span class="prediction-percent">${score}</span></div>
                                            </div>
                                        </div>

                                        <div class="match-actions">
                                            <a href="/best-sites" class="btn" style="width: 100%" title="Best Sites">Best Sites</a>
                                        </div>
                                    </div>
                                </li>`;
                            };

                            pastResults.forEach((matchData) => {
                                let pastCard = predictionsCard(matchData);
                                allPastCardsHTML.push(pastCard);
                            });

                            if (allPastCardsHTML.length === 0) {
                                listPastPredictions.innerHTML = '<li style="text-align:center;">No past predictions found.</li>';
                                if (showMorePastBtn) showMorePastBtn.style.display = 'none';
                            } else {
                                let pastItemsShown = 0;
                                let pastItemsPerPage = 6;

                                let renderNextPastItems = () => {
                                    let nextBatch = allPastCardsHTML.slice(pastItemsShown, pastItemsShown + pastItemsPerPage);
                                    nextBatch.forEach(cardHtml => {
                                        listPastPredictions.insertAdjacentHTML('beforeend', cardHtml);
                                    });
                                    pastItemsShown += pastItemsPerPage;

                                    if (pastItemsShown >= allPastCardsHTML.length && showMorePastBtn) {
                                        showMorePastBtn.style.display = 'none';
                                    }
                                };

                                renderNextPastItems();

                                if (showMorePastBtn) {
                                    showMorePastBtn.addEventListener('click', renderNextPastItems);
                                }
                            }
                        } else {
                            console.warn("Error fetching past predictions:", resPast.statusText);
                        }
                    } catch (pastError) {
                        console.error('Error in Past Predictions block:', pastError);
                    }
                }


            } catch (e) {
                console.error('Error loading Bundesliga:', e);
            } finally {
                let allLoaders = document.querySelectorAll('.loader');
                allLoaders.forEach(loader => {
                    loader.style.display = 'none';
                });
            }
        }

        await loadBundesliga();
    }

    // ВОТ ЭТО НАПИСАЛ
    // let popupDatas;

    // document.addEventListener("click", function (e) {

    //     let elementInteractive = e.target;

    //     if (elementInteractive.closest(".is-open-modal")) {

    //         let roditel = elementInteractive.closest(".is-open-modal").closest(".match-card");
    //         let roditelIdAway = roditel.dataset.idAway;
    //         let roditelIdHome = roditel.dataset.idHome;
    //         let roditelLeague = roditel.dataset.league;
    //         let roditelDescriprion = roditel.dataset.description;

    //         fetch(`https://aigamepredict.com/api/bets?date=${todayDate}&team_ids[]=${roditelIdAway}&team_ids[]=${roditelIdHome}&page_size=5`)
    //             .then(response => {

    //                 if (!response.ok) {
    //                     throw new Error(`HTTP error! status: ${response.status}`);
    //                 }
    //                 return response.json()
    //             })
    //             .then(data => {
    //                 popupDatas = data;
    //                 let dateMassivePopup = Object.entries(popupDatas);
    //                 dateMassivePopup.forEach(function (e) {
    //                     console.log(e[1])
    //                 })
    //             })
    //             .catch(error => {
    //                 console.error('There was a problem with the fetch operation:', error);
    //             });
    //     }
    // })

    let popupDatas = {};

    document.addEventListener("click", function (e) {

        let elementInteractive = e.target;

        if (elementInteractive.closest(".is-open-modal")) {

            let roditel = elementInteractive.closest(".is-open-modal").closest(".match-card");

            let roditelIdAway = roditel.dataset.idAway;
            let roditelIdHome = roditel.dataset.idHome;
            let todayDate = new Date().toISOString().slice(0, 10);

            const betsRequest = fetch(
                `https://aigamepredict.com/api/bets?date=${todayDate}&team_ids[]=${roditelIdAway}&team_ids[]=${roditelIdHome}&page_size=5`
            ).then(res => res.json());

            const h2hRequest = fetch(
                `https://aigamepredict.com/api/h2h?team1=${roditelIdAway}&team2=${roditelIdHome}`
            ).then(res => res.json());

            const lastFiveRequestAway = fetch(
                `https://aigamepredict.com/api/lastfive?team=${roditelIdAway}`
            ).then(res => res.json());

            const lastFiveRequestHome = fetch(
                `https://aigamepredict.com/api/lastfive?team=${roditelIdHome}`
            ).then(res => res.json());

            Promise.all([
                betsRequest,
                h2hRequest,
                lastFiveRequestAway,
                lastFiveRequestHome
            ])
                .then(([betsData, h2hData, lastFiveAwayData, lastFiveHomeData]) => {

                    const popupDatas = {
                        bets: betsData,
                        h2h: h2hData,
                        lastFiveAway: lastFiveAwayData,
                        lastFiveHome: lastFiveHomeData
                    };

                    console.log("BETS:", betsData);
                    console.log("H2H:", h2hData);
                    console.log("LAST FIVE AWAY:", lastFiveAwayData);
                    console.log("LAST FIVE HOME:", lastFiveHomeData);

                })
                .catch(error => {
                    console.error("Ошибка при загрузке данных:", error);
                });
        }

    });
    // ВОТ ЭТО НАПИСАЛ

    document.addEventListener("click", (e) => {
        // Открытие модалки
        let btn = e.target.closest(".open-modal");
        if (btn) {
            let id = btn.dataset.target.replace("id-", "");
            let matchData = cardInfoArray.find(cardInfo => cardInfo.id == id);

            if (!matchData) return;

            document.getElementById("modalInner").innerHTML = `

    <div class="match-stats">
        <div class="match-stats-grid">

            <div class="match-column">
                <div class="ms-header">
                    <img class="ms-logo" src="${matchData.team_away.logo}" alt="${matchData.team_away.name}" title="no img" onerror="this.onerror=null; this.src='/assets/puhgRimg/puhgRno-img.svg'">
                        <div class="ms-team-name">${matchData.team_away.name}</div>
                </div>

                <div class="ms-standings">
                    <span>${matchData.league}</span>
                    <!-- <span>2</span> -->
                </div>

                <div class="ms-section-title">Last Matches</div>
                <div class="ms-progress-bar">
                    <div class="bar-segment bg-green" style="width: 100%"></div>
                </div>
                <div id="awayRecent" class="text-gray" style="font-size: 11px; margin-bottom: 20px;">
                    <div class="loader" style="width: 31px;"></div>
                </div>

                <div class="ms-section-title visually-hidden">
                    <span>Team Lineups</span>
                    <span>3–2–4–1</span>
                </div>
                <div class="ms-lineups text-gray visually-hidden">
                    <div class="ms-lineup-col">
                        <div>Ederson</div>
                        <div>Walker</div>
                        <div>Dias</div>
                        <div>Gvardiol</div>
                        <div>Rodri</div>
                        <div>Stones</div>
                    </div>
                    <div class="ms-lineup-col">
                        <div>Foden</div>
                        <div>De Bruyne</div>
                        <div>Silva</div>
                        <div>Doku</div>
                        <div>Haaland</div>
                    </div>
                </div>

                <div class="ms-section-title visually-hidden">Injuries and Suspensions</div>
                <div class="text-gray visually-hidden">
                    Out: Stones(Thigh injury), Doubtful: Grealish (Knee bruise)
                </div>

                <div class="ms-section-title" style="margin-top: 35px;">Head-to-Head</div>

                <div id="h2hContainer">
                    <div class="ms-row">
                        <span class="ms-date"><div class="loader" style="width: 20px;"></div></span>
                        <span class="ms-match"><div class="loader" style="width: 20px;"></div></span>
                        <span class="ms-score"><div class="loader" style="width: 20px;"></div></span>
                    </div>
                </div>
            </div>

            <div class="match-column">
                <div class="ms-header">
                    <img class="ms-logo" src="${matchData.team_home.logo}" alt="${matchData.team_home.name}" title="no img" onerror="this.onerror=null; this.src='/assets/puhgRimg/puhgRno-img.svg'">
                        <div class="ms-team-name">${matchData.team_home.name}</div>
                </div>

                <div class="ms-standings">
                    <span>${matchData.league}</span>
                    <!-- <span>1</span> -->
                </div>

                <div class="ms-section-title">Last Matches</div>
                <div class="ms-progress-bar">
                    <div class="bar-segment bg-green" style="width: 100%"></div>
                </div>
                <div id="homeRecent" class="text-gray" style="font-size: 11px; margin-bottom: 20px;">
                    <div class="loader" style="width: 31px;"></div>
                </div>

                <div class="ms-section-title visually-hidden">
                    <span>Team Lineups</span>
                    <span>4–3–3</span>
                </div>
                <div class="ms-lineups text-gray visually-hidden">
                    <div class="ms-lineup-col">
                        <div>Alisson</div>
                        <div>Alexander-Arnold</div>
                        <div>Van Dijk</div>
                        <div>Gomez</div>
                        <div>Robertson</div>
                        <div>Mac Allister</div>
                    </div>
                    <div class="ms-lineup-col">
                        <div>Szoboszlai</div>
                        <div>Elliott</div>
                        <div>Salah</div>
                        <div>Núñez</div>
                        <div>Díaz</div>
                    </div>
                </div>

                <div class="ms-section-title visually-hidden">Injuries and Suspensions</div>
                <div class="text-gray visually-hidden">
                    Out: Jota(Broken toe), Thiago(Recovery from injury)
                </div>

                <div class="ms-section-title visually-hidden" style="margin-top: 35px;">
                    <span>Referee</span>
                    <span>Michael Oliver</span>
                </div>
                
                <div class="ms-row text-gray visually-hidden">
                    <span>Avg cards per match</span>
                    <span class="ms-cards">
                        <span><span class="card-dot bg-yellow"></span>3.4 yellow</span>
                        <span><span class="card-dot bg-red"></span>0.1 red</span>
                    </span>
                </div>
                <div class="ms-row text-gray visually-hidden">
                    <span>Avg fouls</span>
                    <span class="ms-ref-val">22.8</span>
                </div>
                <div class="ms-row text-gray visually-hidden">
                    <span>Manchester City under this referee</span>
                    <span class="ms-ref-val">2 Wins – 1 Los</span>
                </div>
                <div class="ms-row text-gray visually-hidden">
                    <span>Liverpool under this referee</span>
                    <span class="ms-ref-val">1 Win – 2 Draws</span>
                </div>
                
            </div>
        </div>
    </div>
    <div class="ms-footer wrap">
        <div class="ms-section-title" style="margin-top: 0;">Team Insights</div>
        <p class="text-gray hidden" style="margin: 5px 0;">
            ${matchData.description}
        </p>
        <button class="ms-link open-hidden">Read More</button>
    </div>`;
            const globalModalEl = document.getElementById("globalModal");
            globalModalEl.classList.add("open");
            document.body.style.overflow = "hidden";

            // Подгружаем H2H и LAST FIVE
            (async () => {
                try {
                    const awayId = matchData.team_away?.id;
                    const homeId = matchData.team_home?.id;
                    const res = await fetch(`https://aigamepredict.com/api/h2h?team1=${awayId}&team2=${homeId}`);
                    if (!res.ok) throw new Error(res.statusText || 'H2H fetch failed');
                    const h2hData = await res.json();
                    const h2hResults = h2hData.results || [];

                    let h2hRowsHtml = '<div class="ms-row"><span class="ms-date">No matches</span></div>';
                    if (h2hResults.length > 0) {
                        h2hRowsHtml = h2hResults.map(r => {
                            const evDate = r.event_date ? new Date(r.event_date) : null;
                            const day = evDate ? String(evDate.getDate()).padStart(2, '0') : '';
                            const month = evDate ? String(evDate.getMonth() + 1).padStart(2, '0') : '';
                            const year = evDate ? evDate.getFullYear() : '';
                            const formattedDate = evDate ? `${day}.${month}.${year}` : '';

                            const homeName = r.team_home;
                            const awayName = r.team_away;
                            const scoreRaw = r.score;
                            const score = String(scoreRaw).replace(/\s*[:\-]\s*/g, ' - ');

                            return `
                                <div class="ms-row">
                                    <span class="ms-date">${formattedDate}</span>
                                    <span class="ms-match">${awayName} – ${homeName}</span>
                                    <span class="ms-score">${score || 'Not played'}</span>
                                </div>`;
                        }).join('');
                    }

                    const container = document.getElementById('h2hContainer');
                    if (container) container.innerHTML = h2hRowsHtml;

                    try {
                        const [lastAwayRes, lastHomeRes] = await Promise.all([
                            fetch(`https://aigamepredict.com/api/lastfive?team=${awayId}`),
                            fetch(`https://aigamepredict.com/api/lastfive?team=${homeId}`)
                        ]);

                        const lastAwayData = lastAwayRes.ok ? await lastAwayRes.json() : { results: [] };
                        const lastHomeData = lastHomeRes.ok ? await lastHomeRes.json() : { results: [] };

                        const buildRecentHtml = (data, referenceName) => {
                            const rawItems = (data && data.results) ? data.results : [];
                            const items = rawItems.filter(it => {
                                const scoreRaw = it.score;
                                return scoreRaw !== null && scoreRaw !== undefined && String(scoreRaw).trim() !== '';
                            });

                            if (!items.length) return { text: '<div>No matches</div>', progress: '<div class="bar-segment" style="width:100%"></div>' };

                            const text = items.map(it => {
                                const itHomeName = (it.team_home && it.team_home.name) || it.home?.name || it.team_home_name || (typeof it.team_home === 'string' ? it.team_home : '');
                                const itAwayName = (it.team_away && it.team_away.name) || it.away?.name || it.team_away_name || (typeof it.team_away === 'string' ? it.team_away : '');

                                const scoreRaw = it.score;
                                const score = String(scoreRaw).replace(/\s*[:\-]\s*/g, '-');

                                let opposingTeam = itHomeName || it.team_home || itHomeName;
                                let status = '';
                                const m = String(scoreRaw).match(/(\d+)\s*[:\-]\s*(\d+)/);

                                if (m) {
                                    const first = parseInt(m[1], 10);
                                    const second = parseInt(m[2], 10);

                                    if (first > second) status = 'W';
                                    else if (first < second) status = 'L';
                                    else status = 'D';
                                }

                                if (referenceName && itHomeName && itHomeName.trim() === String(referenceName).trim()) {
                                    opposingTeam = itAwayName || it.team_away || itAwayName;
                                }

                                const statusLabel = status ? ` (${status})` : '';
                                return `${score} vs ${opposingTeam} ${statusLabel}`;
                            }).join(', ');

                            const segments = items.map(it => {
                                const scoreRaw = it.score;
                                const m = String(scoreRaw).match(/(\d+)\s*[:\-]\s*(\d+)/);

                                let cls = 'bg-yellow';

                                if (m) {
                                    const first = parseInt(m[1], 10);
                                    const second = parseInt(m[2], 10);

                                    if (first > second) cls = 'bg-green';
                                    else if (first < second) cls = 'bg-red';
                                    else cls = 'bg-yellow';
                                }

                                return `<div class="bar-segment ${cls}" style="width: 100%"></div>`;
                            }).join('');


                            return { text, progress: segments };
                        };

                        const awayEl = document.getElementById('awayRecent');
                        const homeEl = document.getElementById('homeRecent');

                        const awayRes = buildRecentHtml(lastAwayData, matchData.team_away?.name || matchData.team_away);
                        const homeRes = buildRecentHtml(lastHomeData, matchData.team_home?.name || matchData.team_home);

                        if (awayEl) {
                            awayEl.innerHTML = awayRes.text;
                            const progressEl = awayEl.previousElementSibling;
                            if (progressEl && progressEl.classList && progressEl.classList.contains('ms-progress-bar')) {
                                progressEl.innerHTML = awayRes.progress;
                            }
                        }

                        if (homeEl) {
                            homeEl.innerHTML = homeRes.text;
                            const progressEl = homeEl.previousElementSibling;
                            if (progressEl && progressEl.classList && progressEl.classList.contains('ms-progress-bar')) {
                                progressEl.innerHTML = homeRes.progress;
                            }
                        }
                    } catch (lfErr) {
                        console.error('Error fetching last-five data:', lfErr);
                    }
                } catch (err) {
                    console.error('Error fetching H2H after open:', err);
                    const container = document.getElementById('h2hContainer');
                    if (container) container.innerHTML = '<div class="ms-row"><span class="ms-date">Error loading head-to-head</span></div>';
                }
            })();

            return;
        }

        // Закрытие модалки
        if (
            e.target.id === "globalModal" ||
            e.target.closest(".modal-close")
        ) {
            let modal = document.getElementById("globalModal");
            modal.classList.remove("open");
            document.body.style.overflow = "";
        }
    });

</script>
</body>

</html>