* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #f3f4f7;
  --card-bg: linear-gradient(180deg, #ffffff 0%, #ededed 100%);
  --text-dark: #1e2a44;
  --text-muted: #697386;
  --accent: #ff4324;
  --accent-hover: #ff593c;
  --badge: rgba(255, 67, 36, 0.96);
  --shadow: 0 10px 26px rgba(0, 0, 0, 0.06);
}

body {
  min-height: 100vh;
  background: var(--bg);
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text-dark);
  padding: 28px 24px 40px;
}

.games-section {
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 28px;
}

.back-btn {
  width: 54px;
  height: 54px;
  border: none;
  border-radius: 50%;
  background: #ffffff;
  color: var(--text-dark);
  font-size: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.25s ease, background 0.25s ease, color 0.25s ease;
  flex-shrink: 0;
}

.back-btn:hover {
  background: var(--accent);
  color: #ffffff;
  transform: translateY(-2px);
}

.section-heading-block {
  min-width: 0;
}

.section-title {
  font-size: 54px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: -1px;
  color: var(--text-dark);
}

.section-subtitle {
  margin-top: 10px;
  font-size: 15px;
  line-height: 1.4;
  color: var(--text-muted);
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 24px;
  align-items: stretch;
}

.game-card {
  background: var(--card-bg);
  border-radius: 22px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  min-height: 380px;
  box-shadow: var(--shadow);
}

.game-image-box {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 18px;
  background: #d8d8d8;
}

.game-image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
  transition: transform 0.35s ease;
}

.game-card:hover .game-image {
  transform: scale(1.06);
}

.game-image-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.28) 0%, rgba(0, 0, 0, 0.08) 42%, rgba(0, 0, 0, 0.01) 100%);
  pointer-events: none;
}

.game-category-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  max-width: calc(100% - 24px);
  min-height: 38px;
  padding: 8px 14px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--badge);
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.game-name-overlay {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 14px;
  z-index: 2;
  color: #ffffff;
  font-size: 22px;
  line-height: 1.08;
  font-weight: 900;
  text-shadow: 0 4px 16px rgba(0, 0, 0, 0.48);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.game-name {
  margin: 18px 0 16px;
  font-size: 18px;
  line-height: 1.25;
  font-weight: 700;
  color: #111111;
  text-align: center;
  min-height: 44px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.play-btn {
  margin: auto auto 0;
  min-width: 156px;
  min-height: 56px;
  padding: 0 28px;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  font-size: 16px;
  font-weight: 800;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.25s ease, background 0.25s ease;
}

.play-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.loading-state,
.empty-state,
.error-state {
  grid-column: 1 / -1;
  min-height: 220px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-dark);
  box-shadow: var(--shadow);
}

@media (max-width: 991px) {
  .section-title {
    font-size: 42px;
  }

  .games-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 18px;
  }
}

@media (max-width: 768px) {
  body {
    padding: 20px 14px 28px;
  }

  .topbar {
    gap: 14px;
    margin-bottom: 22px;
  }

  .back-btn {
    width: 46px;
    height: 46px;
    font-size: 17px;
  }

  .section-title {
    font-size: 32px;
  }

  .section-subtitle {
    font-size: 14px;
  }

  .games-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }

  .game-card {
    min-height: 300px;
    border-radius: 18px;
    padding: 12px;
  }

  .game-image-box {
    border-radius: 14px;
  }

  .game-category-badge {
    min-height: 32px;
    padding: 6px 12px;
    font-size: 11px;
  }

  .game-name-overlay {
    font-size: 16px;
    left: 12px;
    right: 12px;
    bottom: 12px;
  }

  .game-name {
    font-size: 15px;
    min-height: 38px;
    margin: 14px 0;
  }

  .play-btn {
    min-width: 128px;
    min-height: 46px;
    font-size: 15px;
    padding: 0 20px;
  }
}

@media (max-width: 480px) {
  .games-grid {
    grid-template-columns: 1fr 1fr;
  }
}
