@import url("https://fonts.googleapis.com/css2?family=Nunito:wght@700;800;900&family=Fredoka:wght@600;700&display=swap");

:root {
  --pink: #ff4d9a;
  --pink-dark: #ff1f7a;
  --pink-soft: #ffe3f0;
  --sun: #ffe066;
  --mint: #00d68f;
  --sky: #3dd6f5;
  --orange: #ff8c42;
  --purple: #9b5de5;
  --ink: #2b2d42;
  --muted: #5c677d;
  --page: #ffffff;
  --bg:
    radial-gradient(ellipse 90% 60% at 8% -10%, rgba(255, 196, 58, 0.5), transparent 55%),
    radial-gradient(ellipse 70% 50% at 95% 5%, rgba(61, 184, 255, 0.38), transparent 50%),
    radial-gradient(ellipse 60% 45% at 85% 95%, rgba(30, 200, 176, 0.32), transparent 55%),
    linear-gradient(165deg, #ffe9a8 0%, #fff4d6 22%, #e8f9ff 55%, #d9fff4 78%, #ffe8df 100%);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Nunito", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  background-attachment: fixed;
  line-height: 1.45;
  padding-bottom: 96px;
  position: relative;
  isolation: isolate;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.4;
  background-image: radial-gradient(rgba(255, 255, 255, 0.75) 1.4px, transparent 1.5px);
  background-size: 28px 28px;
}
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
img { max-width: 100%; display: block; border-radius: 14px; }

/* Kids navigation */
.kids-nav {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255,255,255,.94);
  border-bottom: 3px solid #ffd0e8;
  backdrop-filter: blur(10px);
}
.kids-nav-inner {
  width: min(980px, 94vw);
  margin: 0 auto;
  padding: 10px 0;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}
.kids-nav .brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: Fredoka, sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--pink-dark);
}
.kids-nav .brand span {
  width: 42px; height: 42px; border-radius: 14px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--pink), var(--sun));
  font-size: 1.3rem;
}
.kids-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.nav-btn {
  min-width: 56px;
  min-height: 56px;
  border: none;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 6px 16px rgba(31,42,68,.1);
  font-size: 1.5rem;
  font-weight: 900;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0 14px;
  color: var(--ink);
}
.nav-btn.home { background: linear-gradient(135deg, #ffd166, #ff9f1c); }
.nav-btn.prev { background: #eaf7ff; }
.nav-btn.next { background: linear-gradient(135deg, #06d6a0, #4cc9f0); color: #fff; }
.nav-btn:active { transform: scale(.96); }

.wrap { width: min(920px, 94vw); margin: 14px auto 40px; }

.workbook {
  background: var(--page);
  border: 10px solid var(--pink);
  border-radius: 28px;
  padding: 16px;
  box-shadow: 0 16px 40px rgba(255,45,134,.16), 0 0 0 6px #ffe066;
}

.page-title {
  font-family: Fredoka, sans-serif;
  text-align: center;
  color: var(--pink-dark);
  margin: 4px 0 14px;
  font-size: clamp(1.5rem, 4vw, 2rem);
}

.activity {
  border: 3px solid #ffc3db;
  border-radius: 20px;
  padding: 14px;
  margin-bottom: 16px;
  background: #fff;
}
.activity-head {
  display: flex; align-items: center; gap: 10px;
  background: linear-gradient(90deg, var(--pink), #ff8fb8);
  color: #fff;
  border-radius: 999px;
  padding: 10px 14px;
  margin-bottom: 14px;
}
.num {
  width: 36px; height: 36px; border-radius: 50%;
  background: #fff; color: var(--pink-dark);
  display: grid; place-items: center; font-weight: 900;
}
.instruction { font-weight: 800; color: #fff; font-size: .98rem; }

.row { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; align-items: center; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }

.item {
  border: 3px solid #ffd0e4;
  border-radius: 18px;
  background: #fff;
  min-height: 96px;
  display: grid; place-items: center;
  font-size: 2rem;
  cursor: pointer;
  user-select: none;
  transition: .12s transform, .12s border-color, .12s background;
  padding: 8px;
  text-align: center;
  font-weight: 800;
}
.item:hover { transform: scale(1.04); }
.item.selected { border-color: var(--sky); background: #eaf9ff; }
.item.correct { border-color: var(--mint); background: #e7fff6; }
.item.wrong { border-color: #ff4d6d; background: #ffe8ee; }
.item small { display: block; font-size: .78rem; font-weight: 800; color: var(--muted); }
.item img {
  width: 72px; height: 72px; object-fit: cover; border-radius: 14px;
}

.photo-card {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 16px;
}

.answer-box {
  width: 72px; height: 54px;
  border: 3px solid var(--pink);
  border-radius: 12px;
  text-align: center;
  font-weight: 900;
  font-size: 1.25rem;
}
.letter-box {
  width: 46px; height: 50px;
  border: 3px solid #7b6ef6;
  border-radius: 10px;
  text-align: center;
  font-weight: 900;
  text-transform: uppercase;
}

.btn {
  border: none; border-radius: 999px;
  background: linear-gradient(135deg, var(--pink-dark), #ff6b35);
  color: #fff;
  font-weight: 900; padding: 12px 22px; cursor: pointer;
  box-shadow: 0 8px 18px rgba(255,45,134,.28);
}
.btn.secondary { background: #fff; color: var(--pink-dark); border: 3px solid var(--pink); box-shadow: none; }

.feedback {
  margin-top: 10px; font-weight: 900; min-height: 24px; text-align: center; font-size: 1.05rem;
}
.feedback.ok { color: #0a8f63; }
.feedback.bad { color: #d62839; }

.page-no {
  width: 58px; height: 58px; margin: 8px auto 0;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--pink), var(--orange));
  color: #fff;
  display: grid; place-items: center;
  font-family: Fredoka, sans-serif; font-weight: 700;
}

.home-hero {
  text-align: center; padding: 18px 8px 8px;
}
.home-hero h1 {
  font-family: Fredoka, sans-serif;
  color: var(--pink-dark);
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  margin: 0 0 8px;
}
.home-hero p { color: var(--muted); margin: 0 0 16px; }

.card-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.card {
  border: 3px solid #ffc3db;
  border-radius: 20px;
  padding: 14px 12px;
  background: #fff;
  text-align: center;
  box-shadow: 0 10px 24px rgba(31,42,68,.06);
  min-height: 120px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.card .big { font-size: 2rem; margin-bottom: 6px; }
.card h3 { margin: 0 0 4px; font-family: Fredoka, sans-serif; color: var(--pink-dark); font-size: 1.15rem; }
.card p { margin: 0; color: var(--muted); font-size: .85rem; }

/* Ads */
.ad-slot {
  border: 2px dashed #9aa5b8;
  background: repeating-linear-gradient(45deg, #f4f7fb, #f4f7fb 8px, #e9eef5 8px, #e9eef5 16px);
  border-radius: 14px;
  color: #54627a;
  font-weight: 800;
  text-align: center;
  padding: 12px;
  margin: 14px 0;
  position: relative;
}
.ad-slot .ad-label {
  position: absolute; top: 6px; left: 8px;
  background: #35507d; color: #fff;
  font-size: .7rem; padding: 3px 8px; border-radius: 999px;
}
.ad-banner { min-height: 90px; }
.ad-inline { min-height: 120px; }
.ad-bottom {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 35;
  margin: 0; border-radius: 0; min-height: 70px;
  border-left: none; border-right: none; border-bottom: none;
}

.page-ad-layout {
  display: grid;
  grid-template-columns: minmax(120px, 160px) minmax(0, 1fr) minmax(120px, 160px);
  gap: 14px;
  width: min(1240px, 96vw);
  margin: 0 auto;
  align-items: start;
}
.page-ad-main { min-width: 0; }
.page-ad-main .wrap { width: 100%; margin: 14px auto 40px; }

.ad-rail-left,
.ad-rail-right {
  position: sticky;
  top: 88px;
  min-height: 520px;
}

@media (max-width: 1100px) {
  .page-ad-layout {
    grid-template-columns: 1fr;
    width: min(920px, 94vw);
  }
  .ad-rail-left,
  .ad-rail-right { display: none; }
}

.ad-modal {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(20, 24, 40, .55);
  display: none; place-items: center; padding: 18px;
}
.ad-modal.show { display: grid; }
.ad-modal-card {
  width: min(420px, 94vw);
  background: #fff;
  border-radius: 22px;
  padding: 18px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0,0,0,.25);
}
.ad-modal-card .video-fake {
  height: 180px;
  border-radius: 16px;
  background: linear-gradient(135deg, #1f2a44, #4cc9f0);
  color: #fff;
  display: grid; place-items: center;
  font-weight: 900;
  margin: 10px 0 14px;
}

/* Confetti layer */
#fx-layer {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  overflow: hidden;
}
.candy {
  position: absolute;
  top: -40px;
  font-size: 1.6rem;
  animation: fall linear forwards;
  z-index: 10000;
}
@keyframes fall {
  to { transform: translateY(110vh) rotate(720deg); opacity: .15; }
}

.paper-piece {
  position: absolute;
  width: 10px;
  height: 16px;
  border-radius: 2px;
  z-index: 10001;
  animation: popOut ease-out forwards;
  box-shadow: 0 2px 4px rgba(0,0,0,.15);
}
.paper-piece.sq { width: 12px; height: 12px; border-radius: 2px; }
.paper-piece.ribbon { width: 6px; height: 22px; border-radius: 3px; }
@keyframes popOut {
  0% { transform: translate(0,0) rotate(0deg); opacity: 1; }
  100% { transform: translate(var(--dx), calc(var(--dy) + 180px)) rotate(var(--rot)); opacity: 0; }
}
.party-bang {
  position: fixed;
  left: 50%;
  top: 28%;
  transform: translate(-50%, -50%) scale(.4);
  font-size: clamp(1.6rem, 5vw, 2.6rem);
  font-weight: 900;
  color: #ff1f7a;
  text-shadow: 0 4px 0 #ffe066, 0 8px 20px rgba(0,0,0,.15);
  animation: bangIn .9s ease forwards;
  z-index: 10002;
}
@keyframes bangIn {
  0% { transform: translate(-50%, -50%) scale(.2); opacity: 0; }
  35% { transform: translate(-50%, -50%) scale(1.15); opacity: 1; }
  100% { transform: translate(-50%, -60%) scale(1); opacity: 0; }
}

body.wrong-flash {
  animation: wrongFlash .35s ease;
}
@keyframes wrongFlash {
  0%, 100% { filter: none; }
  40% { filter: sepia(0.4) saturate(2) hue-rotate(-20deg); }
}

.topbar { display: none; } /* replaced by kids-nav */

@media (max-width: 700px) {
  .grid2, .grid3, .grid4 { grid-template-columns: 1fr 1fr; }
  .workbook { border-width: 7px; padding: 12px; }
  .nav-btn { min-width: 52px; min-height: 52px; }
}
