/* MizPlay Games Hub — kids app inspired UI */

.page-games {
  --games-font: 'Baloo 2', 'Nunito', 'Segoe UI', system-ui, sans-serif;
  --games-sky: #7ec8f7;
  --games-sky-deep: #5aabeb;
  --games-grass: #7ed957;
  --games-sun: #ffd93d;
  --games-pink: #ff6b9d;
  --games-orange: #ff9f43;
  --games-purple: #9b59f5;
  --games-teal: #2dd4bf;
  --games-navy: #2d3561;
  --games-card-shadow: 0 8px 24px rgba(45, 53, 97, 0.18);
  font-family: var(--games-font);
}

.page-games .site-ambience {
  opacity: 0.35;
}

.page-games .site-header,
.page-games .games-header {
  background: rgba(126, 200, 247, 0.85);
  border-bottom-color: rgba(255, 255, 255, 0.3);
  z-index: var(--z-header);
}

.page-games .site-header.scrolled,
.page-games .games-header.scrolled {
  background: rgba(94, 171, 235, 0.96);
  border-bottom-color: rgba(255, 255, 255, 0.35);
  box-shadow: 0 8px 24px rgba(45, 53, 97, 0.12);
}

.page-games .nav-links a {
  color: var(--games-navy);
}

.page-games .nav-links a:hover,
.page-games .nav-links a.active {
  color: var(--games-navy);
  background: rgba(255, 255, 255, 0.45);
}

.page-games .nav-toggle span {
  background: var(--games-navy);
}

.games-main {
  position: relative;
  z-index: 1;
}

/* ─── Hero sky ─── */
.games-hero {
  position: relative;
  padding: 24px 0 48px;
  background: linear-gradient(180deg, #7ec8f7 0%, #a8dafb 55%, #e8f4fc 100%);
  overflow: hidden;
}

.games-clouds {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.cloud {
  position: absolute;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 999px;
  filter: blur(1px);
  animation: cloudBob 12s ease-in-out infinite;
}

.cloud::before,
.cloud::after {
  content: '';
  position: absolute;
  background: inherit;
  border-radius: 50%;
}

.cloud.c1 { width: 100px; height: 36px; top: 12%; left: 5%; animation-delay: 0s; }
.cloud.c1::before { width: 44px; height: 44px; top: -22px; left: 12px; }
.cloud.c1::after { width: 32px; height: 32px; top: -14px; right: 10px; }

.cloud.c2 { width: 80px; height: 28px; top: 8%; right: 10%; animation-delay: -3s; opacity: 0.7; }
.cloud.c2::before { width: 36px; height: 36px; top: -18px; left: 8px; }

.cloud.c3 { width: 120px; height: 40px; top: 28%; left: 60%; animation-delay: -6s; opacity: 0.6; }
.cloud.c3::before { width: 50px; height: 50px; top: -26px; left: 20px; }

.cloud.c4 { width: 70px; height: 26px; bottom: 20%; left: 15%; animation-delay: -2s; opacity: 0.5; }

@keyframes cloudBob {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(16px); }
}

.games-hero-inner {
  position: relative;
  z-index: 1;
}

.games-profile {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.games-avatar {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  background: white;
  border-radius: 50%;
  box-shadow: var(--games-card-shadow);
  border: 3px solid var(--games-sun);
}

.games-profile-text {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 120px;
}

.games-greeting {
  font-weight: 900;
  font-size: 1.1rem;
  color: var(--games-navy);
}

.games-sub {
  font-size: 0.85rem;
  color: rgba(45, 53, 97, 0.7);
  font-weight: 600;
}

.games-level-pill,
.games-xp-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.85rem;
  box-shadow: var(--games-card-shadow);
}

.games-level-pill {
  background: var(--games-sun);
  color: var(--games-navy);
}

.games-xp-pill {
  background: white;
  color: var(--games-purple);
}

.games-hero-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 32px;
  background: linear-gradient(135deg, #6c5ce7, #9b59f5);
  border-radius: 28px;
  box-shadow: 0 12px 40px rgba(108, 92, 231, 0.35);
  border: 4px solid rgba(255, 255, 255, 0.25);
}

.games-banner-text h1 {
  font-size: clamp(1.6rem, 5vw, 2.4rem);
  font-weight: 900;
  color: white;
  line-height: 1.15;
  margin-bottom: 10px;
}

.games-banner-text h1 span {
  color: var(--games-sun);
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.15);
}

.games-banner-text p {
  color: rgba(255, 255, 255, 0.9);
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 20px;
  max-width: 420px;
}

.games-play-btn {
  display: inline-flex;
  align-items: center;
  padding: 14px 28px;
  background: linear-gradient(180deg, #22c55e 0%, #16a34a 100%);
  color: #fff;
  font-family: var(--games-font);
  font-weight: 900;
  font-size: 1rem;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  text-decoration: none;
  box-shadow: 0 6px 0 #15803d, 0 8px 24px rgba(34, 197, 94, 0.35);
  transition: transform 0.2s var(--ease-out), box-shadow 0.2s;
  cursor: pointer;
}

.games-play-btn:hover {
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 8px 0 #15803d, 0 12px 28px rgba(34, 197, 94, 0.45);
}

.games-play-btn:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #15803d;
}

.games-play-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.5), 0 6px 0 #15803d;
}

.games-banner-mascots {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.mascot {
  font-size: 2.8rem;
  animation: mascotBounce 2.5s ease-in-out infinite;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.15));
}

.mascot.m2 { animation-delay: 0.3s; }
.mascot.m3 { animation-delay: 0.6s; }

@keyframes mascotBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* ─── Toolbar ─── */
.games-toolbar {
  background: white;
  padding: 20px 0;
  box-shadow: 0 4px 20px rgba(45, 53, 97, 0.08);
  position: sticky;
  top: var(--header-height);
  z-index: 50;
}

.games-toolbar-inner {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.games-search-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: #f0f4ff;
  border-radius: 999px;
  border: 2px solid #e0e7ff;
}

.games-search-wrap .search-icon {
  display: flex;
  flex-shrink: 0;
  color: rgba(45, 53, 97, 0.5);
}

.games-search-wrap:focus-within {
  border-color: #818cf8;
  box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.25);
}

.games-search {
  flex: 1;
  border: none;
  background: transparent;
  font-family: var(--games-font);
  font-weight: 700;
  font-size: 1rem;
  color: var(--games-navy);
  min-width: 0;
}

.games-search:focus {
  outline: none;
}

.games-search::placeholder {
  color: rgba(45, 53, 97, 0.45);
}

.games-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cat-pill {
  padding: 10px 18px;
  border: none;
  border-radius: 999px;
  font-family: var(--games-font);
  font-weight: 800;
  font-size: 0.85rem;
  cursor: pointer;
  background: #f0f4ff;
  color: var(--games-navy);
  transition: transform 0.15s, background 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}

.cat-pill:hover {
  transform: translateY(-2px);
  background: #e0e7ff;
}

.cat-pill.active {
  background: var(--games-purple);
  color: white;
  box-shadow: 0 4px 14px rgba(155, 89, 245, 0.4);
}

/* ─── Game grid ─── */
.games-grid-section {
  padding: 48px 0 64px;
  background: linear-gradient(180deg, #e8f4fc 0%, #f5f0ff 100%);
}

.games-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 28px;
}

.games-section-head h2 {
  font-size: 1.75rem;
  font-weight: 900;
  color: var(--games-navy);
}

.games-section-head p {
  font-weight: 700;
  color: rgba(45, 53, 97, 0.55);
  font-size: 0.95rem;
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 20px;
}

.game-tile {
  display: flex;
  flex-direction: column;
  background: white;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: var(--games-card-shadow);
  border: 3px solid rgba(255, 255, 255, 0.8);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s;
  min-width: 0;
  cursor: pointer;
}

.game-tile:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow: 0 16px 40px rgba(45, 53, 97, 0.22);
}

.game-tile.hidden {
  display: none;
}

.game-tile-art {
  position: relative;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.game-tile-emoji {
  font-size: 3.5rem;
  z-index: 1;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.12));
  transition: transform 0.3s;
}

.game-tile:hover .game-tile-emoji {
  transform: scale(1.12) rotate(-4deg);
}

.game-tile-deco {
  position: absolute;
  font-weight: 900;
  font-size: 1.4rem;
  opacity: 0.25;
  color: white;
  letter-spacing: 0.1em;
}

.art-math { background: linear-gradient(135deg, #ff9f43, #ffd93d); }
.art-coding { background: linear-gradient(135deg, #6c5ce7, #a29bfe); }
.art-adventure { background: linear-gradient(135deg, #e74c3c, #ff6b9d); }
.art-logic { background: linear-gradient(135deg, #2dd4bf, #7ed957); }
.art-arcade { background: linear-gradient(135deg, #f39c12, #ffd93d); }
.art-blocks { background: linear-gradient(135deg, #3498db, #2dd4bf); }
.art-robo { background: linear-gradient(135deg, #9b59f5, #6c5ce7); }
.art-quiz { background: linear-gradient(135deg, #ff6b9d, #e74c3c); }

.game-tile-body {
  padding: 18px 20px 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.game-status {
  align-self: flex-start;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.game-status.live { background: #d1fae5; color: #047857; }
.game-status.beta { background: #dbeafe; color: #1d4ed8; }
.game-status.soon { background: #fef3c7; color: #b45309; }

.game-tile-body h3 {
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--games-navy);
  line-height: 1.2;
}

.game-tile-body p {
  font-size: 0.85rem;
  font-weight: 600;
  color: rgba(45, 53, 97, 0.65);
  line-height: 1.45;
  flex: 1;
}

.game-tile-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.game-tile-meta span {
  padding: 4px 10px;
  background: #f0f4ff;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--games-purple);
}

.game-tile-btn {
  display: block;
  margin: 0 16px 16px;
  padding: 12px;
  text-align: center;
  background: var(--games-navy);
  color: white;
  font-weight: 900;
  font-size: 0.9rem;
  border-radius: 14px;
  text-decoration: none;
  transition: background 0.2s, transform 0.15s;
}

.game-tile-btn:hover {
  color: white;
  background: var(--games-purple);
  transform: scale(1.02);
}

.games-empty {
  text-align: center;
  padding: 48px 20px;
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--games-navy);
}

/* ─── Spotlight ─── */
.games-spotlight {
  padding: 0 0 64px;
  background: #f5f0ff;
}

.games-spotlight-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 32px;
  align-items: center;
  padding: 32px;
  background: linear-gradient(135deg, #2d3561, #4a5294);
  border-radius: 28px;
  box-shadow: var(--games-card-shadow);
  border: 4px solid rgba(255, 255, 255, 0.1);
}

.spotlight-art {
  width: 120px;
  height: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--games-sun), var(--games-orange));
  border-radius: 24px;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.1);
}

.spotlight-stars {
  font-size: 0.9rem;
  color: white;
  letter-spacing: 4px;
  margin-bottom: 4px;
}

.spotlight-emoji {
  font-size: 2.5rem;
}

.spotlight-badge {
  display: inline-block;
  padding: 6px 14px;
  background: rgba(255, 217, 61, 0.2);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 900;
  color: var(--games-sun);
  margin-bottom: 12px;
}

.spotlight-content h2 {
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  font-weight: 900;
  color: white;
  margin-bottom: 10px;
  line-height: 1.25;
}

.spotlight-content p {
  color: rgba(255, 255, 255, 0.8);
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 20px;
  max-width: 520px;
}

.spotlight-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.games-outline-btn {
  display: inline-flex;
  padding: 14px 28px;
  border: 3px solid rgba(255, 255, 255, 0.4);
  border-radius: 999px;
  color: white;
  font-family: var(--games-font);
  font-weight: 900;
  text-decoration: none;
  transition: background 0.2s, transform 0.15s;
}

.games-outline-btn:hover {
  color: white;
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-2px);
}

.games-play-btn-light {
  background: white;
  color: var(--games-navy);
  box-shadow: 0 6px 0 #d1d5db;
}

/* ─── Leaderboard ─── */
.games-leaderboard {
  padding: 64px 0;
  background: white;
}

.leaderboard-head {
  text-align: center;
  margin-bottom: 36px;
}

.leaderboard-head h2 {
  font-size: 1.75rem;
  font-weight: 900;
  color: var(--games-navy);
  margin-bottom: 8px;
}

.leaderboard-head p {
  font-weight: 700;
  color: rgba(45, 53, 97, 0.55);
}

.leaderboard-podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 12px;
  margin-bottom: 32px;
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}

.podium-place {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 12px;
  border-radius: 20px 20px 12px 12px;
  min-width: 90px;
  box-shadow: var(--games-card-shadow);
}

.podium-place.first {
  background: linear-gradient(180deg, #ffd93d, #ff9f43);
  padding-bottom: 28px;
  order: 2;
  transform: scale(1.08);
}

.podium-place.second {
  background: linear-gradient(180deg, #c0c0c0, #a8a8a8);
  order: 1;
}

.podium-place.third {
  background: linear-gradient(180deg, #cd7f32, #b87333);
  order: 3;
}

.podium-rank {
  font-weight: 900;
  font-size: 1.2rem;
  color: white;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.2);
}

.podium-avatar {
  font-size: 2rem;
}

.podium-name {
  font-weight: 900;
  font-size: 0.85rem;
  color: var(--games-navy);
}

.podium-score {
  font-weight: 800;
  font-size: 0.75rem;
  color: rgba(45, 53, 97, 0.7);
}

.leaderboard-list {
  list-style: none;
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.leaderboard-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: #f0f4ff;
  border-radius: 999px;
  font-weight: 800;
  color: var(--games-navy);
}

.lb-rank {
  width: 24px;
  text-align: center;
  color: var(--games-purple);
}

.lb-avatar { font-size: 1.3rem; }

.lb-name { flex: 1; }

.lb-score {
  font-size: 0.85rem;
  color: rgba(45, 53, 97, 0.6);
}

/* ─── CTA ─── */
.games-cta {
  padding: 0 0 80px;
  background: white;
}

.games-cta-box {
  text-align: center;
  padding: 48px 32px;
  background: linear-gradient(135deg, #7ec8f7, #9b59f5);
  border-radius: 28px;
  box-shadow: var(--games-card-shadow);
}

.games-cta-box h2 {
  font-size: clamp(1.4rem, 4vw, 2rem);
  font-weight: 900;
  color: white;
  margin-bottom: 12px;
}

.games-cta-box p {
  font-weight: 700;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 24px;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

/* ─── Responsive ─── */
@media (max-width: 880px) {
  .page-games .nav-links {
    background: rgba(240, 248, 255, 0.98);
    border-bottom-color: rgba(45, 53, 97, 0.12);
  }
}

@media (max-width: 768px) {
  .games-hero-banner {
    flex-direction: column;
    text-align: center;
    padding: 24px 20px;
  }

  .games-banner-text p {
    margin-left: auto;
    margin-right: auto;
  }

  .games-banner-mascots {
    justify-content: center;
  }

  .mascot {
    font-size: 2.2rem;
  }

  .games-profile {
    justify-content: center;
    text-align: center;
  }

  .games-profile-text {
    align-items: center;
    flex: 1 1 100%;
  }

  .games-spotlight-card {
    grid-template-columns: 1fr;
    text-align: center;
    padding: 24px 20px;
  }

  .spotlight-art {
    margin: 0 auto;
  }

  .spotlight-actions {
    justify-content: center;
  }

  .spotlight-content p {
    margin-left: auto;
    margin-right: auto;
  }

  .games-categories {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .games-categories::-webkit-scrollbar {
    display: none;
  }

  .cat-pill {
    flex-shrink: 0;
  }
}

@media (max-width: 480px) {
  .games-hero {
    padding: 16px 0 32px;
  }

  .games-level-pill,
  .games-xp-pill {
    font-size: 0.78rem;
    padding: 6px 12px;
  }

  .games-play-btn {
    width: 100%;
    justify-content: center;
  }

  .podium-place {
    min-width: 72px;
    padding: 12px 8px;
  }

  .podium-place.first {
    padding-bottom: 20px;
  }

  .leaderboard-podium {
    gap: 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cloud, .mascot, .game-tile:hover .game-tile-emoji {
    animation: none !important;
  }

  .game-tile:hover {
    transform: none;
  }
}
