:root {
  color-scheme: dark;
  --bg: #07090c;
  --surface: #0e1218;
  --surface-2: #141a22;
  --surface-3: #1a222d;
  --line: #29313c;
  --paper: #f5f6ef;
  --muted: #959eaa;
  --lime: #b8ff3d;
  --blue: #526cff;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }

html { min-width: 320px; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 72% -12%, rgba(82, 108, 255, 0.16), transparent 28rem),
    var(--bg);
  color: var(--paper);
}

body::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: linear-gradient(to bottom, black, transparent 60%);
  content: "";
}

a { color: inherit; }

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 3px;
}

.gallery-nav {
  width: min(1320px, calc(100% - 48px));
  height: 72px;
  margin: 16px auto 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  border-radius: 22px;
  background: rgba(14, 18, 24, 0.9);
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(18px);
}

.gallery-brand {
  text-decoration: none;
}

.gallery-brand .brand-type > span { color: var(--lime); }

.gallery-nav nav { display: flex; align-items: center; gap: 28px; }

.gallery-nav nav a {
  color: #9ea7b3;
  font-size: 14px;
  font-weight: 720;
  text-decoration: none;
}

.gallery-nav nav a:hover,
.gallery-nav nav a[aria-current="page"] { color: var(--paper); }

.gallery-nav nav .build-link {
  border-radius: 999px;
  background: var(--lime);
  padding: 10px 16px;
  color: #090b0d;
}

main {
  width: min(1320px, calc(100% - 48px));
  margin: 0 auto;
  padding: 86px 0 120px;
}

.gallery-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 52px;
}

.gallery-kicker {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 20px;
  color: var(--lime);
  font: 800 0.72rem/1 ui-monospace, SFMono-Regular, Consolas, monospace;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.gallery-kicker i { width: 22px; height: 1px; background: currentColor; }

.gallery-heading h1 {
  margin: 0;
  font-size: clamp(3.7rem, 8vw, 7.7rem);
  line-height: 0.85;
  letter-spacing: -0.08em;
}

.game-count {
  flex: 0 0 auto;
  margin: 0 0 8px;
  border-radius: 999px;
  background: var(--surface-2);
  padding: 8px 11px;
  color: #a1aab6;
  font: 700 0.69rem/1 ui-monospace, SFMono-Regular, Consolas, monospace;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.game-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 20px;
  background: var(--surface);
  text-decoration: none;
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.16);
  transition: background 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.game-card-main {
  min-width: 0;
  flex: 1;
  color: inherit;
  text-decoration: none;
}

.game-card:hover {
  background: var(--surface-2);
  transform: translateY(-5px);
  box-shadow: 0 26px 62px rgba(0, 0, 0, 0.3);
}

.game-preview {
  position: relative;
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
  overflow: hidden;
  margin: 8px 8px 0;
  border-radius: 14px;
  background: #141b25;
}

.game-preview::before {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(82, 108, 255, 0.15) 1px, transparent 1px), linear-gradient(90deg, rgba(82, 108, 255, 0.15) 1px, transparent 1px);
  background-size: 28px 28px;
  content: "";
}

.game-preview img {
  position: absolute;
  z-index: 2;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 260ms ease;
}

.game-card:hover .game-preview img { transform: scale(1.025); }
.game-preview.image-failed img { display: none; }

.preview-monogram {
  position: relative;
  z-index: 1;
  color: #526cff;
  font-size: clamp(3rem, 8vw, 6rem);
  font-weight: 950;
  letter-spacing: -0.08em;
  opacity: 0.75;
}

.game-type,
.play-chip {
  position: absolute;
  z-index: 3;
  top: 12px;
  border-radius: 999px;
  background: rgba(20, 26, 34, 0.9);
  padding: 7px 9px;
  color: #f5f6ef;
  font: 800 0.64rem/1 ui-monospace, SFMono-Regular, Consolas, monospace;
  letter-spacing: 0.06em;
  backdrop-filter: blur(8px);
}

.game-type { left: 12px; }
.play-chip { right: 12px; color: var(--lime); opacity: 0; transform: translateY(-4px); transition: opacity 160ms ease, transform 160ms ease; }
.game-card:hover .play-chip,
.game-card:focus-within .play-chip { opacity: 1; transform: translateY(0); }

.game-info { padding: 18px 18px 17px; }

.game-info h2 {
  overflow: hidden;
  margin: 0 0 8px;
  font-size: 21px;
  line-height: 1.1;
  letter-spacing: -0.035em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-info p {
  min-height: 44px;
  display: -webkit-box;
  overflow: hidden;
  margin: 0 0 15px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.game-info time {
  color: #66707d;
  font: 700 0.66rem/1 ui-monospace, SFMono-Regular, Consolas, monospace;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.game-card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  padding: 0 8px 8px;
}

.game-card-action {
  display: grid;
  min-height: 39px;
  place-items: center;
  border-radius: 11px;
  background: var(--surface-2);
  color: #b4bdc8;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.game-card-action:hover { background: var(--surface-3); color: var(--paper); }
.game-card-action.remix-action { color: var(--lime); }

.game-skeleton {
  min-height: 340px;
  overflow: hidden;
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.14);
}

.game-skeleton i,
.game-skeleton span,
.game-skeleton b {
  display: block;
  background: linear-gradient(90deg, #151b23, #202732, #151b23);
  background-size: 220% 100%;
  animation: skeleton 1.5s linear infinite;
}

.game-skeleton i { aspect-ratio: 16 / 9; margin: 8px 8px 0; border-radius: 14px; }
.game-skeleton span { width: 56%; height: 19px; margin: 19px 18px 12px; border-radius: 5px; }
.game-skeleton b { width: 78%; height: 36px; margin-left: 18px; border-radius: 5px; }

.game-grid.has-state { display: block; }

.gallery-state {
  min-height: 430px;
  display: grid;
  place-content: center;
  justify-items: center;
  border-radius: 24px;
  background: rgba(14, 18, 24, 0.86);
  padding: 36px;
  text-align: center;
}

.state-mark {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  margin-bottom: 22px;
  border-radius: 22px;
  background: #171e27;
  color: #090b0d;
  font-size: 24px;
  font-weight: 950;
  letter-spacing: -0.06em;
  transform: rotate(-6deg);
}

.state-mark img { width: 52px; height: 52px; }

.gallery-state h2 { margin: 0 0 8px; font-size: 30px; letter-spacing: -0.045em; }
.gallery-state p { max-width: 380px; margin: 0 0 24px; color: var(--muted); font-size: 15px; line-height: 1.55; }
.gallery-state a,
.gallery-state button { border: 0; border-radius: 999px; background: var(--paper); padding: 12px 17px; color: #090b0d; font: inherit; font-size: 14px; font-weight: 800; line-height: 1; text-decoration: none; cursor: pointer; }
.error-state .state-mark { background: #ff5b65; }

@keyframes skeleton { to { background-position: -220% 0; } }

@media (max-width: 980px) {
  .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 650px) {
  .gallery-nav,
  main { width: min(100% - 28px, 1320px); }
  .gallery-nav { height: 70px; }
  .gallery-brand { gap: 7px; }
  .gallery-brand .brand-symbol { width: 26px; height: 26px; }
  .gallery-brand .brand-type { font-size: 23px; }
  .gallery-nav nav { gap: 16px; }
  .gallery-nav nav > a:first-child { display: none; }
  .gallery-nav nav a { font-size: 12px; }
  .gallery-nav nav .build-link { padding: 9px 12px; }
  main { padding: 64px 0 80px; }
  .gallery-heading { display: block; margin-bottom: 36px; }
  .gallery-heading h1 { font-size: clamp(3.7rem, 18vw, 6rem); }
  .game-count { display: inline-flex; margin-top: 25px; }
  .game-grid { grid-template-columns: 1fr; }
  .play-chip { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
