:root {
  color-scheme: dark;
  --bg: #030816;
  --panel: #111a2a;
  --panel-2: #172235;
  --line: #263650;
  --text: #f5f8ff;
  --muted: #9aa9c0;
  --accent: #35b9ef;
  --green: #18d66b;
  --violet: #735cff;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.topbar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 50;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 22px;
  align-items: center;
  height: 64px;
  padding: 0 28px;
  background: linear-gradient(180deg, rgba(3, 8, 22, .94), rgba(3, 8, 22, .62));
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 950;
  font-size: 22px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 2px solid #fff;
  border-radius: 9px;
  letter-spacing: 0;
}

.brand-text { color: var(--accent); }

.main-nav {
  display: flex;
  align-items: center;
  gap: 26px;
  color: #c7d2e3;
  font-size: 14px;
  font-weight: 800;
}

.main-nav a:hover { color: #fff; }

.icon-btn,
.desktop-link {
  display: inline-grid;
  place-items: center;
  min-height: 38px;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 9px;
  background: rgba(21, 32, 49, .76);
  color: #fff;
  padding: 0 15px;
  font-weight: 900;
}

.icon-btn { width: 42px; padding: 0; font-size: 24px; }
.desktop-link { background: #2baee7; color: #fff; }
.desktop-link[aria-disabled="true"],
.primary-btn[aria-disabled="true"],
.download-btn[aria-disabled="true"] { pointer-events: none; opacity: .55; }

main { min-height: 100vh; }

.hero {
  position: relative;
  height: 760px;
  min-height: 760px;
  display: grid;
  align-items: center;
  padding: 90px 52px 100px;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(3,8,22,.98) 0%, rgba(3,8,22,.86) 30%, rgba(3,8,22,.28) 68%, rgba(3,8,22,.82) 100%),
    linear-gradient(180deg, rgba(3,8,22,.12), var(--bg) 100%),
    var(--hero-image);
  background-position: center;
  background-size: cover;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 210px;
  background: linear-gradient(180deg, transparent, var(--bg));
}

.hero-copy {
  position: relative;
  z-index: 1;
  max-width: 650px;
  padding-top: 70px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 950;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0 0 18px;
  display: -webkit-box;
  overflow: hidden;
  font-size: clamp(44px, 6vw, 78px);
  line-height: .95;
  letter-spacing: 0;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.hero p {
  display: -webkit-box;
  overflow: hidden;
  max-width: 610px;
  color: var(--muted);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.6;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}

.hero-meta,
.hero-actions,
.detail-meta,
.detail-actions,
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.badge {
  display: inline-grid;
  min-height: 30px;
  place-items: center;
  border-radius: 8px;
  background: #213049;
  color: #d8e5f7;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 950;
}

.badge.version,
.badge.free { background: #08c964; color: #fff; box-shadow: 0 0 22px rgba(8, 201, 100, .35); }
.badge.paid { background: #2a3348; color: #ffe08a; }
.badge.soft { background: #202d41; color: #d7e2f1; }

.primary-btn,
.text-btn,
.download-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 54px;
  border-radius: 8px;
  padding: 0 24px;
  font-size: 16px;
  font-weight: 950;
}

.primary-btn,
.download-btn {
  background: var(--accent);
  color: #fff;
}

.text-btn { color: #c7d2e3; }
.hero-actions { margin-top: 28px; gap: 18px; }

.hero-dots {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: 78px;
  display: flex;
  gap: 9px;
  transform: translateX(-50%);
}

.hero-dots button {
  width: 9px;
  height: 9px;
  border: 0;
  border-radius: 999px;
  background: rgba(255,255,255,.32);
  padding: 0;
}

.hero-dots .active {
  width: 30px;
  background: var(--accent);
}

.hero-dots button:hover {
  background: #fff;
}

.hero-arrows {
  position: absolute;
  z-index: 2;
  right: 52px;
  bottom: 64px;
  display: flex;
  gap: 12px;
}

.hero-arrows button {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(255,255,255,.55);
  border-radius: 999px;
  background: rgba(255,255,255,.14);
  color: #fff;
  font-size: 34px;
  line-height: 1;
  backdrop-filter: blur(8px);
}

.hero-arrows button:hover {
  border-color: #fff;
  background: rgba(255,255,255,.24);
}

.grid-section,
.article-section,
.gallery-section,
.install-info,
.recommended {
  width: min(1620px, calc(100% - 96px));
  margin: 0 auto;
}

.grid-section {
  position: relative;
  z-index: 3;
  padding: 54px 0 24px;
}

.games-page {
  padding-top: 112px;
}

.browse-page {
  width: min(1720px, calc(100% - 56px));
}

.browse-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 28px;
}

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

.browse-tools {
  display: flex;
  align-items: center;
  gap: 20px;
  color: #9fb0c8;
  font-size: 14px;
  font-weight: 850;
}

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

.browse-filter input {
  width: min(260px, 34vw);
  min-height: 38px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 8px;
  background: #111a2a;
  color: #fff;
  padding: 0 12px;
  outline: 0;
}

.browse-filter input:focus {
  border-color: rgba(53,185,239,.6);
}

.browse-filter button {
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  background: #1b2940;
  color: #dce8f5;
  padding: 0 14px;
  font-weight: 900;
}

.browse-filter button:hover {
  background: var(--accent);
  color: #fff;
}

.browse-tools i {
  width: 1px;
  height: 20px;
  background: #1d2b43;
}

.browse-tools a.active,
.browse-tools a:hover {
  color: #fff;
}

.category-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

.category-card {
  position: relative;
  display: flex;
  min-height: 86px;
  align-items: center;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 7px;
  background: #121d31;
  padding: 18px;
}

.category-card.active,
.category-card:hover {
  border-color: rgba(53,185,239,.45);
  background: #17243a;
}

.category-card span {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 4px;
}

.category-card strong {
  font-size: 14px;
}

.category-card small {
  color: var(--muted);
  font-weight: 850;
}

.category-card img {
  position: absolute;
  right: 14px;
  bottom: -24px;
  width: 78px;
  aspect-ratio: 2 / 3;
  border-radius: 5px;
  object-fit: cover;
  transform: rotate(8deg);
  box-shadow: 0 18px 38px rgba(0,0,0,.34);
}

.browse-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 22px;
  margin-bottom: 54px;
}

.top-week {
  margin: 0 0 36px;
  border-radius: 7px;
  background: #121d31;
  padding: 24px;
}

.top-week h2 {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 20px;
  font-size: 18px;
}

.top-week-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px 64px;
}

.top-game {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 12px;
  align-items: center;
  min-width: 0;
}

.top-game img,
.top-game-fallback {
  width: 56px;
  aspect-ratio: 2 / 3;
  border-radius: 5px;
  object-fit: cover;
  background: #0b1220;
}

.top-game-fallback {
  display: grid;
  place-items: center;
  color: var(--accent);
  font-weight: 950;
}

.top-game strong {
  display: -webkit-box;
  overflow: hidden;
  margin-bottom: 8px;
  font-size: 14px;
  line-height: 1.25;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.top-game small {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.top-game b {
  border-radius: 5px;
  background: rgba(255, 132, 0, .14);
  color: #ff8b31;
  padding: 4px 7px;
  font-size: 11px;
}

.top-game b + b {
  background: rgba(153, 78, 255, .16);
  color: #b16cff;
}

.browse-list-head {
  margin-top: 6px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.section-head h2,
.section-head h1,
.article-section h2,
.gallery-section h2 {
  margin: 0;
  font-size: 26px;
}

.section-subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.view-all {
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  padding: 10px 16px;
  font-weight: 900;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 34px;
}

.pagination a,
.page-gap {
  display: inline-grid;
  min-width: 42px;
  min-height: 40px;
  place-items: center;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 8px;
  background: #111a2a;
  color: #dce8f5;
  padding: 0 13px;
  font-size: 14px;
  font-weight: 900;
}

.pagination a.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.pagination a.disabled {
  pointer-events: none;
  opacity: .42;
}

.page-gap {
  min-width: 28px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  padding: 0 4px;
}

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

.poster-card {
  position: relative;
  display: block;
  overflow: hidden;
  aspect-ratio: 2 / 3;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 6px;
  background: #111a2a;
  box-shadow: 0 18px 46px rgba(0,0,0,.2);
}

.poster-card img {
  width: 100%;
  height: 100%;
  aspect-ratio: 2 / 3;
  display: block;
  object-fit: cover;
  color: transparent;
  transition: transform .18s ease;
}

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

.poster-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(3,8,22,0) 25%, rgba(3,8,22,.92) 100%);
  opacity: 0;
  transition: opacity .18s ease;
  pointer-events: none;
}

.poster-card:hover::after,
.poster-card:focus-visible::after {
  opacity: 1;
}

.poster-version {
  position: absolute;
  z-index: 2;
  top: 12px;
  right: 10px;
  display: inline-grid;
  min-height: 28px;
  place-items: center;
  border-radius: 6px;
  background: #13d767;
  color: #fff;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 950;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity .18s ease, transform .18s ease;
}

.poster-hover {
  position: absolute;
  z-index: 2;
  inset: auto 12px 12px;
  display: grid;
  gap: 6px;
  color: #fff;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .18s ease, transform .18s ease;
}

.poster-card:hover .poster-version,
.poster-card:hover .poster-hover,
.poster-card:focus-visible .poster-version,
.poster-card:focus-visible .poster-hover {
  opacity: 1;
  transform: translateY(0);
}

.poster-genre {
  color: #9fe3ff;
  font-size: 12px;
  font-weight: 950;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.poster-hover strong {
  display: -webkit-box;
  overflow: hidden;
  font-size: 15px;
  line-height: 1.15;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.poster-stats {
  display: flex;
  gap: 10px;
  color: #dce8f5;
  font-size: 13px;
  font-weight: 850;
}

.poster-stats span + span {
  position: relative;
}

.poster-stats span + span::before {
  content: "";
  position: absolute;
  top: 2px;
  bottom: 2px;
  left: -6px;
  width: 1px;
  background: rgba(255,255,255,.38);
}

.poster-fallback {
  display: grid;
  width: 100%;
  aspect-ratio: 2 / 3;
  place-items: center;
  color: var(--accent);
  font-size: 42px;
  font-weight: 950;
}

.poster-card.image-missing img {
  display: none;
}

.poster-card.image-missing::before {
  content: "ggsub";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--accent);
  font-size: 24px;
  font-weight: 950;
}

.guide-band {
  width: min(1450px, calc(100% - 96px));
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  margin: 56px auto 86px;
}

.guide-band article,
.info-card {
  border-radius: 18px;
  background: var(--panel);
  padding: 32px;
}

.guide-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 13px;
  background: #102f65;
  color: #4096ff;
  font-weight: 950;
}

.guide-icon.purple { background: #211d58; color: #7e6bff; }
.guide-band p,
.info-card p { color: var(--muted); line-height: 1.7; }

.detail-view {
  padding: 82px 0 70px;
}

.detail-hero {
  min-height: 560px;
  background:
    linear-gradient(90deg, var(--bg) 0%, rgba(3,8,22,.86) 34%, rgba(3,8,22,.5) 100%),
    linear-gradient(180deg, rgba(3,8,22,.35), var(--bg) 100%),
    var(--hero-image);
  background-position: center;
  background-size: cover;
}

.breadcrumb,
.detail-layout {
  width: min(1450px, calc(100% - 96px));
  margin: 0 auto;
}

.breadcrumb {
  display: flex;
  gap: 10px;
  color: var(--muted);
  padding: 12px 0 20px;
}

.breadcrumb strong { color: #fff; }

.detail-layout {
  display: grid;
  grid-template-columns: minmax(360px, 460px) minmax(0, 1fr);
  gap: 48px;
}

.detail-side {
  display: grid;
  gap: 18px;
  align-content: start;
}

.detail-cover {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 7px;
  object-fit: cover;
}

.thumbnail-switcher {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.thumbnail-switcher button {
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border: 2px solid transparent;
  border-radius: 7px;
  background: #1d2a3e;
  padding: 0;
}

.thumbnail-switcher button.active {
  border-color: var(--accent);
}

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

.detail-main {
  padding-top: 8px;
}

.muted-title {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 20px;
  font-weight: 900;
}

.detail-main h1 {
  margin: 0 0 18px;
  font-size: 38px;
  line-height: 1.1;
}

.detail-actions { margin: 26px 0 18px; }

.chip-btn {
  min-height: 42px;
  border: 0;
  border-radius: 999px;
  background: #1b2940;
  color: var(--muted);
  padding: 0 18px;
  font-weight: 900;
}

.detail-desc {
  max-width: 1080px;
  color: var(--muted);
  font-size: 18px;
  font-weight: 650;
  line-height: 1.7;
}

.fact-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 22px 0;
}

.fact-row span,
.tag-row span {
  border-radius: 7px;
  background: #1b2940;
  padding: 9px 13px;
}

.fact-row small {
  color: var(--muted);
  margin-right: 8px;
}

.tag-row { margin-bottom: 26px; }

.download-btn {
  width: 168px;
}

.article-section {
  padding: 44px 0 20px;
}

.article-section p {
  color: #d7e2f1;
  font-size: 18px;
  line-height: 1.8;
}

.gallery-section {
  padding: 28px 0 54px;
  text-align: center;
}

.screenshot-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 28px;
}

.screenshot-row img {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  object-fit: cover;
}

.install-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  margin-bottom: 54px;
}

.card-head {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 28px;
}

.card-head h2,
.card-head p {
  margin: 0;
}

.info-card ol,
.info-card ul {
  color: #dce8f5;
  line-height: 1.8;
}

.note-box {
  margin: 24px -32px -32px;
  background: #192539;
  padding: 24px 32px;
}

.info-card dl {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 24px;
}

.info-card dt { color: var(--muted); }
.info-card dd { margin: 0; text-align: right; font-weight: 950; }

.search-panel {
  position: fixed;
  z-index: 70;
  top: 72px;
  right: 28px;
  width: min(420px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #0e1727;
  box-shadow: 0 24px 70px rgba(0,0,0,.52);
  padding: 16px;
}

.search-panel label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.search-panel input {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #09101d;
  color: #fff;
  padding: 0 12px;
  outline: 0;
}

.search-results {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.search-results a {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  border-radius: 8px;
  background: #182337;
  padding: 10px 12px;
}

.search-results span,
.search-empty { color: var(--muted); }

.site-footer {
  width: min(1620px, calc(100% - 96px));
  display: grid;
  justify-items: center;
  gap: 20px;
  margin: 72px auto 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  padding: 54px 0 40px;
  text-align: center;
}

.footer-logo {
  display: inline-grid;
  justify-items: center;
  gap: 8px;
  color: var(--accent);
  font-size: 34px;
  font-weight: 950;
  line-height: 1;
  text-transform: uppercase;
}

.footer-logo-mark {
  display: grid;
  place-items: center;
  width: 92px;
  height: 92px;
  border: 3px solid var(--accent);
  border-radius: 22px;
  background: radial-gradient(circle at 50% 35%, rgba(53, 185, 239, .24), rgba(17, 26, 42, .9));
  color: #fff;
  font-size: 42px;
  box-shadow: 0 0 42px rgba(53, 185, 239, .18);
}

.site-footer p {
  max-width: 760px;
  margin: 0;
  color: #b9cef0;
  font-size: 18px;
  line-height: 1.6;
}

.site-footer a:hover {
  color: #fff;
}

.site-footer small {
  color: #8fa3c0;
}

.missing,
.empty-state {
  width: min(720px, calc(100% - 48px));
  margin: 120px auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  padding: 40px;
  text-align: center;
}

@media (max-width: 900px) {
  .topbar {
    grid-template-columns: auto 1fr auto;
    padding: 0 16px;
  }

  .main-nav { display: none; }
  .desktop-link { display: none; }
  .hero {
    height: 680px;
    min-height: 680px;
    padding: 88px 22px 96px;
  }
  .hero-arrows {
    right: 22px;
    bottom: 28px;
  }
  .hero-arrows button {
    width: 42px;
    height: 42px;
  }
  .grid-section,
  .article-section,
  .gallery-section,
  .install-info,
  .recommended,
  .site-footer,
  .breadcrumb,
  .detail-layout {
    width: min(100% - 32px, 1450px);
  }

  .browse-page { width: min(100% - 32px, 1450px); }
  .browse-head { align-items: flex-start; flex-direction: column; }
  .browse-tools { width: 100%; gap: 14px; }
  .browse-filter { flex: 1; }
  .browse-filter input { width: 100%; }
  .category-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .browse-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 34px; }
  .top-week { padding: 18px; }
  .top-week-grid { grid-template-columns: 1fr; gap: 14px; }
  .poster-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
  .detail-layout,
  .install-info,
  .screenshot-row { grid-template-columns: 1fr; }
  .site-footer { margin-top: 46px; }
  .detail-cover { max-width: none; }
  .detail-main h1 { font-size: 32px; }
}

@media (max-width: 560px) {
  .poster-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .category-strip { grid-template-columns: 1fr; }
  .browse-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .category-card { min-height: 76px; }
}
