/* =========================================================
   شاطر | Shater — Kids site
   Shared design system: tokens, layout, components, motion
   ========================================================= */

:root {
  --blue-900: #0a2463;
  --blue-800: #0b3a8c;
  --blue-600: #1560d6;
  --blue-500: #1e6fe0;
  --blue-300: #7cb8ff;
  --blue-100: #e3f0ff;
  --sky: #eaf5ff;
  --orange: #f7931e;
  --orange-dark: #d9740a;
  --yellow: #ffc531;
  --yellow-soft: #fff4cc;
  --pink: #ff5fa2;
  --pink-soft: #ffe3f0;
  --green: #22c55e;
  --green-soft: #dcfce7;
  --purple: #8b5cf6;
  --purple-soft: #ede9fe;
  --red: #ef4444;
  --ink: #13284f;
  --ink-soft: #4b5f86;
  --white: #ffffff;
  --cream: #fffaf0;

  --radius-sm: 14px;
  --radius: 22px;
  --radius-lg: 32px;
  --shadow-pop: 0 6px 0 rgba(10, 36, 99, 0.18);
  --shadow-soft: 0 12px 30px rgba(10, 36, 99, 0.12);
  --shadow-float: 0 18px 40px rgba(10, 36, 99, 0.22);

  --font: "Baloo Bhaijaan 2", "Cairo", "Segoe UI", Tahoma, sans-serif;
  --bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--sky);
  line-height: 1.7;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
button { font-family: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }

.container { width: min(1180px, 100% - 32px); margin-inline: auto; }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 0 rgba(10, 36, 99, 0.06);
}
.topbar .container {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding-block: 8px;
}
.brand { display: flex; align-items: center; gap: 8px; }
.brand img { height: 52px; width: auto; mix-blend-mode: multiply; }

.topbar-actions { display: flex; align-items: center; gap: 8px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 999px;
  font-weight: 800; font-size: 1.05rem;
  background: var(--yellow-soft); color: #8a5a00;
  border: 2px solid var(--yellow);
}
.chip.streak { background: #ffe8de; color: #b4380b; border-color: #ff9a6b; }
.chip .ico { font-size: 1.2rem; line-height: 1; }
.chip.bump { animation: bump 0.5s var(--bounce); }

.icon-btn {
  width: 44px; height: 44px; border-radius: 50%;
  border: 2px solid var(--blue-100); background: var(--white);
  font-size: 1.25rem; display: grid; place-items: center;
  transition: transform 0.2s var(--bounce);
}
.icon-btn:hover { transform: scale(1.1) rotate(-6deg); }

.me-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  object-fit: cover; object-position: top;
  border: 3px solid var(--orange); background: var(--white);
}

.parents-link {
  font-weight: 700; font-size: 0.9rem; color: var(--ink-soft);
  padding: 6px 12px; border-radius: 999px; border: 2px dashed #c9d6ee;
}
.parents-link:hover { color: var(--blue-600); border-color: var(--blue-300); }

/* ---------- Buttons ---------- */
.btn {
  --btn-bg: var(--orange);
  --btn-shadow: var(--orange-dark);
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  border: 0; border-radius: 999px;
  padding: 14px 30px;
  font-size: 1.25rem; font-weight: 800;
  color: var(--white); background: var(--btn-bg);
  box-shadow: 0 6px 0 var(--btn-shadow);
  transition: transform 0.15s, box-shadow 0.15s;
  user-select: none;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 8px 0 var(--btn-shadow); }
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--btn-shadow); }
.btn[disabled] { filter: grayscale(0.8); opacity: 0.6; pointer-events: none; }
.btn.blue { --btn-bg: var(--blue-500); --btn-shadow: var(--blue-800); }
.btn.green { --btn-bg: var(--green); --btn-shadow: #15803d; }
.btn.pink { --btn-bg: var(--pink); --btn-shadow: #c2306f; }
.btn.ghost {
  --btn-bg: var(--white); --btn-shadow: #c9d6ee;
  color: var(--blue-800);
}
.btn.big { font-size: 1.5rem; padding: 18px 40px; }
.btn.small { font-size: 1rem; padding: 10px 20px; box-shadow: 0 4px 0 var(--btn-shadow); }
.btn.wiggle { animation: wiggle 2.4s ease-in-out infinite; }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  background: linear-gradient(180deg, #0b3a8c 0%, #1560d6 55%, #4b9bff 100%);
  color: var(--white);
  padding: 48px 0 120px;
}
.hero .container {
  position: relative; z-index: 2;
  display: grid; grid-template-columns: 1.05fr 1fr; align-items: center; gap: 40px;
}
.hero h1 {
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  line-height: 1.25; margin: 0 0 12px;
  text-shadow: 0 4px 0 rgba(0, 0, 0, 0.15);
}
.hero h1 .hl { color: var(--yellow); display: inline-block; }
.hero p.lead { font-size: 1.3rem; opacity: 0.95; margin: 0 0 28px; max-width: 34ch; }
.hero .cta-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.hero .hello { font-size: 1.2rem; font-weight: 700; color: var(--yellow); margin-bottom: 6px; }

.hero-art { position: relative; }
.hero-frame {
  position: relative;
  border-radius: 46% 54% 42% 58% / 52% 44% 56% 48%;
  overflow: hidden;
  border: 8px solid rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-float);
  animation: blob 12s ease-in-out infinite, floaty 5s ease-in-out infinite;
  aspect-ratio: 1.45;
}
.hero-frame img { width: 100%; height: 100%; object-fit: cover; object-position: center 30%; }

.speech {
  position: absolute; z-index: 3;
  background: var(--white); color: var(--ink);
  padding: 10px 16px; border-radius: 20px;
  font-weight: 800; font-size: 1.05rem;
  box-shadow: var(--shadow-soft);
  white-space: nowrap;
}
.speech::after {
  content: ""; position: absolute; bottom: -10px;
  border: 10px solid transparent; border-top-color: var(--white); border-bottom: 0;
}
.speech.s1 { top: -10px; right: 6%; animation: pop-in 0.6s 1.2s var(--bounce) both, floaty 4s 1.6s ease-in-out infinite; }
.speech.s1::after { right: 30px; }
.speech.s2 { top: 8%; left: 2%; animation: pop-in 0.6s 0.6s var(--bounce) both, floaty 4.5s 1s ease-in-out infinite; }
.speech.s2::after { left: 30px; }

/* clouds + sparkles */
.cloud {
  position: absolute; z-index: 1;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 999px;
  filter: drop-shadow(0 6px 0 rgba(10, 36, 99, 0.08));
}
.cloud::before, .cloud::after {
  content: ""; position: absolute; background: inherit; border-radius: 50%;
}
.cloud::before { width: 55%; height: 160%; top: -70%; right: 15%; }
.cloud::after { width: 38%; height: 120%; top: -45%; left: 14%; }
.cloud.c1 { width: 160px; height: 46px; top: 16%; left: -180px; animation: drift 38s linear infinite; }
.cloud.c2 { width: 110px; height: 32px; top: 58%; left: -140px; animation: drift 52s linear infinite 8s; opacity: 0.7; }
.cloud.c3 { width: 200px; height: 56px; top: 78%; left: -220px; animation: drift 64s linear infinite 20s; opacity: 0.55; }

.sparkle {
  position: absolute; z-index: 1; color: var(--yellow);
  font-size: 1.4rem; animation: twinkle 2.6s ease-in-out infinite;
}

.wave {
  position: absolute; bottom: -1px; left: 0; width: 100%; height: 90px; z-index: 2;
}

/* ---------- Sections ---------- */
/* page-level bands (home); nested sections keep their own spacing */
body > section { padding: 70px 0; position: relative; }
.section-head { text-align: center; margin-bottom: 40px; }
.section-head .kicker {
  display: inline-block; font-weight: 800; color: var(--orange);
  background: #fff1df; padding: 4px 16px; border-radius: 999px; margin-bottom: 10px;
}
.section-head h2 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin: 0; line-height: 1.3; color: var(--blue-900); }
.section-head p { color: var(--ink-soft); font-size: 1.15rem; margin: 8px 0 0; }

/* steps (افهم/جرّب/اتقن) */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.step-card {
  background: var(--white); border-radius: var(--radius-lg);
  padding: 30px 24px 26px; text-align: center;
  box-shadow: var(--shadow-soft);
  border-bottom: 8px solid var(--c, var(--blue-500));
  transition: transform 0.3s var(--bounce);
}
.step-card:hover { transform: translateY(-10px) rotate(-1.5deg); }
.step-card .emoji {
  width: 92px; height: 92px; margin: 0 auto 14px;
  display: grid; place-items: center; font-size: 3rem;
  border-radius: 50%; background: var(--bg, var(--blue-100));
}
.step-card .num {
  display: inline-grid; place-items: center; width: 34px; height: 34px;
  border-radius: 50%; background: var(--c); color: var(--white);
  font-weight: 800; margin-bottom: 6px;
}
.step-card h3 { margin: 0 0 4px; font-size: 1.6rem; }
.step-card p { margin: 0; color: var(--ink-soft); }

/* worlds (stages) */
.worlds { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 18px; }
.world {
  position: relative; border-radius: var(--radius); overflow: hidden;
  background: var(--white); box-shadow: var(--shadow-soft);
  transition: transform 0.3s var(--bounce);
  text-align: center;
}
.world:hover { transform: translateY(-8px) scale(1.03); }
.world img { aspect-ratio: 1; width: 100%; object-fit: cover; object-position: top; }
.world .tag {
  display: block; padding: 10px 6px 12px; font-weight: 800; color: var(--white);
  background: var(--c, var(--blue-500)); font-size: 1.05rem;
}

/* adventures (lessons) */
.adventures { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; }
.adv {
  position: relative; display: flex; flex-direction: column;
  background: var(--white); border-radius: var(--radius-lg);
  overflow: hidden; box-shadow: var(--shadow-soft);
  transition: transform 0.3s var(--bounce);
}
.adv:hover { transform: translateY(-8px); }
.adv .cover {
  height: 180px; display: grid; place-items: center; font-size: 5rem;
  background: var(--bg);
}
.adv .cover img { width: 100%; height: 100%; object-fit: cover; }
.adv .body { padding: 18px 22px 22px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.adv h3 { margin: 0; font-size: 1.45rem; }
.adv p { margin: 0; color: var(--ink-soft); flex: 1; }
.adv .meta { display: flex; gap: 8px; flex-wrap: wrap; font-size: 0.9rem; font-weight: 700; }
.adv .meta span { background: var(--sky); padding: 2px 10px; border-radius: 999px; color: var(--blue-800); }
.adv.locked .cover { filter: grayscale(0.6) brightness(0.9); }
.adv .lock {
  position: absolute; top: 14px; left: 14px;
  background: rgba(10, 36, 99, 0.85); color: var(--white);
  padding: 4px 14px; border-radius: 999px; font-weight: 800; font-size: 0.95rem;
}
.adv .ribbon {
  position: absolute; top: 14px; right: 14px;
  background: var(--green); color: var(--white);
  padding: 4px 14px; border-radius: 999px; font-weight: 800; font-size: 0.95rem;
  animation: pulse 1.8s ease-in-out infinite;
}

/* hidden-stars hunt */
.hunt-bar {
  display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap;
  background: var(--white); border: 3px dashed var(--yellow);
  border-radius: var(--radius); padding: 14px 20px; margin: -40px auto 0;
  width: min(640px, 100% - 32px); position: relative; z-index: 5;
  box-shadow: var(--shadow-soft); font-weight: 800; font-size: 1.1rem;
}
.hunt-dots { display: flex; gap: 6px; }
.hunt-dots i {
  width: 26px; height: 26px; display: grid; place-items: center; font-style: normal;
  border-radius: 50%; background: #eef2f9; color: #b8c4da; font-size: 0.95rem;
}
.hunt-dots i.got { background: var(--yellow); color: #8a5a00; animation: bump 0.5s var(--bounce); }

.hidden-star {
  position: absolute; z-index: 6;
  width: 46px; height: 46px; border: 0; background: none; padding: 0;
  font-size: 2rem; line-height: 1;
  animation: twinkle 2.2s ease-in-out infinite;
  filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.15));
}
.hidden-star.caught { animation: fly-up 0.8s ease-in forwards; pointer-events: none; }

/* footer */
.site-footer {
  background: var(--blue-900); color: #cfe0ff; padding: 40px 0 30px; text-align: center;
}
.site-footer img { height: 60px; margin: 0 auto 10px; background: var(--white); border-radius: 16px; padding: 4px 10px; }
.site-footer p { margin: 4px 0; }
.site-footer small { opacity: 0.7; }

/* ---------- Mascot buddy (fixed) ---------- */
.buddy {
  position: fixed; bottom: 16px; left: 16px; z-index: 60;
  display: flex; align-items: flex-end; gap: 10px;
  pointer-events: none;
}
.buddy-img {
  width: 84px; height: 84px; border-radius: 50%;
  object-fit: cover; object-position: top;
  border: 4px solid var(--white); background: var(--white);
  box-shadow: var(--shadow-float);
  pointer-events: auto; cursor: pointer;
  animation: floaty 3.6s ease-in-out infinite;
}
.buddy-bubble {
  max-width: 260px; background: var(--white);
  padding: 12px 16px; border-radius: 20px 20px 20px 4px;
  font-weight: 700; box-shadow: var(--shadow-soft);
  opacity: 0; transform: scale(0.6) translateY(10px); transform-origin: bottom left;
  transition: opacity 0.25s, transform 0.35s var(--bounce);
}
.buddy-bubble.show { opacity: 1; transform: none; }
.buddy.jump .buddy-img { animation: jump 0.6s var(--bounce); }

/* ---------- Modal + toast ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(10, 36, 99, 0.55);
  display: grid; place-items: center; padding: 16px;
  animation: fade-in 0.25s;
}
.modal {
  background: var(--white); border-radius: var(--radius-lg);
  padding: 30px 26px; text-align: center; width: min(440px, 100%);
  box-shadow: var(--shadow-float);
  animation: pop-in 0.45s var(--bounce);
}
.modal .big-emoji { font-size: 4rem; line-height: 1; }
.modal h3 { font-size: 1.8rem; margin: 8px 0 4px; color: var(--blue-900); }
.modal p { color: var(--ink-soft); margin: 0 0 20px; font-size: 1.1rem; }

.toast {
  position: fixed; top: 80px; left: 50%; z-index: 110;
  transform: translateX(-50%);
  background: var(--blue-900); color: var(--white);
  padding: 10px 22px; border-radius: 999px; font-weight: 800;
  box-shadow: var(--shadow-float);
  animation: toast 2.6s forwards;
}

.star-burst {
  position: fixed; z-index: 120; pointer-events: none;
  font-size: 1.8rem; font-weight: 800; color: var(--orange);
  animation: burst-up 1s ease-out forwards;
  text-shadow: 0 2px 0 var(--white);
}

#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 130; }

/* ---------- Fractions ---------- */
.frac {
  display: inline-flex; flex-direction: column; align-items: center;
  font-weight: 800; line-height: 1.05; vertical-align: middle;
  margin-inline: 4px;
}
.frac .n, .frac .d { padding-inline: 4px; }
.frac .bar { width: 100%; min-width: 1.2em; height: 3px; background: currentColor; border-radius: 3px; margin: 2px 0; }
.frac.xl { font-size: 3rem; }
.frac.lg { font-size: 2rem; }

/* ---------- Motion ---------- */
@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes blob {
  0%, 100% { border-radius: 46% 54% 42% 58% / 52% 44% 56% 48%; }
  50% { border-radius: 56% 44% 52% 48% / 44% 56% 44% 56%; }
}
@keyframes drift { from { transform: translateX(0); } to { transform: translateX(calc(100vw + 400px)); } }
@keyframes twinkle { 0%, 100% { transform: scale(1) rotate(0); opacity: 1; } 50% { transform: scale(0.75) rotate(20deg); opacity: 0.6; } }
@keyframes pop-in { from { transform: scale(0.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.35); } 100% { transform: scale(1); } }
@keyframes wiggle { 0%, 88%, 100% { transform: rotate(0); } 91% { transform: rotate(-4deg); } 94% { transform: rotate(4deg); } 97% { transform: rotate(-2deg); } }
@keyframes jump { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-26px) scale(1.08); } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-10px); } 40%, 80% { transform: translateX(10px); } }
@keyframes fly-up { to { transform: translateY(-120px) scale(1.8); opacity: 0; } }
@keyframes burst-up { from { transform: translate(-50%, 0) scale(0.6); opacity: 1; } to { transform: translate(-50%, -80px) scale(1.3); opacity: 0; } }
@keyframes toast { 0% { opacity: 0; transform: translate(-50%, -20px); } 12%, 85% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; transform: translate(-50%, -20px); } }
@keyframes slide-up { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: none; } }

.reveal { opacity: 0; transform: translateY(30px); transition: opacity 0.6s, transform 0.6s var(--bounce); }
.reveal.in { opacity: 1; transform: none; }
.shake { animation: shake 0.45s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .reveal { opacity: 1; transform: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero { padding: 30px 0 110px; text-align: center; }
  .hero .container { grid-template-columns: 1fr; gap: 30px; }
  .hero p.lead { margin-inline: auto; }
  .hero .cta-row { justify-content: center; }
  .hero-art { order: -1; max-width: 520px; margin-inline: auto; width: 100%; }
  .steps { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .brand img { height: 42px; }
  .parents-link { display: none; }
  .chip { padding: 4px 10px; font-size: 0.95rem; }
  .icon-btn, .me-avatar { width: 38px; height: 38px; }
  .btn.big { font-size: 1.25rem; padding: 14px 28px; }
  .buddy-img { width: 64px; height: 64px; }
  .buddy-bubble { max-width: 200px; font-size: 0.95rem; }
  .speech { font-size: 0.9rem; }
  body > section { padding: 54px 0; }
}

/* ---------- Room unlockables (shared: buddy + room) ---------- */
.frame-gold { border-color: #ffc531 !important; box-shadow: 0 0 0 4px #fff4cc, 0 0 22px rgba(255, 197, 49, 0.9) !important; }
.frame-rainbow {
  border: 5px solid transparent !important;
  background: linear-gradient(#fff, #fff) padding-box,
    conic-gradient(#ef4444, #f7931e, #ffc531, #22c55e, #1e6fe0, #8b5cf6, #ef4444) border-box !important;
}
.frame-stars { border-color: #1e6fe0 !important; box-shadow: 0 0 0 4px #ffc531, 0 0 0 8px #1e6fe0 !important; }

.buddy-pet {
  align-self: flex-end; margin-inline-start: -26px; margin-bottom: -4px;
  font-size: 2rem; line-height: 1; z-index: 1;
  animation: floaty 2.6s ease-in-out infinite reverse;
  filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.15));
}

/* top-bar link to the AI buddy */
.ask-link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 999px; font-weight: 800; font-size: 1rem;
  background: linear-gradient(135deg, #8b5cf6, #1e6fe0); color: var(--white);
  box-shadow: 0 4px 0 #4c2fb0;
  transition: transform 0.2s var(--bounce);
}
.ask-link:hover { transform: translateY(-2px) scale(1.04); }
@media (max-width: 600px) { .ask-link .txt { display: none; } .ask-link { padding: 6px 10px; } }
