:root {
  color-scheme: light;
  --bg: #f8f5ef;
  --paper: #ffffff;
  --ink: #202124;
  --muted: #686f77;
  --line: #e6dfd3;
  --green: #25a46a;
  --coral: #f26a5a;
  --gold: #f4c247;
  --sky: #7ec8ff;
  --shadow: 0 18px 60px rgba(38, 34, 27, .12);
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--bg); }

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(180deg, rgba(255,255,255,.86), rgba(255,255,255,0) 36rem),
    radial-gradient(circle at 12% 6%, rgba(244,194,71,.28), transparent 18rem),
    radial-gradient(circle at 88% 0%, rgba(126,200,255,.24), transparent 16rem),
    var(--bg);
}

button, input { font: inherit; }

.shell {
  width: min(1180px, calc(100% - 24px));
  margin: 0 auto;
  padding: 14px 0 42px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
  padding: 10px 0 12px;
  background: linear-gradient(180deg, rgba(248,245,239,.98) 68%, rgba(248,245,239,0));
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
  font-weight: 900;
  letter-spacing: 0;
}

.brand img {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  box-shadow: 0 7px 16px rgba(32, 33, 36, .12);
}

.search {
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  min-width: 0;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.86);
  box-shadow: 0 8px 22px rgba(38, 34, 27, .07);
}

.search__icon {
  font-size: 22px;
  color: var(--muted);
  transform: translateY(-1px);
}

.search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
}

.intro {
  display: grid;
  gap: 16px;
  align-items: end;
  padding: 18px 0 12px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

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

h1 {
  max-width: 680px;
  margin-bottom: 0;
  font-size: clamp(32px, 5vw, 56px);
  line-height: 1.02;
  letter-spacing: 0;
}

.metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.metrics span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.72);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.metrics strong { color: var(--ink); }

.category-strip {
  position: sticky;
  top: 64px;
  z-index: 9;
  margin: 4px -12px 16px;
  padding: 8px 12px;
  overflow-x: auto;
  background: linear-gradient(180deg, rgba(248,245,239,.96), rgba(248,245,239,.82));
  scrollbar-width: none;
}

.category-strip::-webkit-scrollbar { display: none; }

.category-buttons {
  display: flex;
  width: max-content;
  min-width: 100%;
  gap: 8px;
}

.category-button {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.82);
  color: var(--muted);
  font-size: 14px;
  font-weight: 900;
  white-space: nowrap;
  cursor: pointer;
}

.category-button[aria-pressed="true"] {
  border-color: #202124;
  background: #202124;
  color: #fff;
}

.rail, .catalog { margin-top: 20px; }

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.section-heading h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0;
}

.section-heading span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.game-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(148px, 172px);
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
  scroll-snap-type: x proximity;
}

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

.game-card {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 8px;
  min-width: 0;
  min-height: 202px;
  padding: 10px;
  border: 1px solid rgba(32,33,36,.08);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 10px 28px rgba(38, 34, 27, .08);
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.game-card:hover,
.game-card:focus-visible {
  outline: 3px solid rgba(37,164,106,.24);
  transform: translateY(-1px);
}

.game-card__icon {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 8px;
  background: #f1efe9;
  object-fit: cover;
}

.game-card__body {
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 4px;
  min-width: 0;
}

.game-card__title {
  overflow: hidden;
  margin: 0;
  font-size: 14px;
  font-weight: 900;
  line-height: 1.15;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.game-card__category {
  color: var(--coral);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.game-card__description {
  overflow: hidden;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.empty {
  margin: 34px 0;
  padding: 24px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  background: rgba(255,255,255,.56);
}

.player {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  grid-template-rows: 58px 1fr;
  background: #101215;
}

.player[hidden] { display: none; }

.player__chrome {
  display: grid;
  grid-template-columns: 42px 38px 1fr;
  gap: 10px;
  align-items: center;
  min-width: 0;
  padding: 9px 12px;
  color: #fff;
  background: #181b20;
}

.player__chrome img {
  width: 38px;
  height: 38px;
  border-radius: 8px;
}

.player__chrome strong,
.player__chrome span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player__chrome span {
  color: rgba(255,255,255,.66);
  font-size: 12px;
  font-weight: 800;
}

.icon-button {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: rgba(255,255,255,.13);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

#gameFrame {
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
}

@media (min-width: 700px) {
  .shell {
    width: min(1240px, calc(100% - 48px));
    padding-top: 18px;
  }

  .intro {
    grid-template-columns: 1fr auto;
    padding-top: 32px;
  }

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

  .game-card { min-height: 224px; }
}

@media (min-width: 1060px) {
  .game-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }

  .player {
    inset: 24px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
  }
}

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

  .brand span { font-size: 18px; }

  .category-strip { top: 102px; }

  .game-card {
    min-height: 190px;
    padding: 8px;
  }
}
