.game-gallery {
  margin: 0 0 26px;
  padding: 18px;
  border: 1px solid #e4e4e4;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 7px 18px rgba(0, 0, 0, 0.07);
}

.game-gallery__title {
  margin: 0 0 16px;
  padding-left: 11px;
  border-left: 4px solid #fb5e2c;
  color: #333;
  font-size: 20px;
}

.game-gallery__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.game-gallery__item {
  display: block;
  width: 100%;
  padding: 0;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 10px;
  background: #f4f4f4;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.game-gallery__item img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  transition: transform 0.18s ease;
}

.game-gallery__item:focus-visible {
  outline: 3px solid rgba(251, 94, 44, 0.42);
  outline-offset: 2px;
  border-color: #fb5e2c;
}

.game-gallery-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 15, 15, 0.92);
}

.game-gallery-modal[hidden] { display: none; }

.game-gallery-modal__dialog {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(1100px, 100%);
  height: min(820px, calc(100vh - 40px));
  height: min(820px, calc(100dvh - 40px));
  padding: 58px 72px 50px;
  border-radius: 14px;
  background: #1d1d1d;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

.game-gallery-modal__image {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 5px 24px rgba(0, 0, 0, 0.35);
}

.game-gallery-modal__close,
.game-gallery-modal__nav {
  position: absolute;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255, 255, 255, 0.8);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
  cursor: pointer;
  line-height: 1;
  transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.game-gallery-modal__close { top: 12px; right: 12px; width: 42px; height: 42px; font-size: 30px; }
.game-gallery-modal__nav { top: 50%; width: 48px; height: 64px; font-size: 34px; transform: translateY(-50%); }
.game-gallery-modal__nav--previous { left: 12px; }
.game-gallery-modal__nav--next { right: 12px; }
.game-gallery-modal__position { position: absolute; bottom: 15px; left: 50%; margin: 0; color: #fff; font-weight: 700; transform: translateX(-50%); }

.game-gallery-modal__close:focus-visible,
.game-gallery-modal__nav:focus-visible { outline: 3px solid #fb5e2c; outline-offset: 3px; }

@media (hover: hover) and (pointer: fine) {
  .game-gallery__item:hover { border-color: #fb5e2c; box-shadow: 0 7px 17px rgba(251, 94, 44, 0.24); transform: translateY(-2px); }
  .game-gallery__item:hover img { transform: scale(1.025); }
  .game-gallery-modal__close:hover,
  .game-gallery-modal__nav:hover { border-color: #fb5e2c; background: #fb5e2c; }
}

@media (max-width: 640px) {
  .game-gallery { padding: 14px; }
  .game-gallery__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .game-gallery-modal { padding: 8px; }
  .game-gallery-modal__dialog { height: calc(100vh - 16px); height: calc(100dvh - 16px); padding: 56px 12px 64px; }
  .game-gallery-modal__nav { top: auto; bottom: 10px; width: 48px; height: 44px; transform: none; }
  .game-gallery-modal__nav--previous { left: 12px; }
  .game-gallery-modal__nav--next { right: 12px; }
  .game-gallery-modal__position { bottom: 23px; }
}

@media (prefers-reduced-motion: reduce) {
  .game-gallery__item,
  .game-gallery__item img,
  .game-gallery-modal__close,
  .game-gallery-modal__nav { transition: none; }
}
