:root {
  --bg: #fff8ec; --surface: #ffffff; --text: #2b2118; --muted: #7a6a58; --line: #f0e2cc;
  --sun: #ffb627; --sun-ink: #3b1f00; --sky: #4cb5f5; --leaf: #3fbf7f; --berry: #ef5d8e; --grape: #8b6cf0;
  --right: #3fbf7f; --wrong: #e5484d; --radius: 22px; --shadow: 0 4px 0 rgba(80, 50, 10, .12);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1d1712; --surface: #2a221a; --text: #fbefe0; --muted: #c2ae96; --line: #43372a;
    --shadow: 0 4px 0 rgba(0, 0, 0, .35);
  }
}
:root[data-theme="dark"] {
  --bg: #1d1712; --surface: #2a221a; --text: #fbefe0; --muted: #c2ae96; --line: #43372a;
  --shadow: 0 4px 0 rgba(0, 0, 0, .35);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 18px/1.5 "Baloo 2", system-ui, -apple-system, "Segoe UI", sans-serif; }
.ar { font-family: "Noto Naskh Arabic", "Geeza Pro", "Arial", serif; font-weight: 700; line-height: 1.9; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
h1 { font-size: clamp(1.6rem, 5vw, 2.3rem); line-height: 1.2; margin: .6rem 0 .4rem; font-weight: 800; }
h2 { font-size: 1.35rem; margin: 2rem 0 .4rem; }
h2 small, .note { color: var(--muted); font-weight: 500; }
.lead { font-size: 1.2rem; color: var(--muted); margin: 0 0 1rem; }
.em { font-size: 1.15em; }

/* header */
.top { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 16px;
  max-width: 1000px; margin: 0 auto; flex-wrap: wrap; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.35rem; text-decoration: none; }
.logo .ar { font-size: 1.1rem; color: var(--muted); }
.tile { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--sun);
  color: var(--sun-ink); font-family: "Noto Naskh Arabic", serif; font-size: 1.4rem; box-shadow: var(--shadow); }
.tools { display: flex; align-items: center; gap: 8px; }
@media (max-width: 520px) { .logo .ar { display: none; } .top { padding: 8px 12px; } .chipbtn { padding: 4px 10px; } }
.link { background: none; border: 0; color: var(--muted); text-decoration: underline; padding: 6px; }
.chipbtn { display: inline-flex; align-items: center; gap: 6px; border: 2px solid var(--line); background: var(--surface);
  border-radius: 999px; padding: 4px 12px; font-weight: 700; text-decoration: none; min-height: 44px; }
.me .av { font-size: 1.5rem; }
.me.pop { animation: pop .5s; }
@keyframes pop { 50% { transform: scale(1.25); } }

main { max-width: 1000px; margin: 0 auto; padding: 0 16px 48px; }
.back { display: inline-block; margin: 4px 0 8px; color: var(--muted); text-decoration: none; font-weight: 700; padding: 6px 0; }
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }

/* big buttons */
.big-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 999px;
  background: var(--sun); color: var(--sun-ink); font-weight: 800; font-size: 1.2rem; padding: 12px 26px;
  box-shadow: var(--shadow); text-decoration: none; min-height: 56px; }
.big-btn.ghost { background: var(--surface); color: var(--text); border: 2px solid var(--line); }
.big-btn:active, .theme:active, .act:active, .opt:active, .kid:active { transform: translateY(3px); box-shadow: none; }

/* profiles */
.kids { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; margin: 1rem 0; }
.kid { display: flex; flex-direction: column; align-items: center; gap: 2px; border: 0; background: var(--surface);
  border-radius: var(--radius); padding: 18px 10px; box-shadow: var(--shadow); }
.kid .av { font-size: 3.4rem; line-height: 1.1; }
.kid b { font-size: 1.2rem; }
.kid small { color: var(--muted); }
.kid.add { border: 3px dashed var(--line); box-shadow: none; background: transparent; }
.kid.add .av { color: var(--muted); }
.newkid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; max-width: 560px; }
.newkid label { display: grid; gap: 4px; font-weight: 700; }
.newkid input[name="name"] { font: inherit; font-size: 1.3rem; padding: 10px 14px; border-radius: 14px; border: 2px solid var(--line);
  background: var(--bg); color: var(--text); }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; display: flex; flex-wrap: wrap; gap: 8px; }
legend { font-weight: 700; margin-bottom: 6px; }
.pill { display: inline-flex !important; align-items: center; gap: 6px; border: 2px solid var(--line); border-radius: 999px;
  padding: 6px 14px; font-weight: 600 !important; }
.pill:has(input:checked) { border-color: var(--sun); background: color-mix(in srgb, var(--sun) 20%, transparent); }
.avatars { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; width: 100%; }
.avpick input, .pill input { position: absolute; opacity: 0; pointer-events: none; }
.avpick span { display: grid; place-items: center; font-size: clamp(1.6rem, 7vw, 2.2rem); aspect-ratio: 1; border-radius: 16px; border: 3px solid transparent; }
.avpick input:checked + span { border-color: var(--sun); background: color-mix(in srgb, var(--sun) 20%, transparent); }
.avpick input:focus-visible + span, .pill:has(input:focus-visible) { outline: 3px solid var(--sky); }

/* themes */
.hello { cursor: pointer; }
.hello .ar { color: var(--berry); }
.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.theme { display: flex; flex-direction: column; align-items: center; text-align: center; text-decoration: none;
  background: var(--surface); border-radius: var(--radius); padding: 14px 8px 10px; box-shadow: var(--shadow); }
.theme .em { font-size: 3.4rem; line-height: 1.2; }
.theme .ar { font-size: 1.15rem; color: var(--muted); line-height: 1.6; }
.theme b { font-size: 1.15rem; }
.theme small { color: var(--muted); font-size: .85rem; }

/* theme page */
.acts { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin: 1rem 0 1.5rem; }
.act { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 22px 10px; border-radius: var(--radius);
  text-decoration: none; color: #fff; box-shadow: var(--shadow); font-size: 1.3rem; }
.act .em { font-size: 3.2rem; line-height: 1.1; }
.a1 { background: var(--sky); } .a2 { background: var(--berry); } .a3 { background: var(--grape); }
.minis { display: flex; flex-wrap: wrap; gap: 8px; }
.mini { font-size: 1.9rem; width: 58px; height: 58px; border-radius: 16px; border: 2px solid var(--line); background: var(--surface); }
.mini.ok { border-color: var(--right); background: color-mix(in srgb, var(--right) 15%, var(--surface)); }

/* discover */
.discover { display: flex; align-items: center; gap: 10px; justify-content: center; }
.flash { flex: 0 1 460px; display: flex; flex-direction: column; align-items: center; border: 0; background: var(--surface);
  border-radius: 32px; box-shadow: var(--shadow); padding: 24px 12px 18px; min-height: 380px; justify-content: center; }
.flash .em { font-size: clamp(6rem, 28vw, 10rem); line-height: 1.15; }
.flash .ar { font-size: clamp(2.6rem, 10vw, 4rem); color: var(--berry); line-height: 1.6; }
.flash b { font-size: 1.3rem; }
.flash small { color: var(--muted); font-style: italic; }
.nav { flex: none; width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--sun); color: var(--sun-ink);
  font-size: 1.4rem; box-shadow: var(--shadow); }
.dots, .progress { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; margin: 14px 0; }
.dots i, .progress i { width: 12px; height: 12px; border-radius: 50%; background: var(--line); }
.dots i.seen, .progress i.done { background: var(--right); }
.dots i.on, .progress i.on { background: var(--sun); transform: scale(1.3); }
#msg { text-align: center; font-weight: 700; }

/* listen & find */
.speaker { display: block; margin: 4px auto 18px; width: 110px; height: 110px; border-radius: 50%; border: 0;
  background: var(--sun); font-size: 3.4rem; box-shadow: var(--shadow); animation: breathe 2.4s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.06); } }
.options { display: grid; gap: 14px; max-width: 640px; margin: 0 auto; grid-template-columns: repeat(2, 1fr); }
.options.n3 { grid-template-columns: repeat(3, 1fr); max-width: 720px; }
@media (max-width: 520px) { .options.n3 { grid-template-columns: repeat(2, 1fr); } .options.n3 .opt:last-child { grid-column: span 2; } }
.opt { display: flex; flex-direction: column; align-items: center; justify-content: center; aspect-ratio: 1; border: 4px solid transparent;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); font-size: clamp(3.5rem, 15vw, 6rem); line-height: 1.1; }
.opt .ar { font-size: clamp(1.2rem, 4vw, 1.7rem); color: var(--right); }
.opt.right { border-color: var(--right); animation: pop .5s; }
.opt.wrong { border-color: var(--wrong); opacity: .35; animation: shake .4s; }
@keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }

/* memory */
.memory { display: grid; gap: 12px; max-width: 640px; margin: 10px auto; grid-template-columns: repeat(3, 1fr); }
.memory.p4 { grid-template-columns: repeat(4, 1fr); }
.memory.p6 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 520px) { .memory.p4, .memory.p6 { grid-template-columns: repeat(3, 1fr); } }
.mcard { position: relative; aspect-ratio: 3 / 4; border: 0; padding: 0; background: none; perspective: 600px; }
.mcard span { position: absolute; inset: 0; display: grid; place-items: center; border-radius: 18px; backface-visibility: hidden;
  transition: transform .35s; box-shadow: var(--shadow); }
.mcard .front { background: var(--surface); font-size: clamp(2.6rem, 11vw, 4rem); transform: rotateY(180deg); }
.mcard .backface { background: var(--grape); color: #fff; font-size: 2.4rem; }
.mcard.up .front { transform: rotateY(0); }
.mcard.up .backface { transform: rotateY(-180deg); }
.mcard.matched .front { outline: 4px solid var(--right); }

/* end, album */
.end { text-align: center; max-width: 560px; margin: 30px auto; }
.end .big, .sticker-pop .big { font-size: 6rem; line-height: 1.1; }
.row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 16px; }
.stickers { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; }
.stickers span { display: grid; place-items: center; aspect-ratio: 1; border-radius: 16px; font-size: 2.2rem;
  background: var(--surface); border: 2px dashed var(--line); color: var(--line); font-weight: 800; }
.stickers span.got { border: 2px solid var(--sun); color: inherit; }
.danger { margin-top: 3rem; }
.danger .link { font-size: .9rem; }

/* celebrations */
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 20; }
.confetti span { position: absolute; top: -40px; animation: fall 1.6s ease-in forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(360deg); } }
.overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); display: grid; place-items: center; grid-template-columns: minmax(0, 460px); justify-content: center; z-index: 30; padding: 16px; }
.sticker-pop { background: var(--surface); border-radius: 32px; padding: 30px 40px; text-align: center; font-size: 1.5rem;
  font-weight: 800; animation: pop .6s; }

/* add to home screen */
.install { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-top: 28px; }
.install img { border-radius: 14px; flex: none; }
.install > div:nth-child(2) { flex: 1 1 200px; display: flex; flex-direction: column; line-height: 1.3; }
.install small { color: var(--muted); }
.install .row { margin: 0; align-items: center; }
.sheet { background: var(--surface); border-radius: 28px; padding: 22px 20px; max-width: 460px; width: 100%; max-height: 90vh; overflow: auto; }
.sheet h2 { margin-top: 0; }
.steps { padding-left: 1.4em; display: grid; gap: 12px; margin: 0 0 18px; }
.steps li { padding-left: 4px; }
.ico { width: 1.35em; height: 1.35em; vertical-align: -.3em; fill: none; stroke: var(--sky); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.warn { background: color-mix(in srgb, var(--sun) 25%, transparent); border-radius: 14px; padding: 10px 12px; }
.pointer { position: fixed; bottom: 12px; left: 50%; transform: translateX(-50%); font-size: 3rem; animation: nudge 1s ease-in-out infinite; }
@keyframes nudge { 50% { transform: translate(-50%, 10px); } }

.prose { max-width: 70ch; }
.prose li { margin: .4rem 0; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
