/* ==========================================================================
   EduPlayZone — home page
   Written for index.html only (other pages still use home-new-styles.css).

   Layout is mobile-first; every size that matters uses clamp() so there are
   no awkward jumps between the breakpoints.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens
   -------------------------------------------------------------------------- */
:root {
  /* Brand */
  --brand: #7c4dff;
  --brand-600: #6a35ff;
  --brand-700: #5a22e8;
  --brand-soft: #f0eaff;
  --brand-ring: rgba(124, 77, 255, 0.35);

  /* Surfaces */
  --bg: #f7f5ff;
  --bg-alt: #efeaff;
  --surface: #ffffff;
  --surface-2: #faf8ff;
  --border: rgba(26, 16, 51, 0.09);
  --border-strong: rgba(26, 16, 51, 0.16);

  /* Text */
  --ink: #1a1033;
  --ink-2: #514873;
  --ink-3: #7d76a0;
  --on-brand: #ffffff;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(26, 16, 51, 0.06), 0 2px 8px rgba(26, 16, 51, 0.05);
  --shadow-md: 0 4px 12px rgba(26, 16, 51, 0.07), 0 12px 28px rgba(26, 16, 51, 0.07);
  --shadow-lg: 0 12px 24px rgba(26, 16, 51, 0.1), 0 28px 60px rgba(26, 16, 51, 0.12);
  --shadow-brand: 0 10px 24px rgba(124, 77, 255, 0.28);

  /* Shape */
  --r-xs: 10px;
  --r-sm: 14px;
  --r-md: 18px;
  --r-lg: 24px;
  --r-xl: 32px;
  --r-pill: 999px;

  /* Metrics */
  --container: 1200px;
  --pad-x: clamp(1rem, 4vw, 2rem);
  --header-h: 64px;
  --card-w: clamp(11rem, 40vw, 15rem);

  /* Type */
  --font: "Lexend Deca", ui-rounded, "Segoe UI", system-ui, -apple-system, sans-serif;
  --fs-hero: clamp(2.5rem, 7vw, 4.25rem);
  --fs-h2: clamp(1.5rem, 3.2vw, 2.125rem);
  --fs-h3: clamp(1rem, 1.6vw, 1.0625rem);
  --fs-body: clamp(0.9375rem, 1.4vw, 1rem);
  --fs-sm: 0.875rem;
  --fs-xs: 0.75rem;

  --ease: cubic-bezier(0.22, 0.9, 0.28, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --brand: #9270ff;
    --brand-600: #8259ff;
    --brand-700: #6f43ff;
    --brand-soft: rgba(146, 112, 255, 0.16);
    --brand-ring: rgba(146, 112, 255, 0.5);

    --bg: #0f0b1d;
    --bg-alt: #15102a;
    --surface: #191330;
    --surface-2: #1f183a;
    --border: rgba(255, 255, 255, 0.09);
    --border-strong: rgba(255, 255, 255, 0.18);

    --ink: #f4f1ff;
    --ink-2: #c2bade;
    --ink-3: #948cb6;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.55);
    --shadow-brand: 0 10px 24px rgba(124, 77, 255, 0.35);
  }
}

/* --------------------------------------------------------------------------
   2. Reset / base
   -------------------------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Anchor targets clear the sticky header. */
  scroll-padding-top: calc(var(--header-h) + 5rem);
}

body {
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

img, svg { display: block; max-width: 100%; }
img { height: auto; }

/* Author `display` declarations beat the UA rule for [hidden], and several
   components below set display explicitly. Make the attribute authoritative
   so JS can just toggle `el.hidden`. */
[hidden] { display: none !important; }

a { color: inherit; text-decoration: none; }

button, input { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }

h1, h2, h3 { line-height: 1.15; font-weight: 800; letter-spacing: -0.02em; }

ul { list-style: none; padding: 0; }

:where(a, button, input, [tabindex]):focus-visible {
  outline: 3px solid var(--brand-ring);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--pad-x);
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 200;
  padding: 0.7rem 1.1rem;
  border-radius: var(--r-pill);
  background: var(--brand);
  color: var(--on-brand);
  font-weight: 700;
  box-shadow: var(--shadow-md);
  transform: translateY(-160%);
  transition: transform 0.2s var(--ease);
}
.skip-link:focus-visible { transform: translateY(0); }

.icon-sprite { position: absolute; width: 0; height: 0; }

.icon {
  width: 1.15em;
  height: 1.15em;
  flex: none;
}
.icon--lg { width: 1.6em; height: 1.6em; }

/* --------------------------------------------------------------------------
   3. Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.25rem;
  border-radius: var(--r-pill);
  font-weight: 700;
  font-size: var(--fs-sm);
  white-space: nowrap;
  transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease),
              background-color 0.18s var(--ease), color 0.18s var(--ease);
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }

.btn--lg { padding: 0.9rem 1.6rem; font-size: 1rem; }
.btn--sm { padding: 0.5rem 0.95rem; font-size: var(--fs-xs); }

.btn--primary {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-700) 100%);
  color: #fff;
  box-shadow: var(--shadow-brand);
}
.btn--primary:hover { box-shadow: 0 14px 30px rgba(124, 77, 255, 0.38); }

.btn--ghost {
  background: var(--surface);
  color: var(--brand);
  border: 2px solid var(--border-strong);
  box-shadow: var(--shadow-sm);
}
.btn--ghost:hover { border-color: var(--brand); background: var(--brand-soft); }

.btn--light { background: #fff; color: var(--brand-700); box-shadow: var(--shadow-md); }

.btn--quiet {
  color: var(--ink-3);
  border: 1px solid var(--border);
  background: var(--surface);
}
.btn--quiet:hover { color: var(--brand); border-color: var(--brand); }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: var(--r-sm);
  color: var(--ink);
  transition: background-color 0.18s var(--ease);
}
.icon-btn:hover { background: var(--brand-soft); }

.linkish {
  color: var(--brand);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 0;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.85rem;
  border-radius: var(--r-pill);
  background: var(--brand-soft);
  color: var(--brand-700);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.01em;
}
.eyebrow--light { background: rgba(255, 255, 255, 0.18); color: #fff; }

/* --------------------------------------------------------------------------
   4. Header
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.site-header.is-stuck {
  border-bottom-color: var(--border);
  box-shadow: var(--shadow-sm);
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  height: var(--header-h);
}

.brand img { height: 1.85rem; width: auto; }

.site-header__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

.site-nav { display: none; }

.site-nav__link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.9rem;
  border-radius: var(--r-pill);
  font-weight: 600;
  font-size: var(--fs-sm);
  color: var(--ink-2);
  transition: background-color 0.18s var(--ease), color 0.18s var(--ease);
}
.site-nav__link:hover { background: var(--brand-soft); color: var(--brand-700); }
.site-nav__link.is-current { background: var(--brand); color: #fff; }

.nav-toggle__close { display: none; }
.site-header.is-open .nav-toggle__open { display: none; }
.site-header.is-open .nav-toggle__close { display: block; }

/* Mobile drawer */
@media (max-width: 899px) {
  .site-header.is-open .site-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.5rem var(--pad-x) 1rem;
    border-top: 1px solid var(--border);
    background: var(--surface);
  }
  .site-header.is-open .site-nav__link { padding: 0.85rem 1rem; font-size: 1rem; }
  .site-header__inner { flex-wrap: wrap; }
  .site-nav { order: 3; width: 100%; margin-inline: calc(var(--pad-x) * -1); }
}

@media (min-width: 900px) {
  :root { --header-h: 72px; }
  .site-nav { display: flex; align-items: center; gap: 0.25rem; margin-left: 1.5rem; }
  .nav-toggle { display: none; }
  .brand img { height: 2.1rem; }
}

.hide-sm { display: none; }
@media (min-width: 560px) { .hide-sm { display: inline-flex; } }

/* --------------------------------------------------------------------------
   5. Hero
   -------------------------------------------------------------------------- */
.hero {
  position: relative;
  isolation: isolate;
  padding-block: clamp(2rem, 6vw, 4.5rem) clamp(2rem, 5vw, 3.5rem);
  background:
    radial-gradient(60rem 30rem at 12% -10%, var(--brand-soft), transparent 60%),
    linear-gradient(180deg, var(--bg-alt), var(--bg) 70%);
  overflow: hidden;
}

.hero__glow {
  position: absolute;
  inset: auto -10% -40% auto;
  width: min(38rem, 90vw);
  aspect-ratio: 1;
  background: radial-gradient(circle, rgba(124, 77, 255, 0.22), transparent 62%);
  filter: blur(20px);
  z-index: -1;
}

.hero__inner {
  display: grid;
  gap: clamp(2rem, 5vw, 3.5rem);
  align-items: center;
}

.hero__copy { display: flex; flex-direction: column; align-items: start; gap: 1.1rem; }

.hero__title {
  font-size: var(--fs-hero);
  font-weight: 800;
  letter-spacing: -0.035em;
  display: flex;
  flex-wrap: wrap;
  gap: 0 0.35em;
}
.hero__title span { background-clip: text; -webkit-background-clip: text; color: transparent; }
.grad-1 { background-image: linear-gradient(135deg, #7c4dff, #b18cff); }
.grad-2 { background-image: linear-gradient(135deg, #ff4d8d, #ff8fb1); }
.grad-3 { background-image: linear-gradient(135deg, #ff8a2b, #ffc46b); }

.hero__lede {
  max-width: 34rem;
  color: var(--ink-2);
  font-size: clamp(1rem, 1.8vw, 1.125rem);
}

.hero__cta { display: flex; flex-wrap: wrap; gap: 0.75rem; }

.hero__stats {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(1rem, 4vw, 2.5rem);
  margin-top: 0.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  width: min(100%, 30rem);
}
.stat dt { font-size: var(--fs-xs); color: var(--ink-3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.stat dd { font-size: clamp(1.375rem, 3vw, 1.75rem); font-weight: 800; color: var(--ink); }

/* Hero art: slow vertical marquee of real game thumbnails. */
.hero__art {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.875rem;
  height: clamp(15rem, 42vw, 27rem);
  overflow: hidden;
  mask-image: linear-gradient(to bottom, transparent, #000 14%, #000 86%, transparent);
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 14%, #000 86%, transparent);
}

.hero__col { display: flex; flex-direction: column; animation: marquee-y 46s linear infinite; }
.hero__col:nth-child(2) { animation-duration: 62s; animation-direction: reverse; }
.hero__col:nth-child(3) { animation-duration: 54s; }

.hero__tile {
  /* margin (not gap) keeps the 50% loop point exact */
  margin-bottom: 0.875rem;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--surface-2);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
}
.hero__tile img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }

@keyframes marquee-y {
  from { transform: translateY(0); }
  to { transform: translateY(-50%); }
}

@media (min-width: 900px) {
  .hero__inner { grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); }
}

/* --------------------------------------------------------------------------
   6. Search bar
   -------------------------------------------------------------------------- */
.searchbar {
  position: sticky;
  top: var(--header-h);
  z-index: 90;
  padding-block: 0.75rem;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.5rem 0.35rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s var(--ease), border-color 0.2s var(--ease);
}
.search:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-ring);
}

.search__icon { display: grid; place-items: center; color: var(--brand); font-size: 1.1rem; }

.search__input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: none;
  padding: 0.65rem 0;
  font-size: 1rem;
}
.search__input::placeholder { color: var(--ink-3); }
.search__input::-webkit-search-cancel-button { display: none; }

.search__clear,
.search__mic {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--r-pill);
  color: var(--ink-3);
  flex: none;
}
.search__clear:hover { background: var(--bg-alt); color: var(--ink); }
.search__mic { background: linear-gradient(135deg, var(--brand), var(--brand-700)); color: #fff; }
.search__mic.is-listening { animation: pulse 1.2s ease-in-out infinite; }

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--brand-ring); }
  50% { box-shadow: 0 0 0 0.6rem transparent; }
}

.search__status {
  min-height: 1.25rem;
  margin-top: 0.4rem;
  padding-inline: 1rem;
  font-size: var(--fs-xs);
  color: var(--ink-3);
}

/* --------------------------------------------------------------------------
   7. Section furniture
   -------------------------------------------------------------------------- */
.section-head { margin-bottom: 1.25rem; }
.section-title { font-size: var(--fs-h2); }
.section-title--center { text-align: center; margin-bottom: 2rem; }
.section-sub { color: var(--ink-2); font-size: var(--fs-sm); margin-top: 0.35rem; }

/* --------------------------------------------------------------------------
   8. Rails (horizontal game rows)
   -------------------------------------------------------------------------- */
.rail { padding-block: clamp(1.5rem, 3vw, 2.25rem); }

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

.rail__title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: var(--fs-h2);
}

.rail__icon {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--r-sm);
  flex: none;
  color: var(--section-accent, var(--brand));
  background: color-mix(in srgb, var(--section-accent, var(--brand)) 14%, transparent);
  font-size: 1.1rem;
}

.rail__count {
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--ink-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  padding: 0.1rem 0.55rem;
}

.rail__desc { color: var(--ink-2); font-size: var(--fs-sm); margin-top: 0.3rem; }

.rail__nav { display: none; gap: 0.5rem; flex: none; }
@media (min-width: 900px) { .rail__nav:not([hidden]) { display: flex; } }

.rail__btn {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--r-pill);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s var(--ease), background-color 0.18s var(--ease),
              color 0.18s var(--ease), opacity 0.18s var(--ease);
}
.rail__btn:hover:not(:disabled) {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  transform: scale(1.06);
}
.rail__btn:disabled { opacity: 0.35; cursor: default; }

.rail__track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: var(--card-w);
  gap: clamp(0.75rem, 2vw, 1.25rem);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: 0.25rem;
  padding: 0.5rem 0.25rem 1rem;
  /* Let cards bleed to the screen edge on phones, aligned to the container
     on desktop — the classic app-store rail feel. */
  margin-inline: calc(var(--pad-x) * -1);
  padding-inline: var(--pad-x);
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
.rail__track > * { scroll-snap-align: start; }
.rail__track::-webkit-scrollbar { height: 6px; }
.rail__track::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--r-pill); }
.rail__track::-webkit-scrollbar-track { background: transparent; }

@media (min-width: 900px) {
  .rail__track { margin-inline: 0; padding-inline: 0.25rem; scroll-snap-type: none; }
}

/* --------------------------------------------------------------------------
   9. Game card
   -------------------------------------------------------------------------- */
.game-card { min-width: 0; }

.game-card__link {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.22s var(--ease), box-shadow 0.22s var(--ease),
              border-color 0.22s var(--ease);
}
.game-card__link:hover,
.game-card__link:focus-visible {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
  border-color: color-mix(in srgb, var(--card-accent, var(--brand)) 45%, transparent);
}

.game-card__media {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: linear-gradient(135deg, var(--bg-alt), var(--surface-2));
}

.game-card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s var(--ease);
}
.game-card__link:hover .game-card__img { transform: scale(1.06); }

.game-card__play {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  color: #fff;
  font-weight: 700;
  font-size: var(--fs-sm);
  background: color-mix(in srgb, var(--card-accent, var(--brand)) 82%, transparent);
  opacity: 0;
  transition: opacity 0.22s var(--ease);
}
.game-card__link:hover .game-card__play,
.game-card__link:focus-visible .game-card__play { opacity: 1; }

.game-card__body {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.85rem 0.9rem 1rem;
  flex: 1;
}

.game-card__tag {
  align-self: start;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--card-accent, var(--brand));
  background: color-mix(in srgb, var(--card-accent, var(--brand)) 12%, transparent);
  border-radius: var(--r-pill);
  padding: 0.2rem 0.6rem;
}

.game-card__title {
  font-size: var(--fs-h3);
  font-weight: 700;
  color: var(--ink);
  /* Two lines max so cards in a row stay the same height. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.game-card__desc {
  font-size: var(--fs-xs);
  line-height: 1.5;
  color: var(--ink-3);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Touch devices never fire :hover — show the play affordance permanently. */
@media (hover: none) {
  .game-card__play {
    inset: auto 0.5rem 0.5rem auto;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: var(--r-pill);
    opacity: 1;
    gap: 0;
    box-shadow: var(--shadow-md);
  }
  .game-card__play-text { display: none; }
  .game-card__play .icon--lg { width: 1.05rem; height: 1.05rem; }
}

/* --------------------------------------------------------------------------
   10. Category chips + grid
   -------------------------------------------------------------------------- */
.catalogue { padding-block: clamp(2rem, 5vw, 3.5rem); }

.chips {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0.25rem 0 1.25rem;
  margin-inline: calc(var(--pad-x) * -1);
  padding-inline: var(--pad-x);
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
@media (min-width: 900px) {
  .chips { flex-wrap: wrap; overflow: visible; margin-inline: 0; padding-inline: 0; }
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  border-radius: var(--r-pill);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink-2);
  font-size: var(--fs-sm);
  font-weight: 600;
  white-space: nowrap;
  flex: none;
  transition: background-color 0.18s var(--ease), color 0.18s var(--ease),
              border-color 0.18s var(--ease), transform 0.18s var(--ease);
}
.chip:hover { border-color: var(--chip-accent, var(--brand)); color: var(--chip-accent, var(--brand)); }
.chip.is-active {
  background: var(--chip-accent, var(--brand));
  border-color: var(--chip-accent, var(--brand));
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.chip__count {
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 0.05rem 0.4rem;
  border-radius: var(--r-pill);
  background: color-mix(in srgb, currentColor 14%, transparent);
}

/* Column minimums are tuned so the grid lands on 2 / 3 / 4 / 5 columns at
   320 / 560 / 768 / 1280px rather than leaving a half-empty last row. */
.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 8.5rem), 1fr));
  gap: clamp(0.75rem, 2vw, 1.25rem);
}
@media (min-width: 560px) {
  .game-grid { grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); }
}
@media (min-width: 900px) {
  .game-grid { grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); }
}

/* Hidden by filter/search rather than removed, so scroll position is stable. */
.game-card[hidden] { display: none; }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 3rem 1rem;
  text-align: center;
  color: var(--ink-2);
}
.empty-state__icon {
  display: grid;
  place-items: center;
  width: 3.25rem;
  height: 3.25rem;
  margin-bottom: 0.5rem;
  border-radius: var(--r-pill);
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 1.4rem;
}
.empty-state strong { font-size: 1.0625rem; color: var(--ink); }

/* --------------------------------------------------------------------------
   11. Quiz promo
   -------------------------------------------------------------------------- */
.promo-wrap { padding-block: clamp(1.5rem, 4vw, 2.5rem); }

.promo {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 1.5rem;
  align-items: center;
  padding: clamp(1.75rem, 5vw, 3.25rem);
  border-radius: var(--r-xl);
  background:
    radial-gradient(40rem 20rem at 85% 15%, rgba(255, 214, 102, 0.28), transparent 60%),
    linear-gradient(135deg, #2d1b69 0%, #6639e8 100%);
  color: #fff;
  box-shadow: var(--shadow-lg);
}
@media (min-width: 800px) { .promo { grid-template-columns: 1.4fr 0.6fr; } }

.promo__body { display: flex; flex-direction: column; align-items: start; gap: 0.9rem; }
.promo__title { font-size: var(--fs-h2); }
.promo__text { color: rgba(255, 255, 255, 0.86); max-width: 34rem; }

.promo__art { position: relative; min-height: 8rem; display: none; }
@media (min-width: 800px) { .promo__art { display: block; } }

.promo__badge {
  position: absolute;
  display: grid;
  place-items: center;
  border-radius: var(--r-lg);
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(6px);
  animation: bob 4s ease-in-out infinite;
}
.promo__badge--1 { inset: 0 auto auto 12%; width: 5.5rem; height: 5.5rem; font-size: 2.25rem; color: #ffd666; }
.promo__badge--2 { inset: 45% 8% auto auto; width: 4rem; height: 4rem; font-size: 1.6rem; color: #fff; animation-delay: -1.3s; }
.promo__badge--3 { inset: auto auto 0 28%; width: 3.5rem; height: 3.5rem; font-size: 1.4rem; color: #9ef0c7; animation-delay: -2.6s; }

@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50% { transform: translateY(-12px) rotate(3deg); }
}

/* --------------------------------------------------------------------------
   12. Features
   -------------------------------------------------------------------------- */
.features { padding-block: clamp(2rem, 5vw, 3.5rem); }

.feature-list {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
}

.feature {
  padding: 1.5rem;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.feature__icon {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  margin-bottom: 0.85rem;
  border-radius: var(--r-sm);
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 1.25rem;
}
.feature h3 { font-size: 1.0625rem; margin-bottom: 0.35rem; }
.feature p { font-size: var(--fs-sm); color: var(--ink-2); }

/* --------------------------------------------------------------------------
   13. Footer
   -------------------------------------------------------------------------- */
.site-footer {
  margin-top: clamp(2rem, 6vw, 4rem);
  padding-block: clamp(2.5rem, 5vw, 3.5rem) 1.5rem;
  background: var(--surface);
  border-top: 1px solid var(--border);
  color: var(--ink-2);
  font-size: var(--fs-sm);
}

.site-footer__top {
  display: grid;
  gap: 2rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
  padding-bottom: 2rem;
}
@media (min-width: 900px) {
  .site-footer__top { grid-template-columns: 1.6fr 1fr 1fr 1fr; }
}

.site-footer__brand { display: flex; flex-direction: column; gap: 0.9rem; align-items: start; }
.site-footer__brand img { height: 2.25rem; width: auto; }
.site-footer__brand p { max-width: 24rem; }

.site-footer__nav h2 {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  margin-bottom: 0.75rem;
}
.site-footer__nav li + li { margin-top: 0.5rem; }
.site-footer__nav a { transition: color 0.18s var(--ease); }
.site-footer__nav a:hover { color: var(--brand); }

.social { display: flex; gap: 0.5rem; }
.social__link {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--r-pill);
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 1.1rem;
  transition: background-color 0.18s var(--ease), color 0.18s var(--ease), transform 0.18s var(--ease);
}
.social__link:hover { background: var(--brand); color: #fff; transform: translateY(-2px); }

.site-footer__bottom {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  justify-content: space-between;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  font-size: var(--fs-xs);
  color: var(--ink-3);
}

/* --------------------------------------------------------------------------
   14. Back to top
   -------------------------------------------------------------------------- */
.to-top {
  position: fixed;
  right: clamp(0.75rem, 3vw, 1.5rem);
  bottom: clamp(0.75rem, 3vw, 1.5rem);
  z-index: 95;
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border-radius: var(--r-pill);
  background: linear-gradient(135deg, var(--brand), var(--brand-700));
  color: #fff;
  font-size: 1.15rem;
  box-shadow: var(--shadow-brand);
  transition: transform 0.2s var(--ease), opacity 0.2s var(--ease);
}
.to-top[hidden] { display: none; }
.to-top:hover { transform: translateY(-3px) scale(1.05); }

/* --------------------------------------------------------------------------
   15. Motion preferences
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .hero__col { animation: none; }
}
