.worldcup-flags {
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  position: absolute;
  z-index: 1;
  margin: -14px 0 0 0;
  padding: 0;
  pointer-events: none;
  width: 100%;
}

.worldcup-flags li {
  position: relative;
  animation-fill-mode: both;
  animation-iteration-count: infinite;
  animation-name: worldcup-flag-spark;
  animation-duration: 2.4s;
  list-style: none;
  margin: 16px 8px 0;
  padding: 0;
  display: inline-block;
  width: 22px;
  height: 27px;
  transform-origin: 50% 0;
}

.worldcup-flags li:nth-child(2n) {
  animation-duration: 1.9s;
}

.worldcup-flags li:nth-child(3n) {
  animation-duration: 2.9s;
}

.worldcup-flags li:nth-child(4n) {
  animation-name: worldcup-flag-spark-alt;
}

.worldcup-flags li:before {
  content: "";
  position: absolute;
  background: #383838;
  width: 12px;
  height: 4px;
  border-radius: 3px;
  top: -2px;
  left: 5px;
}

.worldcup-flags li:after {
  content: "";
  top: -8px;
  left: 18px;
  position: absolute;
  width: 35px;
  height: 9px;
  border-bottom: solid #222 2px;
  border-radius: 50%;
}

.worldcup-flags li:last-child:after {
  content: none;
}

.worldcup-flag {
  display: block;
  position: relative;
  overflow: hidden;
  width: 22px;
  height: 25px;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.28);
}

.worldcup-flag img {
  position: absolute;
  top: 1px;
  left: -4px;
  width: 30px;
  height: 20px;
  object-fit: contain;
  max-width: none;
}

.worldcup-flag--mx { background: linear-gradient(90deg, #006847 0 33.333%, #fff 33.333% 66.666%, #ce1126 66.666%); }
.worldcup-flag--kr { background: #fff; }
.worldcup-flag--za { background: #007a4d; }
.worldcup-flag--cz { background: linear-gradient(#fff 0 50%, #d7141a 50%); }
.worldcup-flag--ca { background: #d52b1e; }
.worldcup-flag--ch { background: #d52b1e; }
.worldcup-flag--qa { background: #8a1538; }
.worldcup-flag--ba { background: #002395; }
.worldcup-flag--br { background: #009c3b; }
.worldcup-flag--ma { background: #c1272d; }
.worldcup-flag--gb-sct,
.worldcup-flag--sct { background: #005eb8; }
.worldcup-flag--ht { background: linear-gradient(#00209f 0 50%, #d21034 50%); }
.worldcup-flag--us { background: repeating-linear-gradient(#b22234 0 2px, #fff 2px 4px); }
.worldcup-flag--py { background: linear-gradient(#d52b1e 0 33.333%, #fff 33.333% 66.666%, #0038a8 66.666%); }
.worldcup-flag--au { background: #012169; }
.worldcup-flag--tr { background: #e30a17; }
.worldcup-flag--de { background: linear-gradient(#000 0 33.333%, #dd0000 33.333% 66.666%, #ffce00 66.666%); }
.worldcup-flag--ec { background: linear-gradient(#ffdd00 0 50%, #034ea2 50% 75%, #ed1c24 75%); }
.worldcup-flag--ci { background: linear-gradient(90deg, #f77f00 0 33.333%, #fff 33.333% 66.666%, #009e60 66.666%); }
.worldcup-flag--cw { background: #002b7f; }
.worldcup-flag--nl { background: linear-gradient(#ae1c28 0 33.333%, #fff 33.333% 66.666%, #21468b 66.666%); }
.worldcup-flag--jp { background: #fff; }
.worldcup-flag--tn { background: #e70013; }
.worldcup-flag--se { background: #006aa7; }
.worldcup-flag--be { background: linear-gradient(90deg, #000 0 33.333%, #fae042 33.333% 66.666%, #ed2939 66.666%); }
.worldcup-flag--ir { background: linear-gradient(#239f40 0 33.333%, #fff 33.333% 66.666%, #da0000 66.666%); }
.worldcup-flag--eg { background: linear-gradient(#ce1126 0 33.333%, #fff 33.333% 66.666%, #000 66.666%); }
.worldcup-flag--nz { background: #00247d; }
.worldcup-flag--es { background: linear-gradient(#aa151b 0 25%, #f1bf00 25% 75%, #aa151b 75%); }
.worldcup-flag--uy { background: repeating-linear-gradient(#fff 0 3px, #0038a8 3px 6px); }
.worldcup-flag--sa { background: #006c35; }
.worldcup-flag--cv { background: #003893; }
.worldcup-flag--fr { background: linear-gradient(90deg, #0055a4 0 33.333%, #fff 33.333% 66.666%, #ef4135 66.666%); }
.worldcup-flag--sn { background: linear-gradient(90deg, #00853f 0 33.333%, #fdef42 33.333% 66.666%, #e31b23 66.666%); }
.worldcup-flag--no { background: #ba0c2f; }
.worldcup-flag--iq { background: linear-gradient(#ce1126 0 33.333%, #fff 33.333% 66.666%, #000 66.666%); }
.worldcup-flag--ar { background: linear-gradient(#74acdf 0 33.333%, #fff 33.333% 66.666%, #74acdf 66.666%); }
.worldcup-flag--dz { background: linear-gradient(90deg, #006233 0 50%, #fff 50%); }
.worldcup-flag--at { background: linear-gradient(#ed2939 0 33.333%, #fff 33.333% 66.666%, #ed2939 66.666%); }
.worldcup-flag--jo { background: linear-gradient(#000 0 33.333%, #fff 33.333% 66.666%, #007a3d 66.666%); }
.worldcup-flag--pt { background: linear-gradient(90deg, #006600 0 42%, #ff0000 42%); }
.worldcup-flag--co { background: linear-gradient(#fcd116 0 50%, #003893 50% 75%, #ce1126 75%); }
.worldcup-flag--uz { background: linear-gradient(#1eb6e7 0 33.333%, #fff 33.333% 66.666%, #009739 66.666%); }
.worldcup-flag--cd { background: #007fff; }
.worldcup-flag--gb-eng,
.worldcup-flag--eng { background: #fff; }
.worldcup-flag--hr { background: linear-gradient(#f00 0 33.333%, #fff 33.333% 66.666%, #171796 66.666%); }
.worldcup-flag--gh { background: linear-gradient(#ce1126 0 33.333%, #fcd116 33.333% 66.666%, #006b3f 66.666%); }
.worldcup-flag--pa { background: linear-gradient(90deg, #fff 0 50%, #d21034 50%) top / 100% 50% no-repeat, linear-gradient(90deg, #005293 0 50%, #fff 50%) bottom / 100% 50% no-repeat; }

@keyframes worldcup-flag-spark {
  0%, 100% {
    filter: brightness(1.12) saturate(1.08);
    opacity: 1;
    transform: rotate(-2deg);
  }
  50% {
    filter: brightness(0.78) saturate(0.9);
    opacity: 0.72;
    transform: rotate(2deg);
  }
}

@keyframes worldcup-flag-spark-alt {
  0%, 100% {
    filter: brightness(1.18) saturate(1.12);
    opacity: 1;
    transform: rotate(2deg);
  }
  50% {
    filter: brightness(0.82) saturate(0.92);
    opacity: 0.76;
    transform: rotate(-2deg);
  }
}

@media (max-width: 767px) {
  .worldcup-flags {
    margin-top: -14px;
  }

  .worldcup-flags li {
    margin-left: 5px;
    margin-right: 5px;
    width: 19px;
    height: 24px;
  }

  .worldcup-flag {
    width: 19px;
    height: 22px;
  }

  .worldcup-flag img {
    top: 1px;
    left: -4px;
    width: 27px;
    height: 18px;
  }

  .worldcup-flags li:after {
    width: 27px;
    left: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .worldcup-flags li {
    animation: none;
  }
}
