:root {
  --header: #054248;
  --page: #087177;
  --panel: #063e43;
  --green: #2db155;
  --cyan: #2da6b1;
  --text-muted: #c6dfdf;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--page);
}

body {
  min-width: 320px;
  margin: 0;
  color: #fff;
  background: var(--page);
  font-family: Arial, "Helvetica Neue", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.header {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 76px;
  padding: 12px 24px;
  background: var(--header);
}

.logo {
  width: 145px;
  height: 44px;
  object-fit: contain;
}

.navigation {
  display: flex;
  flex: 1;
  gap: 3px;
  overflow-x: auto;
  scrollbar-width: none;
}

.navigation::-webkit-scrollbar {
  display: none;
}

.navigation button,
.language {
  flex: 0 0 auto;
  border: 0;
  color: #fff;
  background: transparent;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.navigation button {
  padding: 10px 8px;
}

.language {
  width: 76px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 20px;
  padding: 0 9px;
  color: #fff;
  background: #075760;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.08);
  color-scheme: dark;
  cursor: pointer;
}

.language option {
  color: #fff;
  background: var(--header);
}

.account {
  display: flex;
  align-items: center;
  gap: 10px;
}

.account button,
.more-button {
  min-height: 38px;
  border: 0;
  border-radius: 22px;
  padding: 0 24px;
  color: #fff;
  font-weight: 700;
}

.login {
  background: #176973;
}

.signup,
.more-button {
  background: var(--green);
}

.hero {
  position: relative;
  min-height: 245px;
  overflow: hidden;
  background: #043e43;
}

.hero-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.72;
}

.hero-content {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 245px;
  align-items: center;
  padding: 30px clamp(18px, 8vw, 12%);
  background: linear-gradient(
    90deg,
    rgba(4, 45, 48, 0.92),
    rgba(4, 45, 48, 0.34) 58%,
    transparent
  );
}

.hero-content p {
  max-width: 420px;
  margin: 0 0 18px;
  font-size: clamp(22px, 3vw, 38px);
  font-weight: 800;
  line-height: 1.1;
}

.hero-content button {
  min-width: 132px;
  min-height: 40px;
  border: 0;
  border-radius: 22px;
  color: #fff;
  background: var(--green);
  font-weight: 700;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 86px;
  padding: 14px 28px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(4, 66, 72, 0.68);
}

.toolbar h1 {
  margin: 0;
  font-size: 28px;
}

.search {
  display: flex;
  width: min(300px, 100%);
  height: 42px;
  margin-left: auto;
  overflow: hidden;
  border-radius: 22px;
  background: #075760;
}

.search input {
  width: 100%;
  min-width: 0;
  border: 0;
  padding: 0 16px;
  color: #fff;
  background: transparent;
  outline: 0;
}

.search input::placeholder {
  color: #b5d8da;
}

.search button {
  width: 48px;
  border: 0;
  color: #fff;
  background: var(--cyan);
  font-size: 19px;
}

.catalog {
  position: relative;
  isolation: isolate;
  min-height: 650px;
  padding: 16px;
  background: #05575d;
}

.catalog-background {
  position: absolute;
  z-index: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  background: #05575d;
}

.catalog::before {
  position: absolute;
  z-index: 1;
  inset: 0;
  content: "";
  background: linear-gradient(rgba(5, 87, 93, 0.34), rgba(5, 87, 93, 0.58));
  pointer-events: none;
}

.catalog > :not(.catalog-background) {
  position: relative;
  z-index: 2;
}

.tabs,
.filters {
  display: flex;
  gap: 8px;
  max-width: 1260px;
  margin: 0 auto 14px;
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar,
.filters::-webkit-scrollbar {
  display: none;
}

.tabs button,
.filters button {
  flex: 0 0 auto;
  min-height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 20px;
  padding: 0 18px;
  color: #fff;
  background: rgba(4, 63, 69, 0.78);
  font-size: 13px;
  font-weight: 700;
}

.tabs button[aria-selected="true"],
.filters button.is-active {
  background: var(--green);
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  max-width: 1260px;
  margin: 0 auto;
}

.game {
  position: relative;
  display: block;
  aspect-ratio: 1.6;
  overflow: hidden;
  border: 0;
  border-radius: 6px;
  padding: 0;
  color: #fff;
  background: var(--panel);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  text-align: left;
}

.game img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--panel);
  transition:
    transform 0.18s ease,
    opacity 0.18s ease;
}

.game img.is-broken {
  opacity: 0;
}

.game::after {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(transparent 42%, rgba(0, 24, 29, 0.9));
  pointer-events: none;
}

.game h2 {
  position: absolute;
  z-index: 1;
  right: 10px;
  bottom: 7px;
  left: 10px;
  margin: 0;
  font-size: 15px;
  line-height: 1.08;
}

.game:hover img {
  transform: scale(1.035);
}

.empty-state {
  grid-column: 1 / -1;
  padding: 42px 18px;
  color: var(--text-muted);
  text-align: center;
}

.more-button {
  display: block;
  min-width: 140px;
  margin: 20px auto 2px;
}

.more-button[hidden] {
  display: none;
}

.modal {
  position: fixed;
  z-index: 50;
  inset: 0;
  display: none;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.72);
}

.modal.is-open {
  display: grid;
}

.dialog {
  position: relative;
  width: min(460px, 100%);
  border: 1px solid #39717a;
  border-radius: 14px;
  padding: 34px 28px 28px;
  background: linear-gradient(135deg, #1c3a45, #08171c);
  box-shadow: 0 22px 80px rgba(0, 0, 0, 0.62);
  text-align: center;
}

.close-button {
  position: absolute;
  top: 10px;
  right: 12px;
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  font-size: 23px;
  line-height: 1;
}

.spinner {
  width: 56px;
  height: 56px;
  margin: 0 auto;
  border: 6px solid #315962;
  border-top-color: #2dc5c4;
  border-right-color: var(--green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.dialog h2 {
  margin: 18px 0 8px;
  font-size: 21px;
}
.dialog p {
  margin: 0;
  color: #bad2d5;
}

.progress-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 25px;
  color: #d1e8e9;
  font-size: 13px;
  text-align: left;
}

.progress-track {
  height: 9px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: 7px;
  background: #031216;
}

.progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
  transition: width 0.1s linear;
}

.retry-button {
  min-height: 38px;
  margin-top: 18px;
  border: 0;
  border-radius: 19px;
  padding: 0 28px;
  color: #fff;
  background: var(--green);
  font-weight: 700;
}

.dialog-error .spinner {
  border-color: #df5353;
  animation: none;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 24px clamp(18px, 5vw, 64px);
  color: var(--text-muted);
  background: #054248;
  font-size: 12px;
}

.footer strong {
  color: #fff;
}

@media (max-width: 900px) {
  .navigation {
    display: none;
  }
  .header {
    min-height: 62px;
    padding: 9px 13px;
  }
  .logo {
    width: 106px;
    height: 38px;
  }
  .account {
    margin-left: auto;
    gap: 7px;
  }
  .login {
    display: none;
  }
  .account button {
    min-height: 34px;
    padding: 0 16px;
    font-size: 12px;
  }
  .language {
    width: 64px;
    height: 34px;
    padding: 0 5px;
    font-size: 11px;
  }
  .hero,
  .hero-content {
    min-height: 170px;
  }
  .hero-content {
    padding: 24px 18px;
  }
  .hero-content > div {
    max-width: min(52%, 230px);
  }
  .hero-content p {
    font-size: clamp(18px, 5vw, 23px);
  }
  .toolbar {
    flex-wrap: wrap;
    min-height: 76px;
    padding: 12px;
  }
  .toolbar h1 {
    font-size: 23px;
  }
  .search {
    order: 2;
    width: 100%;
  }
  .catalog {
    min-height: 0;
    padding: 10px 12px 16px;
    background-attachment: scroll;
  }
  .tabs,
  .filters {
    margin-bottom: 10px;
  }
  .game-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }
  .game h2 {
    font-size: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .game img {
    transition: none;
  }
  .spinner {
    animation: none;
  }
  .progress-bar {
    transition: none;
  }
}
