.games {
  padding: 60px 0;
  background: var(--c-bg);
}

.games__title {
  margin-bottom: 32px;
}

.games__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.game-card {
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  text-align: left;
  display: block;
  color: inherit;
}

.game-card__media {
  position: relative;
  display: block;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--c-card);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
  border: 1px solid var(--c-border);
}
.game-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.game-card:hover .game-card__media {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(47, 128, 255, 0.25);
  border-color: var(--c-blue);
}

.game-card__play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0);
  color: #fff;
  opacity: 0;
  transition:
    opacity 0.15s ease,
    background-color 0.15s ease;
}
.game-card__play svg {
  background: var(--c-blue);
  border-radius: 999px;
  padding: 14px;
  box-sizing: content-box;
  box-shadow: 0 4px 14px rgba(47, 128, 255, 0.6);
}
.game-card:hover .game-card__play {
  opacity: 1;
  background: rgba(0, 0, 0, 0.35);
}

.game-card__name {
  position: absolute;
  left: 12px;
  bottom: 10px;
  right: 12px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #ffffff;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.7);
  z-index: 2;
  text-align: left;
}

.game-card__media::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 60%;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.75) 0%,
    rgba(0, 0, 0, 0) 100%
  );
  pointer-events: none;
  z-index: 1;
}

.games__actions {
  display: flex;
  justify-content: center;
  margin-top: 36px;
}

/* Modal */
.game-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.game-modal.is-open {
  display: flex;
}

.game-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(2px);
}

.game-modal__dialog {
  position: relative;
  width: min(1180px, 100%);
  max-height: calc(100vh - 48px);
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow);
}

.game-modal__close {
  position: absolute;
  top: 10px;
  right: 14px;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  padding: 6px 10px;
}

.game-modal__title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 400;
  letter-spacing: 0.02em;
  padding-right: 36px;
  color: #ffffff;
}

.game-modal__frame-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
}
.game-modal__frame {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

body.is-modal-open {
  overflow: hidden;
}

@media (max-width: 1024px) {
  .games__grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (max-width: 768px) {
  .games {
    padding: 40px 0;
  }
  .games__grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
  }
  .game-modal {
    padding: 12px;
  }
  .game-modal__dialog {
    padding: 14px;
    max-height: calc(100vh - 24px);
  }
  .game-modal__frame-wrap {
    aspect-ratio: 4 / 3;
  }
}
@media (max-width: 420px) {
  .games__grid {
    grid-template-columns: 1fr;
  }
}
