:root {
  --bg: #050a0e;
  --surface: #0d1a24;
  --surface2: #122030;
  --border: #1e3a4a;
  --accent: #00e5ff;
  --accent2: #00ff88;
  --accent3: #ff3d71;
  --accent4: #ffaa00;
  --text: #e8f4f8;
  --text-muted: #6a9ab0;
  --font-display: 'Space Mono', monospace;
  --font-body: 'Outfit', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

/* KEY FIX: html + body must not overflow, width must be 100% */
html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  min-height: 100vh;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(0,229,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,229,255,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: -1;
}

/* ─── Navigation ─────────────────────────────────────────── */
header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  background: rgba(5,10,14,0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  width: 100%;
}

nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 20px;
  gap: 12px;
}

.logo {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  flex-shrink: 0;
  min-width: 0;
}

.logo-icon {
  width: 32px;
  height: 32px;
  min-width: 32px;
  background: var(--accent);
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--bg);
  font-weight: 900;
  font-size: 0.85rem;
}

.logo-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-links {
  display: flex;
  gap: 20px;
  list-style: none;
  align-items: center;
  flex-shrink: 0;
}

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: color 0.2s;
  white-space: nowrap;
}

.nav-links a:hover { color: var(--accent); }

/* CTA — fixed size, never wraps */
.nav-cta {
  background: var(--accent);
  color: var(--bg) !important;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 700 !important;
  white-space: nowrap;
  font-size: 0.82rem;
  flex-shrink: 0;
  line-height: 1.2;
}

/* ─── Hero Section ───────────────────────────────────────── */
.hero {
  position: relative;
  min-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 100px 20px 60px;
  text-align: center;
  /* KEY FIX: contain width */
  width: 100%;
}

.hero-glow {
  position: absolute;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(0,229,255,0.08) 0%, transparent 70%);
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  /* KEY FIX: don't let glow cause overflow */
  max-width: 100vw;
}

/* KEY FIX: hero-content must be constrained and centered */
.hero-content {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(0,229,255,0.1);
  border: 1px solid rgba(0,229,255,0.3);
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 0.7rem;
  padding: 6px 14px;
  border-radius: 100px;
  margin-bottom: 28px;
}

h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 8vw, 5rem);
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 20px;
  width: 100%;
}

h1 .accent  { color: var(--accent); }
h1 .accent2 { color: var(--accent2); }
h1 .accent3 { color: var(--accent3); }

.hero-sub {
  font-size: clamp(0.95rem, 2.5vw, 1.2rem);
  color: var(--text-muted);
  max-width: 560px;
  margin: 0 auto 36px;
  line-height: 1.7;
  font-weight: 300;
  width: 100%;
}

/* ─── Hero Buttons ───────────────────────────────────────── */
.hero-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  width: 100%;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg);
  border: none;
  padding: 14px 32px;
  border-radius: 10px;
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-block;
  white-space: nowrap;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0,229,255,0.35);
}

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  padding: 14px 32px;
  border-radius: 10px;
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-block;
  white-space: nowrap;
}

.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

/* ─── Levels Section ─────────────────────────────────────── */
.levels-section {
  padding: 60px clamp(16px, 4vw, 60px);
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.section-header { text-align: center; margin-bottom: 50px; }
.section-tag {
  font-family: var(--font-display);
  font-size: 0.7rem;
  color: var(--accent2);
  letter-spacing: 2px;
  margin-bottom: 12px;
  display: block;
}

h2 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 4vw, 2.8rem);
  font-weight: 700;
}

h2 .dim { color: var(--text-muted); }

.levels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
  margin-top: 40px;
}

.level-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.25s;
  text-decoration: none;
  color: var(--text);
  display: block;
}

.level-card:hover { border-color: var(--accent); transform: translateY(-3px); }
.level-card.completed {
  border-color: rgba(0,255,136,0.4);
  background: rgba(0,255,136,0.05);
}

.level-num {
  font-family: var(--font-display);
  font-size: 0.65rem;
  color: var(--text-muted);
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.level-icon { font-size: 2rem; margin-bottom: 10px; display: block; }
.level-name { font-weight: 700; font-size: 0.95rem; margin-bottom: 4px; }

/* ─── SEO Articles ───────────────────────────────────────── */
.seo-article {
  max-width: 800px;
  margin: 60px auto;
  padding: 0 20px;
  color: var(--text-muted);
  line-height: 1.8;
  font-size: 1.05rem;
  width: 100%;
}

.seo-article h2, .seo-article h3 {
  color: var(--text);
  font-family: var(--font-display);
  margin: 40px 0 15px;
}

.seo-article p { margin-bottom: 28px; }
.seo-article a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dotted var(--accent);
}
.seo-article a:hover { color: var(--accent2); border-bottom-color: var(--accent2); }

/* ─── Mobile ≤ 768px ─────────────────────────────────────── */
@media (max-width: 768px) {
  nav {
    height: 56px;
    padding: 0 14px;
    gap: 8px;
  }

  /* Hide Play & Levels links, keep only CTA */
  .nav-links li:not(:last-child) { display: none; }

  /* Hide logo text on mobile to free space */
  .logo-text { display: none; }

  .nav-cta {
    padding: 7px 12px;
    font-size: 0.78rem;
  }

  .hero {
    padding: 80px 16px 50px;
    min-height: auto;
  }

  h1 { font-size: clamp(1.8rem, 9vw, 2.6rem); }

  .hero-sub { font-size: 0.95rem; }

  /* Buttons stack full-width */
  .hero-buttons {
    flex-direction: column;
    align-items: stretch;
  }

  .btn-primary,
  .btn-outline {
    text-align: center;
    width: 100%;
    margin-left: 0;
    padding: 14px 20px;
  }

  .levels-section { padding: 40px 16px; }
  .levels-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
}

/* ─── Very narrow ≤ 400px ────────────────────────────────── */
@media (max-width: 400px) {
  .logo-icon { width: 28px; height: 28px; min-width: 28px; font-size: 0.8rem; }
  .nav-cta { padding: 6px 10px; font-size: 0.73rem; border-radius: 6px; }
  h1 { font-size: 1.7rem; }
  .levels-grid { grid-template-columns: repeat(2, 1fr); }
}