:root {
  --bg: #0b0b0c;
  --panel: #141416;
  --panel-2: #1b1b1e;
  --line: rgba(255, 255, 255, 0.06);
  --text: #f4f4f5;
  --muted: #8b8b93;
  --dim: #5d5d64;
  --green: #4ade80;
  --radius: 22px;
  --rail: 76px;
  --gutter: clamp(16px, 3vw, 40px);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.app {
  display: grid;
  grid-template-columns: var(--rail) 1fr;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
}

/* ───────── Top bar ───────── */
.topbar {
  grid-column: 1 / -1;
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  padding: 18px var(--gutter) 18px 14px;
  background: linear-gradient(var(--bg) 70%, transparent);
}
.logo {
  width: 48px; height: 48px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--panel); color: var(--green);
  margin-right: auto;
}
.logo svg { width: 24px; height: 24px; }

.pills { display: flex; gap: 8px; }
.pill {
  height: 48px; min-width: 48px; padding: 0 16px; border: 0; border-radius: 999px;
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--panel); color: var(--muted); font-size: 14px; font-weight: 600;
  cursor: pointer; transition: background .2s, color .2s;
}
.pill:hover { background: var(--panel-2); color: var(--text); }
.pill[aria-pressed="true"] { color: var(--green); background: #16201a; }
.pill .label { display: inline; }

.stat-pill {
  height: 48px; padding: 0 18px; border-radius: 999px;
  display: flex; align-items: center; gap: 14px;
  background: var(--panel); font-size: 14px; color: #d4d4d8; white-space: nowrap;
}
.stat-pill span { display: inline-flex; align-items: center; gap: 8px; }
.stat-pill svg { color: var(--muted); }
.stat-pill b { font-weight: 600; }
.stat-pill i { width: 1px; height: 18px; background: var(--line); }

.search {
  margin-left: auto;
  width: min(270px, 28vw); height: 48px; padding: 0 18px; border-radius: 999px;
  display: flex; align-items: center; gap: 10px;
  background: var(--panel); color: var(--muted);
  transition: box-shadow .2s;
}
.search:focus-within { box-shadow: 0 0 0 1px rgba(74, 222, 128, .45); }
.search input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: none;
  color: var(--text); font: inherit; font-size: 14px;
}
.search input::placeholder { color: var(--muted); }
.search input::-webkit-search-cancel-button { filter: invert(.6); }

/* ───────── Rail ───────── */
.rail {
  position: sticky; top: 84px; align-self: start;
  height: calc(100vh - 84px);
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 40px 0 24px 14px;
}
.rail-games { display: flex; flex-direction: column; gap: 12px; }
.rail-btn {
  width: 48px; height: 48px; border-radius: 50%; border: 0; padding: 0;
  display: grid; place-items: center;
  background: var(--panel); color: var(--muted); cursor: pointer;
  transition: color .2s, background .2s, transform .2s;
}
.rail-btn:hover { color: var(--text); background: var(--panel-2); }
.rail-game {
  position: relative; overflow: hidden;
  background-size: cover; background-position: center;
  outline: 2px solid transparent; outline-offset: 2px;
  transition: outline-color .2s, transform .2s;
}
.rail-game::after { content: ""; position: absolute; inset: 0; background: rgba(0,0,0,.35); transition: opacity .2s; }
.rail-game:hover { transform: scale(1.06); }
.rail-game:hover::after, .rail-game.is-active::after { opacity: 0; }
.rail-game.is-active { outline-color: var(--green); }
.rail-add { border: 1px dashed rgba(255,255,255,.14); background: transparent; }
.rail-bottom { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }

/* ───────── Main ───────── */
.main { grid-column: 2; min-width: 0; padding: 8px var(--gutter) 40px; }
.page-title { font-size: clamp(28px, 3vw, 36px); font-weight: 700; letter-spacing: -.01em; margin: 24px 0 30px; }

/* Featured carousel */
.featured {
  display: flex; gap: 16px;
  overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding: 0;
  margin-right: calc(var(--gutter) * -1); padding-right: var(--gutter);
  scrollbar-width: none;
}
.featured::-webkit-scrollbar { display: none; }

.fcard {
  --accent: #888;
  position: relative; flex: 0 0 min(560px, 86vw); height: 380px;
  scroll-snap-align: start;
  border-radius: var(--radius); overflow: hidden; isolation: isolate;
  background: var(--panel);
  display: flex; flex-direction: column; padding: 28px;
  transition: transform .35s cubic-bezier(.2,.7,.2,1);
}
.fcard::before {               /* accent tint, like the template's active card */
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(120deg, color-mix(in srgb, var(--accent) 55%, transparent), transparent 75%);
  opacity: 0; transition: opacity .4s;
}
.fcard::after {                /* inner hairline */
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  box-shadow: inset 0 0 0 1px var(--line);
}
.fcard.is-active::before { opacity: 1; }
.fcard.is-active::after { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 60%, transparent); }

.fcard .media {
  position: absolute; z-index: -1; top: 0; right: 0; bottom: 0; width: 64%;
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 42%);
          mask-image: linear-gradient(90deg, transparent 0%, #000 42%);
}
.media img, .media video {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block;
}
.media video { opacity: 0; transition: opacity .45s; }
.is-playing .media video { opacity: 1; }
.fcard .media img { transition: transform .8s cubic-bezier(.2,.7,.2,1); }
.fcard.is-active .media img { transform: scale(1.04); }

.fcard-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.fcard h3 { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: .005em; text-shadow: 0 2px 12px rgba(0,0,0,.6); }
.tag {
  flex: none; font-size: 13px; padding: 6px 12px; border-radius: 10px;
  background: rgba(20,20,22,.7); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  color: #e4e4e7;
}
.features { list-style: none; margin: 30px 0 0; padding: 0; display: grid; gap: 16px; max-width: 280px; }
.features li { display: flex; align-items: center; gap: 14px; }
.features .ico {
  width: 44px; height: 44px; border-radius: 12px; flex: none;
  display: grid; place-items: center;
  background: rgba(255,255,255,.06); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  color: #c4c4c8;
}
.features b { display: block; font-size: 14px; font-weight: 600; }
.features small { display: block; font-size: 13.5px; color: var(--muted); margin-top: 2px; text-shadow: 0 1px 8px rgba(0,0,0,.8); }
.fcard.is-active .features small { color: #c9c9cf; }

.play-btn {
  margin-top: auto; align-self: flex-start;
  display: inline-flex; align-items: center; gap: 10px;
  height: 50px; padding: 0 28px; border-radius: 999px;
  border: 1px solid rgba(255,255,255,.14); background: rgba(14,14,16,.6);
  font-size: 14px; font-weight: 600;
  transition: background .25s, color .25s, border-color .25s, transform .2s;
}
.play-btn svg { width: 14px; height: 14px; fill: currentColor; stroke: none; }
.fcard.is-active .play-btn, .play-btn:focus-visible { background: #fff; color: #0b0b0c; border-color: #fff; }
.play-btn:active { transform: scale(.97); }

/* Section header */
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin: 44px 0 18px; scroll-margin-top: 100px; }
#all { scroll-margin-top: 90px; }
.section-head h2 { margin: 0; font-size: 18px; font-weight: 600; letter-spacing: .01em; }
.hint { margin: 0; font-size: 13px; color: var(--dim); }
.hint-touch { display: none; }
@media (hover: none) { .hint-hover { display: none; } .hint-touch { display: inline; } }

/* Grid cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.gcard {
  --accent: #888;
  position: relative; border-radius: var(--radius); overflow: hidden;
  background: var(--panel);
  box-shadow: inset 0 0 0 1px var(--line);
  transition: transform .3s cubic-bezier(.2,.7,.2,1), box-shadow .3s, background .3s;
}
.gcard:hover, .gcard:focus-within { transform: translateY(-4px); background: var(--panel-2); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent), 0 20px 40px -20px color-mix(in srgb, var(--accent) 50%, transparent); }
.gcard .media { position: relative; aspect-ratio: 16 / 9; background: #000; overflow: hidden; }
.gcard .media img { transition: transform .6s cubic-bezier(.2,.7,.2,1); }
.gcard:hover .media img { transform: scale(1.05); }
.gcard .live {
  position: absolute; top: 12px; right: 12px;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  background: rgba(10,10,12,.65); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  opacity: 0; transform: translateY(-4px); transition: opacity .3s, transform .3s;
}
.gcard .live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #ef4444; box-shadow: 0 0 8px #ef4444; }
.gcard.is-playing .live { opacity: 1; transform: none; }

.gcard-body { position: relative; padding: 30px 24px 22px; }
.gcard-body .badge-icon {
  position: absolute; top: -26px; left: 24px;
  width: 50px; height: 50px; border-radius: 14px;
  display: grid; place-items: center;
  background: #0e0e10; color: #fff;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 70%, #0e0e10);
}
.gcard-body .badge-icon svg { width: 24px; height: 24px; }
.gcard h3 { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 19px; font-weight: 600; }
.gcard h3 .check { width: 18px; height: 18px; color: var(--bg); fill: #6b6b72; stroke: none; }
.gcard p { margin: 10px 0 16px; font-size: 14px; line-height: 1.5; color: var(--muted); }
.meta { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: #a1a1aa; }
.meta span { display: inline-flex; align-items: center; gap: 7px; }
.meta span::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #3f3f46; }
.meta span:first-child::before { background: var(--green); box-shadow: 0 0 6px rgba(74,222,128,.6); }
.gcard .stretch::after { content: ""; position: absolute; inset: 0; z-index: 1; }   /* whole card is clickable */
.gcard .stretch:focus-visible { outline: none; }
.gcard:has(.stretch:focus-visible) { outline: 2px solid var(--green); outline-offset: 3px; }

.empty { color: var(--muted); padding: 40px 0; }

.foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px;
  margin-top: 56px; padding-top: 22px; border-top: 1px solid var(--line);
  font-size: 13px; color: var(--dim);
}

/* reveal-on-load */
.fcard, .gcard { animation: rise .6s cubic-bezier(.2,.7,.2,1) both; animation-delay: calc(var(--i, 0) * 70ms); }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

/* ───────── Responsive ───────── */
@media (max-width: 1100px) {
  .stat-pill { display: none; }
}
@media (max-width: 820px) {
  :root { --rail: 0px; }
  .rail { display: none; }
  .topbar { padding-left: var(--gutter); gap: 10px; flex-wrap: wrap; }
  .logo { margin-right: 0; }
  .search { order: 2; margin-left: auto; width: auto; flex: 1; max-width: 360px; }
  .pills { order: 3; width: 100%; overflow-x: auto; scrollbar-width: none; }
  .pill { height: 40px; flex: none; }
  .page-title { margin: 12px 0 20px; }
  .fcard { height: 340px; padding: 22px; }
  .fcard .media { width: 100%; -webkit-mask-image: linear-gradient(90deg, rgba(0,0,0,.25) 0%, #000 70%); mask-image: linear-gradient(90deg, rgba(0,0,0,.25) 0%, #000 70%); }
  .fcard::before { opacity: .55; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}
