/* Version 1.8 — content-driven hero (no fixed 275px body cutoff) */
:root {
  --ink: #17233d;
  --muted: #5b6b82;
  --line: #d5e0ee;
  --page: #eef6fc;
  --hero-sky-top: #1a6fa8;
  --hero-sky-mid: #3d9ad4;
  --hero-sky-bot: #7ec4eb;
}

* { box-sizing: border-box; }

html { background: var(--page); }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--page);
  font-family: ui-rounded, "Arial Rounded MT Bold", "Segoe UI", system-ui, -apple-system, sans-serif;
}

a {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  text-decoration: none;
}

a:focus-visible {
  outline: 4px solid #111827;
  outline-offset: 3px;
}

/* Coloured hero owns its background and grows with content */
.hero {
  position: relative;
  overflow: hidden;
  display: block;
  padding: 28px 20px 36px;
  text-align: center;
  background:
    radial-gradient(circle at 92% 18%, rgba(255, 220, 80, 0.55) 0 5%, transparent 5.2%),
    linear-gradient(180deg, var(--hero-sky-top) 0%, var(--hero-sky-mid) 48%, var(--hero-sky-bot) 100%);
  border-bottom: 4px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 10px 28px rgba(20, 70, 110, 0.18);
}

.hero-inner {
  position: relative;
  z-index: 3;
  width: min(920px, 100%);
  margin: 0 auto;
  padding-bottom: 8px; /* ensure ≥24px visual gap before hero edge with padding */
}

.hero img {
  display: block;
  width: clamp(150px, 16vw, 200px);
  height: auto;
  margin: 0 auto 8px;
  filter: drop-shadow(0 4px 10px rgba(0, 40, 80, 0.25));
}

.eyebrow {
  margin: 0 0 6px;
  color: #eaf7ff;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-shadow: 0 1px 0 rgba(0, 40, 80, 0.2);
}

.hero h1 {
  margin: 0;
  color: #fff;
  font-size: clamp(28px, 4.8vw, 48px);
  font-weight: 950;
  line-height: 1.12;
  letter-spacing: -0.03em;
  text-shadow: 0 3px 0 rgba(21, 75, 117, 0.28);
}

/* Description fully inside hero — high contrast on sky */
.hero p.lead,
.hero .lead {
  max-width: 720px;
  margin: 12px auto 0;
  padding: 10px 14px;
  color: #0f3a5c;
  background: rgba(255, 255, 255, 0.88);
  border-radius: 14px;
  border: 2px solid rgba(255, 255, 255, 0.95);
  font-size: clamp(14px, 1.7vw, 16px);
  font-weight: 750;
  line-height: 1.45;
}

.hero p:not(.lead):not(.eyebrow) {
  max-width: 720px;
  margin: 12px auto 0;
  padding: 10px 14px;
  color: #0f3a5c;
  background: rgba(255, 255, 255, 0.88);
  border-radius: 14px;
  border: 2px solid rgba(255, 255, 255, 0.95);
  font-size: clamp(14px, 1.7vw, 16px);
  font-weight: 750;
  line-height: 1.45;
}

.version-badge {
  display: inline-block;
  margin-top: 14px;
  padding: 8px 16px;
  color: #1e4a72;
  background: rgba(255, 255, 255, 0.92);
  border: 2px solid #fff;
  border-radius: 999px;
  box-shadow: 0 4px 0 rgba(30, 87, 132, 0.2);
  font-size: 12px;
  font-weight: 900;
}

/* Breadcrumb strip fully below hero (never straddles) */
.nav-strip {
  background: #fff;
  border-bottom: 2px solid var(--line);
  padding: 10px 20px;
  text-align: center;
  font-weight: 800;
  font-size: 13px;
  color: #35506e;
}
.nav-strip a { color: #1d4ed8; font-weight: 900; }
.nav-strip a:hover { text-decoration: underline; }

/* Lightweight drifting clouds (transform only) */
.cloud {
  position: absolute;
  z-index: 1;
  pointer-events: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  filter: none;
  opacity: 0.75;
  animation: cloud-drift linear infinite;
}
.cloud::before,
.cloud::after {
  content: "";
  position: absolute;
  background: inherit;
  border-radius: 50%;
}
.cloud-a {
  width: 90px; height: 34px; top: 18%; left: -120px;
  animation-duration: 42s;
}
.cloud-a::before { width: 40px; height: 40px; top: -18px; left: 14px; }
.cloud-a::after { width: 52px; height: 52px; top: -24px; left: 36px; }
.cloud-b {
  width: 120px; height: 40px; top: 42%; left: -160px;
  animation-duration: 55s; animation-delay: -18s; opacity: 0.55;
}
.cloud-b::before { width: 48px; height: 48px; top: -20px; left: 18px; }
.cloud-b::after { width: 60px; height: 60px; top: -28px; left: 48px; }
.cloud-c {
  width: 70px; height: 28px; top: 68%; left: -100px;
  animation-duration: 36s; animation-delay: -8s; opacity: 0.45;
}
.cloud-c::before { width: 32px; height: 32px; top: -14px; left: 10px; }
.cloud-c::after { width: 40px; height: 40px; top: -18px; left: 28px; }

@keyframes cloud-drift {
  from { transform: translateX(0); }
  to { transform: translateX(calc(100vw + 200px)); }
}

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 22px 18px 40px;
}

.section-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.section-heading h2 {
  margin: 0;
  font-size: clamp(20px, 2.8vw, 28px);
  font-weight: 950;
}
.section-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

/* Compact pattern/age cards — no full-row stretch empty space */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  justify-content: start;
}

.game-card {
  position: relative;
  min-height: 0;
  max-width: 360px;
  width: 100%;
  display: flex;
  flex-direction: column;
  padding: 16px;
  color: inherit;
  background: linear-gradient(165deg, #fff 0%, var(--card-tint, #f8fbff) 100%);
  border: 3px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 6px 0 #c9d6e6, 0 12px 22px rgba(31, 58, 96, 0.08);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.game-card::before {
  position: absolute;
  top: 0; right: 0; left: 0;
  height: 8px;
  background: var(--theme, #3b82f6);
  content: "";
  border-radius: 17px 17px 0 0;
}
.game-card:hover,
.game-card:focus-visible {
  border-color: var(--theme, #3b82f6);
  transform: translateY(-4px);
  box-shadow: 0 10px 0 #b7c7db, 0 16px 28px rgba(31, 58, 96, 0.12);
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.card-emoji {
  display: grid;
  width: 56px; height: 56px;
  place-items: center;
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 16px;
  font-size: 32px;
  line-height: 1;
}
.card-number {
  color: #7a8aa0;
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: right;
}
.level-pill {
  display: inline-block;
  margin-top: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--theme, #3b82f6);
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.06em;
}
.game-card h3 {
  margin: 12px 0 6px;
  font-size: 18px;
  font-weight: 950;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.pattern {
  display: inline-block;
  align-self: flex-start;
  padding: 5px 10px;
  color: var(--theme, #2563eb);
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid color-mix(in srgb, var(--theme, #2563eb) 28%, #e2e8f0);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.3;
}
.description {
  flex: 1;
  margin: 8px 0 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.4;
}
.open {
  color: var(--theme, #2563eb);
  font-size: 13px;
  font-weight: 950;
}

.unit-block {
  margin: 0 0 22px;
  padding: 14px 14px 16px;
  background: rgba(255, 255, 255, 0.65);
  border: 2px solid var(--line);
  border-radius: 18px;
}
.unit-title {
  margin: 0 0 10px;
  font-size: 1.05rem;
  font-weight: 950;
  color: var(--ink);
}
.unit-title span {
  display: block;
  margin-top: 2px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
}

footer {
  padding: 8px 20px 28px;
  color: #718096;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

/* Age-tinted page shells */
body.age-3 { --page: #e8f4ff; --hero-sky-top: #1a7fc0; --hero-sky-mid: #4aa3db; --hero-sky-bot: #9fd0f0; }
body.age-4 { --page: #f3eefe; --hero-sky-top: #5b3fad; --hero-sky-mid: #7c5fd4; --hero-sky-bot: #c4b5fd; }
body.age-5 { --page: #fff1f5; --hero-sky-top: #c23b6e; --hero-sky-mid: #e05a8a; --hero-sky-bot: #f9b4cb; }
body.age-6 { --page: #e8faf3; --hero-sky-top: #0f7a5a; --hero-sky-mid: #1fa87a; --hero-sky-bot: #8ee0c0; }
body.age-7 { --page: #fff6e8; --hero-sky-top: #c45a12; --hero-sky-mid: #e07a28; --hero-sky-bot: #f6c48a; }

@media (max-width: 620px) {
  .grid { grid-template-columns: 1fr; }
  .game-card { max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  .cloud { animation: none !important; left: 12% !important; }
  .cloud-b { left: 48% !important; top: 30%; }
  .cloud-c { left: 72% !important; top: 55%; }
  .game-card { transition: none !important; }
  .game-card:hover, .game-card:focus-visible { transform: none; }
}
