/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Outfit', sans-serif;
  background: #0a0a0f;
  color: #e2e8f0;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ===== BG PARTICLES ===== */
.bg-particles {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background: radial-gradient(ellipse at 20% 20%, rgba(124,58,237,0.15) 0%, transparent 50%),
              radial-gradient(ellipse at 80% 80%, rgba(236,72,153,0.1) 0%, transparent 50%),
              radial-gradient(ellipse at 50% 0%, rgba(59,130,246,0.08) 0%, transparent 40%);
}

/* ===== HEADER ===== */
.header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(10,10,15,0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.header-inner {
  max-width: 1200px; margin: 0 auto;
  padding: 0 24px;
  height: 68px;
  display: flex; align-items: center; gap: 32px;
}
.logo { display: flex; align-items: center; gap: 10px; cursor: pointer; text-decoration: none; }
.logo-icon { display: flex; }
.logo-text { font-size: 1.4rem; font-weight: 800; color: #fff; letter-spacing: -0.5px; }
.logo-accent { background: linear-gradient(135deg, #7C3AED, #EC4899); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.nav { display: flex; gap: 8px; margin-left: auto; }
.nav-link {
  color: rgba(255,255,255,0.6); text-decoration: none;
  padding: 6px 16px; border-radius: 8px;
  font-weight: 600; font-size: 0.95rem;
  transition: all 0.2s;
}
.nav-link:hover, .nav-link.active { color: #fff; background: rgba(255,255,255,0.08); }
.header-badge {
  font-size: 0.78rem; font-weight: 700;
  padding: 5px 12px; border-radius: 20px;
  background: rgba(124,58,237,0.2); border: 1px solid rgba(124,58,237,0.4);
  color: #a78bfa; white-space: nowrap;
}

/* ===== HERO ===== */
.hero {
  max-width: 1200px; margin: 0 auto;
  padding: 80px 24px 60px;
  display: flex; align-items: center; gap: 48px;
  position: relative; z-index: 1;
}
.hero-content { flex: 1; }
.hero-tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.85rem; font-weight: 700;
  color: #a78bfa; background: rgba(124,58,237,0.15);
  border: 1px solid rgba(124,58,237,0.3);
  padding: 6px 16px; border-radius: 20px; margin-bottom: 20px;
}
.hero-title {
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 900; line-height: 1.1;
  color: #fff; margin-bottom: 16px;
  letter-spacing: -1px;
}
.gradient-text {
  background: linear-gradient(135deg, #7C3AED 0%, #EC4899 50%, #F59E0B 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.hero-subtitle { font-size: 1.1rem; color: rgba(255,255,255,0.55); margin-bottom: 32px; max-width: 440px; }
.hero-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: linear-gradient(135deg, #7C3AED, #EC4899);
  color: #fff; text-decoration: none;
  padding: 14px 28px; border-radius: 12px;
  font-weight: 700; font-size: 1rem;
  transition: all 0.3s; box-shadow: 0 8px 32px rgba(124,58,237,0.4);
}
.hero-btn:hover { transform: translateY(-2px); box-shadow: 0 12px 40px rgba(124,58,237,0.6); }
.hero-visual { flex: 0 0 auto; }
.hero-cards-float { display: flex; gap: 16px; }
.float-card {
  width: 80px; height: 80px; border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.2rem;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  backdrop-filter: blur(10px);
}
.fc1 { animation: floatA 3s ease-in-out infinite; }
.fc2 { animation: floatA 3s ease-in-out infinite 0.5s; }
.fc3 { animation: floatA 3s ease-in-out infinite 1s; }
@keyframes floatA {
  0%,100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

/* ===== GAMES SECTION ===== */
.games-section { max-width: 1200px; margin: 0 auto; padding: 20px 24px 80px; position: relative; z-index: 1; }
.section-header { text-align: center; margin-bottom: 48px; }
.section-title { font-size: 2rem; font-weight: 800; color: #fff; margin-bottom: 8px; }
.section-sub { color: rgba(255,255,255,0.45); font-size: 1rem; }
.games-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

/* ===== GAME CARD ===== */
.game-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 20px; overflow: hidden;
  cursor: pointer; position: relative;
  transition: all 0.35s cubic-bezier(0.34,1.56,0.64,1);
}
.game-card:hover {
  transform: translateY(-8px) scale(1.02);
  border-color: rgba(255,255,255,0.2);
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
}
.game-card:focus-visible { outline: 2px solid #7C3AED; outline-offset: 4px; }
.game-card.featured { border-color: rgba(124,58,237,0.4); }
.featured-badge {
  position: absolute; top: 16px; right: 16px; z-index: 5;
  background: linear-gradient(135deg, #7C3AED, #EC4899);
  color: #fff; font-size: 0.72rem; font-weight: 700;
  padding: 4px 10px; border-radius: 20px;
}
.card-glow {
  position: absolute; top: -40px; left: 50%; transform: translateX(-50%);
  width: 200px; height: 200px; border-radius: 50%;
  filter: blur(60px); opacity: 0; transition: opacity 0.4s;
  pointer-events: none;
}
.game-card:hover .card-glow { opacity: 0.4; }
.glow-green { background: #22c55e; }
.glow-purple { background: #7C3AED; }
.glow-orange { background: #f59e0b; }

/* Card Thumbnail */
.card-thumb {
  height: 180px; display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
}
.snake-thumb { background: linear-gradient(135deg, #052e16, #14532d); }
.tetris-thumb { background: linear-gradient(135deg, #1e1b4b, #312e81); }
.game2048-thumb { background: linear-gradient(135deg, #431407, #7c2d12); }
.thumb-icon { font-size: 4rem; z-index: 2; filter: drop-shadow(0 4px 16px rgba(0,0,0,0.5)); }

/* 2048 preview grid */
.preview-2048 {
  position: absolute; inset: 0; display: grid;
  grid-template-columns: repeat(3,1fr); grid-template-rows: repeat(3,1fr);
  gap: 4px; padding: 12px; opacity: 0.3;
}
.p2048-tile {
  border-radius: 6px; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 0.7rem;
}
.t2{background:#eee4da;color:#776e65}.t4{background:#ede0c8;color:#776e65}
.t8{background:#f2b179;color:#fff}.t16{background:#f59563;color:#fff}
.t32{background:#f67c5f;color:#fff}.t64{background:#f65e3b;color:#fff}
.t128{background:#edcf72;color:#fff;font-size:0.6rem}
.t256{background:#edcc61;color:#fff;font-size:0.6rem}
.t512{background:#edc850;color:#fff;font-size:0.6rem}

/* Card Body */
.card-body { padding: 20px; }
.card-tags { display: flex; gap: 6px; margin-bottom: 10px; }
.tag {
  font-size: 0.7rem; font-weight: 700; padding: 3px 8px;
  border-radius: 6px; text-transform: uppercase; letter-spacing: 0.5px;
}
.tag-arcade { background: rgba(34,197,94,0.15); color: #4ade80; border: 1px solid rgba(34,197,94,0.3); }
.tag-classic { background: rgba(148,163,184,0.1); color: #94a3b8; border: 1px solid rgba(148,163,184,0.2); }
.tag-puzzle { background: rgba(124,58,237,0.15); color: #a78bfa; border: 1px solid rgba(124,58,237,0.3); }
.tag-strategy { background: rgba(245,158,11,0.15); color: #fbbf24; border: 1px solid rgba(245,158,11,0.3); }
.card-title { font-size: 1.4rem; font-weight: 800; color: #fff; margin-bottom: 8px; }
.card-desc { font-size: 0.88rem; color: rgba(255,255,255,0.5); line-height: 1.5; margin-bottom: 14px; }
.card-meta { display: flex; gap: 12px; margin-bottom: 16px; }
.meta-item { font-size: 0.78rem; color: rgba(255,255,255,0.4); font-weight: 600; }
.card-btn {
  display: flex; align-items: center; gap: 6px;
  width: 100%; padding: 11px 16px; border-radius: 10px;
  background: linear-gradient(135deg, #7C3AED, #EC4899);
  color: #fff; font-weight: 700; font-size: 0.9rem;
  border: none; cursor: pointer;
  justify-content: center;
  transition: all 0.25s; box-shadow: 0 4px 16px rgba(124,58,237,0.3);
}
.card-btn:hover { box-shadow: 0 6px 24px rgba(124,58,237,0.5); filter: brightness(1.1); }

/* ===== ABOUT SECTION ===== */
.about-section {
  background: rgba(255,255,255,0.02);
  border-top: 1px solid rgba(255,255,255,0.06);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.about-inner {
  max-width: 1200px; margin: 0 auto;
  padding: 80px 24px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 64px; align-items: center;
  position: relative; z-index: 1;
}
.about-title { font-size: 2rem; font-weight: 800; color: #fff; margin-bottom: 16px; }
.about-desc { color: rgba(255,255,255,0.5); line-height: 1.7; margin-bottom: 32px; }
.about-stats { display: flex; gap: 32px; }
.stat-item { text-align: center; }
.stat-number { display: block; font-size: 2.5rem; font-weight: 900; background: linear-gradient(135deg,#7C3AED,#EC4899); -webkit-background-clip:text; -webkit-text-fill-color:transparent; background-clip:text; }
.stat-label { font-size: 0.85rem; color: rgba(255,255,255,0.4); font-weight: 600; }
.about-features { display: flex; flex-direction: column; gap: 24px; }
.feature-item { display: flex; gap: 16px; align-items: flex-start; }
.feat-icon { font-size: 1.6rem; flex-shrink: 0; width: 48px; height: 48px; background: rgba(255,255,255,0.06); border-radius: 12px; display: flex; align-items: center; justify-content: center; }
.feature-item h4 { font-size: 1rem; font-weight: 700; color: #fff; margin-bottom: 4px; }
.feature-item p { font-size: 0.88rem; color: rgba(255,255,255,0.45); }

/* ===== FOOTER ===== */
.footer { padding: 32px 24px; position: relative; z-index: 1; }
.footer-inner { max-width: 1200px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; }
.footer-copy { color: rgba(255,255,255,0.3); font-size: 0.85rem; }

/* ===== MODAL ===== */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.8);
  z-index: 200; opacity: 0; pointer-events: none;
  transition: opacity 0.3s;
  backdrop-filter: blur(8px);
}
.modal-backdrop.active { opacity: 1; pointer-events: all; }
.game-modal {
  position: fixed; inset: 0; z-index: 201;
  display: flex; flex-direction: column;
  background: #0d0d15;
  transform: scale(0.92) translateY(24px);
  opacity: 0; pointer-events: none;
  transition: all 0.35s cubic-bezier(0.34,1.56,0.64,1);
  border: 1px solid rgba(255,255,255,0.1);
}
@media(min-width:768px) {
  .game-modal {
    inset: 16px; border-radius: 20px;
    box-shadow: 0 40px 120px rgba(0,0,0,0.8);
  }
}
.game-modal.active { transform: scale(1) translateY(0); opacity: 1; pointer-events: all; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px; border-bottom: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03); flex-shrink: 0;
}
.modal-title-wrap { display: flex; align-items: center; gap: 10px; }
.modal-icon { font-size: 1.5rem; }
.modal-title { font-size: 1.2rem; font-weight: 800; color: #fff; }
.modal-actions { display: flex; align-items: center; gap: 8px; }
.modal-btn-restart {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 8px;
  background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.7); font-weight: 600; font-size: 0.85rem;
  cursor: pointer; transition: all 0.2s;
}
.modal-btn-restart:hover { background: rgba(255,255,255,0.12); color: #fff; }
.modal-btn-close {
  width: 36px; height: 36px; border-radius: 8px;
  background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3);
  color: #f87171; cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.modal-btn-close:hover { background: rgba(239,68,68,0.2); color: #fff; }
.modal-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 16px;
  /* scroll snap so content starts from top when it overflows */
  align-items: flex-start;
}
/* center vertically only when content fits */
.modal-body > * {
  margin: auto;
  width: 100%;
}

/* ===== RESPONSIVE ===== */
@media(max-width: 900px) {
  .games-grid { grid-template-columns: 1fr 1fr; }
  .about-inner { grid-template-columns: 1fr; gap: 40px; }
  .hero { flex-direction: column; padding: 48px 24px 40px; text-align: center; }
  .hero-subtitle { margin: 0 auto 32px; }
  .hero-cards-float { justify-content: center; }
}
@media(max-width: 600px) {
  .games-grid { grid-template-columns: 1fr; }
  .header-badge { display: none; }
  .float-card { width: 60px; height: 60px; font-size: 1.6rem; }
}
