.games {
  background-color: #35f0ec;
  background-image: url("./../images/games-bg.jpg");
  background-size: contain;
  background-position: center;
  background-repeat: repeat;
  padding: 80px 0;
}

.games__inner {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 24px;
}

.games__title {
  font-family: "Roboto", sans-serif;
  font-weight: 900;
  font-size: 42px;
  text-transform: uppercase;
  color: #0d1c33;
  text-align: center;
  margin: 0 0 12px;
}

.games__subtitle {
  font-family: "Roboto", sans-serif;
  font-weight: 400;
  font-size: 24px;
  color: #152a4a;
  text-align: center;
  margin: 0 0 48px;
}

.games__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 40px;
}

.game-card {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  border: 5px solid #9efffd;
  cursor: pointer;
  aspect-ratio: 4 / 3;
  background-color: #0d1c33;
}

.game-card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s;
}

.game-card:hover .game-card__img {
  transform: scale(1.05);
}

.game-card__overlay {
  position: absolute;
  inset: 0;
  background: rgba(13, 28, 51, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s;
}

.game-card:hover .game-card__overlay {
  opacity: 1;
}

.game-card__play {
  background-color: #35f0ec;
  color: #0d1c33;
  font-family: "Roboto", sans-serif;
  font-weight: 900;
  font-size: 20px;
  letter-spacing: 2px;
  border: none;
  border-radius: 8px;
  padding: 14px 48px;
  cursor: pointer;
  transition: transform 0.2s;
}

.game-card__play:hover {
  transform: scale(1.05);
}

.games__cta-wrap {
  text-align: center;
}

.games__see-all {
  font-size: 18px;
  padding: 14px 40px;
}

.game-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  align-items: center;
  justify-content: center;
}

.game-modal.is-open {
  display: flex;
}

.game-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  cursor: pointer;
}

.game-modal__container {
  position: relative;
  z-index: 1;
  background: #0d1c33;
  border: 3px solid #35f0ec;
  border-radius: 16px;
  width: 95%;
  max-width: 1200px;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.game-modal__close {
  position: absolute;
  top: 10px;
  right: 14px;
  background: none;
  border: none;
  color: #35f0ec;
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
  padding: 0;
}

.game-modal__close:hover {
  color: #ffffff;
}

.game-modal__iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  flex: 1;
}

/* ── Home extra games (hidden by default) ── */
.games__grid--extra {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 12px;
  margin-bottom: 40px;
}

.games__grid--extra.is-hidden {
  display: none;
}

.games__grid--extra .game-card {
  aspect-ratio: 4 / 3;
}

@media (max-width: 900px) {
  .games__grid--extra {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 600px) {
  .games__grid--extra {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ── Home page featured layout ── */
.games__grid--home {
  display: grid;
  grid-template-columns: 2fr 1.4fr 1fr;
  grid-template-rows: repeat(6, 1fr);
  gap: 10px;
  height: 500px;
  margin-bottom: 40px;
}

.games__grid--home .game-card {
  aspect-ratio: unset;
  min-height: 0;
  min-width: 0;
}

.game-card--large {
  grid-column: 1;
  grid-row: 1 / 7;
}

.game-card--medium:nth-child(2) {
  grid-column: 2;
  grid-row: 1 / 4;
}

.game-card--medium:nth-child(3) {
  grid-column: 2;
  grid-row: 4 / 7;
}

.game-card--small:nth-child(4) {
  grid-column: 3;
  grid-row: 1 / 3;
}

.game-card--small:nth-child(5) {
  grid-column: 3;
  grid-row: 3 / 5;
}

.game-card--small:nth-child(6) {
  grid-column: 3;
  grid-row: 5 / 7;
}

/* ── Games page layout ── */
.games__grid--top {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}

.games__grid--top .game-card {
  aspect-ratio: 16 / 9;
}

.games__grid--bottom {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 40px;
}

.games__grid--bottom .game-card {
  aspect-ratio: 4 / 3;
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .games__grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .games__grid--home {
    height: 360px;
    gap: 8px;
  }

  .games__grid--home .game-card {
    aspect-ratio: unset;
    min-height: 0;
  }

  .games__grid--top {
    grid-template-columns: repeat(2, 1fr);
  }

  .games__grid--bottom {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 600px) {
  .games__grid--home {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: repeat(4, 1fr);
    height: 360px;
  }

  .game-card--large {
    grid-column: 1 / 3;
    grid-row: 1 / 3;
  }

  .game-card--medium:nth-child(2) {
    grid-column: 1;
    grid-row: 3 / 5;
  }

  .game-card--medium:nth-child(3) {
    grid-column: 2;
    grid-row: 3 / 5;
  }

  .game-card--small {
    display: none;
  }

  .games__grid--top {
    grid-template-columns: 1fr;
  }

  .games__grid--bottom {
    grid-template-columns: repeat(2, 1fr);
  }

  .games {
    padding: 48px 0;
  }

  .games__title {
    font-size: 24px;
  }

  .games__subtitle {
    font-size: 15px;
  }

  .game-modal__container {
    aspect-ratio: unset;
    height: 80vh;
  }
}
