:root {
  --ink: #171B2B;
  --ink-soft: #5B6479;

  /* STEMxPLORE brand palette — sampled from the logo, master reference for
     every accent in this section. No off-brand colors used anywhere below. */
  --brand-blue:   #2E6BFF;  /* S T E M · E */
  --brand-purple: #8B5CF6;  /* x */
  --brand-orange: #F59E0B;  /* P */
  --brand-red:    #EF4444;  /* L */
  --brand-green:  #22C55E;  /* O */
  --brand-lime:   #84CC16;  /* R */

  --card: #FFFFFF;
  --line: #E7E9F3;

  --font-display: 'Poppins', sans-serif;
  --font-body: 'Nunito', sans-serif;
}

html { scroll-behavior: smooth; }
* { box-sizing: border-box; }
body { margin: 0; font-family: var(--font-body); color: var(--ink); }

/* ============================================================
   HERO
   ============================================================ */
.hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(ellipse 900px 520px at 78% 15%, rgba(46, 107, 255, 0.07) 0%, rgba(46, 107, 255, 0) 70%),
    linear-gradient(120deg, #F1EEFE 0%, #F7F8FF 45%, #FFFFFF 100%);
  padding: 26px 52px 22px;
}

.hero__inner {
  position: relative;
  z-index: 2;
  max-width: 1320px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  align-items: center;
  gap: 48px;
}

/* ---- Decorative background motifs ---- */
.hero__decor { position: absolute; inset: 0; z-index: 1; pointer-events: none; }

.decor { position: absolute; color: var(--brand-blue); opacity: 0.10; }
.decor--atom-tl    { width: 160px; height: 160px; top: -30px; left: -20px; }
.decor--atom-right { width: 130px; height: 130px; top: 20px; right: 6%; color: var(--brand-lime); opacity: 0.08; }

.decor--star {
  font-size: 20px;
  color: var(--brand-orange);
  opacity: 0.35;
}
.decor--star1 { top: 12%; right: 34%; font-size: 16px; }
.decor--star2 { top: 60%; left: 6%; font-size: 22px; color: var(--brand-purple); opacity: 0.25; }
.decor--star3 { bottom: 8%; right: 4%; font-size: 18px; }

/* ---- Left: copy ---- */
.hero__title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 1.04;
}
.hero__title-line { display: block; font-size: clamp(24px, 2.2vw, 28px); }
.hero__title-line--ink { color: var(--ink); }
.hero__title-line.logo-word { font-size: clamp(36px, 3.8vw, 46px); margin: 0; }

/* .logo-word no longer sets its own display — it's now also a
   .hero__title-line, so it inherits `display: block` from that class,
   letting it sit on its own line. The individual .logo-letter spans
   below are already inline-block, so they still flow left-to-right
   within it. */
.logo-letter { display: inline-block; }
.logo-letter--blue   { color: var(--brand-blue); }
.logo-letter--purple { color: var(--brand-purple); }
.logo-letter--orange { color: var(--brand-orange); }
.logo-letter--red    { color: var(--brand-red); }
.logo-letter--green  { color: var(--brand-green); }
.logo-letter--lime   { color: var(--brand-lime); }

.hero__word { display: inline-block; }
.hero__word--blue  { color: var(--brand-blue); }
.hero__word--ink   { color: var(--ink); }
.hero__word--green { color: var(--brand-green); }

.hero__subtitle {
  margin: 8px 0 0;
  max-width: 460px;
  font-size: 16.5px;
  line-height: 1.4;
  font-weight: 600;
  color: var(--ink-soft);
}

.trust-badges {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
}

.trust-badge {
  display: inline-flex;
  align-items: center;
  height: 36px;
  gap: 7px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 11px 0 8px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 12px;
  color: var(--ink);
  box-shadow: 0 6px 16px rgba(23, 27, 43, 0.06);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.trust-badge:hover {
  transform: translateY(-2px);
  border-color: rgba(46, 107, 255, 0.35);
  box-shadow: 0 14px 28px rgba(46, 107, 255, 0.16);
}

.trust-badge__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  color: #fff;
  flex-shrink: 0;
}
.trust-badge__icon svg { width: 11px; height: 11px; }
.trust-badge__icon--purple { background: var(--brand-purple); }
.trust-badge__icon--blue   { background: var(--brand-blue); }
.trust-badge__icon--orange { background: var(--brand-orange); }
.trust-badge__icon--green  { background: var(--brand-green); }
.trust-badge__icon--red    { background: var(--brand-red); }

/* ---- Right: laptop illustration ---- */
.hero__art {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* ---- Floating STEM motifs behind/around the laptop ---- */
.art-decor {
  position: absolute;
  inset: -40px;
  z-index: 0;
  pointer-events: none;
}

.art-decor__item {
  position: absolute;
  color: var(--brand-blue);
  opacity: 0.12;
  animation: art-float 7s ease-in-out infinite;
}

.art-decor__item--flask { width: 64px; height: 64px; top: 2%;  left: -6%;  color: var(--brand-purple); animation-delay: 0s; }
.art-decor__item--dna   { width: 44px; height: 78px; top: 8%;  right: -4%; color: var(--brand-blue);   animation-delay: 1.1s; }
.art-decor__item--atom  { width: 70px; height: 70px; bottom: -6%; left: 4%; color: var(--brand-lime); opacity: 0.12; animation-delay: 2.2s; }
.art-decor__item--leaf  { width: 52px; height: 52px; bottom: 4%;  right: 0%; color: var(--brand-green);  animation-delay: 3.3s; }
.art-decor__item--calc  { width: 46px; height: 46px; top: 42%; left: -10%; color: var(--brand-orange);  opacity: 0.10; animation-delay: 4.4s; }
.art-decor__item--orbit { width: 56px; height: 56px; top: 40%; right: -8%; color: var(--brand-red); opacity: 0.10; animation-delay: 5.5s; }

@keyframes art-float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-14px) rotate(5deg); }
}

.laptop {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 340px;
}

.laptop__screen-frame {
  position: relative;
  aspect-ratio: 16 / 10.5;
  background: #1a2033;
  border-radius: 18px;
  padding: 10px;
  box-shadow:
    0 30px 60px -20px rgba(30, 40, 90, 0.35),
    0 10px 24px -10px rgba(30, 40, 90, 0.25);
}

.laptop__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 10px;
  display: block;
}

.laptop__base {
  height: 14px;
  margin: 0 -14px;
  background: linear-gradient(180deg, #C7CCDC 0%, #A6ACC2 100%);
  border-radius: 0 0 12px 12px;
  box-shadow: 0 8px 16px -6px rgba(30, 40, 90, 0.3);
}

.laptop__shadow {
  height: 22px;
  width: 78%;
  margin: 10px auto 0;
  background: radial-gradient(ellipse at center, rgba(30, 40, 90, 0.28) 0%, rgba(30, 40, 90, 0) 72%);
  filter: blur(2px);
}

/* CSS-built placeholder dashboard — same box, same proportions as the real
   screenshot slot. Matches the approved mockup: white SaaS-style dashboard,
   not the old dark-blue tile screen. */
.laptop__placeholder {
  position: absolute;
  inset: 10px;
  border-radius: 10px;
  background: #FFFFFF;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: var(--font-body);
}

/* 1. Top bar */
.dash__topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  border-bottom: 1px solid #EEF0F6;
  flex-shrink: 0;
}
.dash__wordmark {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 13px;
}
.dash__topbar-right { display: flex; align-items: center; gap: 5px; }
.dash__pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 9.5px;
  font-weight: 800;
  padding: 4px 8px;
  border-radius: 999px;
}
.dash__pill--xp { background: #FEF3C7; color: #92400E; }
.dash__pill--level { background: #EDE9FE; color: #6D28D9; }
.dash__avatar {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #DBEAFE;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
}

/* Shared section wrapper */
.dash__section {
  padding: 6px 12px 5px;
  flex-shrink: 0;
}
.dash__section-title {
  display: block;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 8px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 5px;
}

/* 2. Official Stores — first major content beneath the header, no large
   gap above it. Rendered from HERO_STORES, one row, 3 equal columns.
   Cards are ~12% larger than the original pass and now include a short
   description line (logo/icon, name, description, CTA). */
.dash__section--stores { padding-top: 4px; }
.dash__stores {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.store-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 7px 9px;
  border-radius: 9px;
  text-decoration: none;
  border: 1px solid transparent;
}
.store-card__top { display: flex; align-items: center; gap: 5px; }
.store-card__icon { width: 16px; height: 16px; flex-shrink: 0; }
.store-card__name { font-size: 10px; font-weight: 800; color: var(--ink); line-height: 1.2; }
.store-card__desc {
  font-size: 7.5px;
  font-weight: 600;
  color: var(--ink-soft);
  line-height: 1.25;
  margin: 1px 0 2px;
}
.store-card__status {
  font-size: 9px;
  font-weight: 700;
}
/* Accent color per store (from data — orange/blue/green), independent of
   live/coming-soon status, which only affects clickability + status text. */
.store-card--orange { background: #FFF4E8; border-color: #FCD9A8; }
.store-card--blue   { background: #EAF2FF; border-color: #C7DCFF; }
.store-card--green  { background: #ECFDF3; border-color: #BBF0D0; }

.store-card--live .store-card__status { color: #C2410C; }
.store-card--soon {
  opacity: 0.85;
  cursor: default;
}
.store-card--soon .store-card__status { color: var(--ink-soft); }
.store-card--orange .store-card__icon { color: #C2410C; }
.store-card--blue .store-card__icon   { color: #1D4ED8; }
.store-card--green .store-card__icon  { color: #16A34A; }

/* 3. Choose Your Adventure — cards ~10% larger than the original pass */
.dash__section--adventure { padding-top: 5px; padding-bottom: 3px; }
.dash__adventure-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.adv-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 7px 6px 8px;
  border-radius: 10px;
  text-align: center;
}
.adv-card__art { width: 37px; height: 24px; }
.adv-card__title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 10.5px;
  letter-spacing: 0.02em;
}
.adv-card__desc {
  font-size: 8px;
  font-weight: 600;
  color: var(--ink-soft);
  line-height: 1.25;
}
.adv-card__btn {
  margin-top: 2px;
  width: 100%;
  border: none;
  border-radius: 999px;
  padding: 5px 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 9px;
  color: #fff;
  cursor: pointer;
}
.adv-card--green  { background: #F0FDF4; }
.adv-card--green .adv-card__title { color: #16A34A; }
.adv-card--green .adv-card__btn { background: #22C55E; }
.adv-card--purple { background: #F5F3FF; }
.adv-card--purple .adv-card__title { color: #7C3AED; }
.adv-card--purple .adv-card__btn { background: #8B5CF6; }
.adv-card--orange { background: #FFF7ED; }
.adv-card--orange .adv-card__title { color: #EA580C; }
.adv-card--orange .adv-card__btn { background: #F59E0B; }

/* 4. Achievement strip */
.dash__achieve-strip {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 5px 12px;
  border-top: 1px solid #EEF0F6;
  flex-shrink: 0;
}
.dash__achieve-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 8px;
  color: var(--ink-soft);
  line-height: 1.3;
}
.dash__achieve-item strong { color: var(--ink); font-size: 8.5px; }
.dash__achieve-icon { font-size: 13px; }
.dash__achieve-item--right { text-align: right; flex-direction: row-reverse; }


/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 980px) {
  .hero { padding: 48px 28px; }
  .hero__inner {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 36px;
  }
  .hero__subtitle { margin-left: auto; margin-right: auto; }
  .trust-badges { justify-content: center; }
  .hero__art { order: -1; }
  .laptop { max-width: 310px; }

  /* Dashboard scale for the 360px-wide laptop frame at this breakpoint —
     previously missing, which let full desktop font sizes overflow a
     visibly smaller screen. Sized between the desktop and mobile passes. */
  .dash__wordmark { font-size: 12px; }
  .dash__pill { font-size: 8.5px; padding: 3.5px 7px; }
  .dash__avatar { width: 18px; height: 18px; font-size: 10px; }
  .dash__section-title { font-size: 7.5px; }
  .store-card { padding: 6px 7px; }
  .store-card__icon { width: 14px; height: 14px; }
  .store-card__name { font-size: 8.5px; }
  .store-card__desc { font-size: 7px; }
  .store-card__status { font-size: 8px; }
  .adv-card { padding: 6px 5px 7px; }
  .adv-card__art { width: 32px; height: 21px; }
  .adv-card__title { font-size: 9px; }
  .adv-card__desc { font-size: 7px; }
  .adv-card__btn { font-size: 8px; padding: 4px 0; }
  .dash__achieve-strip { padding: 4px 10px; }
  .dash__achieve-item, .dash__achieve-item strong { font-size: 7.5px; }
  .dash__achieve-icon { font-size: 12px; }
}

@media (max-width: 520px) {
  .hero { padding: 36px 18px; }
  .trust-badge { font-size: 12px; padding: 8px 12px 8px 8px; }

  /* Keep the dashboard's 3-column stores/adventure rows intact per the
     brief (never hide the stores), just scale everything down together
     so nothing wraps or overflows on a small laptop frame. */
  .laptop { max-width: 260px; }
  .dash__wordmark { font-size: 11px; }
  .dash__pill { font-size: 8px; padding: 3px 6px; }
  .dash__avatar { width: 16px; height: 16px; font-size: 9px; }
  .dash__section-title { font-size: 7px; }
  .store-card { padding: 5px 6px; }
  .store-card__icon { width: 12px; height: 12px; }
  .store-card__name { font-size: 7.5px; }
  .store-card__desc { font-size: 6.5px; }
  .store-card__status { font-size: 7px; }
  .adv-card { padding: 5px 4px 6px; }
  .adv-card__art { width: 28px; height: 18px; }
  .adv-card__title { font-size: 8px; }
  .adv-card__desc { font-size: 6.5px; }
  .adv-card__btn { font-size: 7.5px; }
  .dash__achieve-strip { padding: 5px 10px; }
  .dash__achieve-item, .dash__achieve-item strong { font-size: 7px; }
  .dash__achieve-icon { font-size: 11px; }
}

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

/* ============================================================
   BRAND — hover / focus states
   Nothing in the Hero is a real interactive control yet (no CTA
   button in this section of the mockup), so this establishes the
   brand-blue focus ring pattern now, ready for any button/link
   added in later steps, and gives the laptop a subtle brand-tinted
   hover lift as the section's one "premium interactive" touch.
   ============================================================ */
:focus-visible {
  outline: 3px solid var(--brand-blue);
  outline-offset: 2px;
}

.laptop { transition: transform 0.25s ease; }
.laptop:hover { transform: translateY(-4px); }

/* ---- Primary CTA: "Explore Games" ---- */
.hero__cta {
  display: inline-flex;
  align-items: center;
  height: 46px;
  gap: 10px;
  margin-top: 12px;
  padding: 0 22px;
  border-radius: 14px;
  background: linear-gradient(135deg, #A78BFA 0%, var(--brand-purple) 55%, #7C3AED 100%);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
  box-shadow: 0 14px 28px rgba(139, 92, 246, 0.32);
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}
.hero__cta svg { width: 18px; height: 18px; transition: transform 0.18s ease; }

.hero__cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 34px rgba(139, 92, 246, 0.4);
  filter: brightness(1.04);
}
.hero__cta:hover svg { transform: translateX(3px); }

.hero__cta:active { transform: translateY(0); }

@media (max-width: 980px) {
  .hero__cta { margin-left: auto; margin-right: auto; }
}

/* ============================================================
   FINAL POLISH — logo, laptop achievements, official stores, tagline
   ============================================================ */

/* ---- Logo slot (image with text-wordmark fallback) ---- */


/* ---- Tagline ---- */
.hero__tagline {
  margin: 8px 0 0;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink-soft);
  font-style: italic;
}

/* ---- Microscope decor placement ---- */
.art-decor__item--microscope {
  width: 50px; height: 50px;
  top: 24%; left: -12%;
  color: var(--brand-blue);
  opacity: 0.1;
  animation-delay: 0.6s;
}

/* ============================================================
   INTERACTIVE FILTER BAR
   ============================================================ */
.filter-bar-section {
  position: sticky;
  top: 12px;
  z-index: 30;
  padding: 0 24px;
  margin: 0 auto 14px;
  max-width: 1320px;
}

.filter-bar {
  /* Floating glassmorphism card */
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 18px;
  box-shadow:
    0 16px 36px -18px rgba(23, 27, 43, 0.16),
    0 4px 12px rgba(23, 27, 43, 0.05);
  padding: 8px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-bar__row {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}
.filter-bar__row--secondary {
  justify-content: space-between;
}

/* ---- Pills ---- */
.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 12.5px;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.6);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.filter-pill__icon {
  display: inline-flex;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.filter-pill__icon svg { width: 100%; height: 100%; }

/* Hover: lift + subtle brand-tinted shadow */
.filter-pill:hover {
  transform: translateY(-2px);
  border-color: rgba(46, 107, 255, 0.35);
  box-shadow: 0 8px 18px rgba(46, 107, 255, 0.14);
  color: var(--ink);
}

/* Per-subject color on hover/active, via data-color */
.filter-pill[data-color="green"]:hover,
.filter-pill[data-color="green"].filter-pill--active {
  border-color: var(--brand-green); color: var(--brand-green);
  background: rgba(34, 197, 94, 0.1);
  box-shadow: 0 8px 18px rgba(34, 197, 94, 0.18);
}
.filter-pill[data-color="purple"]:hover,
.filter-pill[data-color="purple"].filter-pill--active {
  border-color: var(--brand-purple); color: var(--brand-purple);
  background: rgba(139, 92, 246, 0.1);
  box-shadow: 0 8px 18px rgba(139, 92, 246, 0.18);
}
.filter-pill[data-color="blue"]:hover,
.filter-pill[data-color="blue"].filter-pill--active {
  border-color: var(--brand-blue); color: var(--brand-blue);
  background: rgba(46, 107, 255, 0.1);
  box-shadow: 0 8px 18px rgba(46, 107, 255, 0.18);
}
.filter-pill[data-color="orange"]:hover,
.filter-pill[data-color="orange"].filter-pill--active {
  border-color: var(--brand-orange); color: #B45309;
  background: rgba(245, 158, 11, 0.12);
  box-shadow: 0 8px 18px rgba(245, 158, 11, 0.18);
}
.filter-pill[data-color="teal"]:hover,
.filter-pill[data-color="teal"].filter-pill--active {
  border-color: #0D9488; color: #0D9488;
  background: rgba(13, 148, 136, 0.1);
  box-shadow: 0 8px 18px rgba(13, 148, 136, 0.18);
}

/* "All Games" active state — ink-filled, no subject color */
.filter-pill--active:not([data-color]) {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}
.filter-pill--active:not([data-color]):hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(23, 27, 43, 0.25);
}

/* Status pills */
.filter-pill--status { padding: 8px 14px 8px 12px; }
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot--available { background: var(--brand-green); }
.status-dot--soon { background: var(--brand-orange); }
.filter-pill--status.filter-pill--active {
  background: rgba(23, 27, 43, 0.06);
  border-color: var(--ink-soft);
  color: var(--ink);
}

/* ---- Search box ---- */
.search-box {
  display: flex;
  align-items: center;
  gap: 9px;
  background: rgba(255, 255, 255, 0.75);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 7px 14px;
  min-width: 200px;
  flex: 0 1 240px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
.search-box:focus-within {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px rgba(46, 107, 255, 0.14);
}
.search-box__icon { width: 17px; height: 17px; color: var(--ink-soft); flex-shrink: 0; }
.search-box input {
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 13.5px;
  color: var(--ink);
  width: 100%;
}
.search-box input::placeholder { color: #9CA3B8; font-weight: 600; }

/* ---- Counter ---- */
.filter-bar__counter {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12px;
  color: var(--ink-soft);
  margin-left: auto;
  white-space: nowrap;
}
.filter-bar__counter strong { color: var(--ink); font-weight: 800; }

/* ============================================================
   RESPONSIVE — filter bar
   ============================================================ */
@media (max-width: 900px) {
  .filter-bar-section { padding: 0 16px; top: 10px; }
  .filter-bar { padding: 16px; border-radius: 20px; }
  .filter-bar__row--secondary { flex-direction: column; align-items: stretch; }
  .search-box { min-width: 0; flex: 1 1 auto; width: 100%; }
}

@media (max-width: 520px) {
  .filter-pill { font-size: 12.5px; padding: 8px 12px; }
  .filter-bar { gap: 12px; }
}

/* ============================================================
   PREMIUM GAME LIBRARY
   ============================================================ */
.library {
  max-width: 1500px;
  margin: 0 auto;
  padding-block: 4px 56px;
  padding-inline: clamp(16px, 3vw, 40px);
}

.library__header {
  text-align: center;
  max-width: 640px;
  margin: 0 auto 18px;
}
.library__title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(20px, 2.2vw, 26px);
  color: var(--ink);
  margin: 0 0 8px;
}
.library__subtitle {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-soft);
  line-height: 1.4;
  margin: 0;
}

/* ---- Grid: fixed column counts per breakpoint (not auto-fit) so a short
   filtered result never stretches into a few oversized cards — with
   explicit tracks, unused columns just stay empty instead of expanding. ---- */
.game-grid {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 16px;
}
@media (min-width: 600px)  { .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; } }
@media (min-width: 900px)  { .game-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .game-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1600px) { .game-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }

/* ---- Card ---- */
.game-card {
  background: var(--card);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 14px 30px -14px rgba(23, 27, 43, 0.16), 0 3px 10px rgba(23, 27, 43, 0.05);
  display: flex;
  flex-direction: column;
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}
.game-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 40px -16px rgba(23, 27, 43, 0.2), 0 6px 14px rgba(23, 27, 43, 0.07);
}

/* ---- Artwork: 16:9, ~42-48% of total card height by design (paired with
   the compact body below). No SVG icon art — a missing image falls back to
   a plain gradient + text placeholder, not an icon. ---- */
.game-card__art {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: linear-gradient(135deg, #E9ECF6, #F4F5FA);
}
.game-card__art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.game-card__art::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0) 55%, rgba(10,14,30,0.5) 100%);
  pointer-events: none;
}

.img-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 11px;
  color: var(--ink-soft);
}

/* Status ribbon */
.status-ribbon {
  position: absolute;
  top: 10px;
  right: -30px;
  transform: rotate(40deg);
  width: 120px;
  text-align: center;
  padding: 4px 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 9px;
  letter-spacing: 0.03em;
  color: #fff;
  z-index: 2;
  box-shadow: 0 3px 8px rgba(0,0,0,0.18);
}
.status-ribbon--available { background: linear-gradient(90deg, #22C55E, #16A34A); }
.status-ribbon--soon      { background: linear-gradient(90deg, #F59E0B, #D97706); }

/* Badge row, overlaid bottom-left of artwork — compact, per spec */
.game-card__badges {
  position: absolute;
  bottom: 7px;
  left: 7px;
  right: 7px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  z-index: 2;
}
.game-badge {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 8.5px;
  padding: 3px 7px;
  border-radius: 999px;
  color: #fff;
  background: rgba(23, 27, 43, 0.55);
  backdrop-filter: blur(3px);
  line-height: 1.3;
}
.game-badge--digital { background: rgba(46, 107, 255, 0.85); }

/* ---- Body ---- */
.game-card__body {
  padding: 28px 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex: 1;
}
.game-card__title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 15.5px;
  color: var(--ink);
  line-height: 1.3;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.game-card__desc {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  line-height: 1.5;
  margin: 0;
  /* Short description only — detailed learning outcomes and curriculum
     links live in the Learn More modal, kept off the card by design. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---- Actions: one compact row, pinned to the bottom of every card via
   margin-top: auto so uneven title/description lengths never shift button
   position — this is also what keeps every card equal height. ---- */
.game-card__actions {
  display: flex;
  gap: 10px;
  margin-top: auto;
}
.gc-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
  border-radius: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease, background 0.15s ease;
}
.gc-btn:hover { transform: translateY(-1px); }

/* Play Demo — primary, filled purple */
.gc-btn--play {
  min-height: 54px;
  border: none;
  background: linear-gradient(135deg, #A78BFA, var(--brand-purple) 60%, #7C3AED);
  color: #fff;
  font-size: 12.5px;
  padding: 8px 6px;
  box-shadow: 0 6px 14px rgba(139, 92, 246, 0.3);
}
.gc-btn--play[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
.gc-btn--play-icon { width: 14px; height: 14px; flex-shrink: 0; }

/* Learn More — secondary, outlined (View Store has moved into the modal,
   so this row is just the two actions per spec) */
.gc-btn--learn {
  min-height: 54px;
  background: #fff;
  border: 1.5px solid var(--line);
  color: var(--ink);
  font-size: 12.5px;
  padding: 8px 6px;
}
.gc-btn--learn:hover { background: #F7F7FB; border-color: #D7DAE8; }

@media (max-width: 599px) {
  .game-card__title { font-size: 16px; }
  .game-card__desc { font-size: 13.5px; }
}

/* ---- Reused Coming Soon toast (same pattern as elsewhere in the build) ---- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 14px;
  padding: 12px 20px;
  border-radius: 999px;
  box-shadow: 0 16px 36px rgba(0,0,0,0.25);
  z-index: 200;
  max-width: calc(100vw - 32px);
}
.toast[hidden] { display: none; }

/* ============================================================
   QUICK PLAY
   Sits directly beneath the compact Hero. Compact horizontal tiles —
   thumbnail, title, subject/age, and a prominent round Play button.
   No long descriptions/outcomes here by design.
   ============================================================ */
.quick-play {
  max-width: 1320px;
  margin: 0 auto;
  padding: 14px 56px 12px;
}
.quick-play__header {
  margin-bottom: 8px;
}
.quick-play__title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 20px;
  color: var(--ink);
  margin: 0 0 2px;
}
.quick-play__subtitle {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-soft);
  margin: 0;
}

.quick-play__row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
@media (max-width: 900px) {
  .quick-play__row {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: 78%;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }
  .qp-card { scroll-snap-align: start; }
}
@media (max-width: 520px) {
  .quick-play__row { grid-auto-columns: 84%; }
}

.qp-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border-radius: 14px;
  padding: 8px;
  box-shadow: 0 8px 20px -10px rgba(23, 27, 43, 0.14), 0 2px 8px rgba(23, 27, 43, 0.05);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.qp-card:hover { transform: translateY(-3px); box-shadow: 0 14px 28px -10px rgba(23, 27, 43, 0.2); }

.qp-card__thumb {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  overflow: hidden;
  flex-shrink: 0;
  background: #EEF0F6;
}
.qp-card__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.qp-card__body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.qp-card__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.qp-card__meta {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-soft);
}

.qp-card__play {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #A78BFA, var(--brand-purple) 60%, #7C3AED);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(139, 92, 246, 0.32);
  transition: transform 0.15s ease;
}
.qp-card__play:hover { transform: scale(1.06); }
.qp-card__play svg { width: 18px; height: 18px; margin-left: 2px; }

@media (max-width: 900px) { .quick-play { padding: 20px 28px 20px; } }
@media (max-width: 520px) { .quick-play { padding: 16px 18px 18px; } }

/* ============================================================
   LEARN MORE MODAL
   Two-column on desktop (gallery / info), stacks to one column on
   narrow viewports. Populated entirely from GAMES via script.js —
   no per-game markup lives here.
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(15, 18, 32, 0.56);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-overlay[hidden] { display: none; }

.game-modal {
  position: relative;
  width: 100%;
  max-width: 960px;
  max-height: min(88vh, 780px);
  background: var(--card);
  border-radius: 24px;
  box-shadow: 0 40px 90px -24px rgba(15, 18, 32, 0.45), 0 12px 28px rgba(15, 18, 32, 0.12);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.game-modal__close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: none;
  background: rgba(23, 27, 43, 0.55);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(3px);
  transition: background 0.15s ease, transform 0.15s ease;
}
.game-modal__close:hover { background: rgba(23, 27, 43, 0.78); transform: scale(1.06); }
.game-modal__close svg { width: 18px; height: 18px; }

.game-modal__grid {
  display: grid;
  grid-template-columns: 42% 1fr;
  overflow-y: auto;
}

/* ---- Left: gallery ---- */
.game-modal__gallery {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: linear-gradient(180deg, #F7F8FC, #FFFFFF);
}
.game-modal__shot {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 14px 30px -14px rgba(23, 27, 43, 0.28);
}
.game-modal__shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.game-modal__shot .status-ribbon { top: 12px; right: -32px; }

.game-modal__thumbs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.game-modal__thumb {
  width: 62px;
  height: 62px;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid transparent;
  padding: 0;
  cursor: pointer;
  background: none;
  flex-shrink: 0;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.game-modal__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.game-modal__thumb:hover { transform: translateY(-2px); }
.game-modal__thumb--active { border-color: var(--brand-purple); }

/* ---- Right: info ---- */
.game-modal__info {
  padding: 26px 28px 26px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}
.game-modal__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.game-modal__badges .game-badge {
  color: var(--ink);
  background: #F0F1F7;
}
.game-modal__badges .game-badge--digital { color: #fff; background: rgba(46, 107, 255, 0.9); }

.game-modal__title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 26px;
  color: var(--ink);
  margin: 2px 0 0;
  line-height: 1.15;
}
.game-modal__desc {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink-soft);
  line-height: 1.55;
  margin: 0;
}

.game-modal__section { margin-top: 2px; }
.game-modal__heading {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--ink);
  margin: 0 0 8px;
}
.game-modal__list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.game-modal__list li {
  position: relative;
  padding-left: 22px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-soft);
  line-height: 1.4;
}
.game-modal__list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 5px;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, #A78BFA, var(--brand-purple));
}

.game-modal__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.game-modal__tag {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  background: #EEF2FF;
  color: #3730A3;
  border: 1px solid #E0E4FA;
}

.game-modal__meta-row {
  display: flex;
  gap: 14px;
  margin-top: 4px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.game-modal__meta {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.game-modal__meta svg { width: 22px; height: 22px; flex-shrink: 0; color: var(--brand-purple); }
.game-modal__meta > div { display: flex; flex-direction: column; min-width: 0; }
.game-modal__meta-label {
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ink-soft);
}
.game-modal__meta-value {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.3;
}

.game-modal__actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}
.game-modal__actions .gc-btn--play { flex: 1.3; min-height: 48px; font-size: 14px; }
.gc-btn--store-wide {
  flex: 1;
  min-height: 48px;
  background: #F3F4F8;
  color: var(--ink);
  border: 1px solid var(--line);
}
.gc-btn--store-wide:hover { background: #E9EBF3; }
.gc-btn--store-wide[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }

/* ---- Responsive ---- */
@media (max-width: 860px) {
  .game-modal { max-height: 92vh; }
  .game-modal__grid { grid-template-columns: 1fr; overflow-y: auto; }
  .game-modal__gallery { padding: 18px 18px 4px; }
  .game-modal__shot { aspect-ratio: 16 / 10; }
  .game-modal__info { padding: 16px 20px 24px; }
  .game-modal__title { font-size: 22px; }
}
@media (max-width: 520px) {
  .modal-overlay { padding: 0; }
  .game-modal { max-width: 100%; max-height: 100vh; height: 100vh; border-radius: 0; }
  .game-modal__actions { flex-direction: column; }
}

/* ============================================================
   PRODUCTION ADDITIONS
   Subject-colored image fallback, empty state, clear-filters
   control, Quick Play prev/next controls, modal store list.
   ============================================================ */

/* ---- Subject-colored artwork fallback (card + modal) — no icon,
   no broken-image glyph, just a branded gradient + text, always
   sized to fill its 16:9 (card) or 1:1 (modal) container exactly. ---- */
.img-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 6px;
  padding: 14px;
  color: #fff;
}
/* A dark scrim behind the text (rather than relying on the gradient
   itself) guarantees WCAG AA contrast regardless of which subject
   color — or which point along its diagonal gradient — sits behind
   it. Verified: >=4.5:1 even against the lightest stop (math yellow). */
.img-fallback::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}
.img-fallback__title,
.img-fallback__meta {
  position: relative;
  z-index: 1;
}
.img-fallback__title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 13px;
  line-height: 1.3;
}
.img-fallback__meta {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 10px;
  opacity: 0.95;
}
.img-fallback--biology                { background: linear-gradient(135deg, #34D399, #0F9D6B); }
.img-fallback--chemistry               { background: linear-gradient(135deg, #A78BFA, #6D28D9); }
.img-fallback--physics                 { background: linear-gradient(135deg, #60A5FA, #1D4ED8); }
.img-fallback--mathematics             { background: linear-gradient(135deg, #FBBF24, #EA580C); }
.img-fallback--environmental-science   { background: linear-gradient(135deg, #2DD4BF, #0F766E); }

/* ---- Clear filters ---- */
.filter-bar__clear {
  border: none;
  background: none;
  color: #6D28D9;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 12.5px;
  padding: 6px 4px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.filter-bar__clear:hover { color: #5B21B6; }

/* ---- Zero-results empty state ---- */
.game-grid-empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--ink-soft);
  font-weight: 600;
}
.game-grid-empty p { margin: 0 0 14px; font-size: 15px; }
.game-grid-empty .gc-btn { display: inline-flex; padding-inline: 24px; flex: none; }

/* ---- Quick Play prev/next controls (desktop hidden — the grid
   already shows everything; shown only when the row can actually
   scroll, i.e. the mobile swipe layout). ---- */
.quick-play__row-wrap { position: relative; }
.quick-play__controls { display: none; }
@media (max-width: 900px) {
  .quick-play__controls {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 8px;
  }
  .quick-play__nav {
    width: 36px;
    height: 36px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
  }
  .quick-play__nav svg { width: 18px; height: 18px; }
  .quick-play__nav:hover { background: #F7F7FB; }
}

/* ---- Modal store list — one button per configured store, rendered
   entirely from data (see modalStoresHTML in script.js). ---- */
.game-modal__stores {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.game-modal__stores .gc-btn--store-wide {
  width: 100%;
  min-height: 44px;
}

/* Hero image starts hidden until script.js confirms it loaded
   successfully (fallback-first render) — a class instead of an inline
   style="" attribute so the CSP below never needs style-src
   'unsafe-inline'. */
.laptop__image--init-hidden { visibility: hidden; }


/* ============================================================
   EMBED MODE — /embed
   Used when the Cloudflare library is framed inside STEMxPLORE /play.
   Keeps the full standalone hero at / while removing the duplicate hero
   from the iframe experience.
   ============================================================ */
body.embed-mode {
  background: #fff;
}
body.embed-mode .hero {
  display: none !important;
}
body.embed-mode .quick-play {
  padding-top: 18px;
}
body.embed-mode .filter-bar-section {
  top: 0;
}
@media (max-width: 900px) {
  body.embed-mode .quick-play { padding-top: 14px; }
}
@media (max-width: 520px) {
  body.embed-mode .quick-play { padding-top: 12px; }
}
