@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@500;600;700&family=DM+Sans:wght@400;500;700&display=swap');

:root {
  --bg: #FFF9F2;
  --bg-alt: #F3F0FF;
  --bg-alt-2: #FFF1E6;
  --primary: #6C5CE7;
  --primary-dark: #5B4BD1;
  --accent: #FF9F6B;
  --accent-2: #4ECDC4;
  --text: #2E2A45;
  --text-muted: #6B647F;
  --white: #FFFFFF;
  --border: #ECE6FA;
  --gradient: linear-gradient(135deg, #8A7CFF 0%, #FF9F6B 100%);
  --font-heading: 'Fredoka', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --header-height: 84px;
}

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

html, body { background: var(--bg); height: 100%; }

body {
  font-family: var(--font-body);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
}

footer { flex-shrink: 0; }

html.hide #preloader { opacity: 0; pointer-events: none; }

#preloader {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity .4s ease;
}
#preloader img { width: 64px; height: 64px; }

.container {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
}

h1, h2, h3 {
  font-family: var(--font-heading);
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
}

h1 { font-size: 52px; margin-bottom: 22px; }
h2 { font-size: 38px; margin-bottom: 16px; }
h3 { font-size: 21px; margin-bottom: 10px; }

p { color: var(--text-muted); }

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

img { max-width: 100%; display: block; }

section { position: relative; padding: 100px 0; overflow: hidden; }

/* Header */
header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1100;
  background: rgba(255, 249, 242, 0.7);
  backdrop-filter: blur(10px);
  transition: background .3s ease, box-shadow .3s ease;
}
header.scrolled {
  background: rgba(255, 249, 242, 0.95);
  box-shadow: 0 4px 24px rgba(46, 42, 69, 0.06);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
}
.logo img { height: 34px; }
.nav-desktop { display: flex; align-items: center; gap: 36px; }
.nav-link {
  position: relative;
  font-weight: 500;
  color: var(--text);
  padding: 4px 0;
}
.nav-link::after {
  content: '';
  position: absolute;
  left: 0; bottom: -2px;
  width: 0; height: 2px;
  background: var(--gradient);
  transition: width .25s ease;
}
.nav-link:hover::after { width: 100%; }

.burger-btn {
  display: none;
  width: 40px;
  height: 40px;
  background: transparent;
  border: 0;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  z-index: 1150;
}
.burger-btn span {
  width: 24px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform .25s ease, opacity .25s ease;
}
.burger-btn.act span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.burger-btn.act span:nth-child(2) { opacity: 0; }
.burger-btn.act span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

#mobile-menu {
  position: fixed;
  top: var(--header-height);
  left: 0; right: 0;
  bottom: 0;
  width: 100%;
  z-index: 1050;
  background: var(--bg);
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s ease;
  overflow-y: auto;
}
#mobile-menu.opened { opacity: 1; pointer-events: auto; }
#mobile-menu nav {
  display: flex;
  flex-direction: column;
  padding: 32px 24px;
  gap: 8px;
}
#mobile-menu .nav-link {
  font-size: 20px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

body.fixed { overflow: hidden; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 16px 32px;
  border-radius: 999px;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 16px;
  transition: transform .2s ease, box-shadow .2s ease;
}
.btn-primary {
  background: var(--gradient);
  color: var(--white);
  box-shadow: 0 12px 28px rgba(108, 92, 231, 0.28);
  animation: floaty 3s ease-in-out infinite;
}
.btn-primary:hover {
  animation-play-state: paused;
  transform: translateY(-4px);
  box-shadow: 0 16px 32px rgba(108, 92, 231, 0.35);
}
.btn-outline {
  background: transparent;
  color: var(--text);
  border: 2px solid var(--primary);
}
.btn-outline:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--white);
}
@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* Hero */
.hero {
  padding-top: calc(var(--header-height) + 60px);
  min-height: 100vh;
  display: flex;
  align-items: center;
  z-index: 0;
}
.hero-bg {
  position: absolute;
  inset: 0;
  background-image: url('../img/hero-bg.webp');
  background-size: cover;
  background-position: center;
  z-index: -1;
}
.hero-inner {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  align-items: center;
  gap: 40px;
}
.hero-lead { font-size: 19px; margin-bottom: 16px; }
.hero-sub { font-size: 17px; margin-bottom: 34px; }
.hero-actions { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 28px; }
.hero-pills { display: flex; gap: 12px; flex-wrap: wrap; }
.pill {
  display: inline-flex;
  align-items: center;
  padding: 9px 18px;
  border-radius: 999px;
  background: var(--white);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}
.hero-visual img {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  filter: drop-shadow(0 30px 40px rgba(108, 92, 231, 0.18));
}

/* How it plays */
.how-it-plays { background: var(--bg-alt); }
.section-head { max-width: 720px; margin: 0 auto 56px; text-align: center; }
.section-lead { font-size: 18px; }
.how-it-plays-top {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
  margin-bottom: 56px;
}
.how-it-plays-top .section-head {
  max-width: none;
  margin: 0;
  text-align: left;
}
.how-it-plays-image {
  max-width: none;
  margin: 0;
}
.how-it-plays-image img { border-radius: 28px; width: 100%; }
.steps-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}
.step-card {
  background: var(--white);
  border-radius: 24px;
  padding: 32px 26px;
  border: 1px solid var(--border);
}
.step-number {
  display: inline-block;
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  color: var(--white);
  background: var(--gradient);
  width: 36px; height: 36px;
  line-height: 36px;
  text-align: center;
  border-radius: 50%;
  margin-bottom: 16px;
}
.step-card p { font-size: 15px; }

/* Galaxies */
.galaxies { background: var(--bg); }
.galaxies-layout {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(3, 1fr) auto;
  gap: 24px;
  margin-bottom: 32px;
}
.galaxies-image {
  grid-column: 1;
  grid-row: 1 / 4;
}
.galaxies-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 28px;
}
.galaxies-list { display: contents; }
.galaxy-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 22px 26px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.galaxy-card:nth-of-type(1) { grid-column: 2; grid-row: 1; }
.galaxy-card:nth-of-type(2) { grid-column: 2; grid-row: 2; }
.galaxy-card:nth-of-type(3) { grid-column: 2; grid-row: 3; }
.galaxy-card:nth-of-type(4) { grid-column: 1; grid-row: 4; }
.galaxy-card:nth-of-type(5) { grid-column: 2; grid-row: 4; }
.galaxy-card h3 { color: var(--primary); margin-bottom: 6px; font-size: 18px; }
.galaxy-card p { font-size: 15px; margin: 0; }
.galaxies-footnote {
  text-align: center;
  font-size: 15px;
  max-width: 560px;
  margin: 0 auto;
}

/* Behind the numbers */
.behind-the-numbers { background: var(--bg-alt-2); }
.behind-layout {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 56px;
  align-items: center;
}
.behind-image img { border-radius: 28px; }
.behind-content p { font-size: 17px; margin-bottom: 16px; }

/* Contact */
.contact {
  text-align: center;
  padding: 120px 0;
  z-index: 0;
}
.contact-bg {
  position: absolute;
  inset: 0;
  background-image: url('../img/footer-bg.webp');
  background-size: cover;
  background-position: center;
  z-index: -1;
}
.contact-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, rgba(46, 42, 69, 0.88) 0%, rgba(108, 92, 231, 0.82) 100%);
}
.contact-inner { max-width: 640px; margin: 0 auto; }
.contact h2 { color: var(--white); }
.contact p { color: rgba(255,255,255,0.88); font-size: 17px; margin-bottom: 30px; }
.contact .btn-primary { margin-bottom: 26px; }
.contact-note { font-size: 14px; color: rgba(255,255,255,0.72); }

/* Footer */
footer { background: var(--text); padding: 48px 0; }
.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  text-align: center;
}
footer .logo img { height: 30px; }
.footer-links { display: flex; gap: 24px; }
.footer-links a { color: rgba(255,255,255,0.75); font-size: 14px; transition: color .2s ease; }
.footer-links a:hover { color: var(--accent); }
.footer-copy { color: rgba(255,255,255,0.5); font-size: 13px; }

/* Legal pages */
.legal-page {
  flex: 1 0 auto;
  padding: 160px 0 100px;
}
.legal-content { max-width: 780px; margin: 0 auto; }
.legal-content h1 { margin-bottom: 24px; }
.legal-content h2 { font-size: 24px; margin-top: 36px; }
.legal-content p { margin-bottom: 16px; font-size: 16px; }
.legal-content ol, .legal-content ul { color: var(--text-muted); margin: 0 0 16px 20px; }
.legal-content li { margin-bottom: 10px; font-size: 16px; }
.legal-content a {
  color: var(--primary);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  transition: color .2s ease, text-decoration-color .2s ease;
}
.legal-content a:hover,
.legal-content a:focus-visible { color: var(--accent); text-decoration-color: var(--accent); }
.legal-content .updated { font-size: 14px; color: var(--text-muted); margin-top: 40px; }

/* Responsive */
@media (max-width: 1024px) {
  h1 { font-size: 42px; }
  h2 { font-size: 32px; }
  .nav-desktop { display: none; }
  .burger-btn { display: flex; }
  .hero-inner { grid-template-columns: 1fr; text-align: center; }
  .hero-actions, .hero-pills { justify-content: center; }
  .hero-visual { order: -1; max-width: 340px; margin: 0 auto; }
  .how-it-plays-top { grid-template-columns: 1fr; text-align: center; }
  .how-it-plays-top .section-head { text-align: center; }
  .how-it-plays-image { order: -1; }
  .steps-grid { grid-template-columns: repeat(2, 1fr); }
  .galaxies-layout { grid-template-columns: 1fr; grid-template-rows: auto; }
  .galaxies-image,
  .galaxy-card:nth-of-type(1),
  .galaxy-card:nth-of-type(2),
  .galaxy-card:nth-of-type(3),
  .galaxy-card:nth-of-type(4),
  .galaxy-card:nth-of-type(5) {
    grid-column: 1;
    grid-row: auto;
  }
  .galaxies-image { height: 320px; }
  .behind-layout { grid-template-columns: 1fr; }
  .galaxies-image, .behind-image { order: -1; }
}

@media (max-width: 768px) {
  section { padding: 72px 0; }
  h1 { font-size: 34px; }
  h2 { font-size: 28px; }
  .hero { padding-top: calc(var(--header-height) + 32px); }
}

@media (max-width: 640px) {
  .steps-grid { grid-template-columns: 1fr; }
  .btn { width: 100%; }
  .hero-actions { flex-direction: column; }
  .contact { padding: 90px 0; }
}
