/* ── Games Hub — frontend styles ─────────────────────────────────────────── */

/* Grid */
.lrn-games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1.25rem;
}

/* Game card */
.lrn-game-card {
  background: #fff;
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(124,58,237,.08);
  border: 1.5px solid #ede9fe;
  transition: transform .18s ease, box-shadow .18s ease;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
}

.lrn-game-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(124,58,237,.18);
  border-color: #c4b5fd;
  color: inherit;
}

.lrn-game-card-thumb {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  display: block;
  background: #f5f3ff;
}

.lrn-game-card-thumb-placeholder {
  width: 100%;
  aspect-ratio: 4/3;
  background: linear-gradient(135deg, #ede9fe 0%, #ddd6fe 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
}

.lrn-game-card-body {
  padding: .75rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: .25rem;
}

.lrn-game-card-title {
  font-size: .88rem;
  font-weight: 700;
  line-height: 1.3;
  color: #1e1b4b;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.lrn-game-card-meta {
  font-size: .72rem;
  color: #7c3aed;
  display: flex;
  align-items: center;
  gap: .35rem;
  margin-top: auto;
}

.lrn-game-card-mobile {
  font-size: .65rem;
  background: #f0fdf4;
  color: #166534;
  border-radius: .35rem;
  padding: .1rem .4rem;
  font-weight: 600;
}

/* Category filter bar */
.lrn-game-cats {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: 1.5rem;
}

.lrn-game-cat-btn {
  padding: .35rem .9rem;
  border-radius: 2rem;
  border: 1.5px solid #ddd6fe;
  background: #fff;
  color: #6d28d9;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  text-decoration: none;
}

.lrn-game-cat-btn:hover,
.lrn-game-cat-btn.active {
  background: #7c3aed;
  color: #fff;
  border-color: #7c3aed;
}

/* Hero section */
.lrn-games-hero {
  background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
  border-radius: 1.25rem;
  padding: 2rem 1.5rem;
  color: #fff;
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.lrn-games-hero-icon {
  font-size: 3rem;
  flex-shrink: 0;
}

.lrn-games-hero h1 {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: .25rem;
}

.lrn-games-hero p {
  font-size: .95rem;
  opacity: .9;
  margin: 0;
}

/* Empty state */
.lrn-games-empty {
  text-align: center;
  padding: 4rem 1rem;
  color: #a78bfa;
}

.lrn-games-empty-icon {
  font-size: 3.5rem;
  margin-bottom: 1rem;
}

/* ── Game player page ─────────────────────────────────────────────────────── */

/* 2-column outer grid — used on both games hub and individual game page */
.lrn-gp-outer {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 2rem;
  align-items: start;
  max-width: 1360px;
  margin: 0 auto;
  padding-top: 1.5rem;
  padding-bottom: 3rem;
}

/* Main column */
.lrn-gp-main {
  min-width: 0;
}

/* Sidebar column */
.lrn-gp-sidebar {
  position: sticky;
  top: 5.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* ── Sidebar widgets ── */

.lrn-gp-widget {
  background: #fff;
  border: 1.5px solid #ede9fe;
  border-radius: 1rem;
  overflow: hidden;
}

.lrn-gp-widget-hd {
  padding: .7rem 1rem;
  background: #f5f3ff;
  border-bottom: 1.5px solid #ede9fe;
  font-size: .76rem;
  font-weight: 900;
  color: #6d28d9;
  text-transform: uppercase;
  letter-spacing: .05em;
  display: flex;
  align-items: center;
  gap: .4rem;
}

.lrn-gp-widget-foot {
  padding: .55rem .875rem .65rem;
  border-top: 1px solid #f3f0ff;
}

.lrn-gp-widget-btn {
  width: 100%;
  justify-content: center;
}

/* Shared list styles (lessons + games) */
.lrn-gp-slist {
  list-style: none;
  margin: 0;
  padding: 0;
}

.lrn-gp-slist-item {
  border-bottom: 1px solid #f5f3ff;
}

.lrn-gp-slist-item:last-child {
  border-bottom: none;
}

.lrn-gp-slist-link {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .6rem .875rem;
  text-decoration: none;
  color: #1e1b4b;
  font-size: .83rem;
  font-weight: 700;
  transition: background .14s;
}

.lrn-gp-slist-link:hover {
  background: #f9f7ff;
  color: #7c3aed;
  text-decoration: none;
}

.lrn-gp-slist-thumb {
  width: 52px;
  height: 39px;
  object-fit: cover;
  border-radius: .35rem;
  flex-shrink: 0;
  display: block;
}

.lrn-gp-slist-thumb--ph {
  background: #ede9fe;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  overflow: hidden;
}

/* Scale SVG flag icons inside the placeholder to fit */
.lrn-gp-slist-thumb--ph .lrn-lang-icon,
.lrn-gp-slist-thumb--ph .lrn-lang-icon img {
  width: 32px;
  height: 32px;
}

.lrn-gp-slist-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: .15rem;
}

.lrn-gp-slist-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.3;
}

.lrn-gp-slist-sub {
  font-size: .72rem;
  font-weight: 600;
  color: #7c3aed;
  display: flex;
  align-items: center;
  gap: .25rem;
}

/* Related games row (inside main column) */
.lrn-gp-related {
  margin-top: 1.75rem;
}

.lrn-gp-frame-wrap {
  position: relative;
  background: #000;
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(124,58,237,.2);
  margin-bottom: 1.5rem;
}

.lrn-gp-frame-wrap iframe {
  display: block;
  width: 100%;
  border: 0;
}

.lrn-gp-fullscreen-btn {
  position: absolute;
  bottom: .75rem;
  right: .75rem;
  background: rgba(0,0,0,.6);
  color: #fff;
  border: none;
  border-radius: .5rem;
  padding: .4rem .7rem;
  font-size: .8rem;
  cursor: pointer;
  transition: background .15s;
  display: flex;
  align-items: center;
  gap: .35rem;
}

.lrn-gp-fullscreen-btn:hover {
  background: rgba(124,58,237,.85);
}

.lrn-gp-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.lrn-gp-info {
  flex: 1;
  min-width: 0;
}

.lrn-gp-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: #1e1b4b;
  margin-bottom: .4rem;
}

.lrn-gp-tags {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-top: .75rem;
}

.lrn-gp-tag {
  background: #ede9fe;
  color: #6d28d9;
  border-radius: .4rem;
  padding: .15rem .55rem;
  font-size: .72rem;
  font-weight: 600;
}

.lrn-gp-desc {
  font-size: .93rem;
  color: #374151;
  line-height: 1.7;
  margin-bottom: 1.25rem;
}

.lrn-gp-howto {
  background: #f5f3ff;
  border-radius: .875rem;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.lrn-gp-howto h2 {
  font-size: 1rem;
  font-weight: 700;
  color: #6d28d9;
  margin-bottom: .75rem;
}

.lrn-gp-howto p {
  font-size: .88rem;
  color: #374151;
  margin: 0;
  white-space: pre-line;
}

/* Related games */
.lrn-related-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #1e1b4b;
  margin-bottom: 1rem;
}

.lrn-related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
}

/* ── Responsive ── */

/* Tablet: collapse sidebar below main */
@media (max-width: 960px) {
  .lrn-gp-outer {
    grid-template-columns: 1fr;
  }

  .lrn-gp-sidebar {
    position: static;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
  }
}

@media (max-width: 600px) {
  .lrn-games-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: .875rem;
  }

  .lrn-games-hero {
    flex-direction: column;
    text-align: center;
    padding: 1.5rem 1rem;
  }

  .lrn-games-hero h1 { font-size: 1.3rem; }

  .lrn-gp-title { font-size: 1.2rem; }

  .lrn-gp-sidebar {
    grid-template-columns: 1fr;
  }
}
