/* ===================================================
   Game WonderWeb — Exact replica of competitor CSS
   Colors: blue #1d4ed8 | orange #f59e0b | purple #8b5cf6
   =================================================== */

:root {
  --brand-header-blue: #1d4ed8;
  --brand-orange: #f59e0b;
  --brand-footer-blue: #1e40af;
  --brand-purple: #8b5cf6;
  --brand-green: #22c55e;
  --detail-bg-gradient: linear-gradient(135deg, #8b5cf6 0%, #ec4899 50%, #06b6d4 100%);
  --detail-bg-gradient-light: linear-gradient(135deg, #c4b5fd 0%, #f9a8d4 50%, #a5f3fc 100%);
  --detail-bg-gradient-dark: linear-gradient(135deg, #4c1d95 0%, #831843 50%, #0e7490 100%);
  --text: #333;
  --font-joyful: "Slackey", sans-serif;
}

/* ── Reset ────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--brand-orange); font-family: var(--font-joyful); color: var(--text); }
img { object-fit: cover; display: block; max-width: 100%; }
a { text-decoration: none; color: inherit; }
button { cursor: pointer; font: inherit; border: none; background: none; }

/* ── Scrollbar ─────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { border-radius: 4px; background: #f1f1f1; }
::-webkit-scrollbar-thumb { border-radius: 4px; background: #c1c1c1; }
::-webkit-scrollbar-thumb:hover { background: #a8a8a8; }

/* ── Flex helpers (matches competitor) ─────────────── */
.fx-r  { display: flex; flex-direction: row; }
.fx-h  { display: flex; flex-direction: column; }
.fx-ac { justify-content: center; }
.fx-bc { align-items: center; }
.center { display: flex; justify-content: center; align-items: center; }

/* ── Header / Hero ─────────────────────────────────── */
header {
  background-image: url("/img/hero.jpg");
  background-size: cover;
  background-position: center center;
}
.site-header {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.75rem;
  color: #fff;
}
@media (min-width: 768px) {
  .site-header { gap: 1.25rem; padding: 2rem; }
}
.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 1rem;
  padding-bottom: 1rem;
  min-height: 56px;
}
@media (min-width: 768px) { .header-top { min-height: 64px; } }
.header-bar { display: flex; align-items: center; }
.header-brand {
  display: flex;
  align-items: center;
  background-color: var(--brand-orange);
  padding: 5px;
  border-radius: 20px;
  gap: 6px;
}
.brand-logo {
  border-radius: 10px;
  width: 40px;
  height: 40px;
  box-shadow: 0 2px 6px rgba(17,24,39,.15);
  transition: transform 180ms ease, box-shadow 180ms ease;
}
@media (hover: hover) {
  .brand-logo:hover { transform: scale(1.05) rotate(3deg); box-shadow: 0 6px 18px rgba(17,24,39,.18); }
}
.brand-title {
  font-family: var(--font-joyful), -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", arial, helvetica, sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: .02em;
  color: #fff;
  padding-right: 8px;
  white-space: nowrap;
}
.header-nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  color: #333;
}
.nav-item.nav-pill { display: none; }
@media (min-width: 768px) { .nav-item.nav-pill { display: inline-flex; } }
.nav-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 600;
  color: #374151;
  background: linear-gradient(180deg, #fff, #f8fafc);
  border: 1px solid #e5e7eb;
  transition: background-color 0.15s, color 0.15s;
  text-decoration: none;
  white-space: nowrap;
}
.nav-pill:hover, .nav-pill.active { background: var(--brand-header-blue); color: #fff; border-color: var(--brand-header-blue); }
.menu-toggle { cursor: pointer; width: 32px; height: 32px; display: block; }
@media (min-width: 768px) { .menu-toggle { display: none; } }

/* Hero card (featured game in header) */
.hero-fixed {
  width: 512px;
  height: 384px;
  position: relative;
}
@media (max-width: 640px) {
  .hero-fixed { width: 374px; height: 280px; }
}
.hero-fixed > img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hero-card {
  position: relative;
  border: 8px solid transparent;
  cursor: pointer;
  transition: border-color 160ms ease;
  display: flex;
  flex-direction: column;
}
.hero-card:hover { border-color: var(--brand-purple); }
.hero-card--rounded { border-radius: 1rem; overflow: visible; }
.hero-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.hero-badge {
  position: absolute;
  top: -16px;
  left: -16px;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  border-radius: 50%;
  font-weight: 900;
  font-size: 1rem;
  color: #fff;
  z-index: 10;
}
@media (min-width: 768px) { .hero-badge { font-size: 1.125rem; } }
.hero-badge--hot { background: var(--brand-orange); border: 5px solid #101d8d; }
.hero-badge--new { background: var(--brand-purple); border: 8px solid #101d8d; }
.hero-title {
  font-family: var(--font-joyful);
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--brand-orange);
  padding: 0.75rem 1rem;
  font-size: 1.5rem;
  line-height: 2rem;
  text-align: center;
  min-height: 56px;
  box-sizing: border-box;
  color: #fff;
}
#heroGameTitle {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--brand-orange);
  padding: 0.75rem 1rem;
  font-size: 1.5rem;
  line-height: 2rem;
  text-align: center;
  min-height: 56px;
}

/* ── Headings font ────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-joyful), -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", arial, helvetica, sans-serif;
}

/* ── Mobile Menu Overlay ─────────────────────────────── */
#mobile-menu {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 50;
  justify-content: center;
  align-items: center;
  background: rgba(0,0,0,0.5);
}
#mobile-menu.open { display: flex; }
#mobile-menu .menu-panel {
  position: relative;
  background: #fff;
  padding: 1.5rem;
  border-radius: 0.5rem;
  width: 75%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  text-align: center;
}
#close-menu {
  position: absolute;
  top: 8px;
  right: 24px;
  color: #4b5563;
  font-size: 1.5rem;
  background: none;
  border: none;
  cursor: pointer;
}
.menu-nav-link {
  color: #1f2937;
  font-size: 1.125rem;
  font-weight: 500;
  padding: 0.5rem 0;
  transition: color 0.15s;
}
.menu-nav-link:hover { color: var(--brand-purple); }

/* ── Ad slot containers ───────────────────────────────── */
.ad-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  overflow: hidden;
}
.ad-slot:empty { display: none; }
.ad-banner { width: 100%; }
.ad-anchor {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(255,255,255,0.96);
  border-top: 1px solid #e5e7eb;
  padding: 6px;
  min-height: 60px;
  transform: translateY(100%);
  transition: transform 0.4s;
}
.ad-anchor.visible { transform: translateY(0); }

/* ── Game Cards (exact competitor CSS) ─────────────────── */
.game-card {
  border: 6px solid transparent;
  border-radius: 0.5rem;
  overflow: hidden;
  background-color: #fff;
  cursor: pointer;
  position: relative;
}
.game-card:hover { border-color: var(--brand-purple); }
.game-card_1 { width: 15rem; height: 8rem; }
.game-card_2 { height: 15rem; }
.game-card-square { width: 100%; aspect-ratio: 1/1; }
.game-card-wide { width: 100%; aspect-ratio: 16/9; }
@media (max-width: 768px) {
  .game-card_1 { width: 10rem; }
  .game-card_2 { height: 10rem; }
}

.tag-badge {
  position: absolute;
  top: -16px;
  left: -16px;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  border-radius: 50%;
  font-weight: 900;
  font-size: 1rem;
  color: #fff;
  z-index: 10;
}
.tag-badge_2 { width: 40px; height: 40px; font-size: .8rem; }
@media (max-width: 768px) { .tag-badge.tag-badge_2 { width: 40px; height: 40px; font-size: .8rem; } }
.group:hover .tag-badge { transform: scale(1.1) rotate(-15deg); }
.tag-badge-hot  { background: #ef4444 !important; }
.tag-badge-new  { background: var(--brand-green) !important; }

/* ── Grid width helpers ───────────────────────────────── */
#hotPicksGrid, #trendingGrid { width: 100%; }
@media (max-width: 768px) { #trendingGrid { width: 100%; } }

/* ── Popular Games Carousel ───────────────────────────── */
#gameListScroller {
  display: flex;
  gap: 1rem;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  overflow-x: auto;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
#gameListScroller::-webkit-scrollbar { display: none; }
#gameListScroller .game-card { scroll-snap-align: start; }

/* ── Hot Picks Grid ────────────────────────────────────── */
.hot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.75rem;
}
.hot-card {
  position: relative;
  border-radius: 0.5rem;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
  cursor: pointer;
  aspect-ratio: 4/3;
}
.hot-card img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.2s; }
.hot-card:hover img { transform: scale(1.05); }
.hot-card-title {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 16px 6px 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Fun Ranks ─────────────────────────────────────────── */
#FunRanks { background-image: url(/img/bg_3.svg); padding: 1.25rem 0.75rem; }
@media (min-width: 768px) { #FunRanks { padding: 1.25rem 2rem; } }
#FunRanks ol { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 640px) { #FunRanks ol { grid-template-columns: repeat(2, 1fr); } }
#FunRanks li a { display: flex; flex-direction: column; gap: 10px; }
@media (min-width: 640px) { #FunRanks li a { flex-direction: row; align-items: center; } }
#FunRanks .funranks-meta { white-space: nowrap; }
@media (max-width: 640px) { #FunRanks .funranks-meta { white-space: normal; flex-wrap: wrap; } }
#FunRanks li img { width: 100%; height: 160px; border-radius: 8px; object-fit: cover; }
@media (min-width: 640px) { #FunRanks li img { width: 140px; height: 96px; } }
.funranks-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0;
  border-bottom: 1px solid #f3f4f6;
}
.funranks-item:last-child { border-bottom: none; }
.funranks-rank {
  font-weight: 800;
  font-size: 1rem;
  color: #9ca3af;
  min-width: 1.5rem;
  text-align: center;
}
.funranks-thumb {
  width: 80px;
  height: 56px;
  border-radius: 0.375rem;
  object-fit: cover;
  flex-shrink: 0;
}
.funranks-info { flex: 1; overflow: hidden; display: flex; flex-direction: column; gap: 4px; }
.funranks-title {
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}
.funranks-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.funranks-cat {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  background: var(--brand-orange);
  padding: 1px 8px;
  border-radius: 9999px;
  font-weight: 700;
  color: #fff;
  font-size: 0.7rem;
  text-transform: capitalize;
}
.funranks-score { color: #6b7280; font-size: 0.75rem; }
.funranks-desc {
  color: #6b7280;
  font-size: 0.8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Trending Grid ─────────────────────────────────────── */
.trend-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
}
.trend-card {
  position: relative;
  border-radius: 0.5rem;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
  cursor: pointer;
  aspect-ratio: 4/3;
}
.trend-card img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.2s; }
.trend-card:hover img { transform: scale(1.05); }
.trend-card-label {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.72));
  color: #fff;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 18px 5px 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Section headings ────────────────────────────────── */
.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #111827;
  margin: 0;
}
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.see-all {
  font-size: 0.8rem;
  color: var(--brand-header-blue);
  font-weight: 600;
}
.see-all:hover { text-decoration: underline; }

/* ── Carousel buttons ────────────────────────────────── */
.carousel-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #1d4ed8;
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  border: none;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  flex-shrink: 0;
}
.carousel-btn:hover { background: #1e40af; transform: scale(1.08); }

/* ── Back to Top ─────────────────────────────────────── */
#back-to-top {
  position: fixed;
  right: 1rem;
  bottom: 2.5rem;
  background: var(--brand-green);
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 9999px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  z-index: 100;
  border: none;
  cursor: pointer;
}

/* ── Footer ──────────────────────────────────────────── */
footer { background-color: var(--brand-footer-blue); color: #fff; }
.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  margin: 0 auto;
  padding: 1.5rem 1rem;
  max-width: 80rem;
}
@media (min-width: 640px) { .footer-inner { flex-direction: row; justify-content: space-between; } }
.footer-copy { font-size: 0.875rem; }
.footer-nav { display: flex; align-items: center; gap: 1.5rem; font-size: 0.875rem; }
.footer-nav a { transition: color 0.15s; }
.footer-nav a:hover { color: var(--brand-orange); }

/* ── Game Detail Page ────────────────────────────────── */
.detail-bg, .category-bg {
  background: var(--detail-bg-gradient);
  min-height: 100vh;
}
.detail-wrap {
  max-width: 72rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 2rem;
}
.detail-top {
  display: flex;
  gap: 1.5rem;
  flex-direction: column;
  align-items: flex-start;
}
@media (min-width: 640px) { .detail-top { flex-direction: row; align-items: flex-start; } }
.detail-thumb {
  width: 100%;
  max-width: 320px;
  aspect-ratio: 4/3;
  border-radius: 0.75rem;
  object-fit: cover;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  flex-shrink: 0;
}
.detail-info { flex: 1; color: #fff; display: flex; flex-direction: column; gap: 0.75rem; }
.detail-title {
  font-size: 1.5rem;
  font-weight: 800;
  text-shadow: 0 1px 3px rgba(0,0,0,0.4);
  margin: 0;
}
@media (min-width: 640px) { .detail-title { font-size: 1.85rem; } }
.detail-meta { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.detail-meta-item { font-size: 0.875rem; display: flex; align-items: center; gap: 4px; }
.detail-cat-badge {
  background: var(--brand-orange);
  color: #fff;
  font-weight: 700;
  font-size: 0.75rem;
  padding: 2px 10px;
  border-radius: 9999px;
  text-transform: capitalize;
}
.detail-score {
  background: rgba(255,255,255,0.2);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 0.875rem;
  font-weight: 700;
}
.btn-play {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 9999px;
  background: linear-gradient(#ffffff, #f8fafc);
  border: 1px solid #93c5fd;
  color: #1e3a8a;
  font-weight: 700;
  box-shadow: 0 10px 20px rgba(17,24,39,0.12);
  transition: transform 160ms, box-shadow 160ms;
  cursor: pointer;
}
.btn-play:hover { transform: translateY(-1px) scale(1.03); box-shadow: 0 14px 26px rgba(17,24,39,0.16); }
.btn-play svg { fill: #1e3a8a; }
.detail-desc {
  color: rgba(255,255,255,0.85);
  font-size: 0.9rem;
  line-height: 1.6;
  background: rgba(0,0,0,0.15);
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
}

/* ── Play Layer (fullscreen game overlay) ────────────── */
#playLayer {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 16px;
}
#playLayer.open { display: flex; }
.play-wrap {
  position: relative;
  width: min(90vw, 1280px);
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0,0,0,0.35);
}
.play-close {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(255,255,255,0.9);
  color: #111827;
  border: none;
  border-radius: 8px;
  padding: 6px 10px;
  font-weight: 700;
  cursor: pointer;
  z-index: 10;
}
.play-close:hover { background: #fff; }
.play-frame {
  width: 100%;
  height: 100%;
  border: 0;
}
.tags-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 28px;
}

/* ── List Page ───────────────────────────────────────── */
.list-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
  gap: 0.85rem;
}
.list-card {
  position: relative;
  border-radius: 0.5rem;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.12);
  cursor: pointer;
  background: #fff;
}
.list-card-img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  display: block;
  transition: transform 0.2s;
}
.list-card:hover .list-card-img { transform: scale(1.04); }
.list-card-title {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 5px 7px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #111827;
}
.list-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 7px 6px;
  font-size: 0.65rem;
  color: #6b7280;
}

/* ── Static pages ────────────────────────────────────── */
.static-wrap { max-width: 760px; margin: 0 auto; padding: 2rem 1rem 4rem; }
.static-wrap h1 { font-size: 1.6rem; font-weight: 800; margin-bottom: 1.25rem; }
.static-wrap h2 { font-size: 1.1rem; font-weight: 700; margin: 1.5rem 0 0.5rem; color: var(--brand-header-blue); }
.static-wrap p, .static-wrap li { font-size: 0.9rem; color: #4b5563; line-height: 1.7; }
.static-wrap ul { padding-left: 1.25rem; list-style: disc; }

/* ── Load more ───────────────────────────────────────── */
.load-more {
  display: block;
  width: 100%;
  padding: 0.75rem;
  text-align: center;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: #374151;
  margin-top: 1rem;
  cursor: pointer;
  transition: background 0.15s;
}
.load-more:hover { background: var(--brand-orange); color: #fff; border-color: var(--brand-orange); }

.game-title {
  margin-top: 0.5rem;
  font-size: 1.125rem;
  font-weight: 600;
  color: #1f2937;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tag-chip {
  background: #eef2ff;
  color: #1e3a8a;
  border-radius: 9999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  display: inline-block;
}

/* ── Line clamp ───────────────────────────────────────── */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Cursor / pointer utilities ──────────────────────── */
.cursor-pointer { cursor: pointer; }

/* ── Transitions ─────────────────────────────────────── */
.transition-transform { transition: transform 200ms ease; }
.duration-200 { transition-duration: 200ms; }

/* ── Competitor-match utilities ─────────────────────────── */
.group:hover .group-hover\:scale-105 { transform: scale(1.05); }
.snap-start { scroll-snap-align: start; }
.shrink-0 { flex-shrink: 0; }
.overflow-visible { overflow: visible; }
