/* ============================================================
   PlayHub — Home / Public page styles
   Inspired by Poki.com: vibrant gradients, generous spacing,
   big tap targets, smooth motion, dark mode native + light mode.
   ============================================================ */

/* ----------- Demo banner (static deploy only) ----------- */
.demo-banner {
  background: linear-gradient(90deg, var(--brand-4), var(--brand-2));
  color: #0a0c11;
  padding: 8px 18px;
  font-size: 0.82rem;
  font-weight: 600;
  text-align: center;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.demo-banner a {
  color: #0a0c11;
  text-decoration: underline;
  font-weight: 800;
}
.demo-banner span:first-child { font-size: 1.1rem; }

:root {
  --bg: #0f1115;
  --bg-soft: #161922;
  --bg-elev: #1d212c;
  --line: #252a37;
  --line-soft: #20242f;
  --text: #e7e9ee;
  --text-dim: #9aa1b1;
  --muted: #6c7383;
  --brand: #ff3b6b;
  --brand-2: #ffb800;
  --brand-3: #2dd4bf;
  --brand-4: #6c5cff;
  --brand-5: #00c2ff;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow-1: 0 4px 12px rgba(0,0,0,.25);
  --shadow-2: 0 12px 32px rgba(0,0,0,.35);
  --transition: 180ms cubic-bezier(.2,.7,.2,1);
  --container: 1280px;
  --header-h: 64px;
  --tap-min: 44px;
}

:root[data-theme="light"] {
  --bg: #f7f8fb;
  --bg-soft: #ffffff;
  --bg-elev: #ffffff;
  --line: #e2e6ee;
  --line-soft: #ebeef4;
  --text: #1a1d24;
  --text-dim: #4a5061;
  --muted: #7a8194;
  --shadow-1: 0 4px 12px rgba(20,30,60,.06);
  --shadow-2: 0 12px 32px rgba(20,30,60,.10);
}

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

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01", "cv11";
  line-height: 1.5;
  transition: background-color 200ms ease, color 200ms ease;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
img { max-width: 100%; display: block; }
h1, h2, h3 { margin: 0; line-height: 1.2; font-weight: 800; letter-spacing: -0.01em; }
p { margin: 0; }
.muted { color: var(--text-dim); }
.small { font-size: 0.85em; }

:focus-visible {
  outline: 2px solid var(--brand-4);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Accessibility: skip link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 12px;
  background: var(--brand-4);
  color: white;
  padding: 8px 14px;
  border-radius: 6px;
  font-weight: 600;
  z-index: 1000;
  transition: top 150ms ease;
}
.skip-link:focus { top: 12px; }

/* ----------- Top bar ----------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--line-soft);
}
.topbar__inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 20px;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 18px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-size: 1.15rem;
}
.brand__mark {
  display: inline-grid;
  place-items: center;
  width: 32px; height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--brand), var(--brand-4));
  color: white;
  font-size: 14px;
  box-shadow: 0 6px 18px rgba(255, 59, 107, .35);
}
.search {
  flex: 1;
  max-width: 540px;
  position: relative;
  display: flex;
  align-items: center;
}
.search__icon {
  position: absolute;
  left: 14px;
  color: var(--text-dim);
  font-size: 18px;
  pointer-events: none;
}
.search input {
  width: 100%;
  height: var(--tap-min);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 0 38px 0 40px;
  border-radius: 999px;
  font-size: 0.95rem;
  outline: none;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}
.search input::placeholder { color: var(--muted); }
.search input:focus {
  border-color: var(--brand-4);
  background: var(--bg-elev);
  box-shadow: 0 0 0 4px rgba(108, 92, 255, .15);
}
.search__clear {
  position: absolute;
  right: 8px;
  background: transparent;
  border: 0;
  color: var(--text-dim);
  width: 32px; height: 32px;
  border-radius: 999px;
  font-size: 20px;
  line-height: 1;
}
.search__clear:hover { background: var(--bg-elev); color: var(--text); }
.topbar__nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}
.topbar__link {
  padding: 0 16px;
  height: var(--tap-min);
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  color: var(--text-dim);
  font-weight: 600;
  font-size: 0.92rem;
  transition: color var(--transition), background var(--transition);
}
.topbar__link:hover { color: var(--text); background: var(--bg-soft); }
.topbar__link--cta {
  background: linear-gradient(135deg, var(--brand), var(--brand-4));
  color: white;
}
.topbar__link--cta:hover { filter: brightness(1.1); color: white; }

.theme-toggle {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-dim);
  width: var(--tap-min);
  height: var(--tap-min);
  border-radius: 999px;
  font-size: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}
.theme-toggle:hover { color: var(--text); background: var(--bg-soft); }

@media (max-width: 720px) {
  .topbar__nav .topbar__link:not(.topbar__link--cta) { display: none; }
  .brand__name { display: none; }
}

/* ----------- Hero ----------- */
.hero {
  position: relative;
  overflow: hidden;
  padding: 60px 0 50px;
  background:
    radial-gradient(1100px 400px at 50% 0%, rgba(108,92,255,.18), transparent 60%),
    radial-gradient(800px 360px at 90% 30%, rgba(255,59,107,.18), transparent 60%);
}
.hero__inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 20px;
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 30px;
  align-items: center;
}
.hero__title {
  font-size: clamp(2.2rem, 5.5vw, 4.2rem);
  letter-spacing: -0.03em;
}
.grad {
  background: linear-gradient(90deg, var(--brand-2), var(--brand), var(--brand-4));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero__sub {
  margin-top: 14px;
  color: var(--text-dim);
  font-size: 1.1rem;
  max-width: 50ch;
}
.hero__stats {
  margin-top: 24px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.hero__stats > div {
  display: flex;
  flex-direction: column;
  padding: 14px 18px;
  background: color-mix(in srgb, var(--bg-soft) 90%, transparent);
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  min-width: 110px;
}
.hero__stats strong {
  font-size: 1.6rem;
  background: linear-gradient(90deg, var(--brand-3), var(--brand-5));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-variant-numeric: tabular-nums;
}
.hero__stats span {
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-top: 2px;
}
.hero__cta {
  margin-top: 28px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.hero__art {
  position: relative;
  height: 320px;
  display: none;
}
.orb {
  position: absolute;
  width: 180px; height: 180px;
  border-radius: 50%;
  filter: blur(20px);
  opacity: 0.7;
  animation: float 9s ease-in-out infinite;
}
.orb-a { background: radial-gradient(circle, var(--brand), transparent 60%); top: 0; right: 0; }
.orb-b { background: radial-gradient(circle, var(--brand-4), transparent 60%); bottom: 30px; left: 40px; animation-delay: -3s; }
.orb-c { background: radial-gradient(circle, var(--brand-3), transparent 60%); top: 80px; right: 100px; animation-delay: -6s; }
@keyframes float {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-20px) scale(1.06); }
}
@media (min-width: 900px) {
  .hero__art { display: block; }
}

/* Trending strip inside the hero */
.hero__strip {
  max-width: var(--container);
  margin: 28px auto 0;
  padding: 0 20px 8px;
}
.hero__strip[hidden] { display: none; }
.hero__strip-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px;
  color: var(--text);
}
.hero__strip-title .fire { filter: saturate(1.2); }
.strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}
@media (max-width: 900px) {
  .strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
  }
  .strip__card { scroll-snap-align: start; }
}
@media (max-width: 540px) {
  .strip { grid-template-columns: repeat(2, minmax(140px, 1fr)); }
}
.strip__card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  background: var(--bg-soft);
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  min-width: 0;
  transition: transform var(--transition), border-color var(--transition);
}
.strip__card:hover { transform: translateY(-2px); border-color: var(--brand-4); }
.strip__thumb {
  width: 56px; height: 56px;
  flex: 0 0 56px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-elev);
  display: grid; place-items: center;
}
.strip__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.strip__thumb-fallback {
  font-weight: 800;
  font-size: 1.4rem;
  color: var(--text-dim);
  background: linear-gradient(135deg, var(--bg-elev), var(--bg-soft));
  width: 100%; height: 100%;
  display: grid; place-items: center;
}
.strip__body { min-width: 0; }
.strip__title {
  font-weight: 700;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.strip__meta {
  font-size: 0.78rem;
  color: var(--text-dim);
  display: flex; align-items: center; gap: 6px;
  margin-top: 2px;
}
.strip__meta .dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: .6; }

/* ----------- Container & sections ----------- */
.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 30px 20px 80px;
}
.section { margin-top: 50px; }
.section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.section__head h2 {
  font-size: clamp(1.4rem, 2.4vw, 1.8rem);
  letter-spacing: -0.01em;
}
.section__sub { color: var(--text-dim); font-size: 0.95rem; }

/* ----------- Game grid ----------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}
.card {
  display: block;
  position: relative;
  background: var(--bg-soft);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
  will-change: transform;
}
.card:hover {
  transform: translateY(-4px);
  border-color: var(--brand-4);
  box-shadow: 0 16px 40px rgba(108, 92, 255, .25), 0 0 0 1px rgba(108, 92, 255, .4);
}
.card__thumb {
  position: relative;
  aspect-ratio: 16 / 10;
  background: linear-gradient(135deg, #1d212c, #2a2f3e);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.card__thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 350ms ease;
}
.card__thumb-img {
  position: absolute;
  inset: 0;
  z-index: 1;
}
.card:hover .card__thumb img { transform: scale(1.06); }
.card__thumb-fallback {
  font-size: 3rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--brand-2), var(--brand), var(--brand-4));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-transform: uppercase;
  letter-spacing: -0.05em;
}
.card__badges {
  position: absolute;
  top: 10px; left: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: calc(100% - 20px);
  z-index: 2;
}
.badge {
  background: rgba(0,0,0,0.6);
  color: white;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  white-space: nowrap;
  line-height: 1.2;
}
.badge--hot {
  background: linear-gradient(135deg, var(--brand-2), var(--brand));
  color: #1a1d24;
  box-shadow: 0 2px 8px rgba(255, 184, 0, .4);
}
.badge--new {
  background: linear-gradient(135deg, var(--brand-3), var(--brand-5));
  color: #0a1820;
}
.badge--tag {
  background: rgba(0,0,0,0.55);
  color: white;
}
.card__mp {
  position: absolute;
  top: 10px; right: 10px;
  width: 32px; height: 32px;
  display: grid; place-items: center;
  background: rgba(0,0,0,0.6);
  border-radius: 50%;
  font-size: 1rem;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 2;
}

/* Rating row on card */
.card__rating {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  margin: 6px 0 2px;
  color: var(--text-dim);
  flex-wrap: wrap;
}
.card__stars {
  color: var(--brand-2);
  letter-spacing: -1px;
  font-size: 0.85rem;
}
.card__rating-num {
  color: var(--text);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.card__rating-count {
  font-size: 0.72rem;
}
.card__play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, transparent 50%, rgba(0,0,0,.55) 100%);
  opacity: 0;
  transition: opacity var(--transition);
  color: white;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.04em;
}
.card__play::before {
  content: '▶';
  display: inline-grid;
  place-items: center;
  width: 54px; height: 54px;
  border-radius: 999px;
  background: rgba(255,255,255,0.95);
  color: var(--bg);
  font-size: 18px;
  margin-right: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
}
.card:hover .card__play, .card:focus-within .card__play { opacity: 1; }
.card__body { padding: 12px 14px 14px; }
.card__title {
  font-weight: 700;
  font-size: 0.98rem;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card__meta {
  color: var(--text-dim);
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card__meta .dot { width: 3px; height: 3px; background: var(--muted); border-radius: 50%; }

/* ----------- Sort + section controls ----------- */
.section__head--row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.sort {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-dim);
}
.sort__select {
  appearance: none;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 8px 32px 8px 12px;
  border-radius: 10px;
  font: inherit;
  cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-dim) 50%),
                    linear-gradient(135deg, var(--text-dim) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  min-height: var(--tap-min);
}
.sort__select:hover { border-color: var(--brand-4); }
.sort__select:focus-visible {
  outline: 2px solid var(--brand-4);
  outline-offset: 2px;
}

/* Smaller / hidden sections */
.section--small { margin-top: 0; }
.section__clear {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-dim);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.82rem;
  cursor: pointer;
  min-height: 36px;
}
.section__clear:hover { color: var(--text); border-color: var(--brand); }

.grid--small .card { /* nothing different yet, hook for future */ }

/* ----------- Skeleton placeholders with shimmer ----------- */
.skeleton {
  height: 250px;
  background: linear-gradient(90deg,
    var(--bg-soft) 0%,
    color-mix(in srgb, var(--bg-soft) 70%, var(--bg-elev) 30%) 50%,
    var(--bg-soft) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.6s ease-in-out infinite;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
}
@keyframes shimmer {
  0%   { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
  border-radius: var(--radius);
  background: linear-gradient(90deg, var(--bg-soft) 0%, var(--bg-elev) 50%, var(--bg-soft) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
  border: 1px solid var(--line-soft);
}
@keyframes shimmer { 0% { background-position: -100% 0; } 100% { background-position: 100% 0; } }

/* ----------- Categories ----------- */
.categories {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.cat-chip {
  padding: 0 18px;
  height: var(--tap-min);
  display: inline-flex;
  align-items: center;
  background: var(--bg-soft);
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  font-weight: 600;
  color: var(--text-dim);
  font-size: 0.92rem;
  transition: all var(--transition);
}
.cat-chip:hover { color: var(--text); background: var(--bg-elev); border-color: var(--line); }
.cat-chip.active {
  background: linear-gradient(135deg, var(--brand), var(--brand-4));
  color: white;
  border-color: transparent;
  box-shadow: 0 6px 20px rgba(255,59,107,.25);
}

/* ----------- Buttons ----------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: var(--tap-min);
  padding: 0 22px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  border: 0;
  transition: transform var(--transition), filter var(--transition), box-shadow var(--transition);
  cursor: pointer;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.1); }
.btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-4));
  color: white;
  box-shadow: 0 8px 24px rgba(255,59,107,.25);
}

/* ----------- Empty state ----------- */
.empty {
  text-align: center;
  padding: 60px 20px;
  background: var(--bg-soft);
  border: 1px dashed var(--line);
  border-radius: var(--radius-lg);
}
.empty__icon { font-size: 3rem; margin-bottom: 10px; }
.empty h3 { font-size: 1.3rem; margin-bottom: 6px; }
.empty p { color: var(--text-dim); }
.empty a { color: var(--brand-3); text-decoration: underline; }

/* ----------- Footer ----------- */
.footer {
  border-top: 1px solid var(--line-soft);
  background: var(--bg-soft);
  padding: 40px 0 30px;
  margin-top: 60px;
}
.footer__inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 20px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 20px;
  align-items: center;
}
.footer__brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
}
.footer__tag { color: var(--text-dim); }
.footer__links { list-style: none; display: flex; gap: 16px; margin: 0; padding: 0; flex-wrap: wrap; }
.footer__links a { color: var(--text-dim); }
.footer__links a:hover { color: var(--text); }
.footer__copy { grid-column: 1 / -1; color: var(--muted); font-size: 0.85rem; border-top: 1px solid var(--line-soft); padding-top: 16px; }
@media (max-width: 720px) {
  .footer__inner { grid-template-columns: 1fr; }
}
