:root {
  --cream: #FFF8EC;
  --cream-2: #FDEFD9;
  --ink: #2E1F57;
  --ink-soft: #5A4C80;
  --purple: #5B34B5;
  --purple-deep: #3F2390;
  --sun: #F8C53A;
  --sun-deep: #E9A615;
  --sky-1: #CDE9FF;
  --sky-2: #FFF3D6;
  --white: #FFFFFF;
  --radius: 28px;
  --shadow: 0 10px 30px rgba(63, 35, 144, 0.12);
  --shadow-sm: 0 4px 14px rgba(63, 35, 144, 0.10);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: 'Nunito', system-ui, -apple-system, sans-serif;
  font-size: 18px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--purple); }
h1, h2, h3 { font-family: 'Baloo 2', 'Nunito', sans-serif; line-height: 1.1; margin: 0; color: var(--ink); }
h1 { font-size: clamp(2.4rem, 6vw, 4.2rem); font-weight: 800; }
h2 { font-size: clamp(2rem, 4.6vw, 3rem); font-weight: 800; text-align: center; margin-bottom: 28px; }
h3 { font-size: 1.35rem; font-weight: 700; }
p { margin: 0 0 0.7em; }
p:last-child { margin-bottom: 0; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }

.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 760px; }
.section { padding: 72px 0; }
.section-tint { background: var(--cream-2); }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px 20px;
  background: rgba(255, 248, 236, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(63, 35, 144, 0.08);
}
.brand { display: flex; align-items: center; gap: 6px; text-decoration: none; }
.brand img { width: 92px; height: auto; }
.brand-kids {
  font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 1.05rem;
  color: var(--ink); background: var(--sun); padding: 2px 12px 0; border-radius: 999px;
  transform: rotate(-4deg); margin-top: 18px;
}
.topnav { display: flex; gap: 4px; }
.topnav a {
  font-weight: 700; text-decoration: none; color: var(--ink-soft);
  padding: 8px 14px; border-radius: 999px; font-size: 1rem;
}
.topnav a:hover, .topnav a:focus-visible { background: #fff; color: var(--purple); }

/* Hero */
.hero {
  position: relative;
  background: linear-gradient(180deg, var(--sky-1) 0%, #E6F3FF 45%, var(--sky-2) 100%);
  padding: 56px 0 110px;
  overflow: hidden;
}
.hero-inner { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 32px; align-items: center; position: relative; z-index: 1; }
.tagline {
  font-family: 'Baloo 2', sans-serif; font-weight: 700; font-size: clamp(1.3rem, 2.6vw, 1.75rem);
  color: var(--purple); margin: 8px 0 22px;
}
.hero-zen { display: flex; justify-content: center; }
.hero-zen img { width: min(100%, 440px); filter: drop-shadow(0 22px 30px rgba(233, 166, 21, 0.35)); }
.wave { position: absolute; left: 0; bottom: -1px; width: 100%; height: 70px; }
.twinkle { position: absolute; color: #fff; font-size: 22px; opacity: 0.9; animation: twinkle 3.2s ease-in-out infinite; }
.t1 { top: 12%; left: 6%; }
.t2 { top: 22%; left: 48%; animation-delay: 0.8s; font-size: 16px; color: var(--sun); }
.t3 { top: 8%; right: 10%; animation-delay: 1.6s; }
.t4 { bottom: 26%; right: 42%; animation-delay: 2.2s; font-size: 14px; color: var(--sun); }

/* Speech bubbles */
.bubble {
  position: relative;
  background: var(--white);
  border-radius: var(--radius);
  padding: 22px 26px;
  box-shadow: var(--shadow);
  font-size: 1.08rem;
}
.bubble-hero { margin-bottom: 28px; max-width: 560px; }
.bubble-hero::after {
  content: ""; position: absolute; right: -14px; top: 38%;
  border: 14px solid transparent; border-left-color: var(--white); border-right: 0;
}
.bubble-hello { font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 1.6rem; color: var(--purple); line-height: 1.2; }
.bubble-ask { font-family: 'Baloo 2', sans-serif; font-weight: 700; font-size: 1.3rem; color: var(--ink); }
.says { font-family: 'Baloo 2', sans-serif; font-weight: 700; color: var(--purple); font-size: 1rem; letter-spacing: 0.02em; margin-bottom: 4px; }
.bubble-center { max-width: 520px; margin: 0 auto 28px; }

.zen-says { display: flex; align-items: flex-start; gap: 16px; max-width: 720px; margin: 0 auto 40px; }
.zen-says > img { width: 88px; height: 88px; flex: none; margin-top: 6px; animation: bob 4s ease-in-out infinite; }
.zen-says .bubble::before {
  content: ""; position: absolute; left: -12px; top: 28px;
  border: 12px solid transparent; border-right-color: var(--white); border-left: 0;
}

/* Buttons */
.btn {
  display: inline-block;
  font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 1.25rem;
  color: var(--ink); background: var(--sun);
  padding: 14px 34px 11px; border-radius: 999px; text-decoration: none; border: 0; cursor: pointer;
  box-shadow: 0 6px 0 var(--sun-deep), 0 12px 24px rgba(233, 166, 21, 0.3);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 8px 0 var(--sun-deep), 0 16px 28px rgba(233, 166, 21, 0.35); }
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--sun-deep), 0 6px 12px rgba(233, 166, 21, 0.3); }
.btn-big { font-size: 1.5rem; padding: 16px 44px 13px; }
:focus-visible { outline: 4px solid var(--purple); outline-offset: 3px; border-radius: 12px; }

/* Friends */
.friends {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 18px;
}
.friend {
  background: var(--s); border-radius: 24px; padding: 18px 12px 16px; text-align: center;
  box-shadow: var(--shadow-sm); transition: transform 0.2s ease;
  border: 3px solid transparent;
}
.friend:hover { transform: translateY(-6px) rotate(-1.5deg); border-color: var(--c); }
.friend img { width: 112px; height: 112px; margin: 0 auto 8px; object-fit: contain; }
.friend h3 { font-size: 1.4rem; }
.friend .feel {
  display: inline-block; margin-top: 6px; font-weight: 700; font-size: 0.85rem;
  color: #fff; background: var(--c); padding: 2px 12px; border-radius: 999px;
}

/* Play tiles */
.play-tiles { list-style: none; margin: 0 0 36px; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.tile { background: #fff; border-radius: var(--radius); padding: 26px 22px; text-align: center; box-shadow: var(--shadow-sm); border-top: 8px solid var(--c); }
.tile img { width: 110px; height: 110px; margin: 0 auto 12px; object-fit: contain; background: var(--s); border-radius: 50%; padding: 8px; }
.tile h3 { margin-bottom: 6px; }
.tile p { color: var(--ink-soft); font-size: 1rem; }

/* Story Nook */
.nook { background: radial-gradient(ellipse at top, #FFF1D2 0%, var(--cream) 60%); }
.shelf {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px;
}
.book {
  background: var(--cream); border-radius: var(--radius); padding: 14px 14px 20px;
  box-shadow: var(--shadow); text-align: center; display: flex; flex-direction: column;
  transition: transform 0.25s ease;
}
.book:hover { transform: translateY(-6px); }
.book-cover {
  position: relative; border-radius: 6px 16px 16px 6px; overflow: hidden; aspect-ratio: 5 / 4; background: var(--cream-2);
  box-shadow: 0 8px 18px rgba(46, 31, 87, 0.22);
}
.book-cover::after {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 14px;
  background: linear-gradient(90deg, rgba(0,0,0,0.18), rgba(255,255,255,0.12) 60%, transparent);
}
.book-cover img { width: 100%; height: 100%; object-fit: cover; }
.book-cover-art img { object-fit: contain; padding: 6% 8% 14%; }
.book h3 { font-size: 1.2rem; margin: 12px 4px 14px; flex: 1; }
.peek {
  font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 1.05rem;
  border: 0; border-radius: 999px; padding: 10px 20px 7px; cursor: pointer;
  background: var(--purple); color: #fff; box-shadow: 0 4px 0 var(--purple-deep);
}
.peek:hover { background: var(--purple-deep); }
.peek[disabled] { background: #EDE7F8; color: var(--ink-soft); box-shadow: none; cursor: default; }
.soon-note { text-align: center; margin-top: 30px; font-style: italic; color: var(--ink-soft); }

/* Grown-ups */
.grownups {
  background: #fff; border-radius: var(--radius); padding: 36px 34px; box-shadow: var(--shadow-sm);
  border: 2px dashed rgba(91, 52, 181, 0.25);
}
.grownups h2 { font-size: clamp(1.7rem, 3.6vw, 2.3rem); margin-bottom: 18px; }
.grownups p { color: var(--ink-soft); }

/* Begin */
.begin { background: linear-gradient(180deg, var(--cream) 0%, var(--sky-1) 100%); padding-bottom: 88px; }
.begin-zen { width: 150px; height: 150px; margin: 0 auto 10px; }
.begin h2 { margin-bottom: 20px; }

/* Footer */
.footer { background: var(--ink); color: #E4DCF7; text-align: center; padding: 40px 0 46px; }
.footer img { width: 110px; margin: 0 auto 10px; background: #fff; border-radius: 16px; padding: 8px 10px; }
.footer a { color: var(--sun); }
.footer .small { font-size: 0.9rem; opacity: 0.85; }

/* Viewer */
.viewer {
  width: min(94vw, 900px); max-height: 92vh; padding: 16px 16px 12px;
  border: 0; border-radius: var(--radius); background: var(--cream); color: var(--ink);
  box-shadow: 0 30px 80px rgba(20, 10, 50, 0.4);
}
.viewer::backdrop { background: rgba(46, 31, 87, 0.65); }
.viewer-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; }
.viewer-head h3 { font-size: 1.3rem; }
.viewer-stage { overflow: hidden; border-radius: 18px; background: #fff; touch-action: pan-y; }
.viewer-track { display: flex; transition: transform 0.35s ease; }
.viewer-track img { flex: 0 0 100%; width: 100%; max-height: 70vh; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.viewer-controls { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 12px; }
.icon-btn {
  width: 48px; height: 48px; border-radius: 50%; border: 0; cursor: pointer;
  background: #fff; color: var(--purple); font-size: 1.6rem; font-weight: 700; line-height: 1;
  box-shadow: var(--shadow-sm);
}
.icon-btn[disabled] { opacity: 0.35; cursor: default; }
.dots { display: flex; gap: 8px; }
.dots span { width: 10px; height: 10px; border-radius: 50%; background: #D8CDEF; }
.dots span.on { background: var(--purple); }
.viewer-count { text-align: center; font-size: 0.9rem; color: var(--ink-soft); margin: 6px 0 0; }

/* Motion */
.zen-float { animation: float 5s ease-in-out infinite; }
@keyframes float { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-16px) rotate(2deg); } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes twinkle { 0%, 100% { opacity: 0.2; transform: scale(0.8); } 50% { opacity: 1; transform: scale(1.15); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

/* Responsive */
@media (max-width: 960px) {
  .shelf { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 820px) {
  .hero { padding-top: 28px; }
  .hero-inner { grid-template-columns: 1fr; text-align: center; }
  .hero-zen { order: -1; }
  .hero-zen img { width: 220px; }
  .bubble-hero { text-align: left; margin-left: auto; margin-right: auto; }
  .bubble-hero::after { right: auto; left: 50%; top: -14px; transform: translateX(-50%); border: 14px solid transparent; border-bottom-color: #fff; border-top: 0; }
  .play-tiles { grid-template-columns: 1fr; }
  .topnav { display: none; }
}
@media (max-width: 600px) {
  body { font-size: 17px; }
  .wrap { padding: 0 16px; }
  .section { padding: 56px 0; }
  .zen-says > img { width: 60px; height: 60px; }
  .bubble { padding: 18px 20px; }
  .friends { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .friend img { width: 92px; height: 92px; }
  /* Story shelf becomes a swipeable row on phones */
  .shelf {
    display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 16px;
    margin: 0 -16px; padding: 6px 16px 22px; -webkit-overflow-scrolling: touch;
  }
  .book { flex: 0 0 80%; scroll-snap-align: center; }
  .grownups { padding: 26px 22px; }
}
