:root {
  --blue: #3a55a6;
  --blue-dark: #22336b;
  --red: #c8194b;
  --yellow: #d9df2a;
  --green: #4cb648;
  --ink: #1d2233;
  --muted: #5d6478;
  --bg: #fffdf8;
  --bg-alt: #eef2fb;
  --card: #ffffff;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(34, 51, 107, 0.12);
  --font-display: "Fredoka", system-ui, sans-serif;
  --font-body: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--blue); }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; margin: 0 0 .5em; }

.container { width: min(1120px, 92vw); margin-inline: auto; }
.narrow { width: min(760px, 92vw); }

.skip-link {
  position: absolute; left: -999px; top: 8px;
  background: var(--blue); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 100;
}
.skip-link:focus { left: 8px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  font-family: var(--font-display); font-weight: 600; font-size: 1.05rem;
  padding: .8em 1.5em; border-radius: 999px; border: 2px solid transparent;
  text-decoration: none; cursor: pointer; transition: transform .15s ease, box-shadow .15s ease, background .15s;
}
.btn:hover { transform: translateY(-2px); }
.btn:focus-visible { outline: 3px solid var(--green); outline-offset: 3px; }
.btn-primary { background: var(--red); color: #fff; box-shadow: 0 6px 0 #8f0f33; }
.btn-primary:hover { box-shadow: 0 8px 0 #8f0f33; }
.btn-ghost { background: transparent; color: var(--blue); border-color: var(--blue); }
.btn-ghost:hover { background: var(--blue); color: #fff; }
.btn-light { background: #fff; color: var(--blue); }
.btn-small { font-size: .9rem; padding: .55em 1.1em; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 253, 248, .92); backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(58, 85, 166, .1);
}
.nav { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .75rem 0; }
.brand { display: flex; align-items: center; gap: .5rem; text-decoration: none; color: var(--ink);
  font-family: var(--font-display); font-weight: 700; font-size: 1.35rem; }
.accent { color: var(--red); }
.nav ul { display: flex; gap: 1.5rem; list-style: none; margin: 0; padding: 0; }
.nav ul a { text-decoration: none; color: var(--ink); font-weight: 600; }
.nav ul a:hover { color: var(--blue); }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  background: radial-gradient(circle at 80% 20%, #5873c9 0%, var(--blue) 45%, var(--blue-dark) 100%);
  color: #fff; padding: clamp(3rem, 8vw, 6rem) 0;
}
.hero-letters {
  position: absolute; inset: 0; opacity: .08; pointer-events: none;
  font-family: var(--font-display); font-size: 2rem; letter-spacing: .9em; line-height: 1.6em;
  word-break: break-all; overflow: hidden; user-select: none;
}
.hero-grid { position: relative; display: grid; grid-template-columns: 1.1fr .9fr; gap: 3rem; align-items: center; }
.eyebrow {
  display: inline-block; background: rgba(255,255,255,.14); padding: .3em .9em; border-radius: 999px;
  font-weight: 700; font-size: .85rem; letter-spacing: .08em; text-transform: uppercase; margin: 0 0 1rem;
}
.hero h1 { font-size: clamp(2.5rem, 6vw, 4.2rem); }
.highlight {
  color: var(--yellow);
  background: linear-gradient(transparent 62%, rgba(200, 25, 75, .6) 62%);
}
.lede { font-size: 1.2rem; max-width: 34em; opacity: .95; }
.cta-row { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 2rem; }
.hero .btn-ghost { color: #fff; border-color: rgba(255,255,255,.7); }
.hero .btn-ghost:hover { background: #fff; color: var(--blue); }
.hero-book { display: flex; justify-content: center; perspective: 1200px; }
.book-cover {
  width: min(360px, 80vw); height: auto; border-radius: 6px 14px 14px 6px;
  box-shadow: -12px 18px 40px rgba(0,0,0,.45), inset 4px 0 0 rgba(0,0,0,.15);
  transform: rotateY(-14deg) rotateZ(2deg); transition: transform .4s ease;
}
.book-cover:hover { transform: rotateY(0) rotateZ(0) scale(1.02); }

/* ---------- Sections ---------- */
.section { padding: clamp(3.5rem, 7vw, 5.5rem) 0; }
.section-alt { background: var(--bg-alt); }
.section-title { text-align: center; font-size: clamp(1.9rem, 4vw, 2.6rem); color: var(--blue-dark); }
.section-title.left { text-align: left; }
.section-sub { text-align: center; color: var(--muted); max-width: 40em; margin: 0 auto 2.5rem; font-size: 1.1rem; }

.features { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; }
.feature {
  background: var(--card); border-radius: var(--radius); padding: 1.75rem 1.5rem; box-shadow: var(--shadow);
  border-top: 5px solid var(--green);
}
.feature:nth-child(2) { border-color: var(--red); }
.feature:nth-child(3) { border-color: var(--blue); }
.feature:nth-child(4) { border-color: var(--yellow); }
.feature-icon { font-size: 2.2rem; margin-bottom: .5rem; }
.feature h3 { font-size: 1.25rem; }
.feature p { color: var(--muted); margin: 0; }

/* ---------- Puzzle ---------- */
.puzzle-wrap { display: grid; grid-template-columns: auto 280px; gap: 2rem; justify-content: center; align-items: start; }
.puzzle-board { background: var(--card); padding: 14px; border-radius: var(--radius); box-shadow: var(--shadow); }
.maze-box { position: relative; width: min(560px, calc(92vw - 28px)); aspect-ratio: 1; }
.maze { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.maze-walls { fill: none; stroke: var(--blue-dark); stroke-width: .14; stroke-linecap: round; }
.maze-start { fill: var(--green); }
.maze-end { fill: var(--red); }
.maze-solution { fill: none; stroke: var(--red); stroke-width: .3; stroke-linecap: round; stroke-linejoin: round; opacity: 0; transition: opacity .3s; }
.maze.show-path .maze-solution { opacity: .75; }
.grid {
  --n: 10;
  position: absolute; inset: calc(100% * 4 / 30); /* ring / maze size, see puzzle.js */
  display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 2px;
  touch-action: none; user-select: none;
}
.cell {
  display: flex; align-items: center; justify-content: center; min-width: 0;
  font-family: var(--font-display); font-weight: 600; font-size: clamp(.85rem, 3vw, 1.35rem);
  border: none; border-radius: 50%; background: transparent; color: var(--ink); cursor: pointer; padding: 0;
  transition: background .12s, color .12s, transform .12s;
}
.cell:hover { background: #e6ecf9; }
.cell:focus-visible { outline: 3px solid var(--green); }
.cell.selecting { background: var(--yellow); transform: scale(1.06); }
.cell.anchor { background: var(--yellow); box-shadow: 0 0 0 3px var(--red); }
.cell.found { color: #fff; }
.cell.found.c0 { background: var(--green); }
.cell.found.c1 { background: var(--red); }
.cell.found.c2 { background: var(--blue); }
.cell.found.c3 { background: #7a3fb0; }
.cell.found.c4 { background: #118ab2; }
.cell.found.c5 { background: #06a77d; }
.cell.found.c6 { background: #d17b0f; }
.cell.found.c7 { background: #c2185b; }

.puzzle-side { background: var(--card); padding: 1.5rem; border-radius: var(--radius); box-shadow: var(--shadow); }
.word-list { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; grid-template-columns: 1fr 1fr; gap: .35rem .75rem; }
.word-list li { font-family: var(--font-display); font-weight: 600; letter-spacing: .05em; }
.word-list li.done { text-decoration: line-through; text-decoration-thickness: 3px; color: var(--muted); }
.progress { color: var(--muted); font-weight: 700; }
.win { margin-top: 1.25rem; padding: 1rem; background: #fdeef2; border-radius: 12px; border: 2px dashed var(--red); }
.win-title { font-family: var(--font-display); font-size: 1.25rem; margin: 0 0 .25rem; }

/* ---------- Audience / quote ---------- */
.two-col { display: grid; grid-template-columns: 1.2fr 1fr; gap: 3rem; align-items: center; }
.checklist { list-style: none; padding: 0; margin: 1rem 0 0; }
.checklist li { position: relative; padding-left: 2rem; margin-bottom: .75rem; font-size: 1.1rem; }
.checklist li::before {
  content: "✓"; position: absolute; left: 0; top: 0; width: 1.4rem; height: 1.4rem; border-radius: 50%;
  background: var(--green); color: #fff; font-weight: 700; font-size: .85rem; display: grid; place-items: center; margin-top: .2rem;
}
.quote {
  margin: 0; padding: 2rem; border-radius: var(--radius); background: var(--blue); color: #fff;
  font-family: var(--font-display); font-size: 1.5rem; box-shadow: var(--shadow); position: relative;
}
.quote p { margin: 0; }

/* ---------- FAQ ---------- */
details {
  background: var(--card); border-radius: 12px; padding: 1rem 1.25rem; margin-bottom: .75rem; box-shadow: 0 2px 10px rgba(34, 51, 107,.06);
}
summary { cursor: pointer; font-weight: 700; font-size: 1.1rem; list-style: none; position: relative; padding-right: 2rem; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; position: absolute; right: 0; top: -2px; font-size: 1.5rem; color: var(--blue); }
details[open] summary::after { content: "–"; }
details p { margin: .75rem 0 0; color: var(--muted); }

/* ---------- CTA band & footer ---------- */
.cta-band { background: linear-gradient(120deg, var(--red), var(--blue)); color: #fff; padding: 3rem 0; }
.cta-band-inner { display: flex; align-items: center; justify-content: space-between; gap: 2rem; flex-wrap: wrap; }
.cta-band h2 { font-size: 2rem; margin: 0; }
.cta-band p { margin: .25rem 0 0; font-size: 1.1rem; }

.site-footer { background: var(--blue-dark); color: rgba(255,255,255,.8); padding: 2rem 0; }
.footer-inner p { margin: .25rem 0; }
.small { font-size: .85rem; opacity: .75; }

/* ---------- 404 ---------- */
.notfound { min-height: 70vh; display: grid; place-items: center; text-align: center; }
.notfound h1 { font-size: 4rem; color: var(--blue); }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .features { grid-template-columns: repeat(2, 1fr); }
  .puzzle-wrap { grid-template-columns: 1fr; justify-items: center; }
  .puzzle-side { width: min(588px, 92vw); }
}
@media (max-width: 760px) {
  .hero-grid, .two-col { grid-template-columns: 1fr; }
  .hero-book { order: -1; }
  .book-cover { width: min(240px, 60vw); }
  .nav ul { display: none; }
  .cta-band-inner { flex-direction: column; text-align: center; }
  .cta-band-actions { justify-content: center; }
  .stats-inner { grid-template-columns: repeat(2, 1fr); row-gap: 1.5rem; }
}
@media (max-width: 480px) {
  .features { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
  .book-cover { transform: none; }
}

/* ---------- Logo ---------- */
.cell.selecting, .cell.anchor { color: var(--ink); }

/* ---------- Stats strip ---------- */
.stats { background: var(--yellow); color: var(--blue-dark); padding: 1.75rem 0; }
.stats-inner { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; text-align: center; }
.stat { display: flex; flex-direction: column; }
.stat-num { font-family: var(--font-display); font-weight: 700; font-size: clamp(2rem, 5vw, 3rem); line-height: 1; }
.stat-label { font-weight: 700; text-transform: uppercase; letter-spacing: .08em; font-size: .85rem; margin-top: .35rem; }

/* ---------- Puzzle side extras ---------- */
.puzzle-theme-label { margin: 0; font-weight: 700; font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; color: var(--red); }
.puzzle-theme { font-size: 1.6rem; color: var(--blue-dark); margin: 0 0 1rem; }
.puzzle-actions { display: flex; flex-wrap: wrap; gap: .5rem; }

/* ---------- Theme cloud ---------- */
.theme-cloud { list-style: none; padding: 0; margin: 0 auto; max-width: 960px; display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem; }
.theme-cloud li {
  font-family: var(--font-display); font-weight: 600; font-size: 1.02rem;
  padding: .45em 1em; border-radius: 999px; background: var(--card);
  border: 2px solid var(--blue); color: var(--blue-dark);
  transition: transform .15s ease;
}
.theme-cloud li:nth-child(4n+2) { border-color: var(--red); }
.theme-cloud li:nth-child(4n+3) { border-color: var(--green); }
.theme-cloud li:nth-child(4n) { border-color: #b8bd1c; }
.theme-cloud li:hover { transform: translateY(-2px) rotate(-1deg); }
.theme-cloud li.theme-more { background: var(--blue); border-color: var(--blue); color: #fff; }

/* ---------- CTA band actions ---------- */
.cta-band-actions { display: flex; flex-wrap: wrap; gap: .75rem; }
.btn-outline-light { background: transparent; color: #fff; border-color: rgba(255,255,255,.8); }
.btn-outline-light:hover { background: #fff; color: var(--red); }
