@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;700&display=swap");

/* ==========================================================================
   M.GAMES — Standalone Games Website Styles
   ApeChain-inspired: bold, immersive, neon, 3D
   ========================================================================== */

:root {
  --g-bg:        #050510;
  --g-surface:   #0c0c20;
  --g-card:      #11112a;
  --g-border:    #1e1e45;
  --g-border-hi: rgba(99, 102, 241, 0.4);
  --g-text:      #f0f0ff;
  --g-muted:     #7878aa;
  --g-dark:      #44447a;

  --g-primary:   #6366f1;   /* indigo */
  --g-accent:    #f59e0b;   /* amber */
  --g-green:     #10b981;
  --g-pink:      #ec4899;
  --g-cyan:      #06b6d4;

  --g-glow-p:    rgba(99, 102, 241, 0.3);
  --g-glow-a:    rgba(245, 158, 11, 0.25);

  --g-grad:      linear-gradient(135deg, #6366f1, #a855f7, #ec4899);
  --g-grad-text: linear-gradient(135deg, #6366f1 0%, #ec4899 100%);

  --g-sans: "Inter", -apple-system, sans-serif;
  --g-mono: "JetBrains Mono", monospace;

  --g-r-sm: 8px;
  --g-r-md: 16px;
  --g-r-lg: 24px;
  --g-r-xl: 32px;

  --g-fast:   0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --g-smooth: 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; overflow-x: hidden; }

body {
  font-family: var(--g-sans);
  background: var(--g-bg);
  color: var(--g-text);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

/* ==========================================================================
   Loader
   ========================================================================== */
.g-loader {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--g-bg);
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.4s ease;
}
.g-loader__text {
  font-family: var(--g-mono);
  font-size: 2.5rem;
  font-weight: 700;
  background: var(--g-grad-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 0.1em;
  animation: glitch 0.5s step-end infinite alternate;
}
@keyframes glitch {
  0%, 100% { text-shadow: -2px 0 rgba(99,102,241,0.5), 2px 0 rgba(236,72,153,0.5); }
  50% { text-shadow: 2px 0 rgba(99,102,241,0.5), -2px 0 rgba(236,72,153,0.5); }
}

/* ==========================================================================
   Background FX
   ========================================================================== */
.g-noise {
  position: fixed; inset: 0; pointer-events: none; z-index: 100; opacity: 0.02;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 256px;
}
.g-mesh {
  position: fixed; inset: 0; pointer-events: none; z-index: -1;
  background:
    radial-gradient(ellipse 70% 60% at 15% 15%, rgba(99,102,241,0.12) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 85% 75%, rgba(236,72,153,0.09) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 50% 50%, rgba(5,5,16,0.95) 0%, transparent 100%);
  animation: gmeshDrift 22s ease-in-out infinite alternate;
}
@keyframes gmeshDrift { from { opacity: 1; } to { opacity: 0.85; } }

/* ==========================================================================
   Layout
   ========================================================================== */
.g-container { width: 100%; max-width: 1280px; margin: 0 auto; padding: 0 1.5rem; }

/* ==========================================================================
   Header
   ========================================================================== */
.g-header {
  position: fixed; top: 0; left: 0; width: 100%; z-index: 500;
  background: rgba(5,5,16,0.85); backdrop-filter: blur(20px) saturate(150%);
  border-bottom: 1px solid var(--g-border);
}
.g-nav {
  display: flex; align-items: center; gap: 2rem;
  height: 68px; justify-content: space-between;
}
.g-brand { display: flex; align-items: center; }
.g-brand__logo {
  font-family: var(--g-mono); font-size: 1.4rem; font-weight: 700;
  letter-spacing: 0.05em; background: var(--g-grad-text);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.g-brand__dot { color: var(--g-accent); -webkit-text-fill-color: var(--g-accent); }

.g-nav__links { display: flex; align-items: center; gap: 1.75rem; }
.g-nav__links a {
  font-size: 0.88rem; font-weight: 500; color: var(--g-muted);
  transition: color var(--g-fast); position: relative; padding-bottom: 2px;
}
.g-nav__links a::after {
  content: ''; position: absolute; bottom: -2px; left: 0; width: 0; height: 1px;
  background: var(--g-primary); transition: width var(--g-smooth);
}
.g-nav__links a:hover, .g-nav__links a.active { color: var(--g-text); }
.g-nav__links a:hover::after, .g-nav__links a.active::after { width: 100%; }

.g-back-link {
  font-family: var(--g-mono); font-size: 0.8rem; color: var(--g-muted);
  border: 1px solid var(--g-border); border-radius: 100px;
  padding: 0.3rem 0.85rem; transition: all var(--g-fast);
  display: flex; align-items: center; gap: 0.4rem;
}
.g-back-link:hover { border-color: var(--g-primary); color: var(--g-primary); }

/* ==========================================================================
   Buttons
   ========================================================================== */
.g-btn {
  display: inline-flex; align-items: center; gap: 0.6rem;
  padding: 0.85rem 2rem; font-family: var(--g-mono); font-size: 0.9rem;
  font-weight: 600; border-radius: var(--g-r-sm); cursor: pointer;
  transition: all var(--g-fast); border: none; white-space: nowrap;
}
.g-btn--primary {
  background: var(--g-grad); color: #fff;
  box-shadow: 0 0 30px rgba(99,102,241,0.4);
}
.g-btn--primary:hover { filter: brightness(1.1); transform: translateY(-2px); box-shadow: 0 8px 30px rgba(99,102,241,0.5); color: #fff; }

/* ==========================================================================
   Hero
   ========================================================================== */
.g-hero {
  min-height: 100vh; display: flex; align-items: center;
  padding-top: 68px; position: relative; overflow: hidden;
}
.g-hero .g-container { position: relative; z-index: 2; }

.g-hero__badge {
  display: inline-flex; align-items: center; gap: 0.6rem;
  padding: 0.4rem 1.1rem; background: rgba(99,102,241,.1);
  border: 1px solid rgba(99,102,241,.3); border-radius: 100px;
  font-family: var(--g-mono); font-size: 0.8rem; color: var(--g-primary);
  margin-bottom: 2rem;
}
.g-dot {
  width: 7px; height: 7px; background: var(--g-primary); border-radius: 50%;
  box-shadow: 0 0 8px var(--g-primary); animation: gpulse 2s infinite;
}
@keyframes gpulse {
  0%   { box-shadow: 0 0 0 0 rgba(99,102,241,.7); }
  70%  { box-shadow: 0 0 0 8px rgba(99,102,241,0); }
  100% { box-shadow: 0 0 0 0 rgba(99,102,241,0); }
}

.g-hero__title {
  font-size: clamp(4rem, 10vw, 8rem);
  font-weight: 900; line-height: 0.95; letter-spacing: -0.05em;
  margin-bottom: 1.5rem;
  display: flex; flex-direction: column;
}
.g-hero__title-line { display: block; }
.g-grad {
  background: var(--g-grad-text);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}

.g-hero__sub {
  font-size: clamp(1rem, 2vw, 1.2rem); color: var(--g-muted);
  max-width: 540px; margin-bottom: 2.5rem; line-height: 1.8;
}

/* Floating emojis */
.g-hero__floats { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.g-float {
  position: absolute; font-size: clamp(1.5rem, 3vw, 2.5rem);
  opacity: 0.15; animation: gfloat 6s ease-in-out infinite alternate;
  user-select: none;
}
.g-float--1 { top: 15%; right: 8%;  animation-delay: 0s;    animation-duration: 5s; }
.g-float--2 { top: 30%; right: 20%; animation-delay: 0.7s;  animation-duration: 7s; }
.g-float--3 { top: 55%; right: 10%; animation-delay: 1.4s;  animation-duration: 6s; }
.g-float--4 { top: 70%; right: 30%; animation-delay: 0.3s;  animation-duration: 8s; }
.g-float--5 { top: 20%; right: 40%; animation-delay: 1.8s;  animation-duration: 5.5s; }
.g-float--6 { top: 80%; right: 5%;  animation-delay: 0.9s;  animation-duration: 7s; }
.g-float--7 { top: 45%; right: 50%; animation-delay: 2.1s;  animation-duration: 6.5s; opacity: 0.1; }
.g-float--8 { top: 10%; right: 55%; animation-delay: 1.1s;  animation-duration: 4.5s; opacity: 0.1; }
@keyframes gfloat {
  from { transform: translateY(0) rotate(-5deg); }
  to   { transform: translateY(-20px) rotate(5deg); }
}

/* ==========================================================================
   Catalog
   ========================================================================== */
.g-catalog { padding: 6rem 0; }
.g-catalog__header { text-align: center; margin-bottom: 4rem; }

.g-label {
  font-family: var(--g-mono); font-size: 0.75rem; font-weight: 700;
  letter-spacing: 0.15em; text-transform: uppercase; color: var(--g-primary);
  display: block; margin-bottom: 0.75rem;
}
.g-section-title {
  font-size: clamp(2rem, 4vw, 3.5rem); font-weight: 900;
  letter-spacing: -0.04em; margin-bottom: 0.75rem;
}
.g-section-sub { font-size: 1.05rem; color: var(--g-muted); max-width: 500px; margin: 0 auto; }

/* Genre Filter */
.g-filter {
  display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center;
  margin-top: 2rem;
}
.g-filter__btn {
  font-family: var(--g-mono); font-size: 0.78rem; font-weight: 600;
  padding: 0.4rem 1rem; border-radius: 100px; cursor: pointer;
  border: 1px solid var(--g-border); background: var(--g-surface);
  color: var(--g-muted); transition: all var(--g-fast);
}
.g-filter__btn:hover { border-color: var(--g-primary); color: var(--g-primary); }
.g-filter__btn.active {
  background: linear-gradient(135deg, rgba(99,102,241,.2), rgba(236,72,153,.15));
  border-color: rgba(99,102,241,.5); color: var(--g-text);
}

/* Grid */
.g-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

/* Cards */
.g-card {
  background: var(--g-card); border: 1px solid var(--g-border);
  border-radius: var(--g-r-lg); padding: 2rem;
  transition: border-color var(--g-fast), transform var(--g-smooth), box-shadow var(--g-smooth);
  display: flex; flex-direction: column; gap: 0.75rem;
  position: relative; overflow: hidden; cursor: pointer;
  opacity: 0; transform: translateY(30px);
}
.g-card.visible { opacity: 1; transform: translateY(0); }
.g-card::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(600px circle at var(--mx, 50%) var(--my, 50%), rgba(99,102,241,.06), transparent 40%);
  opacity: 0; transition: opacity 0.3s;
}
.g-card:hover::before { opacity: 1; }
.g-card:hover {
  border-color: var(--g-border-hi);
  transform: translateY(-6px);
  box-shadow: 0 20px 60px -15px rgba(0,0,0,.7), 0 0 0 1px rgba(99,102,241,.15);
}
/* Card with real thumbnail */
.g-card--has-thumb {
  padding-top: 0;
  overflow: hidden;
}
.g-card__thumb {
  position: relative; width: calc(100% + 2px); margin: -1px -1px 1.25rem -1px;
  aspect-ratio: 16 / 7; overflow: hidden; border-radius: var(--g-r) var(--g-r) 0 0;
}
.g-card__thumb-img {
  width: 100%; height: 100%; object-fit: cover; object-position: center;
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1), filter 0.4s;
  filter: brightness(0.7) saturate(0.8);
}
.g-card:hover .g-card__thumb-img {
  transform: scale(1.06);
  filter: brightness(0.9) saturate(1.1);
}
.g-card__thumb-veil {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 20%, var(--g-card) 100%);
  pointer-events: none;
}

.g-card--featured {
  border-color: rgba(99,102,241,.25);
  background: linear-gradient(135deg, rgba(99,102,241,.06) 0%, var(--g-card) 100%);
}
.g-card--featured:hover { border-color: rgba(99,102,241,.5); }

.g-card__badges { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.g-badge {
  font-family: var(--g-mono); font-size: 0.68rem; font-weight: 700;
  padding: 0.2rem 0.6rem; border-radius: 100px; letter-spacing: 0.05em;
}
.g-badge--hot  { background: rgba(245,158,11,.15); border: 1px solid rgba(245,158,11,.4); color: var(--g-accent); }
.g-badge--new  { background: rgba(16,185,129,.15); border: 1px solid rgba(16,185,129,.4); color: var(--g-green); }
.g-badge--genre { background: var(--g-surface); border: 1px solid var(--g-border); color: var(--g-muted); }

.g-card__icon { font-size: 2.5rem; margin: 0.25rem 0; }
.g-card__title { font-size: 1.3rem; font-weight: 800; letter-spacing: -0.02em; }
.g-card__desc  { font-size: 0.9rem; color: var(--g-muted); line-height: 1.65; flex: 1; }

.g-card__meta { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.g-tag {
  font-family: var(--g-mono); font-size: 0.7rem; padding: 0.18rem 0.55rem;
  background: var(--g-surface); border: 1px solid var(--g-border);
  border-radius: 4px; color: var(--g-muted);
}

.g-card__play {
  font-family: var(--g-mono); font-size: 0.82rem; font-weight: 700;
  color: var(--g-primary); display: flex; align-items: center; gap: 0.5rem;
  transition: gap var(--g-fast);
}
.g-card:hover .g-card__play { gap: 0.85rem; }

/* Card mouse glow */
.g-grid .g-card { transition: border-color var(--g-fast), transform 0.4s var(--g-smooth), box-shadow 0.4s var(--g-smooth), opacity 0.5s ease, translate 0.5s ease; }

/* ==========================================================================
   About Strip
   ========================================================================== */
.g-about { padding: 5rem 0; border-top: 1px solid var(--g-border); }
.g-about__grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 2rem; margin-bottom: 3rem;
}
@media (max-width: 640px) { .g-about__grid { grid-template-columns: repeat(2, 1fr); } }

.g-about__stat {
  text-align: center;
  opacity: 0; transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.g-about__stat.visible { opacity: 1; transform: translateY(0); }
.g-about__num {
  font-family: var(--g-mono); font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 900; background: var(--g-grad-text);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; display: block; line-height: 1;
}
.g-about__label { font-size: 0.85rem; color: var(--g-muted); margin-top: 0.35rem; display: block; }
.g-about__text {
  text-align: center; max-width: 640px; margin: 0 auto;
  font-size: 1.05rem; color: var(--g-muted); line-height: 1.85;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.g-footer { border-top: 1px solid var(--g-border); padding: 3rem 0 2rem; }
.g-footer__inner {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 1rem; margin-bottom: 1.5rem;
}
.g-footer__links { display: flex; gap: 1.5rem; }
.g-footer__links a {
  font-size: 0.88rem; color: var(--g-muted); transition: color var(--g-fast);
  display: flex; align-items: center; gap: 0.4rem;
}
.g-footer__links a:hover { color: var(--g-primary); }
.g-footer__copy { text-align: center; font-size: 0.8rem; color: var(--g-dark); font-family: var(--g-mono); }

/* ==========================================================================
   Card glow follow
   ========================================================================== */
@media (pointer: fine) {
  .g-card { --mx: 50%; --my: 50%; }
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 768px) {
  .g-hero__title { font-size: clamp(3rem, 12vw, 5rem); }
  .g-nav__links { display: none; }
  .g-float { display: none; }
}

@media (max-width: 540px) {
  /* Full-width cards on very small phones */
  .g-grid { grid-template-columns: 1fr; gap: 1rem; }
  .g-card { padding: 1.25rem; border-radius: 16px; }
  .g-card__title { font-size: 1.1rem; }
  .g-card__desc  { font-size: 0.85rem; }

  /* Compact nav */
  .g-nav { padding: 0 1rem; height: 54px; }
  .g-brand__logo { font-size: 1.15rem; }

  /* Hero tighter */
  .g-hero { padding: 3rem 0 2rem; }
  .g-hero__eyebrow { font-size: 0.65rem; }

  /* Filters horizontal scroll */
  .g-filter {
    justify-content: flex-start;
    overflow-x: auto;
    padding: 0 1rem 0.5rem;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
  }
  .g-filter::-webkit-scrollbar { display: none; }
  .g-filter__btn { flex-shrink: 0; }

  /* Section paddings */
  .g-section { padding: 3rem 0; }
  .g-section-title { font-size: clamp(1.8rem, 8vw, 2.5rem); }

  /* About grid */
  .g-about__grid { gap: 1rem; }
}

@media (max-width: 380px) {
  .g-grid { gap: 0.75rem; }
  .g-card { padding: 1rem; }
}

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