/* Reset & Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: #20312b;
  background:
    linear-gradient(180deg, #f7fbff 0%, #f4faf5 42%, #fffaf4 100%);
}

.container {
  max-width: 1380px;
  margin: 0 auto;
  padding: 0 28px;
}

/* Header */
.header {
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid rgba(38, 94, 70, 0.12);
  padding: 12px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 8px 24px rgba(31, 49, 43, 0.06);
  backdrop-filter: blur(10px);
}

.header__content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
}

.header__logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: #1f2937;
  font-weight: 600;
  font-size: 18px;
  line-height: 1.2;
}

.header__logo img {
  width: 150px;
  height: 48px;
}

.header__logo small {
  font-size: 12px;
  font-weight: 400;
  color: #6b7280;
}

.header__search {
  flex: 1;
  max-width: 500px;
  position: relative;
}

.header__search input {
  width: 100%;
  padding: 12px 16px 12px 44px;
  border: 1px solid #d9e1dd;
  border-radius: 8px;
  font-size: 15px;
  color: #20312b;
  background: #ffffff;
  transition: all 0.2s ease;
}

.header__search input:focus {
  outline: none;
  border-color: #2f8a5f;
  box-shadow: 0 0 0 3px rgba(47, 138, 95, 0.13);
}

.header__search svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #9ca3af;
  pointer-events: none;
}

.header__search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: #ffffff;
  border: 1px solid #dbe5df;
  border-radius: 8px;
  box-shadow: 0 18px 36px rgba(28, 48, 39, 0.14);
  max-height: 360px;
  overflow-y: auto;
  padding: 8px 0;
  z-index: 200;
}

.header__search-results.empty::before {
  content: 'Ничего не найдено';
  display: block;
  padding: 12px 16px;
  color: #6b7280;
  font-size: 14px;
}

.header__search-result {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  text-decoration: none;
  color: #1f2937;
  transition: background 0.15s ease;
}

.header__search-result:hover {
  background: #f2f8f4;
}

.header__search-result img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 6px;
}

.header__search-result-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.header__search-result-title {
  font-size: 15px;
  font-weight: 600;
  color: #1f2937;
}

.header__search-result-meta {
  font-size: 13px;
  color: #6b7280;
}

/* Hero Section */
.hero {
  position: relative;
  overflow: hidden;
  color: #183128;
  padding: 34px 0;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.86) 0%, rgba(255, 248, 235, 0.86) 42%, rgba(225, 245, 239, 0.9) 100%),
    linear-gradient(90deg, #ffcf5f 0%, #35a572 52%, #2f68b8 100%);
  border-bottom: 1px solid rgba(37, 87, 66, 0.12);
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(90deg, rgba(31, 49, 43, 0.06) 1px, transparent 1px),
    linear-gradient(0deg, rgba(31, 49, 43, 0.05) 1px, transparent 1px);
  background-size: 72px 72px;
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 24%, #000 100%);
  mask-image: linear-gradient(90deg, transparent 0%, #000 24%, #000 100%);
  pointer-events: none;
}

.hero__container {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(420px, 520px);
  gap: 42px;
  align-items: center;
}

.hero__content {
  max-width: 700px;
}

.hero__eyebrow {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  margin-bottom: 14px;
  padding: 6px 12px;
  border: 1px solid rgba(47, 138, 95, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: #1f6f4b;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero__title {
  font-size: 46px;
  line-height: 1.08;
  font-weight: 800;
  margin-bottom: 14px;
  color: #13251f;
}

.hero__description {
  font-size: 18px;
  max-width: 690px;
  color: #41564e;
  line-height: 1.6;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.hero__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 11px 18px;
  border: 1px solid rgba(34, 91, 66, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  color: #1c4e3a;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 10px 22px rgba(26, 57, 45, 0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.hero__button:hover {
  transform: translateY(-2px);
  background: #ffffff;
  box-shadow: 0 16px 28px rgba(26, 57, 45, 0.13);
}

.hero__button--primary {
  background: #218755;
  border-color: #218755;
  color: #ffffff;
}

.hero__button--primary:hover {
  background: #176f44;
}

.hero__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.hero__tags span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.56);
  color: #53655e;
  font-size: 14px;
  font-weight: 600;
}

.hero__showcase {
  display: grid;
  grid-template-columns: 1.18fr 1fr;
  grid-template-rows: repeat(3, 94px);
  gap: 12px;
  min-height: 306px;
}

.hero-preview {
  position: relative;
  overflow: hidden;
  display: block;
  min-height: 94px;
  border: 1px solid rgba(255, 255, 255, 0.66);
  border-radius: 8px;
  color: #ffffff;
  text-decoration: none;
  box-shadow: 0 18px 38px rgba(31, 49, 43, 0.18);
  background: #1f3d31;
  transform: translateZ(0);
}

.hero-preview--main {
  grid-row: 1 / 4;
}

.hero-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}

.hero-preview::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 34%, rgba(11, 38, 24, 0.78) 100%);
}

.hero-preview:hover img {
  transform: scale(1.05);
}

.hero-preview span {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 10px;
  z-index: 1;
  font-size: 16px;
  line-height: 1.15;
  font-weight: 800;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

/* Main Content */
.main {
  padding: 34px 0 46px;
}

/* Section */
.section {
  margin-bottom: 52px;
}

.section__heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.section__title {
  font-size: 30px;
  line-height: 1.16;
  font-weight: 800;
  margin-bottom: 0;
  color: #303c35;
}

.section__lead {
  max-width: 440px;
  color: #687970;
  font-size: 15px;
  line-height: 1.45;
}

.section__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

/* Games Grid Popular */
.games-grid-popular {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 16px;
  max-width: 1380px;
  margin: 0 auto;
}

.user-choice__filters {
    display: flex;
    margin-top: 16px;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.user-choice__filters--desktop {
    display: flex;
}

.user-choice__filters--mobile {
    display: none;
}

.user-choice__filter {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    color: #687970;
    background: rgba(255, 255, 255, 0.64);
    border: 1px solid transparent;
    border-radius: 999px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.user-choice__filter:hover {
    background: #ffffff;
    border-color: #d8e4dd;
}

.user-choice__filter.active {
    color: #173d2d;
    font-weight: bold;
    background: #eaf6ef;
    border-color: #cde7d8;
}

.user-choice__filter-arrow {
    width: 12px;
    height: 8px;
    transition: transform 0.2s ease;
}

.user-choice__filter.active .user-choice__filter-arrow {
    color: #787878;
}

.user-choice__filter[data-order="asc"] .user-choice__filter-arrow {
    transform: rotate(180deg);
}

.games-grid-user-choice {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  max-width: 1380px;
  margin: 0 auto;
}

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

.game-card--s1 {
  grid-column: 3 / 5;
  grid-row: 1 / 2;
  aspect-ratio: 2;
}

.game-card--s2 {
  grid-column: 5 / 7;
  grid-row: 1 / 2;
  aspect-ratio: 2;
}

.game-card--s3 {
  grid-column: 7 / 9;
  grid-row: 1 / 2;
  aspect-ratio: 2;
}

.game-card--s4 {
  grid-column: 3 / 5;
  grid-row: 2 / 3;
  aspect-ratio: 2;
}

.game-card--s5 {
  grid-column: 5 / 6;
  grid-row: 2 / 3;
}

.game-card--s6 {
  grid-column: 6 / 7;
  grid-row: 2 / 3;
}

.game-card--s7 {
  grid-column: 7 / 8;
  grid-row: 2 / 3;
}

.game-card--s8 {
  grid-column: 8 / 9;
  grid-row: 2 / 3;
}

@media screen and (min-width: 769px) {
  .games-grid-popular .game-card:nth-child(n + 5) {
    min-height: 100px;
  }

  .games-grid-popular .game-card__title {
    overflow-wrap: anywhere;
  }

  .games-grid-popular .game-card--s4 {
    grid-column: 3 / 4;
    aspect-ratio: auto;
  }

  .games-grid-popular .game-card--s5 {
    grid-column: 4 / 5;
  }

  .games-grid-popular .game-card--s6 {
    grid-column: 5 / 6;
  }

  .games-grid-popular .game-card--s7 {
    grid-column: 6 / 7;
  }

  .games-grid-popular .game-card--s8 {
    grid-column: 7 / 8;
  }

  .games-grid-popular .game-card:nth-child(10) {
    grid-column: 8 / 9;
    grid-row: 2 / 3;
  }
}

@media screen and (min-width: 769px) and (max-width: 1024px) {
  .games-grid-popular .game-card:nth-child(n + 5) .game-card__title {
    font-size: 14px;
    padding: 8px 6px;
  }
}

/* Classes for items after first 9 - varied sizes */
.game-card--wide {
  grid-column: span 2;
  grid-row: span 1;
}

.game-card--tall {
  grid-column: span 1;
  grid-row: span 2;
}

.game-card--normal {
  grid-column: span 1;
  grid-row: span 1;
}

.game-card--uniform {
  grid-column: span 1;
  grid-row: span 1;
  aspect-ratio: 2 / 1;
}

.game-card {
  background: #ffffff;
  border: 1px solid rgba(35, 77, 57, 0.1);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 10px 26px rgba(28, 48, 39, 0.09);
  transition: all 0.3s ease;
  text-decoration: none;
  color: inherit;
  position: relative;
  display: block;
}

.game-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 34px rgba(28, 48, 39, 0.16);
}

.game-card__image {
  width: 100%;
  height: 100%;
  position: relative;
}

.game-card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}

.game-card:hover .game-card__image img {
  transform: scale(1.04);
}

.game-card__title {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  min-height: 43px;
  height: auto;
  background: linear-gradient(180deg, rgba(15, 62, 38, 0.18) 0%, rgba(11, 55, 31, 0.9) 100%);
  color: white;
  font-size: 17px;
  line-height: 1.15;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
  text-align: center;
  text-shadow: 0 1px 7px rgba(0, 0, 0, 0.35);
}

/* Sort Dropdown */
.sort-dropdown {
  position: relative;
}

.sort-dropdown__button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: white;
  border: 1px solid #d9e1dd;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 500;
  color: #33463d;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sort-dropdown__button:hover {
  border-color: #b6c9bf;
  background: #f7fbf8;
}

.sort-dropdown__button.active {
  border-color: #2f8a5f;
  color: #2f8a5f;
}

.sort-dropdown__button svg {
  transition: transform 0.2s ease;
}

.sort-dropdown.open .sort-dropdown__button svg {
  transform: rotate(180deg);
}

.sort-dropdown__menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: white;
  border: 1px solid #dbe5df;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  min-width: 200px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
  z-index: 50;
}

.sort-dropdown.open .sort-dropdown__menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.sort-dropdown__item {
  width: 100%;
}

.sort-dropdown__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 12px 16px;
  background: none;
  border: none;
  text-align: left;
  font-size: 14px;
  color: #374151;
  cursor: pointer;
  transition: background 0.2s ease;
}

.sort-dropdown__link:hover {
  background: #f2f8f4;
}

.sort-dropdown__link.active {
  color: #2f8a5f;
  font-weight: 600;
}

.sort-dropdown__item:first-child .sort-dropdown__link {
  border-radius: 8px 8px 0 0;
}

.sort-dropdown__item:last-child .sort-dropdown__link {
  border-radius: 0 0 8px 8px;
}

/* Games List */
.games-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.games-list-user-choice {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 24px;
}

.games-list-user-choice__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid #dfe8e3;
  border-radius: 8px;
  text-decoration: none;
  color: #343330;
  font-size: 15px;
  transition: all 0.2s ease;
}

.games-list-user-choice__item:hover {
  border-color: #2f8a5f;
  background: #eef8f2;
  color: #1f6f4b;
}

.games-list-user-choice__item img {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}

.games-list__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: white;
  border: 1px solid #dfe8e3;
  border-radius: 8px;
  text-decoration: none;
  color: #374151;
  font-size: 15px;
  transition: all 0.2s ease;
}

.games-list__item:hover {
  border-color: #2f8a5f;
  background: #eef8f2;
  color: #1f6f4b;
}

.games-list__item svg {
  flex-shrink: 0;
  color: #9ca3af;
}

.games-list__item:hover svg {
  color: #2f8a5f;
}

/* Games List Grouped */
.games-list-grouped {
  margin-top: 24px;
}

.games-list-grouped__letter {
  font-size: 24px;
  font-weight: 700;
  color: #1f2937;
  margin: 32px 0 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid #e5e7eb;
}

.games-list-grouped__letter:first-child {
  margin-top: 0;
}

/* Footer */
.footer {
  background: #1e2f28;
  color: #b6c4bd;
  padding: 28px 0;
  text-align: center;
  margin-top: 42px;
}

.footer p {
  font-size: 14px;
}

/* Tablet Responsive */
@media screen and (max-width: 1024px) {
  .hero__container {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .hero__content {
    max-width: 820px;
  }

  .hero__showcase {
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 160px;
    min-height: 160px;
  }

  .hero-preview--main {
    grid-row: auto;
  }

  .hero-preview:nth-child(n + 4) {
    display: none;
  }

  .games-grid-user-choice {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .games-list-user-choice {
    grid-template-columns: 1fr;
  }
}

/* Mobile Responsive */
@media screen and (max-width: 768px) {
  .container {
    padding: 0 16px;
  }

  .header__content {
    flex-direction: column;
    gap: 16px;
    align-items: center;
  }

  .header__logo {
    text-align: center;
  }

  .header__logo img {
    width: 130px;
    height: auto;
  }

  .header__search {
    width: 100%;
    max-width: 100%;
  }

  .header__search input {
    width: 100%;
  }

  .hero {
    padding: 28px 0 30px;
  }

  .hero__title {
    font-size: 32px;
    text-align: left;
  }

  .hero__description {
    font-size: 15px;
    text-align: left;
  }

  .hero__actions {
    gap: 10px;
  }

  .hero__button {
    flex: 1 1 190px;
  }

  .hero__showcase {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 120px 120px;
    min-height: 252px;
  }

  .hero-preview--main {
    grid-column: 1 / 3;
  }

  .hero-preview:nth-child(n + 4) {
    display: block;
  }

  .section__title {
    font-size: 24px;
    text-align: left;
  }

  .section__heading {
    display: block;
    margin-bottom: 18px;
  }

  .section__lead {
    margin-top: 8px;
    font-size: 14px;
  }

  .section__header {
    flex-direction: column;
    align-items: flex-start;
  }

  .user-choice__filters--desktop {
    display: none;
  }

  .user-choice__filters--mobile {
    display: block;
    width: 100%;
  }

  .user-choice__filters--mobile .sort-dropdown {
    width: 100%;
  }

  .user-choice__filters--mobile .sort-dropdown__button {
    width: 100%;
    justify-content: space-between;
  }

  .user-choice__filters--mobile .sort-dropdown__menu {
    width: 100%;
    left: 0;
    right: auto;
  }

  .game-card {
    grid-column: auto;
    grid-row: auto;
            aspect-ratio: 2;
  }

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

  .games-grid-popular {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .games-grid-user-choice {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .games-grid-popular .game-card:last-child {
    display: block;
  }
  
  /* Reset all special size classes for mobile */
  .games-grid-user-choice .game-card--big,
  .games-grid-user-choice .game-card--s1,
  .games-grid-user-choice .game-card--s2,
  .games-grid-user-choice .game-card--s3,
  .games-grid-user-choice .game-card--s4,
  .games-grid-user-choice .game-card--s5,
  .games-grid-user-choice .game-card--s6,
  .games-grid-user-choice .game-card--s7,
  .games-grid-user-choice .game-card--s8,
  .games-grid-user-choice .game-card--wide,
  .games-grid-user-choice .game-card--tall,
  .games-grid-user-choice .game-card--normal {
    grid-column: span 1;
    grid-row: span 1;
  }
  
  /* Mobile pattern - every 3rd card is taller */
  .games-grid-user-choice .game-card:nth-child(3n + 1) {
    grid-row: span 2;
  }

  .games-list-user-choice {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .game-card:nth-child(5n + 1) {
    aspect-ratio: 2;
    grid-column: 1 / 3;
  }

  .games-list {
    grid-template-columns: 1fr;
  }

  .sort-dropdown__menu {
    right: auto;
    left: 0;
  }
}
/* 
@media screen and (max-width: 480px) {
  .container {
    padding: 0 16px;
  }

  .header__logo {
    font-size: 16px;
  }

  .header__logo img {
    width: 40px;
    height: 40px;
  }

  .hero__title {
    font-size: 28px;
  }

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

  .games-grid-popular {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: auto;
    gap: 12px;
  }

  .games-grid-user-choice {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
  }

  .games-list-user-choice {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    grid-template-rows: auto;
    gap: 8px;
  }

  .game-card--big {
    grid-column: 1 / 3;
    grid-row: 1 / 3;
    aspect-ratio: 1;
  }

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

  .game-card--s2 {
    grid-column: 1 / 2;
    grid-row: 4 / 5;
    aspect-ratio: 1;
  }

  .game-card--s3 {
    grid-column: 2 / 3;
    grid-row: 4 / 5;
    aspect-ratio: 1;
  }

  .game-card--s4 {
    grid-column: 1 / 3;
    grid-row: 5 / 6;
  }

  .game-card--s5 {
    grid-column: 1 / 2;
    grid-row: 6 / 7;
    aspect-ratio: 1;
  }

  .game-card--s6 {
    grid-column: 2 / 3;
    grid-row: 6 / 7;
    aspect-ratio: 1;
  }

  .game-card--s7 {
    grid-column: 1 / 3;
    grid-row: 7 / 8;
    aspect-ratio: 0.5;
  }

  .game-card--s8 {
    grid-column: 1 / 2;
    grid-row: 8 / 9;
    aspect-ratio: 0.5;
  }

  .game-card--s9 {
    grid-column: 2 / 3;
    grid-row: 8 / 9;
    aspect-ratio: 1;
  }

  .game-card__title {
    font-size: 14px;
    padding: 12px;
  }
} */

/* Search Highlight */
.games-list__item.hidden {
  display: none;
}

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