/* ============================================================
   frenzy-games  —  stylesheet
   Framework mirrors the reference site (fixed header/footer,
   .game-area grid, .game-card, .category-card) while the visual
   language is redesigned for a warm, Western-friendly look.
   Pure CSS variables power the theme switch (dark = default).
   ============================================================ */

/* ---------- THEME TOKENS ---------- */
:root,
[data-theme="dark"] {
  --bg: #0e0f15;
  --bg-elev: #171a23;
  --bg-elev-2: #1f2330;
  --text: #eceef5;
  --text-dim: #99a1b5;
  --border: #2a2f3d;
  --header-bg: #11131b;
  --footer-bg: #0a0b11;          /* inter ad bar uses this too (ad contract) */
  --accent: #7c8cff;
  --accent-soft: rgba(124, 140, 255, .15);
  --accent-2: #ff8aa0;
  --chip: #232838;
  --shadow: 0 10px 30px rgba(0, 0, 0, .45);
  --ad-label: #aeb6c9;
  --hero-glass: rgba(23, 26, 35, .62);
  --radius: 16px;
  --radius-sm: 10px;
  --header-h: 56px;
  --footer-h: 66px;
  --inter-h: 64px;
}

[data-theme="light"] {
  --bg: #f3f5fb;
  --bg-elev: #ffffff;
  --bg-elev-2: #eef1f8;
  --text: #1a1e29;
  --text-dim: #5d6577;
  --border: #e2e6f0;
  --header-bg: #ffffff;
  --footer-bg: #11131b;          /* keep ad/footer band dark for contrast */
  --accent: #5b6cff;
  --accent-soft: rgba(91, 108, 255, .12);
  --accent-2: #ff6f88;
  --chip: #eef1f8;
  --shadow: 0 10px 30px rgba(40, 50, 90, .12);
  --ad-label: #8a93a8;
  --hero-glass: rgba(255, 255, 255, .72);
}

* { box-sizing: border-box; }

html { height: 100%; }

/* the page colour lives on <html> so the fixed home background layer
   (body::before, z-index:-1) can sit above it and below the content */
html {
  background: var(--bg);
  transition: background .25s ease;
}

body {
  margin: 0;
  min-height: 100%;   /* grow with content so the footer + bottom padding work */
  background: transparent;
  color: var(--text);
  font: 15px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding-top: var(--header-h);
  /* bottom space reserved for footer + inter ad bar (set per route via JS) */
  transition: color .25s ease;
}

/* ---------- SITE BACKGROUND ----------
   A static, dimmed gradient backdrop keeps cards and copy readable.
   The moving layer (falling snow / wind-blown motes) is drawn on the
   fixed <canvas id="bgCanvas"> by initBackground() in app.js — it sits
   above this layer (z-index -1) but below all content. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(42% 42% at 14% 16%, rgba(124, 140, 255, .22), transparent 70%),
    radial-gradient(38% 38% at 86% 24%, rgba(255, 138, 160, .16), transparent 70%),
    radial-gradient(48% 48% at 50% 95%, rgba(43, 182, 201, .14), transparent 70%),
    var(--bg);
}
.bg-canvas {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  display: block;
}

/* the hero is a frosted panel on every page so the art shows through */
.hero {
  background: linear-gradient(135deg, var(--accent-soft), transparent 60%), var(--hero-glass);
  -webkit-backdrop-filter: blur(14px) saturate(125%);
  backdrop-filter: blur(14px) saturate(125%);
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; border: none; background: none; }
img { max-width: 100%; display: block; }

/* ---------- FIXED HEADER ---------- */
.game-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: saturate(140%) blur(8px);
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 19px;
  letter-spacing: .2px;
  color: var(--text);
  white-space: nowrap;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  padding-right: 6px;
}
.logo-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 9px;
  flex: none;
  background: transparent;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .35);
}
.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.main-nav::-webkit-scrollbar { display: none; }
.main-nav a {
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--text-dim);
  font-weight: 600;
  white-space: nowrap;
  transition: background .15s ease, color .15s ease;
}
.main-nav a:hover { color: var(--text); background: var(--accent-soft); }
.main-nav a.active { color: #fff; background: var(--accent); }

.actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.icon-btn {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 12px;
  color: var(--text-dim);
  transition: background .15s ease, color .15s ease;
}
.icon-btn:hover { background: var(--accent-soft); color: var(--text); }
.icon-btn svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .icon-sun { display: none; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }
[data-theme="light"] .theme-toggle .icon-sun { display: block; }
.theme-toggle .icon-moon { fill: currentColor; stroke: none; }
.hamburger { display: grid; place-items: center; }
.hamburger svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

/* ---------- NAV DRAWER (hamburger, slides from the right) ---------- */
.nav-backdrop {
  position: fixed; inset: 0;
  z-index: 70;
  background: rgba(4, 6, 12, .55);
  opacity: 0; visibility: hidden;
  transition: opacity .25s ease, visibility .25s ease;
}
.nav-backdrop.open { opacity: 1; visibility: visible; }
.nav-drawer {
  position: fixed;
  top: 0; right: 0;
  height: 100%;
  width: min(280px, 82vw);
  z-index: 71;
  background: var(--header-bg);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: saturate(140%) blur(8px);
  backdrop-filter: saturate(140%) blur(8px);
  transform: translateX(100%);
  transition: transform .28s ease;
  display: flex;
  flex-direction: column;
  padding: 10px 0;
}
.nav-drawer.open { transform: translateX(0); }
.nav-drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 8px 12px 16px;
  border-bottom: 1px solid var(--border);
}
.nav-drawer-close { display: grid; place-items: center; }
.nav-drawer-close svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nav-drawer-menu { display: flex; flex-direction: column; padding: 12px 12px; gap: 4px; overflow-y: auto; flex: 1; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.nav-drawer-menu a {
  padding: 15px 16px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-weight: 700;
  font-size: 16px;
  transition: background .15s ease;
}
.nav-drawer-menu a:hover { background: var(--accent-soft); }
.nav-drawer-menu a.active { color: #fff; background: var(--accent); }

/* All-categories block inside the drawer (scrollable together with the menu) */
.nav-cats-label {
  padding: 14px 16px 6px;
  font-size: 12px; letter-spacing: 1.5px; text-transform: uppercase;
  font-weight: 800; color: var(--text-dim);
}
.nav-cats { display: flex; flex-direction: column; gap: 2px; }
.nav-cats a {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-weight: 600;
  font-size: 15px;
  transition: background .15s ease, color .15s ease;
}
.nav-cats a:hover { background: var(--accent-soft); color: var(--text); }
.nav-cats a.active { color: #fff; background: var(--accent); }

/* ---------- APP OUTLET ---------- */
.app-outlet {
  max-width: 1180px;
  margin: 0 auto;
  padding: 18px 14px 28px;
  min-height: calc(100vh - var(--header-h) - var(--footer-h));
}

/* page enter animation (cheap, GPU-friendly) */
.fade-in { animation: fadeIn .28s ease both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- GENERIC PAGE HEADERS ---------- */
.page-head { margin: 4px 0 18px; }
.page-title {
  font-size: clamp(24px, 5vw, 34px);
  margin: 0 0 6px;
  font-weight: 800;
  letter-spacing: -.3px;
}
.page-sub { color: var(--text-dim); margin: 0; max-width: 640px; }

/* ---------- HERO ---------- */
.hero {
  background: linear-gradient(135deg, var(--accent-soft), transparent 60%), var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px 22px;
  margin-bottom: 22px;
}
.hero h1 { margin: 0 0 8px; font-size: clamp(26px, 6vw, 40px); letter-spacing: -.4px; }
.hero p { margin: 0; color: var(--text-dim); max-width: 620px; }

/* ---------- AD SLOTS (deployment-system contract) ----------
   Per delivery spec: the template only provides the markup + styles.
   The deployment system measures .ad-slot, then applies
   .is-filled / .is-unfilled to the matching .ad-unit. NEVER set
   display:none on .ad-slot or its outer .ad-unit here. */
.ad-unit { width: 100%; margin: 16px 0; }
.ad-slot {
  display: block;
  width: 100%;
  min-height: 0;
}
.ad-slot > ins.adsbygoogle,
.ad-slot > iframe { width: 100%; display: block; }
.ad-fallback {
  display: block;
  width: 100%;
  text-align: center;
  font-size: 12px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--ad-label);
  user-select: none;
  pointer-events: none;
}
/* System-driven states (applied by ad-boot.js, do not set in template JS) */
.ad-unit.is-filled .ad-fallback { display: none; }   /* has ad: hide placeholder */
.ad-unit.is-unfilled { display: none; }              /* no ad: collapse block */

/* ---------- GAME GRID (framework preserved) ---------- */
.game-area {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 14px;
  margin-bottom: 8px;
}
/* In-grid ad slots (home2 / home3) must span the full grid width,
   not sit inside a single game column (~1/3). */
.game-area > .ad-unit { grid-column: 1 / -1; }
.game-card {
  display: block;
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
  will-change: transform;
}
.game-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--accent); }
.card-wrap { display: block; }
.card-icon {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.card-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
}
.card-icon .thumb-letter {
  position: relative;
  z-index: 0;
  font-size: 30px;
  font-weight: 800;
  color: rgba(255, 255, 255, .92);
  text-shadow: 0 2px 8px rgba(0, 0, 0, .35);
}
.icon-video {
  position: absolute;
  right: 6px; bottom: 6px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(0, 0, 0, .45);
  display: grid; place-items: center;
  z-index: 4;
}
.icon-video::after {
  content: "";
  border-style: solid;
  border-width: 5px 0 5px 8px;
  border-color: transparent transparent transparent #fff;
  margin-left: 2px;
}
.card-meta { display: block; padding: 8px 9px 10px; }
.card-overlay {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 3;
  padding: 20px 8px 7px;
  display: flex; flex-direction: column; gap: 1px;
  background: linear-gradient(to top, rgba(0, 0, 0, .82) 0%, rgba(0, 0, 0, .45) 55%, rgba(0, 0, 0, 0) 100%);
  pointer-events: none;
}
.card-title {
  display: block;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .6);
}
.card-cat {
  display: block;
  color: rgba(255, 255, 255, .82);
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .6);
}

/* ---------- CATEGORIES (framework preserved) ---------- */
.section-label {
  display: flex; align-items: center; gap: 10px;
  margin: 26px 0 14px;
  font-size: 18px; font-weight: 800;
}
.section-label::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.count-pill {
  font-size: 13px; font-weight: 700; color: var(--text-dim);
  background: var(--chip); padding: 2px 10px; border-radius: 999px;
}
.load-note {
  margin: 10px 0 4px; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-elev); color: var(--text-dim); font-size: 14px;
  line-height: 1.6;
}
.retry-btn {
  margin-top: 10px; padding: 7px 16px; cursor: pointer;
  border: 1px solid var(--accent, #7c8cff); border-radius: 999px;
  background: var(--accent, #7c8cff); color: #fff; font-size: 14px; font-weight: 600;
}
.retry-btn:disabled { opacity: .6; cursor: default; }
.load-note--soft { color: var(--text-dim); background: var(--bg-elev); border-style: dashed; }
.load-note code { background: rgba(128,128,128,.18); padding: 1px 6px; border-radius: 4px; font-size: 13px; }

.categories-area { margin-bottom: 20px; }
.categories-content {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}
.category-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  transition: transform .15s ease, border-color .15s ease;
}
.category-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.category-thumb {
  position: relative;
  width: 44px; height: 44px; border-radius: 10px; flex: none;
  overflow: hidden;
  display: grid; place-items: center;
}
.category-thumb-img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
.category-name { font-weight: 700; }
.category-count { font-size: 12px; color: var(--text-dim); }

/* ---------- DETAIL PAGE ---------- */
.detail { max-width: 860px; margin: 0 auto; }
.back-link { color: var(--text-dim); font-weight: 600; display: inline-block; margin-bottom: 14px; }
.back-link:hover { color: var(--accent); }
.detail-head { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 16px; margin-bottom: 18px; }
.detail-thumb {
  position: relative;
  width: 140px; height: 140px; border-radius: 20px; flex: none;
  display: grid; place-items: center;
  font-size: 52px; font-weight: 800; color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, .35);
  overflow: hidden;
}
/* generated (emoji) cover sits behind the real image as a fallback */
.gen-cover { position: absolute; inset: 0; display: grid; place-items: center; z-index: 0; }
.gen-emoji { font-size: 34px; line-height: 1; }
.gen-emoji--lg { font-size: 64px; }
.detail-thumb-img {
  position: absolute; inset: 0; z-index: 1;
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 20px;
}
.detail-meta { display: flex; flex-direction: column; align-items: center; }
.detail-meta h1 { margin: 0 0 4px; font-size: 26px; text-align: center; }
.detail-meta .sub { color: var(--text-dim); margin: 0; text-align: center; }
.detail-meta .sub .rating { color: #ffd36e; margin-left: 8px; font-weight: 700; }
.play-btn {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 14px;
  padding: 13px 26px;
  border-radius: 999px;
  font-weight: 800; font-size: 16px;
  color: #fff;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  box-shadow: var(--shadow);
  transition: transform .12s ease, filter .12s ease;
}
.play-btn:hover { transform: translateY(-2px); filter: brightness(1.05); }
.game-player {
  margin: 16px 0;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elev-2);
  display: grid; place-items: center;
  color: var(--text-dim);
  overflow: hidden;
}
.game-player iframe { width: 100%; height: 100%; border: 0; }
.detail-desc { color: var(--text-dim); line-height: 1.7; }
.tag-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.tag {
  font-size: 12px; padding: 5px 12px; border-radius: 999px;
  background: var(--chip); color: var(--text-dim); font-weight: 600;
}

/* ---------- SEARCH ---------- */
.search-bar {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 16px;
  margin-bottom: 18px;
}
.search-bar svg { fill: none; stroke: var(--text-dim); stroke-width: 2; stroke-linecap: round; flex: none; }
.search-bar input {
  flex: 1; border: none; background: none; color: var(--text);
  font-size: 16px; outline: none;
}
.search-bar input::placeholder { color: var(--text-dim); }
.empty-state { text-align: center; color: var(--text-dim); padding: 40px 0; }

/* ---------- STATIC CONTENT PAGES ---------- */
.doc { max-width: 760px; margin: 0 auto; }
.doc h2 { margin: 26px 0 8px; font-size: 20px; }
.doc p, .doc li { color: var(--text-dim); line-height: 1.75; }
.doc ul { padding-left: 20px; }
.doc a { color: var(--accent); }

/* ---------- FIXED ANCHORED AD BAR (site-wide) ---------- */
.inter-ad {
  position: fixed;
  left: 0; right: 0;
  bottom: 0;                       /* anchored to the bottom of the viewport */
  z-index: 55;
  margin: 0;                       /* override .ad-unit margin so the bar sits flush */
  display: grid;
  place-items: center;
  min-height: 50px;
  padding: 6px 0;
  background: rgba(10, 12, 20, .92);
  border-top: 1px solid var(--border);
}

/* per-route bottom layout: reserve space for the fixed anchored ad bar */
body.has-inter { padding-bottom: calc(var(--inter-h) + 16px); }

/* ---------- FOOTER (flows with the page, not fixed) ---------- */
.footer {
  background: var(--footer-bg);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 22px 12px;
}
.footer-copy { color: #aeb6c9; font-size: 12px; }
.footer-menu { display: flex; gap: 18px; }
.footer-menu a { color: #cfd5e3; font-size: 13px; font-weight: 600; }
.footer-menu a:hover { color: #fff; text-decoration: underline; }

/* ---------- FLOATING BUTTONS ---------- */
.float-btn {
  position: fixed;
  right: 16px;
  z-index: 58;
  width: 46px; height: 46px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: grid; place-items: center;
  box-shadow: var(--shadow);
  opacity: 0; visibility: hidden;
  transform: translateY(8px);
  transition: opacity .2s ease, transform .2s ease, visibility .2s;
}
.float-btn svg { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.float-btn.show { opacity: 1; visibility: visible; transform: none; }
.float-btn:hover { filter: brightness(1.08); }
/* back-to-top: 100px from bottom (clears the 64px inter ad bar on home/detail). */
.back-top { bottom: 100px; }
/* back-home (non-home only): sits above back-to-top, >=130px from bottom. */
.back-home { bottom: 156px; }

/* ---------- INTERSTITIAL ---------- */
.interstitial {
  position: fixed; inset: 0;
  z-index: 90;
  background: rgba(6, 7, 12, .82);
  display: grid; place-items: center;
  padding: 20px;
  animation: fadeIn .2s ease both;
}
.interstitial[hidden] { display: none; }
.interstitial-inner {
  position: relative;
  width: min(420px, 92vw);
  height: min(70vh, 560px);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.interstitial-slot { width: 100%; height: 100%; }

/* ---------- PAGE LOADER (game-click -> detail transition, creative) ---------- */
.page-loader {
  position: fixed; inset: 0;
  z-index: 80;                 /* above page content, below interstitial(90) & fullscreen(95) */
  display: grid; place-items: center;
  background: var(--bg);
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s ease, visibility .3s ease;
}
.page-loader.is-active { opacity: 1; visibility: visible; }
.loader-inner {
  display: flex; flex-direction: column; align-items: center; gap: 22px;
  animation: loaderPop .4s ease both;
}
@keyframes loaderPop { from { transform: scale(.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* game-themed spinner: a rotating ring with a pulsing play triangle in the middle */
.loader-game { position: relative; width: 76px; height: 76px; display: grid; place-items: center; }
.loader-ring {
  position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 0deg, var(--accent), var(--accent-2), var(--accent));
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 6px), #000 calc(100% - 6px));
          mask: radial-gradient(farthest-side, transparent calc(100% - 6px), #000 calc(100% - 6px));
  animation: loaderSpin 1s linear infinite;
}
@keyframes loaderSpin { to { transform: rotate(360deg); } }
.loader-triangle {
  width: 0; height: 0;
  border-left: 18px solid var(--text);
  border-top: 11px solid transparent;
  border-bottom: 11px solid transparent;
  margin-left: 5px;
  animation: loaderPulse 1s ease-in-out infinite;
}
@keyframes loaderPulse { 0%, 100% { transform: scale(1); opacity: .8; } 50% { transform: scale(1.18); opacity: 1; } }

/* bouncing dots */
.loader-dots { display: flex; gap: 8px; }
.loader-dots span {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent);
  animation: loaderBounce 1s ease-in-out infinite;
}
.loader-dots span:nth-child(2) { animation-delay: .15s; background: var(--accent-2); }
.loader-dots span:nth-child(3) { animation-delay: .3s; }
@keyframes loaderBounce { 0%, 100% { transform: translateY(0); opacity: .55; } 50% { transform: translateY(-9px); opacity: 1; } }

.loader-text {
  font-size: 14px; letter-spacing: 1px;
  color: var(--text-dim);
  user-select: none;
}

/* ---------- HOME IN-LIST LOADING (skeleton cards in the game-list area) ---------- */
.list-loading {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 14px;
  margin-bottom: 8px;
}
.skel-card {
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  background: linear-gradient(100deg, var(--bg-elev) 30%, var(--bg-elev-2) 50%, var(--bg-elev) 70%);
  background-size: 200% 100%;
  animation: skelShimmer 1.3s ease-in-out infinite;
}
@keyframes skelShimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ---------- FULLSCREEN PLAY OVERLAY ---------- */
/* While playing, hide the site chrome so the game owns the whole screen. */
body.is-playing .game-header,
body.is-playing .footer,
body.is-playing .inter-ad,
body.is-playing .nav-drawer,
body.is-playing .nav-backdrop,
body.is-playing #backTop { display: none !important; }

.fullscreen-player {
  position: fixed; inset: 0; z-index: 95;
  background: #000;
}
.fullscreen-player[hidden] { display: none; }
.fp-stage {
  position: absolute; inset: 0;
  padding: 0;
}
/* Game fills the entire viewport — no 16:9 letterboxing, no black bars. */
.fp-frame {
  position: absolute; inset: 0;
  width: 100vw;
  height: 100vh;          /* fallback for browsers without dvh */
  height: 100dvh;         /* dynamic viewport height (accounts for mobile browser UI) */
  background: #000;
}
.fp-frame iframe { width: 100%; height: 100%; border: 0; display: block; }
.fp-back {
  position: absolute; top: 16px; left: 16px; z-index: 2;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 16px; border-radius: 999px;
  background: rgba(20, 22, 30, .72); color: #fff; font-weight: 700; font-size: 15px;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .4);
}
.fp-back:hover { background: rgba(40, 44, 60, .92); }
.fp-back svg { fill: none; stroke: currentColor; }

/* ---------- RESPONSIVE TWEAKS ---------- */
@media (min-width: 640px) {
  .game-area { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 16px; }
  .app-outlet { padding: 24px 20px 32px; }
}
@media (min-width: 900px) {
  .main-nav { flex: none; }
  .footer { flex-direction: row; justify-content: space-between; padding: 0 28px; }
  .footer-copy { font-size: 13px; }
}

/* reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
