/* ============================================================
   GameZone - Main Stylesheet
   ============================================================ */

:root {
  --primary: #a855f7;
  --primary-dark: #7c3aed;
  --accent: #f472b6;
  --accent-2: #00f5d4;
  --bg: #0a0a14;
  --bg-2: #12121f;
  --bg-3: #1b1b2d;
  --card: #17172a;
  --card-hover: #25253e;
  --text: #f0f0f5;
  --text-2: #b8b8cc;
  --text-3: #8a8aa0;
  --border: #2a2a44;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 20px rgba(168,85,247,.15);
  --shadow-lg: 0 10px 40px rgba(168,85,247,.25);
  --transition: all .25s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent; }
button { -webkit-tap-highlight-color: transparent; }
img { max-width: 100%; display: block; }
ul { list-style: none; }

.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- Header / Navigation ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15,15,26,.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top, 0px);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text);
}
.logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 10px;
  display: grid; place-items: center;
  font-size: 1.2rem;
}
.logo span { color: var(--accent); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
}
.nav-links a {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  color: var(--text-2);
  transition: var(--transition);
  font-size: .95rem;
}
.nav-links a:hover, .nav-links a.active {
  color: var(--text);
  background: var(--bg-3);
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  place-items: center;
  transition: var(--transition);
}
.nav-toggle:active { background: var(--bg-3); }

/* Mobile menu backdrop (toggled by JS) */
.nav-mask {
  position: fixed;
  inset: 0;
  z-index: 98;
  background: rgba(0,0,0,.55);
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s ease, visibility 0s linear .3s;
}
.nav-mask.show {
  opacity: 1;
  visibility: visible;
  transition: opacity .3s ease;
}

/* ---------- Hero ---------- */
.hero {
  background: linear-gradient(135deg, rgba(108,92,231,.15), rgba(0,206,201,.1)), var(--bg-2);
  padding: 60px 0 50px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}
.hero h1 {
  font-size: 2.6rem;
  font-weight: 800;
  margin-bottom: 14px;
  background: linear-gradient(135deg, #fff, var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero p {
  font-size: 1.15rem;
  color: var(--text-2);
  max-width: 640px;
  margin: 0 auto;
}

/* ---------- Section ---------- */
.section {
  padding: 24px 0;
}
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-title .icon { font-size: 1.4rem; }
.view-all {
  color: var(--accent);
  font-weight: 600;
  font-size: .9rem;
  white-space: nowrap;
  flex-shrink: 0;
  transition: var(--transition);
}
.view-all:hover { opacity: .75; }

/* ---------- Game Grid ---------- */
.game-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.game-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: var(--transition);
  cursor: pointer;
  position: relative;
}
.game-card:active {
  transform: scale(.97);
  border-color: var(--primary);
}
.game-thumb {
  position: relative;
  aspect-ratio: 4/3;
  overflow: hidden;
  background: var(--bg-3);
}
.game-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .4s ease;
}

.game-thumb::after {
  content: "▶";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,.4);
  color: #fff;
  font-size: 2.2rem;
  opacity: 0;
  transition: var(--transition);
  pointer-events: none;
}

/* Hover effects only for devices that actually support hover */
@media (hover: hover) {
  .game-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
    box-shadow: var(--shadow-lg);
  }
  .game-card:hover .game-thumb img { transform: scale(1.06); }
  .game-card:hover .game-thumb::after { opacity: 1; }
}

/* Touch devices: always show a light play affordance */
@media (hover: none) {
  .game-thumb::after {
    opacity: .5;
    font-size: 1.6rem;
    text-shadow: 0 1px 6px rgba(0,0,0,.6);
  }
}

.game-info { padding: 12px 14px 14px; }
.game-name {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.game-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: .8rem;
  color: var(--text-3);
}
.game-meta .rating { color: var(--accent-2); }

/* ---------- Category chips ---------- */
.category-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 28px;
}
.chip {
  padding: 8px 18px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: .9rem;
  font-weight: 500;
  color: var(--text-2);
  transition: var(--transition);
  cursor: pointer;
}
.chip:hover, .chip.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ---------- Detail page ---------- */
.detail-wrap {
  padding: 20px 0 12px;
}
.game-detail {
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
}
.game-header {
  display: flex;
  gap: 28px;
  align-items: flex-start;
  flex-wrap: wrap;
  background: linear-gradient(135deg, var(--bg-2), var(--bg-3));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.game-header .cover {
  width: 240px;
  border-radius: var(--radius);
  overflow: hidden;
  flex-shrink: 0;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.game-header .cover img { width: 100%; aspect-ratio: 4/3; object-fit: cover; }
.game-header .info { flex: 1; min-width: 260px; }
.game-header h1 {
  font-size: 2.2rem;
  margin-bottom: 10px;
  background: linear-gradient(135deg, #fff, var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.game-tags { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 14px; }
.tag {
  padding: 4px 12px;
  background: var(--bg-3);
  border-radius: 999px;
  font-size: .8rem;
  color: var(--text-2);
  border: 1px solid var(--border);
}
.game-stats {
  display: flex;
  gap: 28px;
  margin: 14px 0 20px;
  font-size: .95rem;
  color: var(--text-2);
}
.game-stats strong { color: var(--text); font-size: 1.1rem; }

.play-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 16px 44px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  font-size: 1.2rem;
  font-weight: 700;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 8px 24px rgba(108,92,231,.45);
}
.play-btn:hover { transform: translateY(-3px); box-shadow: 0 14px 36px rgba(0,206,201,.35); }
.play-btn:active { transform: translateY(-1px); }

.play-hint {
  display: block;
  margin-top: 12px;
  font-size: .82rem;
  color: var(--text-3);
}

.game-frame-wrap {
  position: relative;
  width: 100%;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 16/10;
  box-shadow: var(--shadow-lg);
}
.game-frame-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.game-description {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.game-description h2 { font-size: 1.3rem; margin-bottom: 12px; }
.game-description p { color: var(--text-2); line-height: 1.8; }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--bg-2);
  border-top: 1px solid var(--border);
  padding: 24px 0 18px;
  margin-top: 24px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 30px;
  margin-bottom: 18px;
}
.footer-col h4 {
  font-size: 1rem;
  margin-bottom: 14px;
  color: var(--text);
}
.footer-col a {
  display: block;
  color: var(--text-3);
  font-size: .9rem;
  padding: 4px 0;
  transition: var(--transition);
}
.footer-col a:hover { color: var(--accent); }
.footer-about p { color: var(--text-3); font-size: .9rem; margin-top: 10px; }
.footer-bottom {
  text-align: center;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  color: var(--text-3);
  font-size: .85rem;
}

/* ---------- Static pages ---------- */
.page-content {
  max-width: 820px;
  margin: 0 auto;
  padding: 40px 20px 60px;
}
.page-content h1 { font-size: 2.2rem; margin-bottom: 8px; }
.page-content .lead { color: var(--text-2); margin-bottom: 30px; }
.page-content h2 { font-size: 1.4rem; margin: 30px 0 12px; color: var(--accent); }
.page-content p { color: var(--text-2); margin-bottom: 14px; line-height: 1.8; }
.page-content ul { margin: 12px 0 16px 24px; }
.page-content ul li { color: var(--text-2); margin-bottom: 8px; list-style: disc; }

/* ---------- Empty state ---------- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-3);
}
.empty-state .icon { font-size: 3rem; margin-bottom: 14px; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .game-grid { grid-template-columns: repeat(3, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .hero h1 { font-size: 2rem; }
}
@media (max-width: 700px) {
  .nav { height: 56px; }
  .logo { font-size: 1.2rem; gap: 8px; }
  .logo-icon { width: 32px; height: 32px; font-size: 1rem; border-radius: 8px; }

  .nav-links {
    position: fixed;
    top: calc(56px + env(safe-area-inset-top, 0px));
    left: 0;
    right: 0;
    z-index: 99;
    background: var(--bg-2);
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 10px calc(14px + env(safe-area-inset-right, 0px)) 16px calc(14px + env(safe-area-inset-left, 0px));
    border-bottom: 1px solid var(--border);
    box-shadow: 0 18px 30px rgba(0,0,0,.45);
    max-height: calc(100vh - 56px - env(safe-area-inset-top, 0px));
    max-height: calc(100dvh - 56px - env(safe-area-inset-top, 0px));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transform: translateY(-120%);
    visibility: hidden;
    transition: transform .3s ease, visibility 0s linear .3s;
  }
  .nav-links.open {
    transform: translateY(0);
    visibility: visible;
    transition: transform .3s ease, visibility 0s;
  }
  .nav-links a {
    padding: 13px 12px;
    font-size: 1rem;
    border-radius: var(--radius-sm);
  }
  .nav-toggle { display: grid; }
  body.nav-open { overflow: hidden; }

  .container {
    padding-left: calc(14px + env(safe-area-inset-left, 0px));
    padding-right: calc(14px + env(safe-area-inset-right, 0px));
  }
  .section { padding: 18px 0; }
  .section-header { margin-bottom: 12px; gap: 10px; }
  .section-title { font-size: 1.15rem; gap: 6px; }
  .section-title .icon { font-size: 1.15rem; }

  .game-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .game-info { padding: 10px 10px 12px; }
  .game-name { font-size: .92rem; margin-bottom: 4px; }
  .hero { padding: 40px 0 30px; }
  .hero h1 { font-size: 1.7rem; }
  .game-header { display: block !important; text-align: center; }
  .game-header h1 { font-size: 1.5rem; }
  .game-header .cover { display: block; width: 100%; max-width: 300px; margin: 0 auto 16px !important; }
  .game-header .info { width: 100%; }
  .game-tags { justify-content: center; }
  .game-stats { justify-content: center; }

  /* ----- Mobile Footer Fix ----- */
  .site-footer {
    padding: 20px 0 calc(14px + env(safe-area-inset-bottom, 0px));
    margin-top: 18px;
  }
  .footer-grid {
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px 24px;
    margin-bottom: 14px;
    text-align: left;
  }
  .footer-col h4 {
    font-size: .95rem;
    margin-bottom: 10px;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    padding-bottom: 6px;
    letter-spacing: .3px;
  }
  .footer-col a {
    font-size: .85rem;
    padding: 3px 0;
    line-height: 1.5;
  }
  .footer-about {
    grid-column: 1 / -1;
    text-align: center;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 4px;
  }
  .footer-about .logo { justify-content: center; }
  .footer-about p { margin-top: 8px; font-size: .85rem; }
  .footer-bottom { font-size: .8rem; padding-top: 16px; }
}
@media (max-width: 500px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 16px 18px;
  }
  .footer-about { margin-bottom: 6px; }
  .footer-company-legal h4:last-of-type {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px dashed var(--border);
  }
}
@media (max-width: 420px) {
  .game-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .game-meta { font-size: .75rem; }
  .section-title { font-size: 1.05rem; }
  .view-all { font-size: .82rem; }
}

/* ---------- Skeleton loading ---------- */
.skeleton {
  background: linear-gradient(90deg, var(--bg-3) 25%, var(--card) 50%, var(--bg-3) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
