@import url("https://fonts.googleapis.com/css2?family=Gemunu+Libre:wght@300;400;500;600;700&display=swap");
:root {
  --bg-color: #9a0e15;
  --box-shadow: 1px 1px 2px #4b070a, -1px -1px 2px #e91520;
}
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
body {
  font-family: "Gemunu Libre", sans-serif;
  background: var(--bg-color);
}
::-webkit-scrollbar {
  width: .4em;
  height: .4em;
}
 
::-webkit-scrollbar-track {
  box-shadow: var(--box-shadow);
}
 
::-webkit-scrollbar-thumb {
    background-color: var(--bg-color);
    outline: 1px solid #400602;
}

.container {
  display: flex;
  justify-content: space-between;
  max-width: 991px;
  width: 100%;
  margin: 0 auto;
  padding: 0 15px;
}

footer,
nav {
  background: var(--bg-color);
  box-shadow: var(--box-shadow);
  padding: 0.5rem;
  color: #fff;
  border: 2px dashed #f255;
  font-size: 1.3rem;
}
footer {
  margin-top: 3rem;
}
footer .container {
  justify-content: flex-start;
  gap: 1rem;
}

footer a {
  color: #fff;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border 0.3s ease-in-out;
}
footer a:hover {
  border-bottom: 1px solid;
}

nav a {
  color: #fff;
  text-decoration: none;
  display: flex;
}
nav a img {
  max-width: 32px;
  margin-right: 10px;
  background: #fff;
  padding: 3px;
  border-radius: 50%;
}
/* Teams */
.game-options {
  text-align: center;
  max-width: 400px;
  margin: 1rem auto 0;
  transition: opacity 0.3s ease-in-out;
}
.game-options a,
.game-options button {
  padding: 0.5rem;
  border-radius: 0.25rem;
  text-decoration: none;
}
.game-options a:first-of-type {
  color: #fff;
  background: #4caf50;
}
.game-options button {
  border: none;
  cursor: copy;
  margin-left: 0.5rem;
}
.game-options.hide {
  opacity: 0;
  pointer-events: none;
  max-height: 0;
}
.matches {
  margin-top: 1rem;
  position: relative;
}

.matches .container::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  background-image: url("../images/game.png");
  z-index: -1;
  filter: drop-shadow(2px 24px 6px black) blur(3px);
  background-repeat: no-repeat;
  background-attachment: fixed;
  opacity: 0.2;
  background-position: center;
  background-size: cover;
}
.matches h1 {
  width: 320px;
  color: #fff;
  text-align: center;
  padding-top: 0.5rem;
  margin: 0 auto;
  background: -webkit-linear-gradient(#ffffff, #9e9e9e);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.matches h1.remove-style {
  background: none;
  color: #fff;
  -webkit-background-clip: unset;
  -webkit-text-fill-color: unset;
}
.matches .container {
  align-items: center;
  position: relative;
}

/* Home page */
section.results {
  margin-top: 1rem;
}
section.most-teams:not(.results) {
  margin: 0 auto;
  margin: 2rem auto 1rem;
  max-width:100%;
}
section.most-teams .teams {
  display: grid;
  padding: .5rem;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  overflow-x: auto;
  max-width:100%;
  
}
section.most-teams.results .teams {
  display: flex;
  flex-wrap: wrap;
}
section.most-teams.results .teams .most-teams-item {
  flex: 1;
  max-width: 124px;
}
section.most-teams .most-teams-item {
  text-align: center;
  color: #fff;
  background: var(--bg-color);
  box-shadow: var(--box-shadow);
  padding: 0.25rem;
  padding-bottom: 0.5rem;
}
section.most-teams h3 {
  margin-bottom: 0.25rem;
}
section.most-teams img {
  max-width: 100px;
  height: 75px;
  object-fit: cover;
  margin-bottom: 0.5rem;
}
section.most-teams a {
  display: block;
  margin: 0 auto;
  max-width: 120px;
  background: #fff;
  color: #f44336;
  text-align: center;
  font-weight: 500;
  padding: 0.5rem;
  text-decoration: none;
  margin-top: 1rem;
  border-radius: 0.25rem;
}

.home-page {
  border-top: 2px dashed #f255;
}
.title-style {
  margin-top: 1rem;
  clip-path: polygon(
    0% 15%,
    15% 15%,
    15% 0%,
    85% 0%,
    85% 15%,
    100% 15%,
    100% 85%,
    85% 85%,
    85% 100%,
    15% 100%,
    15% 85%,
    0% 85%
  );
  background: var(--bg-color);
  box-shadow: var(--box-shadow);
  text-align: center;
  padding: 0.5rem;
  color: #fff;
}
.best-four .title-style {
  font-size: 1.8rem;
  margin: 0;
  margin-bottom: .5rem;
}

.groups {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem 1rem;
  width: 100%;
}

.groups div[class^="group-"] {
  max-width: 300px;
  background: var(--bg-color);
  box-shadow: var(--box-shadow);
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1rem;
  border-radius: 1rem;
  position: relative;
  margin-top: 20px;
}
.groups div[class^="group-"] h3 {
  text-align: center;
  border-bottom: 1px solid #ccc8;
  padding-bottom: 0.5rem;
  margin-bottom: 0.5rem;
}
.groups div[class^="group-"] .team,
.groups div[class^="group-"] .flag {
  display: flex;
  align-items: center;
}
.groups div[class^="group-"] .team {
  position: relative;
  padding: 4px 3px;
  border-radius: 0.25rem;
  border: 2px dashed transparent;
  transition: all 0.3s ease-in-out;
}
.groups .team.active input[type="checkbox"] {
  opacity: 0 !important;
}
.groups div[class^="group-"] .team span {
  display: none;
}

.groups div[class^="group-"] .team.active {
  background: #6f0c11;
  border-color: #9a0e15;
}
.groups div[class^="group-"] .team.active span {
  display: block;
}

.groups div[class^="group-"] .flag {
  flex: 1;
  text-align: left;
  gap: 10px;
}
.groups div[class^="group-"] .flag img {
  width: 45px;
  height: 30px;
}
.groups figcaption {
  white-space: inherit;
  font-size: 1rem;
  text-align: left;
}

.groups div[class^="group-"] input[type="checkbox"] {
  min-width: 20px;
  min-height: 20px;
  margin-right: 16px;
  accent-color: #e65100;
  position: absolute;
  top: 10px;
  right: -18px;
  z-index: 1;
  border-radius: 50%;
}

#goNext {
  max-width: 250px;
  margin: 20px auto 0;
  display: block;
  width: 100%;
  box-shadow: var(--box-shadow);
  color: var(--bg-color);
  font-size: 1.3rem;
  border: none;
  border-radius: 0.5rem;
  background-color: #fff;
  transition: transform 0.3s ease-in;
  cursor: pointer;
}
#goNext a {
  color: inherit;
  text-decoration: none;
  display: block;
  padding: 1rem;
}
#goNext:disabled a {
  pointer-events: none;
}
button#goNext:disabled {
  opacity: 0.8;
  background: #0003;
  color: #080606;
}
#goNext:hover {
  /* transform: scale(1.2); */
}

/* New */

.groups-right,
.groups-left {
  display: flex;
  align-items: center;
  gap: 5px;
}
.top-level {
  /* display: none; */
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
}
.top-level .groups-top-level {
  margin-top: -2rem;
}

.group-container {
  box-shadow: var(--box-shadow);
  padding: 0.5rem;
  place-items: center;
  position: relative;
  color: #fff;
  margin-top: 60px;
}
.group-container:before {
  position: absolute;
  content: "Group " attr(data-level);
  top: -22px;
  left: -2px;
  background-color: #c73333;
  color: #fff;
  padding: 2px 7px;
  border-radius: 5px 5px 0 0;
}

figure.flag img {
  width: 60px;
  height: 40px;
  object-fit: cover;
}
figure.flag img[src=""] {
  position: relative;
}
figure.flag img[src=""]:before {
  position: absolute;
  content: "";
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  background: #000;
  pointer-events: none;
}

.matches figure.flag img:not(img[src=""]):hover {
  transform: scale(1.1);
  transition: transform 0.2s ease-in-out;
}
figcaption {
  text-align: center;
  margin-right: 1rem;
  white-space: pre;
  font-weight: bold;
}
.groups-left figcaption,
.groups-right figcaption {
  font-size: 0.7rem;
  margin: 0;
}

/* Sub level groups  */
.sub-level-groups,
.sub-level {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  position: relative;
  height: 450px;
}
.sub-level-team {
  position: relative;
}
.sub-level-team figcaption {
  display: none;
}
.sub-level-team:before {
  position: absolute;
  content: "";
  top: 50%;
  height: 2px;
  background: #000;
  width: 100%;
  z-index: -1;
}
.sub-level-team::after {
  position: absolute;
  content: attr(data-level);
  top: -4px;
  right: -19px;
  color: #fff;
  font-size: 0.8rem;
}
.level-2 .sub-level-team::after {
  content: "";
  height: 2px;
  width: 5px;
  right: -5px;
  left: unset;
  background-color: #000;
  top: 50%;
}
.level-2 .sub-level-team:last-of-type:after {
  top: unset;
  bottom: 50%;
}
.groups-left .level-2 .sub-level-team::after {
  left: -5px;
  right: unset;
}

.final-group {
  background: var(--bg-color);
  flex: 1;
  position: relative;
}
#qr-code {
  position: absolute;
  top: -160px;
  display: none;
  left: calc(50% - 32px);
  z-index: 9999;
}
.final-group::after {
  position: absolute;
  content: "";
  top: 90px;
  background-image: url("../images/cup.png");
  width: 110px;
  height: 130px;
  left: 50%;
  transform: translateX(-50%);
  background-repeat: no-repeat;
  z-index: 99;
  background-position: center center;
  background-size: contain;
  filter: drop-shadow(0px 5px 6px black);
}
.final-level-groups {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex: 1;
  position: relative;
  border: 2px solid #000;
  padding: 1px 4px;
}
.final-level-champions {
  border: 2px solid #000;
  transform: scale(1.5) translateY(-35px);
  padding: 3px;
  background: var(--bg-color);
  position: relative;
}
.final-level-champions:before {
  content: "";
  position: absolute;
  bottom: -13px;
  left: 50%;
  background: #000;
  height: 11px;
  width: 2px;
  z-index: 99;
  opacity: 0;
}
.final-level-champions .flag {
  margin-bottom: -4px;
}
.final-level-champions img {
  width: 44px;
  height: 30px;
}

/* reverse directions */
.groups-right .group-container:before {
  left: unset;
  right: -2px;
}
.groups-right {
  flex-direction: row-reverse;
}
.groups-right .sub-level-groups {
  align-items: flex-end;
}
.groups-right .sub-level:not(.level-2) .sub-level-team:before {
  left: -40px;
  right: unset;
}
.groups-right .sub-level:not(.level-2) .sub-level-team::after {
  right: unset;
  left: -19px;
}
.groups-right .level-2 .sub-level-groups {
  margin-right: 10px;
}

/* new added */
.sub-level {
  /* width: 40px; */
}
.sub-level:not(.level-2) {
  width: 60px !important;
}
.sub-level-groups {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0;
}

.sub-level-groups::after,
.sub-level-groups::before {
  position: absolute;
  content: "";
  height: calc(50% - 10px);
  background: #000;
  width: 2px;
  z-index: -1;
}
.sub-level-groups::before {
  top: 14px;
}
.sub-level-groups::after {
  top: unset;
  bottom: 12px;
}
.groups-left .sub-level-groups::after,
.groups-left .sub-level-groups::before {
  right: 0;
  left: unset;
}
.groups-right .sub-level-groups::after,
.groups-right .sub-level-groups::before {
  right: unset;
  left: -10px;
}

.groups-left .sub-level.level-2 .sub-level-groups:before,
.groups-left .sub-level.level-2 .sub-level-groups:after {
  right: -10px;
}
.groups-right .sub-level.level-2 .sub-level-groups:before,
.groups-right .sub-level.level-2 .sub-level-groups:after {
  left: -10px;
}

.groups-left .sub-level.level-2.level-3 .sub-level-groups {
  margin-left: 10px;
}
.groups-right .sub-level.level-2.level-3 .sub-level-groups {
  margin-right: 10px;
}

.sub-level-team:before {
  width: 30px;
  height: 2px;
}
.level-2 .sub-level-team:before {
  right: -10px;
}
.groups-right .level-2 .sub-level-team:before {
  left: -10px;
  right: unset;
}
.groups-left .sub-level:not(.level-2) .sub-level-team:before,
.groups-right .sub-level:not(.level-2) .sub-level-team:before {
  right: -30px;
}

/* end new */

/* Media  */

@media (max-width: 575px) {
  main {
    padding: 10px 15px 0;
  }
  main h1 {
    font-size: 1.75rem;
  }
  main h2 {
    font-size: 1.25rem;
  }
  .groups figcaption {
    white-space: inherit;
    margin-right: 0;
  }
  .groups div[class^="group-"] input[type="checkbox"] {
    margin-right: 5px;
  }
}

@media (max-width: 767px) {
  .top-level {
    display: none;
  }
}
@media (max-width: 991px) {
  .groups {
    grid-template-columns: repeat(auto-fill, minmax(186px, 1fr));
  }
}

@media (min-width: 1000px) {
  .final-level-champions:before {
    bottom: -43px;
    height: 42px;
  }
  .final-level-champions {
    transform: scale(1.5) translateY(-45px);
  }
}
.matches figure.flag {
  max-width: 45px;
  text-align: center;
  background-color: var(--bg-color);
}
.matches figure.flag img {
  width: 30px;
  height: 21px;
}

.level-2 .sub-level-groups {
  height: 110px;
}

@media (max-width: 575px) {
  .sub-level {
    width: 25px;
    height: 330px;
  }
  .level-2 {
    justify-content: space-around;
  }
  .level-3 .sub-level-groups {
    height: 180px;
  }
  .level-2 .sub-level-team:before {
    right: -5px;
  }
  .groups-right .level-2 .sub-level-team:before {
    left: -5px;
    right: unset;
  }
  .sub-level-groups {
    margin: 0 0 15px !important;
  }
  .groups-left,
  .groups-right {
    gap: 0;
  }
  .level-2 .sub-level-team::after {
    display: none;
  }
  .final-level-champions {
    transform: scale(1.2) translateY(-40px);
  }
}

@media (min-width: 578px) {
  .sub-level-groups {
    height: 90px;
  }
  .level-2 .sub-level-groups {
    height: 140px;
  }
  .level-3 .sub-level-groups {
    height: 250px;
  }
}

@media (min-width: 991px) {
  .top-level {
    margin: 0 20px;
  }
  .matches figure.flag img {
    width: 45px;
    height: 30px;
  }
  .groups-left .level-2:not(.level-3) {
    margin-left: 17px;
  }
  .groups-right .level-2:not(.level-3) {
    margin-right: 19px;
  }

  .groups-right .sub-level.level-2:not(.level-3) .sub-level-groups {
    margin-right: 5px;
  }
  .groups-right .sub-level-groups::after,
  .groups-left .sub-level-groups::before {
    left: -17px;
    right: unset;
  }
  .groups-left .sub-level-groups::after,
  .groups-left .sub-level-groups::before {
    right: -17px;
    left: unset;
  }
  .groups-right .sub-level-groups::after,
  .groups-right .sub-level-groups::before {
    left: -25px;
  }
  .sub-level-groups::after,
  .sub-level-groups::before {
    height: calc(50% - 14px);
  }
  .sub-level-groups::before {
    top: 17px;
    bottom: unset;
  }
  .sub-level-groups::after {
    top: unset;
    bottom: 17px;
  }
}

/* Active path  */
.final-level-groups.active-path {
  border-color: transparent;
}
.final-level-groups.active-path.right:before,
.final-level-groups.active-path.right:after,
.final-level-groups.active-path.left:before,
.final-level-groups.active-path.left:after {
  opacity: 1;
}

.final-level-groups.active-path:before,
.final-level-groups.active-path::after {
  position: absolute;
  top: 50%;
  width: calc(50% - 5px);
  height: 2px;
  background: #000;
  content: "";
  z-index: 9;
  opacity: 0;
}
.final-level-groups.active-path:before {
  left: 5px;
  z-index: 0;
}
.final-level-groups.active-path:after {
  right: 5px;
  z-index: 0;
}
.final-level-groups.active-path.left:before,
.final-level-groups.active-path.right:after {
  background: #ff0 !important;
}

.final-level-champions.active-path:before {
  background-color: #ff0;
  z-index: 9;
  height: 29px;
  bottom: -28px;
  opacity: 1;
}
.sub-level-team.active-path:before,
.sub-level-team.active-path:after,
.final-level-champions.active-path,
.sub-level-groups.active-path.top::before,
.sub-level-groups.active-path.bottom::after {
  z-index: 9;
  background-color: #ff0 !important;
  color: #000;
}

.active-path .flag {
  z-index: 99;
  position: relative;
}
.final-level-groups.active-path.left .final-level-team:first-of-type img,
.final-level-groups.active-path.right .final-level-team:last-of-type img,
.sub-level-team.active-path img {
  border: 3px solid #ff0;
}

.matches.finished {
  pointer-events: none;
}
.matches.finished .container::before {
  display: none;
}
.matches.finished .top-level,
.matches.finished .sub-level-groups.active-path.top::after,
.matches.finished .sub-level-groups.active-path.bottom::before,
.matches.finished .final-level-groups.active-path.right::before,
.matches.finished .final-level-groups.active-path.left:after,
.matches.finished .sub-level-team:not(.active-path),
.matches.finished .sub-level-groups:not(.active-path),
.matches.finished .final-level-groups:not(.active-path) {
  opacity: 0.8;
}

.results-page .container:not(nav .container, footer .container),
.contact-page main .container,
.about-page main .container {
  display: block;
  text-align: center;
}
.contact-page footer,
.about-page footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
}

.contact-page .title-style,
.results-page .title-style,
.about-page .title-style {
  font-size: 2rem;
}
.contact-page main a,
.about-page main a,
.contact-page main p,
.about-page main p {
  font-size: 1.4rem;
  color: #ccc;
  max-width: 400px;
  margin: 0 auto;
  line-height: 1.4;
}

.back {
  margin: 1.5rem auto 0 0;
  display: block;
  max-width: 200px;
  background: #fff;
  color: #f00;
  padding: 0.5rem;
  text-decoration: none;
  border-radius: 0.25rem;
}
