:root {
  --bg: #090312;
  --bg-2: #12051f;
  --bg-3: #170725;
  --panel: rgba(15, 10, 31, 0.88);
  --panel-strong: rgba(18, 11, 35, 0.96);
  --line: rgba(112, 76, 180, 0.34);
  --line-strong: rgba(255, 74, 173, 0.44);
  --text: #f6f3ff;
  --muted: #a89ac8;
  --cyan: #42f5ff;
  --pink: #ff4aad;
  --orange: #ff8a1f;
  --green: #68ff9b;
  --yellow: #ffe667;
  --shadow-soft: 0 24px 48px rgba(1, 0, 9, 0.42);
  --shadow-card: 0 18px 34px rgba(0, 0, 0, 0.38);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background-color: var(--bg);
}

body {
  position: relative;
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: "Manrope", sans-serif;
  color: var(--text);
  background-color: var(--bg);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at top left, rgba(66, 245, 255, 0.16), transparent 22%),
    radial-gradient(circle at top right, rgba(255, 74, 173, 0.16), transparent 28%),
    linear-gradient(180deg, #0a0313 0%, #11051d 35%, #07020f 100%),
    linear-gradient(rgba(66, 245, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 74, 173, 0.04) 1px, transparent 1px);
  background-size:
    auto,
    auto,
    auto,
    26px 26px,
    26px 26px;
  background-position:
    top left,
    top right,
    top center,
    top center,
    top center;
  background-repeat: no-repeat, no-repeat, no-repeat, repeat, repeat;
  opacity: 0.55;
}

a {
  color: inherit;
}

button,
input,
select {
  font: inherit;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Chakra Petch", sans-serif;
  letter-spacing: -0.03em;
}

.page-shell {
  position: relative;
  z-index: 1;
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 20px 0 48px;
}

.compact-hero-copy,
.filter-panel,
.genre-panel,
.results-head,
.status-box,
.game-card,
.game-modal-dialog {
  background: linear-gradient(180deg, rgba(18, 11, 35, 0.94), rgba(10, 6, 22, 0.94));
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}

.compact-hero {
  margin-bottom: 18px;
}

.compact-hero-copy {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-xl);
  padding: 28px 30px;
}

.compact-hero-copy::before,
.compact-hero-copy::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(18px);
}

.compact-hero-copy::before {
  width: 260px;
  height: 260px;
  right: -90px;
  top: -80px;
  background: radial-gradient(circle, rgba(255, 74, 173, 0.28) 0%, rgba(255, 74, 173, 0) 70%);
}

.compact-hero-copy::after {
  width: 220px;
  height: 220px;
  left: -70px;
  bottom: -90px;
  background: radial-gradient(circle, rgba(66, 245, 255, 0.2) 0%, rgba(66, 245, 255, 0) 72%);
}

.hero-topline {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) auto;
  gap: 24px;
  align-items: start;
}

.hero-copy {
  display: grid;
  gap: 16px;
}

.eyebrow,
.results-kicker,
.stat-label,
.gallery-title {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  color: var(--cyan);
}

h1 {
  font-size: clamp(2.6rem, 5vw, 4.6rem);
  line-height: 0.9;
  text-transform: uppercase;
}

.compact-text {
  margin: 0;
  max-width: 58ch;
  color: var(--muted);
  line-height: 1.7;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(140px, 1fr));
  gap: 12px;
}

.stat-card {
  padding: 16px 18px;
  min-width: 150px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(16, 10, 34, 0.92), rgba(11, 7, 22, 0.92));
  border: 1px solid rgba(66, 245, 255, 0.18);
}

.stat-card strong {
  display: block;
  margin-top: 4px;
  font-size: 1.2rem;
  font-weight: 800;
}

.mode-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.mode-button,
.genre-filter-button {
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(20, 12, 37, 0.82);
  color: var(--muted);
  cursor: pointer;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    color 160ms ease,
    background 160ms ease;
}

.mode-button {
  padding: 11px 16px;
  font-weight: 700;
}

.mode-button:hover,
.genre-filter-button:hover {
  transform: translateY(-1px);
  color: var(--text);
  border-color: rgba(66, 245, 255, 0.42);
  box-shadow: 0 0 0 1px rgba(66, 245, 255, 0.08), 0 12px 24px rgba(0, 0, 0, 0.24);
}

.mode-button.is-active,
.genre-filter-button.is-active {
  color: #08111a;
  background: linear-gradient(135deg, var(--cyan), #8f7bff);
  border-color: transparent;
}

.catalog-layout {
  display: grid;
  grid-template-columns: minmax(290px, 330px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.catalog-sidebar {
  position: sticky;
  top: 16px;
  display: grid;
  gap: 18px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding-right: 6px;
}

.catalog-sidebar::-webkit-scrollbar,
.genre-filter-group::-webkit-scrollbar,
.game-modal-dialog::-webkit-scrollbar {
  width: 10px;
}

.catalog-sidebar::-webkit-scrollbar-thumb,
.genre-filter-group::-webkit-scrollbar-thumb,
.game-modal-dialog::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(255, 74, 173, 0.65), rgba(66, 245, 255, 0.65));
  border-radius: 999px;
}

.filter-panel,
.genre-panel,
.results-head,
.status-box {
  border-radius: var(--radius-lg);
}

.filter-panel,
.genre-panel {
  padding: 20px;
}

.panel-head,
.genre-panel-head {
  display: grid;
  gap: 6px;
  margin-bottom: 16px;
}

.panel-head h2,
.genre-panel-head h2,
.results-head h2 {
  font-size: 1.85rem;
  line-height: 0.95;
  text-transform: uppercase;
}

.panel-head p,
.genre-panel-head p,
.results-head p,
.search-box span,
.select-box span,
.status-box {
  margin: 0;
  color: var(--muted);
}

.controls {
  display: grid;
  gap: 14px;
}

.search-box,
.select-box {
  display: grid;
  gap: 8px;
}

input,
select {
  width: 100%;
  min-height: 52px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(9, 6, 20, 0.92);
  color: var(--text);
  outline: none;
}

input::placeholder {
  color: #7c70a0;
}

input:focus,
select:focus {
  border-color: rgba(66, 245, 255, 0.58);
  box-shadow: 0 0 0 4px rgba(66, 245, 255, 0.12);
}

.refresh-button,
.card-link,
.description-toggle {
  cursor: pointer;
  text-decoration: none;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

.refresh-button {
  min-height: 52px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--pink), #813bff);
  color: #fff8ff;
  font-weight: 800;
  box-shadow: 0 18px 30px rgba(129, 59, 255, 0.28);
}

.refresh-button:hover,
.card-link:hover,
.description-toggle:hover {
  transform: translateY(-1px);
}

.genre-filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: min(46vh, 430px);
  overflow-y: auto;
  padding-right: 4px;
}

.genre-filter-button {
  padding: 7px 11px;
  font-size: 0.74rem;
  line-height: 1;
  font-weight: 700;
}

.catalog-main {
  display: grid;
  gap: 16px;
}

.results-head {
  padding: 22px 24px;
  position: relative;
  overflow: hidden;
}

.results-head::after {
  content: "";
  position: absolute;
  inset: auto -30px -40px auto;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(255, 138, 31, 0.22) 0%, rgba(255, 138, 31, 0) 70%);
  border-radius: 50%;
}

.results-head #resultSummary {
  margin-top: 10px;
  font-size: 0.98rem;
}

.status-box {
  padding: 18px 20px;
}

.status-box.hidden {
  display: none;
}

.cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.compact-card {
  overflow: hidden;
  border-radius: 20px;
  cursor: pointer;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease;
}

.compact-card:hover {
  transform: translateY(-4px);
  border-color: rgba(66, 245, 255, 0.44);
  box-shadow: var(--shadow-card);
}

.card-media {
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: linear-gradient(180deg, #160927 0%, #0a0617 100%);
}

.card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 220ms ease;
}

.compact-card:hover .card-image {
  transform: scale(1.03);
}

.card-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 12px;
  background:
    linear-gradient(180deg, rgba(6, 4, 12, 0.64) 0%, rgba(6, 4, 12, 0.18) 30%, rgba(6, 4, 12, 0) 54%);
}

.card-badges,
.platform-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.card-badges {
  max-width: calc(100% - 64px);
}

.card-badge,
.rank-badge,
.chip,
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 27px;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
}

.card-badge,
.rank-badge {
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.22);
}

.card-badge-genre {
  background: rgba(10, 9, 20, 0.76);
  color: #f7f4ff;
  font-size: 0.66rem;
  padding-inline: 8px;
}

.platform-badge {
  color: #090312;
}

.platform-badge-xbox {
  background: rgba(104, 255, 155, 0.96);
}

.platform-badge-pc {
  background: rgba(66, 245, 255, 0.96);
}

.platform-badge-cloud {
  background: rgba(255, 230, 103, 0.96);
}

.platform-badge-default {
  background: rgba(255, 255, 255, 0.92);
}

.rank-badge {
  background: linear-gradient(135deg, rgba(255, 138, 31, 0.96), rgba(255, 102, 0, 0.96));
  color: #220800;
  border-color: rgba(255, 196, 145, 0.44);
}

.card-body {
  display: grid;
  gap: 8px;
  padding: 16px 16px 18px;
  background: linear-gradient(180deg, rgba(17, 11, 31, 0.96), rgba(10, 7, 19, 0.98));
}

.card-title {
  font-size: 1.22rem;
  line-height: 1.02;
  text-transform: uppercase;
}

.game-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(2, 1, 8, 0.72);
  backdrop-filter: blur(10px);
}

.game-modal.hidden,
.description-toggle.hidden {
  display: none;
}

.game-modal-dialog {
  position: relative;
  width: min(1120px, 100%);
  max-height: 90vh;
  overflow: auto;
  border-radius: 28px;
  padding: 22px;
  background: linear-gradient(180deg, rgba(19, 12, 37, 0.98), rgba(9, 5, 18, 0.98));
}

.game-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(18, 11, 35, 0.9);
  color: var(--text);
  font-size: 1.8rem;
  cursor: pointer;
}

.game-modal-hero {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(0, 1.2fr);
  gap: 20px;
}

.game-modal-cover {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 20px;
  border: 1px solid var(--line);
}

.game-modal-summary {
  display: grid;
  align-content: start;
  gap: 14px;
}

.card-meta,
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  background: rgba(16, 11, 30, 0.88);
  color: var(--text);
  border: 1px solid var(--line);
}

.tag {
  background: rgba(66, 245, 255, 0.1);
  color: var(--cyan);
  border: 1px solid rgba(66, 245, 255, 0.16);
}

.game-modal-title {
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 0.92;
  text-transform: uppercase;
}

.game-modal-genre,
.game-modal-description {
  margin: 0;
}

.game-modal-genre {
  color: var(--pink);
  font-weight: 700;
}

.game-modal-description-block {
  display: grid;
  gap: 10px;
}

.game-modal-description {
  color: var(--muted);
  line-height: 1.75;
}

.description-toggle {
  justify-self: start;
  padding: 9px 12px;
  border-radius: 999px;
  border: 1px solid rgba(66, 245, 255, 0.24);
  background: rgba(66, 245, 255, 0.08);
  color: var(--cyan);
  font-weight: 700;
}

.details {
  margin: 0;
  display: grid;
  gap: 10px;
}

.details dt {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.82rem;
}

.details dd {
  margin: 0;
}

.card-link {
  justify-self: start;
  padding: 13px 16px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--pink), #8d44ff);
  color: #fff7ff;
  font-weight: 800;
}

.gallery-block {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

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

.modal-gallery-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.gallery-item {
  display: block;
  aspect-ratio: 16 / 10;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: rgba(15, 10, 28, 0.8);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gallery-empty {
  padding: 12px 14px;
  border-radius: 12px;
  color: var(--muted);
  background: rgba(18, 11, 35, 0.88);
  border: 1px dashed var(--line);
  font-size: 0.92rem;
}

@media (max-width: 1320px) {
  .cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1080px) {
  .catalog-layout,
  .hero-topline {
    grid-template-columns: 1fr;
  }

  .catalog-sidebar {
    position: static;
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

  .hero-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 840px) {
  .page-shell {
    width: min(100% - 20px, 1440px);
  }

  .cards,
  .modal-gallery-grid,
  .game-modal-hero {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .page-shell {
    padding-top: 14px;
  }

  .compact-hero-copy,
  .filter-panel,
  .genre-panel,
  .results-head,
  .status-box,
  .game-modal-dialog {
    padding: 18px;
    border-radius: 20px;
  }

  .hero-stats,
  .cards,
  .modal-gallery-grid,
  .gallery-grid,
  .game-modal-hero {
    grid-template-columns: 1fr;
  }

  .game-modal {
    padding: 12px;
  }

  .card-overlay {
    padding: 10px;
  }

  .card-badges {
    max-width: calc(100% - 56px);
  }
}
