:root {
  --bg: #eef2ff;
  --surface: #ffffff;
  --surface-soft: #f8faff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --radius: 16px;
  --shadow: 0 4px 18px rgba(15, 23, 42, 0.05);
  --max-w: 1100px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
  max-width: 100%;
  overflow-x: clip;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 15px;
  min-height: 100vh;
  max-width: 100%;
  overflow-x: clip;
  display: flex;
  flex-direction: column;
}

a {
  color: inherit;
  text-decoration: none;
}

.container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 14px;
}

/* Header (Mobile-First) */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  position: relative;
}

.brand {
  font-size: 1.2rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  letter-spacing: -0.02em;
}

.brand-accent {
  color: var(--primary);
}

.brand-ext {
  font-size: 0.78rem;
  color: var(--primary);
  font-weight: 700;
}

.menu-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--text);
  font-size: 1.25rem;
  cursor: pointer;
}

.nav-links {
  display: none;
  flex-direction: column;
  position: absolute;
  top: 60px;
  left: -14px;
  right: -14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.1);
  padding: 10px 14px 16px;
  gap: 4px;
}

.nav-links.open {
  display: flex;
}

.nav-links a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  color: #334155;
}

.nav-links a:hover,
.nav-links a:active {
  background: var(--surface-soft);
  color: var(--primary);
}

.nav-links .nav-highlight {
  color: var(--primary);
  background: #eef2ff;
}

/* Main */
main {
  flex: 1;
  padding: 24px 0 48px;
}

/* Hero Section */
.hero {
  text-align: center;
  max-width: 740px;
  margin: 0 auto 28px;
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}

.hero h1 {
  font-size: clamp(1.65rem, 6.5vw, 2.75rem);
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 12px;
  letter-spacing: -0.02em;
}

.hero p {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0 auto 20px;
}

.hero-banner {
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 55%, #312e81 100%);
  border-radius: 18px;
  padding: 26px 18px;
  color: #ffffff;
  box-shadow: 0 12px 28px rgba(30, 27, 75, 0.2);
  margin-bottom: 20px;
}

.hero-banner-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: #ffffff;
}

.hero-banner-sub {
  color: #cbd5e1;
  font-size: 0.86rem;
  margin: 0;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  max-width: 280px;
  min-height: 46px;
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 12px 24px;
  border-radius: 999px;
  box-shadow: 0 8px 20px rgba(79, 70, 229, 0.3);
  border: none;
  cursor: pointer;
}

/* Grids (Mobile-First: 1 Column) */
.grid-2,
.grid-3 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-bottom: 24px;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.85);
}

.card-interactive {
  display: flex;
  flex-direction: column;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.card-interactive.hidden {
  display: none;
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.icon-box {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.cat-tag {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--primary);
  background: #eef2ff;
  padding: 4px 10px;
  border-radius: 999px;
}

.card h3 {
  font-size: 1.02rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text);
}

.card p {
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 14px;
  flex: 1;
}

.card-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 36px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--primary);
}

/* Filter Bar (Swipeable on Mobile) */
.section-heading {
  text-align: center;
  font-size: 1.45rem;
  font-weight: 800;
  margin: 34px 0 14px;
}

.games-count {
  text-align: center;
  font-size: 0.86rem;
  color: var(--muted);
  margin-bottom: 16px;
}

.filter-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px 2px 12px;
  margin-bottom: 14px;
  scrollbar-width: none;
}

.filter-bar::-webkit-scrollbar {
  display: none;
}

.filter-btn {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: #334155;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
}

.filter-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

/* Editorial & FAQ */
.section-block {
  margin-bottom: 24px;
}

.editorial-card {
  padding: 20px;
  margin-bottom: 16px;
}

.editorial-card h2 {
  font-size: 1.28rem;
  font-weight: 800;
  margin-bottom: 12px;
  line-height: 1.3;
}

.editorial-card p {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 12px;
}

.editorial-card ul {
  padding-left: 18px;
  margin-top: 8px;
}

.editorial-card li {
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 8px;
}

.editorial-card li strong {
  color: var(--text);
}

.faq-card {
  padding: 20px;
  margin-bottom: 24px;
}

.faq-card h2 {
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 14px;
}

.faq-item {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 10px;
}

.faq-item summary {
  list-style: none;
  padding: 14px 16px;
  min-height: 48px;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "▼";
  font-size: 0.7rem;
  color: var(--primary);
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.faq-item[open] summary::after {
  transform: rotate(180deg);
}

.faq-answer {
  padding: 0 16px 14px;
  font-size: 0.88rem;
  color: var(--muted);
}

/* Safe AdSense Slot */
.ad-slot {
  margin: 22px auto;
  padding: 14px;
  min-height: 100px;
  background: var(--surface);
  border: 1px dashed #cbd5e1;
  border-radius: var(--radius);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.ad-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

/* Game Stage (For Individual Game Pages) */
.game-wrapper {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 20px;
}

.game-stage {
  width: 100%;
  aspect-ratio: 4 / 5;
  min-height: 380px;
  background: #0f172a;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.game-controls-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
}

.btn-outline {
  min-height: 38px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 10px;
  cursor: pointer;
}

/* Footer (Mobile-First: 1 Column) */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 32px 0 24px;
  margin-top: auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.footer-desc {
  font-size: 0.86rem;
  color: var(--muted);
  margin: 10px 0;
}

.footer-contact {
  font-size: 0.86rem;
  font-weight: 700;
}

.footer-col h4 {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

.footer-col ul {
  list-style: none;
}

.footer-col li {
  margin-bottom: 8px;
  font-size: 0.88rem;
  color: var(--muted);
}

.footer-bottom {
  padding-top: 16px;
  font-size: 0.8rem;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Tablet (>= 640px) */
@media (min-width: 640px) {
  .container {
    padding: 0 20px;
  }
  .grid-2,
  .grid-3,
  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
  }
  .card {
    padding: 22px;
  }
  .editorial-card,
  .faq-card {
    padding: 28px;
  }
  .filter-bar {
    justify-content: center;
    flex-wrap: wrap;
    overflow-x: visible;
  }
  .game-stage {
    aspect-ratio: 16 / 9;
  }
  .footer-bottom {
    flex-direction: row;
    justify-content: space-between;
  }
}

/* Desktop (>= 900px) */
@media (min-width: 900px) {
  .menu-toggle {
    display: none;
  }
  .nav-links {
    display: flex;
    flex-direction: row;
    position: static;
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    gap: 18px;
  }
  .nav-links a {
    min-height: auto;
    padding: 6px 10px;
    font-size: 0.9rem;
  }
  .nav-links .nav-highlight {
    background: transparent;
  }
  main {
    padding: 36px 0 64px;
  }
  .hero-banner {
    padding: 40px 28px;
  }
  .grid-3 {
    grid-template-columns: repeat(3, 1fr);
  }
  .footer-grid {
    grid-template-columns: 1.5fr 1fr 1fr 1fr;
  }
  .card-interactive:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 26px rgba(79, 70, 229, 0.1);
  }
}
