html {
  visibility: hidden;
  opacity: 0;
  background: #000;
}
html.loaded {
  visibility: visible;
  opacity: 1;
  transition: opacity 0.5s ease-in;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Segoe UI", sans-serif;
}

body {
  height: 100vh;
  overflow: hidden;
  background: #000;
  display: flex;
  flex-direction: column;
  color: #fff;
  -webkit-tap-highlight-color: transparent;
}

.hyperdrive-nebula {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
  background: #000;
}
.hyperdrive-nebula::before,
.hyperdrive-nebula::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(72px);
  opacity: 0.45;
}
.hyperdrive-nebula::before {
  width: 55vmax;
  height: 55vmax;
  left: 10%;
  top: 15%;
  background: radial-gradient(circle, rgba(30, 80, 255, 0.35) 0%, transparent 70%);
  animation: gamesNebulaA 24s ease-in-out infinite alternate;
}
.hyperdrive-nebula::after {
  width: 50vmax;
  height: 50vmax;
  right: 5%;
  bottom: 10%;
  background: radial-gradient(circle, rgba(90, 40, 220, 0.3) 0%, transparent 70%);
  animation: gamesNebulaB 28s ease-in-out infinite alternate;
}
@keyframes gamesNebulaA {
  0% {
    transform: translate(0, 0) scale(1);
    opacity: 0.35;
  }
  100% {
    transform: translate(8vw, 6vh) scale(1.12);
    opacity: 0.5;
  }
}
@keyframes gamesNebulaB {
  0% {
    transform: translate(0, 0) scale(1);
    opacity: 0.3;
  }
  100% {
    transform: translate(-6vw, -5vh) scale(1.08);
    opacity: 0.45;
  }
}

canvas#starCanvas {
  position: fixed;
  inset: 0;
  z-index: 2;
  display: block;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .hyperdrive-nebula::before,
  .hyperdrive-nebula::after {
    animation: none;
  }
}

header {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 28px 24px 8px;
  flex-shrink: 0;
}

.logo-container {
  width: 220px;
  filter: drop-shadow(0 0 20px rgba(100, 181, 246, 0.6));
}
.logo-container svg,
.logo-container img {
  width: 100%;
  height: auto;
  display: block;
}

.games-title {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.9);
}

.games-toolbar {
  position: relative;
  z-index: 10;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 8px 24px 16px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

.games-search {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  padding: 14px 20px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: #fff;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.games-search::placeholder {
  color: rgba(255, 255, 255, 0.45);
}
.games-search:focus {
  border-color: rgba(100, 181, 246, 0.8);
  box-shadow: 0 0 24px rgba(100, 181, 246, 0.25);
}

.games-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.filter-btn {
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.85rem;
  cursor: pointer;
  touch-action: manipulation;
  transition: all 0.2s ease;
}
.filter-btn:hover,
.filter-btn:focus-visible {
  border-color: rgba(100, 181, 246, 0.6);
  color: #fff;
}
.filter-btn.active {
  background: rgba(100, 181, 246, 0.2);
  border-color: rgba(100, 181, 246, 0.8);
  color: #fff;
  box-shadow: 0 0 20px rgba(100, 181, 246, 0.25);
}

.games-main {
  position: relative;
  z-index: 10;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 24px 32px;
  -webkit-overflow-scrolling: touch;
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 18px;
  max-width: 1400px;
  margin: 0 auto;
}

.game-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  text-decoration: none;
  color: inherit;
  padding: 22px 14px 18px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  transform-style: preserve-3d;
  transition: transform 0.35s cubic-bezier(0.2, 1, 0.3, 1), box-shadow 0.3s ease,
    background 0.3s ease, border-color 0.3s ease;
  touch-action: manipulation;
  cursor: pointer;
  opacity: 0;
  transform: translateY(12px);
}
.game-card.is-visible {
  opacity: 1;
  transform: translateY(0);
}
.game-card:hover,
.game-card:focus-visible {
  background: rgba(100, 181, 246, 0.12);
  border-color: rgba(100, 181, 246, 0.75);
  box-shadow: 0 0 40px rgba(100, 181, 246, 0.35);
  transform: translateY(-4px);
}
.game-card:active {
  transform: scale(0.97);
}

.game-card-icon {
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.6rem;
  margin-bottom: 14px;
  transition: transform 0.35s ease, filter 0.35s ease;
}
.game-card:hover .game-card-icon,
.game-card:focus-visible .game-card-icon {
  transform: scale(1.1);
  filter: drop-shadow(0 0 16px rgba(100, 181, 246, 0.7));
}

.game-card-name {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.3;
  color: #fff;
  letter-spacing: 0.02em;
}

.game-card-tag {
  margin-top: 8px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.45);
}

.games-empty,
.games-status {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 1rem;
  color: rgba(255, 255, 255, 0.55);
  font-size: 1.05rem;
}
.games-status.is-error {
  color: rgba(255, 140, 140, 0.9);
}

.game-card.is-hidden {
  display: none;
}

@media (max-width: 700px) {
  .games-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
  }
  .game-card-icon {
    width: 56px;
    height: 56px;
    font-size: 2rem;
  }
}
