/* Colours match MazeOut/Theme.swift in the game */
:root {
  --bg: #0B0A1C;
  --bg-deep: #05050D;
  --board: #131230;
  --surface: #1A1938;
  --line: #2B2A52;
  --lip: #2F2D5C;
  --text: #F3F2FF;
  --subtext: #8E8CB8;
  --violet: #8B5CF6;
  --violet-dark: #6236D9;
  --blue: #4F7CFF;
  --blue-dark: #2F56D6;
  --cyan: #22D3EE;
  --cyan-dark: #0E9FBA;
  --fuchsia: #E25CF5;
  --fuchsia-dark: #B12FC7;
  --lime: #A3E635;
  --lime-dark: #65A30D;
  --ember: #EF4444;
  --ember-dark: #B91C1C;
  --gold: #FBBF24;
  --accent: linear-gradient(90deg, var(--violet), var(--blue));
  --accent-lip: #4A35B5;
  --font: "Nunito", "Arial Rounded MT Bold", "Helvetica Rounded", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  font-weight: 600;
  color: var(--text);
  background: linear-gradient(180deg, var(--bg), var(--bg-deep)) fixed;
  line-height: 1.5;
  overflow-x: hidden;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }

/* Drifting lights behind everything */
.backdrop { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.glow { position: absolute; width: 70vmax; height: 70vmax; border-radius: 50%; opacity: 0.32; filter: blur(20px); }
.glow-violet { left: -25vmax; top: -10vmax; background: radial-gradient(circle, var(--violet), transparent 65%); animation: drift 14s ease-in-out infinite alternate; }
.glow-blue { right: -30vmax; bottom: -25vmax; background: radial-gradient(circle, var(--blue), transparent 65%); animation: drift 14s ease-in-out infinite alternate-reverse; }
@keyframes drift { to { transform: translate(6vmax, 5vmax); } }

.gradient-text {
  background: linear-gradient(90deg, #A78BFA, var(--blue));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Nav */
.nav {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 14px clamp(20px, 5vw, 64px);
  background: rgba(11, 10, 28, 0.7);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; font-size: 24px; font-weight: 900; }
.brand img { border-radius: 11px; }
.brand em { font-style: normal; color: var(--violet); }
.nav-links { display: flex; gap: 28px; color: var(--subtext); font-weight: 800; }
.nav-links a { transition: color 0.2s; }
.nav-links a:hover { color: var(--text); }

.pill {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 8px 16px; border-radius: 999px;
  background: var(--accent); color: #fff; font-weight: 800; font-size: 14px; white-space: nowrap;
}
.pill-soft { background: var(--surface); border: 2px solid var(--line); color: var(--text); font-size: 15px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--violet); box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.7); animation: ping 1.8s infinite; }
@keyframes ping { to { box-shadow: 0 0 0 12px rgba(139, 92, 246, 0); } }

/* Chunky buttons with a lip, like the ones in the game */
.btn {
  display: inline-block; padding: 16px 30px; border: 0; border-radius: 18px; cursor: pointer;
  font: 900 18px var(--font); letter-spacing: 0.04em; text-transform: uppercase; color: #fff;
  transition: transform 0.08s, box-shadow 0.08s, filter 0.2s;
}
.btn:hover { filter: brightness(1.1); }
.btn:active { transform: translateY(6px); }
.btn-accent { background: var(--accent); box-shadow: 0 6px 0 var(--accent-lip); }
.btn-accent:active { box-shadow: 0 0 0 var(--accent-lip); }
.btn-outline { background: var(--surface); box-shadow: 0 0 0 2px var(--lip) inset, 0 6px 0 var(--lip); }
.btn-outline:active { box-shadow: 0 0 0 2px var(--lip) inset, 0 0 0 var(--lip); }

/* Hero */
.hero {
  display: grid; grid-template-columns: 1.1fr 0.9fr; align-items: center; gap: 48px;
  max-width: 1200px; margin: 0 auto; padding: clamp(48px, 8vw, 96px) clamp(20px, 5vw, 64px);
}
.hero h1 { font-size: clamp(48px, 7.5vw, 92px); font-weight: 900; line-height: 1.02; margin: 22px 0 20px; letter-spacing: -0.01em; }
.lead { font-size: clamp(18px, 2vw, 21px); color: var(--subtext); max-width: 520px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 16px; margin: 34px 0 38px; }
.hero-stats { display: flex; gap: 14px; list-style: none; padding: 0; margin: 0; flex-wrap: wrap; }
.hero-stats li { background: var(--surface); border: 2px solid var(--line); border-radius: 16px; padding: 10px 18px; display: flex; flex-direction: column; }
.hero-stats strong { font-size: 26px; font-weight: 900; line-height: 1.1; }
.hero-stats li:nth-child(1) strong { color: var(--violet); }
.hero-stats li:nth-child(2) strong { color: var(--blue); }
.hero-stats li:nth-child(3) strong { color: var(--gold); }
.hero-stats span { font-size: 13px; color: var(--subtext); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 800; }

.hero-visual { position: relative; display: flex; justify-content: center; perspective: 1200px; }
.halo { position: absolute; inset: 8% 0; background: radial-gradient(circle, rgba(139, 92, 246, 0.55), transparent 62%); filter: blur(10px); }

.phone {
  position: relative; border-radius: 44px; padding: 9px;
  background: #0d0c22; border: 2px solid var(--line);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
}
.phone img { border-radius: 35px; }
.phone-hero { width: min(310px, 70vw); transition: transform 0.15s ease-out; transform-style: preserve-3d; will-change: transform; }

.mascot { position: absolute; width: 110px; right: 4%; top: -4%; filter: drop-shadow(0 14px 30px rgba(139, 92, 246, 0.6)); animation: bob 2.4s ease-in-out infinite alternate; }
@keyframes bob { to { transform: translateY(-16px); } }

/* Sections */
.section { max-width: 1200px; margin: 0 auto; padding: clamp(56px, 8vw, 104px) clamp(20px, 5vw, 64px); text-align: center; }
.section h2 { font-size: clamp(32px, 4.6vw, 54px); font-weight: 900; line-height: 1.1; }
.section-lead { color: var(--subtext); font-size: 19px; margin: 14px auto 44px; max-width: 560px; }

.grid { display: grid; gap: 20px; text-align: left; }
.features { grid-template-columns: repeat(4, 1fr); }
.card {
  background: var(--surface); border: 2px solid var(--line); border-radius: 26px; padding: 26px;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.card:hover { transform: translateY(-6px); border-color: var(--violet); box-shadow: 0 18px 50px rgba(139, 92, 246, 0.22); }
.card h3 { font-size: 21px; font-weight: 900; margin: 18px 0 8px; }
.card p { color: var(--subtext); font-size: 16px; }
.icon-chip { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; }
.icon-chip svg { width: 32px; height: 32px; }
.chip-violet { background: rgba(139, 92, 246, 0.16); color: var(--violet); }
.chip-gold { background: rgba(251, 191, 36, 0.14); color: var(--gold); }
.chip-blue { background: rgba(79, 124, 255, 0.16); color: var(--blue); }
.chip-cyan { background: rgba(34, 211, 238, 0.14); color: var(--cyan); }

.worlds { grid-template-columns: repeat(3, 1fr); }
.world {
  border-radius: 26px; padding: 26px 24px 30px; color: #fff; cursor: default;
  background: var(--c); box-shadow: 0 8px 0 var(--d);
  transition: transform 0.15s, box-shadow 0.15s;
}
.world:hover { transform: translateY(-6px); box-shadow: 0 14px 0 var(--d), 0 26px 50px color-mix(in srgb, var(--c) 35%, transparent); }
.world-number { font-size: 13px; font-weight: 900; letter-spacing: 0.1em; text-transform: uppercase; opacity: 0.8; }
.world h3 { font-size: 26px; font-weight: 900; margin: 4px 0 10px; }
.world p { font-size: 16px; opacity: 0.92; }
.world-violet { --c: var(--violet); --d: var(--violet-dark); }
.world-blue { --c: var(--blue); --d: var(--blue-dark); }
.world-cyan { --c: var(--cyan); --d: var(--cyan-dark); color: #06202a; }
.world-fuchsia { --c: var(--fuchsia); --d: var(--fuchsia-dark); }
.world-lime { --c: var(--lime); --d: var(--lime-dark); color: #16240a; }
.world-ember { --c: var(--ember); --d: var(--ember-dark); }

/* Screenshots */
.screens { display: grid; grid-template-columns: repeat(3, 1fr); gap: 40px 34px; max-width: 900px; margin: 0 auto; }
.screen { margin: 0; }
.screen .phone { transition: transform 0.25s, box-shadow 0.25s; border-radius: 34px; padding: 7px; }
.screen .phone img { border-radius: 27px; }
.screen:hover .phone { transform: translateY(-10px) scale(1.02); box-shadow: 0 30px 70px rgba(79, 124, 255, 0.3); }
.screen figcaption { margin-top: 18px; color: var(--subtext); font-size: 15px; }
.screen figcaption strong { display: block; color: var(--text); font-size: 18px; font-weight: 900; }

/* Playable demo */
.demo { display: flex; justify-content: center; align-items: center; gap: 44px; flex-wrap: wrap; text-align: left; }
.demo-board { background: var(--surface); border: 2px solid var(--line); border-radius: 30px; padding: 18px; width: min(460px, 100%); }
.demo-hud { display: flex; justify-content: space-between; align-items: center; padding: 2px 6px 14px; font-weight: 900; }
.demo-stars { color: var(--gold); display: inline-flex; align-items: center; gap: 6px; font-size: 20px; }
.demo-message { color: var(--subtext); font-size: 15px; }
.demo-message.is-win { color: var(--gold); }
#maze { display: block; width: 100%; border-radius: 18px; touch-action: none; outline: none; cursor: grab; }
#maze:focus-visible { box-shadow: 0 0 0 3px var(--violet); }
.demo-side { max-width: 300px; display: flex; flex-direction: column; gap: 20px; align-items: flex-start; }
.demo-side h3 { font-size: 22px; font-weight: 900; }
.swatches { display: flex; gap: 12px; }
.swatch { width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--c); cursor: pointer; box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px transparent; transition: box-shadow 0.15s, transform 0.15s; }
.swatch:hover { transform: scale(1.08); }
.swatch.is-active { box-shadow: 0 0 0 3px var(--bg), 0 0 0 6px var(--c); }
.demo-note { color: var(--subtext); font-size: 15px; }

/* Closing call to action */
.cta { display: flex; flex-direction: column; align-items: center; }
.cta-icon { border-radius: 26px; margin-bottom: 26px; box-shadow: 0 20px 60px rgba(139, 92, 246, 0.45); border: 2px solid var(--line); }
.cta .section-lead { margin-bottom: 30px; }
.store-badge { display: inline-flex; flex-direction: column; align-items: flex-start; padding: 12px 30px; border-radius: 18px; background: #000; border: 2px solid var(--line); line-height: 1.15; }
.store-small { font-size: 13px; color: var(--subtext); font-weight: 800; }
.store-big { font-size: 28px; font-weight: 900; }

.footer { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 26px clamp(20px, 5vw, 64px); border-top: 1px solid var(--line); color: var(--subtext); font-size: 14px; }

/* Fade sections in as they scroll into view */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.is-visible { opacity: 1; transform: none; }
.card.reveal.is-visible:hover, .world.reveal.is-visible:hover { transform: translateY(-6px); }

@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; text-align: center; }
  .hero-copy { display: flex; flex-direction: column; align-items: center; }
  .hero-actions, .hero-stats { justify-content: center; }
  .features, .worlds { grid-template-columns: repeat(2, 1fr); }
  .screens { grid-auto-flow: column; grid-template-columns: none; grid-auto-columns: 62%; overflow-x: auto; scroll-snap-type: x mandatory; padding: 12px 4px 20px; }
  .screen { scroll-snap-align: center; }
  .nav-links { display: none; }
}

@media (max-width: 560px) {
  .features, .worlds { grid-template-columns: 1fr; }
  .demo-side { align-items: center; text-align: center; max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .glow, .mascot, .dot { animation: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
}
