:root {
  color-scheme: dark;
  --bg: #10131f;
  --panel: #171b2a;
  --panel-2: #202638;
  --text: #f8f9ff;
  --muted: #aeb7cf;
  --line: rgba(255, 255, 255, 0.12);
  --accent: #31d6b5;
  --accent-2: #ffcc4d;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
  scroll-behavior: smooth;
}

body {
  min-width: 0;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 10% 0%, rgba(49, 214, 181, 0.16), transparent 18rem),
    linear-gradient(180deg, #10131f 0%, #111827 55%, #0f111a 100%);
  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;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: auto minmax(9rem, 22rem);
  gap: 0.8rem;
  align-items: center;
  width: 100%;
  padding: max(0.75rem, env(safe-area-inset-top)) max(0.85rem, env(safe-area-inset-right)) 0.75rem max(0.85rem, env(safe-area-inset-left));
  background: rgba(16, 19, 31, 0.9);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.brand-mark {
  display: grid;
  width: 2.35rem;
  height: 2.35rem;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 0.55rem;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #10131f;
  font-weight: 950;
}

.brand strong,
.brand small {
  display: block;
  line-height: 1;
}

.brand small,
.eyebrow,
.quick-stats,
.game-meta {
  color: var(--muted);
}

.search input {
  width: 100%;
  min-height: 2.55rem;
  padding: 0 0.85rem;
  background: #0d101a;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  outline: 0;
}

.search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(49, 214, 181, 0.14);
}

main {
  width: min(100%, 1240px);
  margin: 0 auto;
  padding: 0.95rem max(0.85rem, env(safe-area-inset-right)) 1.4rem max(0.85rem, env(safe-area-inset-left));
}

.catalog-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.8rem;
}

.eyebrow {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.65rem, 7vw, 3rem);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.05rem, 4.5vw, 1.55rem);
  letter-spacing: 0;
}

.quick-stats {
  display: flex;
  gap: 0.45rem;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}

.quick-stats span {
  flex: 0 0 auto;
  padding: 0.42rem 0.62rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
}

.player-shell {
  width: 100%;
  max-width: 100%;
  margin: 0 0 1rem;
  padding: 0.65rem;
  overflow: hidden;
  background: rgba(23, 27, 42, 0.96);
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  box-shadow: var(--shadow);
}

.player-shell.is-hidden {
  display: none;
}

.player-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 0.55rem;
}

.close-player {
  min-height: 2.35rem;
  padding: 0 0.75rem;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 0.55rem;
  font-weight: 850;
}

.iframe-wrap {
  position: relative;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  height: var(--player-height, 360px);
  max-height: calc(100svh - 7rem);
  background: #05060a;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 0.6rem;
}

iframe {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  width: 960px;
  max-width: none;
  height: 641px;
  transform: scale(var(--player-scale, 1));
  transform-origin: top left;
  border: 0;
}

.category-list {
  display: grid;
  gap: 1.1rem;
}

.category-section {
  min-width: 0;
}

.category-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 0.55rem;
}

.category-title h2 {
  font-size: 1.15rem;
}

.category-title span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.game-row {
  display: grid;
  grid-auto-columns: clamp(8.7rem, 42vw, 13rem);
  grid-auto-flow: column;
  gap: 0.72rem;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0 0.05rem 0.65rem;
  scroll-snap-type: x proximity;
  scrollbar-color: rgba(255, 255, 255, 0.32) transparent;
}

.game-card {
  min-width: 0;
  overflow: hidden;
  scroll-snap-align: start;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.24);
  cursor: pointer;
}

.thumb {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--cover);
}

.thumb img {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  background:
    linear-gradient(180deg, transparent 45%, rgba(0, 0, 0, 0.56)),
    repeating-linear-gradient(90deg, transparent 0 22px, rgba(255,255,255,0.08) 22px 23px);
  pointer-events: none;
}

.fallback-art {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: grid;
  place-items: center;
  padding: 0.65rem;
  text-align: center;
  font-size: 1.05rem;
  font-weight: 950;
  line-height: 1.05;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.45);
}

.game-info {
  padding: 0.62rem;
}

.game-info h3 {
  display: -webkit-box;
  min-height: 2.35rem;
  margin-bottom: 0.35rem;
  overflow: hidden;
  font-size: 0.92rem;
  line-height: 1.18;
  letter-spacing: 0;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.game-meta {
  margin-bottom: 0;
  font-size: 0.75rem;
  font-weight: 800;
}

.empty {
  padding: 1rem;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: 0.7rem;
}

@media (min-width: 760px) {
  main {
    padding-right: 1.5rem;
    padding-left: 1.5rem;
  }

  .topbar {
    padding-right: 1.5rem;
    padding-left: 1.5rem;
  }
}

@media (max-width: 560px) {
  .topbar {
    grid-template-columns: 1fr;
  }

  .catalog-head {
    align-items: start;
    flex-direction: column;
  }

  .quick-stats {
    width: 100%;
  }

  .player-shell {
    margin-right: calc(-1 * max(0.85rem, env(safe-area-inset-right)));
    margin-left: calc(-1 * max(0.85rem, env(safe-area-inset-left)));
    width: calc(100% + max(0.85rem, env(safe-area-inset-right)) + max(0.85rem, env(safe-area-inset-left)));
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  .player-heading {
    padding: 0 0.15rem;
  }

  .iframe-wrap {
    max-height: calc(100svh - 6rem);
  }
}
