:root {
  --navy: #0d3796;
  --sky: #1d9cf0;
  --red: #e23a2e;
  --yellow: #f7b917;
  --green: #2f9a55;
  --ink: #1f2b45;
  --muted: #5f6a80;
  --cream: #fbf5e8;
  --field: #fffdf8;
  --line: #e6dcc7;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Nunito", system-ui, sans-serif;
  color: var(--ink);
  background: var(--cream);
  line-height: 1.5;
  overflow-x: hidden;
}

h1, h2, legend, .steps b, button { font-family: "Fredoka", "Nunito", sans-serif; }

/* ---------- Top bar ---------- */
.top {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: space-between;
  max-width: 1180px; margin: 0 auto; padding: 14px 24px 0;
}
.top img { height: 62px; width: auto; }

/* ---------- Toy blocks ---------- */
.cube {
  display: inline-grid; place-items: center;
  width: 56px; height: 56px; border-radius: 12px;
  font-family: "Fredoka", sans-serif; font-weight: 700; font-size: 1.8rem; color: #fff;
  box-shadow: inset -6px -7px 0 rgba(0, 0, 0, 0.16), inset 4px 4px 0 rgba(255, 255, 255, 0.22), 0 6px 0 rgba(60, 40, 10, 0.12);
}
.cube.red { background: var(--red); }
.cube.yellow { background: var(--yellow); }
.cube.blue { background: var(--sky); }
.cube.green { background: var(--green); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding: 48px 24px 120px;
  text-align: center;
}

.decor { position: absolute; inset: -90px 0 0; overflow: hidden; pointer-events: none; }
.sun {
  position: absolute; top: -60px; left: -80px;
  width: 360px; height: 360px; border-radius: 50%;
  background: radial-gradient(circle at 60% 60%, #fcd65a, #f8c534 72%);
}
.blob {
  position: absolute; top: 40px; right: -120px;
  width: 400px; height: 340px; border-radius: 48% 52% 44% 56%;
  background: #c6e3f7;
}
.decor .cube { position: absolute; animation: bob 6s ease-in-out infinite; }
.c1 { top: 170px; left: 12%; transform: rotate(-12deg); }
.c2 { top: 300px; left: 20%; width: 46px; height: 46px; font-size: 1.5rem; animation-delay: -2s; }
.c3 { top: 150px; right: 14%; transform: rotate(10deg); animation-delay: -1s; }
.c4 { top: 290px; right: 22%; width: 46px; height: 46px; font-size: 1.5rem; animation-delay: -3s; }
.c5 { top: 360px; left: 6%; width: 40px; height: 40px; font-size: 1.3rem; animation-delay: -4s; }
.c6 { top: 380px; right: 8%; width: 40px; height: 40px; font-size: 1.3rem; animation-delay: -5s; }

@keyframes bob {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -10px; }
}


.hero-text { position: relative; max-width: 640px; margin: 0 auto; }

h1 {
  margin: 0;
  font-size: clamp(2.1rem, 10vw, 5.4rem);
  white-space: nowrap;
  font-weight: 700; line-height: 1;
  color: var(--navy);
  text-shadow: 0 6px 0 rgba(13, 55, 150, 0.15);
}

/* Red banner ribbon with notched ends */
.ribbon { margin: 22px 0 26px; }
.ribbon span {
  position: relative; display: inline-block;
  padding: 8px 34px;
  font-family: "Fredoka", sans-serif; font-weight: 600; font-size: 1.35rem; color: #fff;
  background: var(--red);
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.14);
}
.ribbon span::before, .ribbon span::after {
  content: ""; position: absolute; top: 8px; width: 28px; height: 100%;
  background: #b92a21; z-index: -1;
}
.ribbon span::before { left: -20px; clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 10px 50%); }
.ribbon span::after { right: -20px; clip-path: polygon(0 0, 100% 0, calc(100% - 10px) 50%, 100% 100%, 0 100%); }

.lead { margin: 0 auto; max-width: 520px; font-size: 1.15rem; color: var(--muted); }

/* ---------- Wooden table ---------- */
.table {
  position: relative;
  padding: 0 20px 90px;
  background:
    repeating-linear-gradient(178deg, rgba(120, 70, 20, 0.05) 0 3px, transparent 3px 22px),
    linear-gradient(#e8bf8a, #dcaa70);
}
.table::before { /* table edge */
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 14px;
  background: #c98f52; box-shadow: 0 3px 0 rgba(90, 50, 10, 0.15);
}

.paper {
  position: relative; top: -70px;
  max-width: 760px; margin: 0 auto;
  background: repeating-linear-gradient(transparent 0 33px, rgba(29, 156, 240, 0.07) 33px 34px), #fff;
  border-radius: 6px;
  padding: 46px 48px 40px;
  box-shadow: 0 18px 30px -12px rgba(90, 50, 10, 0.35), 0 2px 0 #efe5d0;
}
.tape {
  position: absolute; top: -16px; left: 50%; width: 150px; height: 34px;
  translate: -50% 0; rotate: -3deg;
  background: rgba(247, 185, 23, 0.7);
  clip-path: polygon(3% 0, 97% 4%, 100% 50%, 96% 100%, 2% 96%, 0 50%);
}

/* ---------- Stepper ---------- */
.steps {
  position: relative;
  display: flex; justify-content: space-between;
  margin: 0 0 34px; padding: 0; list-style: none;
}
.steps::before { /* dashed track behind the blocks */
  content: ""; position: absolute; top: 24px; left: 12%; right: 12%;
  border-top: 3px dashed var(--line);
}
.steps li {
  position: relative; flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  text-align: center;
}
.steps .cube {
  width: 48px; height: 48px; font-size: 1.4rem;
  filter: grayscale(0.85) opacity(0.45);
  transition: filter 0.25s, transform 0.25s;
}
.steps b { font-weight: 600; font-size: 0.98rem; color: #a59c8a; transition: color 0.25s; }
.steps li.active .cube { filter: none; transform: translateY(-6px) rotate(-4deg) scale(1.1); }
.steps li.active b { color: var(--navy); }
.steps li.complete .cube { filter: none; }
.steps li.complete b { color: var(--ink); }

/* ---------- Child summary (steps 2-3 and thank-you) ---------- */
.summary {
  display: grid; grid-template-columns: 1.1fr 1fr 1fr; gap: 14px 20px;
  margin: 0 0 28px; padding: 16px 20px;
  background: #fff5d4;
  border: 2px dashed #efd27e;
  border-radius: 14px;
}
.summary[hidden] { display: none; }
.summary dt { font-size: 0.75rem; font-weight: 800; letter-spacing: 0.07em; text-transform: uppercase; color: #9a7b28; }
.summary dd { margin: 2px 0 0; font-weight: 800; color: var(--navy); }
.summary dd.sub-age { margin: 0; font-weight: 700; font-size: 0.88rem; color: var(--ink); }

/* ---------- Form ---------- */
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.step { display: none; }
.step.active { display: block; animation: slide 0.35s ease; }
@keyframes slide {
  from { opacity: 0; transform: translateX(18px); }
  to { opacity: 1; transform: none; }
}

/* The stepper already names each step, so legends are for screen readers only */
legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }

label { position: relative; display: block; font-weight: 700; font-size: 0.95rem; margin-bottom: 18px; }
.req { color: var(--red); margin-left: 3px; font-size: 1.15em; line-height: 0; }

input {
  display: block; width: 100%; margin-top: 6px;
  padding: 12px 14px;
  font: inherit; font-weight: 400; color: var(--ink);
  background: var(--field);
  border: 2px solid var(--line);
  border-radius: 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:hover { border-color: #d6c8ab; }
input:focus { outline: none; border-color: var(--sky); box-shadow: 0 0 0 4px rgba(29, 156, 240, 0.18); background: #fff; }
input.invalid { border-color: var(--red); background: #fff7f6; }

.age { display: block; margin-top: 8px; min-height: 1.4em; font-weight: 800; font-size: 0.95rem; color: var(--navy); }
.age:not(:empty):not(.warn)::before {
  content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 7px;
  border-radius: 3px; background: var(--yellow); vertical-align: 1px;
}
.age.warn { color: var(--red); }

.trap { position: absolute; left: -9999px; }

.error {
  margin: 0 0 16px; padding: 10px 14px;
  background: #fdeceb; color: #a3241b;
  border-radius: 12px; font-weight: 600;
}

.nav { display: flex; gap: 12px; justify-content: flex-end; margin-top: 8px; }

button {
  padding: 13px 30px;
  font-size: 1.15rem; font-weight: 600;
  border: 0; border-radius: 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.08s, filter 0.15s;
}
button:hover { filter: brightness(1.06); }
button:active { transform: translateY(2px); }
.next { color: #fff; background: var(--sky); box-shadow: inset 0 -5px 0 #1479c0; }
.go { color: #fff; background: var(--red); box-shadow: inset 0 -5px 0 #b82a20; }
.back { margin-right: auto; color: var(--navy); background: #f1ead9; box-shadow: inset 0 -4px 0 #ddd1b6; }
button:disabled { background: #b8b2a6; box-shadow: none; cursor: wait; }

/* ---------- Thank you ---------- */
.done { position: relative; text-align: center; padding: 20px 0 10px; }
.stack { display: flex; justify-content: center; gap: 10px; margin-bottom: 14px; }
.stack .cube:first-child { rotate: -8deg; translate: 0 4px; }
.stack .cube:nth-child(2) { translate: 0 -6px; }
.stack .cube:last-child { rotate: 7deg; translate: 0 4px; }
.done h2 { margin: 0 0 8px; font-size: 2.6rem; color: var(--navy); }
.done p { margin: 0; font-size: 1.1rem; }

/* ---------- Footer ---------- */
footer { position: relative; margin-top: -60px; }
.hills { display: block; width: 100%; height: 130px; }
.foot { background: #6fb47a; padding: 0 16px 26px; text-align: center; }
.foot p { margin: 0; color: #fff; font-weight: 700; font-size: 0.9rem; }

/* ---------- Smaller screens ---------- */
@media (max-width: 900px) {
  .c2, .c4, .c5, .c6 { display: none; }
  .c1 { top: 120px; left: 4%; width: 44px; height: 44px; font-size: 1.4rem; }
  .c3 { top: 110px; right: 4%; width: 44px; height: 44px; font-size: 1.4rem; }
}

@media (max-width: 600px) {
  .top img { height: 48px; }
  .hero { padding: 36px 16px 100px; }
  .sun { width: 220px; height: 220px; top: -30px; left: -90px; }
  .blob { width: 220px; height: 200px; right: -110px; }
  .c1, .c3 { display: none; }
  .ribbon span { font-size: 1.1rem; padding: 7px 24px; }
  .table { padding: 0 12px 80px; }
  .paper { padding: 36px 20px 28px; }
  .row { grid-template-columns: 1fr; }
  .summary { grid-template-columns: 1fr; gap: 10px; }
  .steps b { font-size: 0.8rem; }
  .steps .cube { width: 40px; height: 40px; font-size: 1.2rem; }
  .steps::before { top: 20px; }
  button { padding: 12px 18px; }
  .nav { gap: 8px; }
  .back { padding: 12px 14px; }
  .go { flex: 1; min-width: 0; padding: 12px 10px; font-size: 0.98rem; }
}

@media (prefers-reduced-motion: reduce) {
  .decor .cube, .step.active { animation: none; }
}
