/* ── Variables ─────────────────────────────────────────────── */
:root {
  --purple-deep:    #3b1263;
  --purple-mid:     #7c3aad;
  --purple-soft:    #a855d8;
  --purple-pale:    #dbb8f5;
  --grey-purple:    #5c4a72;
  --grey-muted:     #8a7a9a;
  --bg:             #1a0733;
  --text-light:     #f5eeff;
  --text-muted:     #b0a0c8;
  --card-bg:        rgba(59, 18, 99, 0.75);
  --pink-peg:       #f472b6;
  --yellow-accent:  #fbbf24;

  --shadow-glow: 0 0 50px rgba(168, 85, 216, 0.35);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text-light);
  font-family: 'Segoe UI', system-ui, sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(1px 1px at 20% 30%, rgba(255,255,255,0.35) 0%, transparent 100%),
    radial-gradient(1px 1px at 70% 15%, rgba(255,255,255,0.25) 0%, transparent 100%),
    radial-gradient(1px 1px at 45% 70%, rgba(255,255,255,0.2)  0%, transparent 100%),
    radial-gradient(1px 1px at 85% 55%, rgba(255,255,255,0.3)  0%, transparent 100%),
    radial-gradient(1px 1px at 10% 85%, rgba(255,255,255,0.2)  0%, transparent 100%);
  pointer-events: none;
  z-index: 0;
}

/* ── Layout ────────────────────────────────────────────────── */
.page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1.5rem 4rem;
}

/* ── Top section (board + spinner shrink together) ─────────── */
.top-section {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform-origin: top center;
  transition: transform 0.85s cubic-bezier(0.4, 0, 0.2, 1),
              margin-bottom 0.85s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.85s ease;
}

.top-section.shrunk {
  transform: scale(0.52);
  opacity: 0.75;
  /* margin-bottom is set dynamically in JS */
}

/* ── Board path ────────────────────────────────────────────── */
.board-path {
  width: 100%;
  max-width: 900px;
  margin-bottom: 0.5rem;
}

.path-svg {
  width: 100%;
  height: auto;
  filter: drop-shadow(0 0 16px rgba(168, 85, 216, 0.45));
}

/* ── Spinner ───────────────────────────────────────────────── */
.spinner-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 2rem;
}

.spinner-label {
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--grey-muted);
}

.spinner-container {
  position: relative;
  width:  clamp(160px, 28vw, 220px);
  height: clamp(160px, 28vw, 220px);
  cursor: pointer;
  transition: transform 0.15s;
}

.spinner-container:hover  { transform: scale(1.04); }
.spinner-container:active { transform: scale(0.97); }

.spinner-wheel {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(
    #a855d8  0deg  45deg,
    #7c3aad 45deg  90deg,
    #f472b6 90deg 135deg,
    #dbb8f5 135deg 180deg,
    #5c4a72 180deg 225deg,
    #a855d8 225deg 270deg,
    #7c3aad 270deg 315deg,
    #f472b6 315deg 360deg
  );
  box-shadow:
    0 0 30px rgba(168, 85, 216, 0.55),
    inset 0 0 10px rgba(0,0,0,0.3);
  animation: spin-slow 14s linear infinite;
}

@keyframes spin-slow {
  to { transform: rotate(360deg); }
}

/* Needle sits independently inside the container */
.spinner-needle {
  position: absolute;
  top: 12%;               /* tip */
  left: calc(50% - 2px);  /* centered horizontally */
  width: 4px;
  height: 38%;             /* 12 + 38 = 50 → bottom at centre */
  background: linear-gradient(to top, var(--yellow-accent), #fff);
  border-radius: 99px 99px 2px 2px;
  transform-origin: bottom center;
  /* default transform: no rotation (pointing straight up) */
  z-index: 3;
  box-shadow: 0 0 8px rgba(251, 191, 36, 0.8);
}

/* Hub on top covers needle base */
.spinner-hub {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 24%;
  height: 24%;
  border-radius: 50%;
  background: var(--bg);
  border: 3px solid var(--purple-pale);
  box-shadow: 0 0 10px rgba(219, 184, 245, 0.5);
  z-index: 4;
}

/* ── Life card — hidden by default ────────────────────────── */
.life-card {
  background: var(--card-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(168, 85, 216, 0.35);
  border-radius: 1.75rem;
  box-shadow: var(--shadow-glow);
  padding: clamp(2rem, 6vw, 3.5rem) clamp(1.5rem, 5vw, 3.5rem);
  max-width: 620px;
  width: 100%;
  text-align: center;

  /* display:none takes it fully out of layout so the page loads at the top */
  display: none;
  opacity: 0;
  transform: perspective(800px) rotateX(16deg) translateY(30px) scale(0.96);
  pointer-events: none;
  transition:
    opacity 0.7s cubic-bezier(0.34, 1.2, 0.64, 1),
    transform 0.7s cubic-bezier(0.34, 1.2, 0.64, 1);
}

.life-card.revealed {
  display: block;
  opacity: 1;
  transform: perspective(800px) rotateX(0deg) translateY(0) scale(1);
  pointer-events: auto;
}

/* ── Family name ───────────────────────────────────────────── */
.family-name {
  font-size: clamp(1rem, 3vw, 1.25rem);
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--purple-pale);
  margin-bottom: 1.25rem;
  font-style: italic;
}

/* ── Life tile badge ───────────────────────────────────────── */
.life-tile {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, var(--purple-mid), var(--purple-soft));
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 0.45rem 1.1rem;
  border-radius: 99px;
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 16px rgba(168, 85, 216, 0.5);
}
.tile-star { font-size: 0.9rem; }

/* ── Headline ──────────────────────────────────────────────── */
.headline {
  font-size: clamp(1.8rem, 6vw, 3.4rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
  color: var(--text-light);
}

.headline-reveal {
  display: block;
  font-size: clamp(2.4rem, 8vw, 5rem);
  background: linear-gradient(135deg, var(--pink-peg) 0%, var(--purple-pale) 60%, #fff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-top: 0.1rem;
}

/* ── Pegs & Car ────────────────────────────────────────────── */
.peg-row {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 0.6rem;
  margin: 1.5rem 0;
}

.peg {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.peg-head {
  width: 18px; height: 18px;
  border-radius: 50%;
  box-shadow: 0 0 8px currentColor;
}

.peg-body {
  width: 6px; height: 26px;
  border-radius: 0 0 3px 3px;
  opacity: 0.75;
}

.peg.pink   .peg-head,
.peg.pink   .peg-body  { background: var(--pink-peg);    color: var(--pink-peg); }
.peg.purple .peg-head,
.peg.purple .peg-body  { background: var(--purple-soft); color: var(--purple-soft); }

.peg.baby { animation: bounce-peg 1.8s ease-in-out infinite; }
.peg.baby .peg-head { width: 13px; height: 13px; }
.peg.baby .peg-body { height: 18px; }

@keyframes bounce-peg {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-6px); }
}

.car { width: 90px; height: 40px; margin: 0 0.4rem; }
.car svg { width: 100%; height: 100%; }

/* ── Divider ───────────────────────────────────────────────── */
.divider {
  width: 50px; height: 3px;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--purple-mid), var(--purple-pale));
  margin: 1.25rem auto;
}

/* ── Subtext ───────────────────────────────────────────────── */
.subtext {
  font-size: clamp(0.95rem, 2.4vw, 1.1rem);
  color: var(--text-muted);
  line-height: 1.75;
  max-width: 480px;
  margin: 0 auto 2rem;
}
.subtext strong { color: var(--purple-pale); }

/* ── Space tiles ───────────────────────────────────────────── */
.spaces {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.space {
  width: clamp(70px, 16vw, 90px);
  height: clamp(70px, 16vw, 90px);
  border-radius: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 2px solid rgba(255,255,255,0.12);
  transition: transform 0.2s;
}
.space:hover { transform: translateY(-3px); }
.space-icon  { font-size: 1.6rem; line-height: 1; }

.space.pink-s   { background: rgba(244,114,182,0.18); color: var(--pink-peg);     border-color: rgba(244,114,182,0.3); }
.space.purple-s { background: rgba(168,85,216,0.18);  color: var(--purple-pale);  border-color: rgba(168,85,216,0.3); }
.space.gold-s   { background: rgba(251,191,36,0.12);  color: var(--yellow-accent); border-color: rgba(251,191,36,0.25); }

/* ── CTA ───────────────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: 0.9rem 2.4rem;
  border-radius: 99px;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  background: linear-gradient(135deg, var(--pink-peg), var(--purple-soft));
  color: #fff;
  box-shadow: 0 4px 24px rgba(244, 114, 182, 0.45);
}
.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(244, 114, 182, 0.6);
}

/* ── Mailing list section ──────────────────────────────────── */
.mailing-section { margin-top: 0.5rem; }

.mailing-heading {
  font-size: clamp(1.1rem, 3vw, 1.4rem);
  font-weight: 700;
  color: var(--text-light);
  margin-bottom: 0.4rem;
}

.mailing-sub {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  line-height: 1.6;
}

.signup-form { display: flex; flex-direction: column; gap: 1rem; }

.form-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1 1 180px;
  text-align: left;
}

.form-group label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--purple-pale);
}

.form-input {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(168, 85, 216, 0.4);
  border-radius: 0.65rem;
  color: var(--text-light);
  font-size: 1rem;
  padding: 0.7rem 1rem;
  width: 100%;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input::placeholder { color: var(--grey-muted); }

.form-input:focus {
  border-color: var(--purple-soft);
  box-shadow: 0 0 0 3px rgba(168, 85, 216, 0.22);
}

.btn-signup {
  align-self: flex-start;
  background: linear-gradient(135deg, var(--purple-mid), var(--purple-soft));
  box-shadow: 0 4px 18px rgba(168, 85, 216, 0.45);
  padding: 0.75rem 2rem;
  font-size: 0.95rem;
}

.btn-signup:hover {
  box-shadow: 0 8px 28px rgba(168, 85, 216, 0.6);
}

.btn-signup:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.form-status {
  font-size: 0.88rem;
  min-height: 1.2em;
  line-height: 1.4;
}

.form-status--success { color: #86efac; }
.form-status--error   { color: #fca5a5; }

/* ── Footer ────────────────────────────────────────────────── */
footer {
  position: relative; z-index: 1;
  text-align: center;
  padding: 1.5rem;
  font-size: 0.75rem;
  color: var(--grey-muted);
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 480px) {
  .life-card { border-radius: 1.25rem; }
  .spaces    { gap: 0.5rem; }
}
