/* 100 words: warm, playful, one action per screen. System fonts only, no network. */
:root {
  --m: #6dd9ff; --m-dark: #0b6b94; --m-ink: #08293a;
  --f: #ff9bff; --f-dark: #9c1f9c; --f-ink: #3a0c3a;
  --ink: #2b2340; --line: #d8cbb4; --accent: #ff8a3d; --good: #17703f;
  --font: system-ui, -apple-system, "Segoe UI", "Geeza Pro", "Noto Naskh Arabic", "Noto Sans Arabic", "Droid Arabic Naskh", Tahoma, Arial, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh; overflow-x: hidden;
  font-family: var(--font); color: var(--ink); font-size: 18px;
  background: var(--bg); background-attachment: fixed;
}
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; min-height: 56px; min-width: 56px; }
button:focus-visible, dialog:focus-visible { outline: 4px solid #1b4fd8; outline-offset: 2px; }
button[disabled] { opacity: 0.4; cursor: default; }

/* ---------- scenes: gradient + four decorative emoji per scene ---------- */
body[data-scene="map"] { --bg: linear-gradient(#ffe9a8, #ffd1dc 60%, #cfe9ff); --e1: "⭐"; --e2: "🌈"; --e3: "☁️"; --e4: "🗺️"; }
body[data-scene="street"] { --bg: linear-gradient(#cfe8ff 0 62%, #9aa5b1 62%); --e1: "☁️"; --e2: "🚌"; --e3: "🚦"; --e4: "🏙️"; }
body[data-scene="rainbow"] { --bg: linear-gradient(#ffd6e8, #fff3b0 35%, #c8f7c5 65%, #b5e3ff); --e1: "🌈"; --e2: "🎨"; --e3: "☁️"; --e4: "✨"; }
body[data-scene="playground"] { --bg: linear-gradient(#bfe9ff 0 60%, #9be37f 60%); --e1: "☀️"; --e2: "🛝"; --e3: "🪁"; --e4: "🌳"; }
body[data-scene="nature"] {
  --bg: radial-gradient(ellipse 60% 22% at 20% 100%, #7ccf6a 98%, transparent 100%), radial-gradient(ellipse 70% 26% at 85% 100%, #5fbf5a 98%, transparent 100%), linear-gradient(#a8e0ff, #eaf9ff);
  --e1: "☁️"; --e2: "🌳"; --e3: "🦋"; --e4: "🌷";
}
body[data-scene="playroom"] { --bg: linear-gradient(#ffe0f0, #fff4c2); --e1: "🎈"; --e2: "🧸"; --e3: "🧩"; --e4: "🪀"; }
body[data-scene="home"] { --bg: linear-gradient(#ffe7c2 0 68%, #c98f5a 68%); --e1: "🖼️"; --e2: "🛋️"; --e3: "🪴"; --e4: "🕰️"; }
body[data-scene="farm"] { --bg: linear-gradient(#bfe9ff 0 55%, #8fd27a 55%); --e1: "☀️"; --e2: "🐓"; --e3: "🚜"; --e4: "🌾"; }
body[data-scene="kitchen"] { --bg: repeating-linear-gradient(45deg, #fff3e0 0 22px, #ffe6bf 22px 44px); --e1: "🍳"; --e2: "🥄"; --e3: "🍅"; --e4: "🫖"; }
body[data-scene="mirror"] { --bg: linear-gradient(#e8e0ff, #f8e8ff); --e1: "🪞"; --e2: "🧼"; --e3: "✨"; --e4: "💫"; }
body[data-scene="family"] { --bg: linear-gradient(#ffe3d1, #ffd0e0); --e1: "🏡"; --e2: "❤️"; --e3: "🌻"; --e4: "🎈"; }

#deco, #deco::before, #deco::after, body::before, body::after { position: fixed; pointer-events: none; z-index: 0; }
#deco { inset: 0; }
body::before, body::after, #deco::before, #deco::after { font-size: 3rem; opacity: 0.6; animation: float 6s ease-in-out infinite; }
body::before { content: var(--e1); top: 4.8rem; right: 5%; }
#deco::before { content: var(--e2); bottom: 6%; left: 4%; animation-delay: -2s; }
#deco::after { content: var(--e3); top: 40%; left: 3%; animation-delay: -4s; }
body::after { content: var(--e4); bottom: 14%; right: 4%; animation-delay: -1s; }

/* ---------- chrome ---------- */
#main { position: relative; z-index: 1; max-width: 760px; margin: 0 auto; padding: 5rem 16px 2.5rem; }
#bar { position: fixed; inset: 0 0 auto 0; z-index: 5; display: flex; align-items: center; gap: 8px; padding: 8px 12px; pointer-events: none; }
#bar > * { pointer-events: auto; }
.icon-btn { position: relative; width: 56px; height: 56px; font-size: 1.6rem; border-radius: 50%; border: 3px solid #fff; background: rgba(255, 255, 255, 0.9); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18); padding: 0; }
#gear { margin-inline-start: auto; }
#gear.alert::after { content: "!"; position: absolute; top: -4px; inset-inline-end: -4px; width: 22px; height: 22px; border-radius: 50%; background: #d62828; color: #fff; font: 700 14px/22px var(--font); }
#lantern { display: flex; align-items: center; gap: 6px; padding: 2px 12px; margin-inline: auto; border-radius: 999px; background: rgba(255, 255, 255, 0.9); border: 3px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18); }
#home:not([hidden]) ~ #gear { margin-inline-start: 0; }
#lantern .lamp { font-size: 1.8rem; opacity: var(--glow, 1); }
#lantern .pips { color: #a35f00; letter-spacing: 0.15em; font-size: 1.1rem; }
#lantern.dim .lamp { animation: dimdown 1.2s; }
#lantern.up .lamp { animation: brighten 0.7s; }
#wash { position: fixed; inset: 0; z-index: 4; pointer-events: none; opacity: 0; transition: opacity 0.35s; }
#wash.on { opacity: 0.5; }
#wash.m { background: var(--m); }
#wash.f { background: var(--f); }

/* ---------- start, map, done ---------- */
.start, .finish { display: flex; flex-direction: column; align-items: center; gap: 1rem; text-align: center; padding-top: 3vh; }
.start .logo, .mascot.big { font-size: 6rem; line-height: 1.2; }
h1 { font-size: 2.6rem; margin: 0; }
h2 { font-size: 2rem; margin: 0; }
.map-title { text-align: center; margin-bottom: 1rem; }
.go { min-height: 72px; padding: 0 2.4rem; font-size: 2rem; font-weight: 800; border-radius: 999px; background: #ffd23f; color: #3a2a00; border: 4px solid #b78a00; box-shadow: 0 5px 0 #b78a00; }
.map { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.station { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 160px; padding: 10px 8px; border-radius: 24px; background: #fff; border: 4px solid var(--line); box-shadow: 0 4px 0 var(--line); }
.station:nth-child(even) { margin-top: 18px; }
.station .num { position: absolute; top: 6px; inset-inline-start: 8px; width: 32px; height: 32px; line-height: 32px; border-radius: 50%; background: var(--ink); color: #fff; font-weight: 700; }
.station .icon { font-size: 3rem; line-height: 1.3; }
.station .t { font-weight: 800; font-size: 1.05rem; line-height: 1.5; }
.station .stars { letter-spacing: 2px; font-size: 1.1rem; }
.stars.big { font-size: 3rem; }
.confetti { position: fixed; top: -3rem; z-index: 2; font-size: 2rem; pointer-events: none; animation: fall 3.2s linear infinite; }

/* ---------- station layout ---------- */
.guide { display: flex; align-items: center; gap: 10px; }
.mascot { position: relative; font-size: 3.4rem; line-height: 1.1; animation: bob 3s ease-in-out infinite; }
.mascot::after { position: absolute; top: -0.5rem; inset-inline-start: -0.5rem; font-size: 1.5rem; }
.mascot[data-mood="think"] { animation: tilt 0.8s ease-in-out 2; }
.mascot[data-mood="think"]::after { content: "💭"; }
.mascot[data-mood="cheer"] { animation: jump 0.7s ease-in-out 3; }
.mascot[data-mood="cheer"]::after { content: "✨"; }
.bubble { flex: 1; display: flex; align-items: center; gap: 0.6rem; padding: 0.3rem 0.8rem; background: #fff; border: 3px solid var(--line); border-radius: 22px; font-size: 1.3rem; font-weight: 800; }
.bubble .txt { flex: 1; }
.replay { border-radius: 50%; border: 3px solid var(--line); background: #fff; font-size: 1.4rem; padding: 0; }
.dots { display: flex; justify-content: center; gap: 6px; margin: 10px 0; }
.dots span { width: 12px; height: 12px; border-radius: 50%; background: rgba(255, 255, 255, 0.8); border: 2px solid var(--ink); }
.dots .done { background: var(--ink); }
.dots .now { transform: scale(1.5); background: #ffd23f; }
.stage { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-top: 8px; min-height: 40vh; }
.foot { position: sticky; bottom: 12px; display: flex; justify-content: center; margin-top: 16px; min-height: 64px; }
.next { min-height: 64px; padding: 0 2.2rem; font-size: 1.6rem; font-weight: 800; border-radius: 999px; background: var(--good); color: #fff; border: 4px solid #0e4a2a; animation: pop 0.5s; }

/* ---------- cards ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(136px, 1fr)); gap: 10px; width: 100%; }
.grid.pairs { grid-template-columns: repeat(2, 1fr); }
.card { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0.3rem 0.4rem; text-align: center; background: #fff; border: 3px solid var(--line); border-radius: 20px; box-shadow: 0 3px 0 var(--line); }
.card .emoji { font-size: 2.2rem; line-height: 1.3; position: relative; }
.ar { font-size: 2.2rem; line-height: 2; font-weight: 600; }
.badge { position: absolute; top: 2px; inset-inline-start: 4px; font-size: 1.1rem; }
.card.seen, .card.found { border-color: var(--good); }
.card.found { background: #e7ffe9; }
.need { display: flex; gap: 4px; font-size: 1.6rem; }
.need span { opacity: 0.25; }
.need .on { opacity: 1; }
.tint-m { background: var(--m); border-color: var(--m-dark); color: var(--m-ink); }
.tint-f { background: var(--f); border-color: var(--f-dark); color: var(--f-ink); }
.hl { background: #ffe066; color: #1c1c1c; border-radius: 0.25em; }
.taa { background: #ffe066; color: var(--f-ink); border-radius: 0.25em; box-shadow: 0 0.1em 0 var(--f-dark); }
.hl.brief { animation: fadehl 2.8s forwards; }
.hl.glow { animation: glowpop 0.9s ease-in-out 2; }
.target { min-width: 150px; border: 4px solid var(--accent); }

/* ---------- gender ---------- */
.gender-board { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; width: 100%; }
.gender-board .card { min-width: 120px; max-width: 190px; }
.side { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 160px; border-radius: 24px; border: 4px solid; font-size: 1.2rem; font-weight: 800; }
.side .kid { font-size: 3.2rem; line-height: 1.2; }
.side-m { background: var(--m); border-color: var(--m-dark); color: var(--m-ink); }
.side-f { background: var(--f); border-color: var(--f-dark); color: var(--f-ink); }
.feedback { display: flex; flex-direction: column; align-items: center; gap: 6px; min-height: 3rem; text-align: center; }
.feedback .big { font-size: 2rem; font-weight: 800; line-height: 1.8; padding: 0.1rem 1rem; border: 3px solid; border-radius: 20px; animation: pop 0.5s; }
.surprise { font-size: 1.3rem; font-weight: 800; animation: pop 0.7s; }
.speaker { width: 72px; height: 72px; padding: 0; border-radius: 50%; font-size: 2rem; background: #fff; border: 4px solid var(--line); }
.listen-head { display: flex; justify-content: center; }

/* ---------- describe, adjectives ---------- */
.choices { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; width: 100%; }
.choice { min-width: 130px; min-height: 76px; padding: 0 1rem; border-radius: 20px; border: 3px solid var(--line); background: #fff; box-shadow: 0 3px 0 var(--line); }
.choices.three .choice { min-width: 100px; padding: 0 0.6rem; }
.arrow-row { display: flex; align-items: center; justify-content: center; gap: 10px; }
.arrow { font-size: 2rem; }
.slot-f { min-width: 110px; }
.slot-f:not(.filled) { border-style: dashed; }
.card:has(.fx) { margin-block: 1.4rem; }
.fx { display: inline-block; }
.fx-kabir { animation: scaleto 1s forwards; --s: 1.9; }
.fx-saghir { animation: scaleto 1s forwards; --s: 0.5; }
.fx-tawil { animation: stretch 1s forwards; transform-origin: center bottom; }
.fx-qasir { animation: squash 1s forwards; transform-origin: center bottom; }
.fx-sari { animation: zoom 1s ease-in; }
.fx-bati { animation: slow 3s ease-in-out forwards; }
.fx-jamil { animation: twinkle 0.9s 3; filter: drop-shadow(0 0 0.5rem gold); }
.fx-jamil::after { content: "✨"; position: absolute; top: -0.6rem; inset-inline-end: -0.8rem; font-size: 1.2rem; }
.fx-qalil { animation: scaleto 1s forwards; --s: 0.6; opacity: 0.7; }
.fx-kathir::before, .fx-kathir::after { content: attr(data-e); animation: pop 0.6s; }
.fx-abyad { filter: grayscale(1) brightness(2) drop-shadow(0 0 4px #888); }
.fx-akhdar { filter: sepia(1) hue-rotate(60deg) saturate(4); }
.matched { background: #fff7d6; }
.sel { outline: 4px solid #ffb400; transform: scale(1.04); }
[data-pair] { border-width: 6px; }
[data-pair="0"] { border-color: #e76f51; }
[data-pair="1"] { border-color: #1f8a7d; }
[data-pair="2"] { border-color: #7b5cd6; }

/* ---------- family, abc, sentence ---------- */
.chip { font-size: 1.5rem; font-weight: 800; background: #fff; border: 3px solid var(--good); border-radius: 999px; padding: 0.2rem 1.2rem; animation: pop 0.5s; }
.link { font-size: 1.3rem; line-height: 2; }
.strip { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; padding: 6px; background: rgba(255, 255, 255, 0.85); border-radius: 16px; width: 100%; }
.strip span { min-width: 28px; text-align: center; font-size: 1.15rem; line-height: 1.8; border-radius: 8px; }
.strip .lit { background: #ffe066; font-weight: 800; }
.slots { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; width: 100%; }
.slot { min-width: 84px; min-height: 64px; border: 3px dashed var(--line); background: rgba(255, 255, 255, 0.6); border-radius: 18px; box-shadow: none; display: flex; align-items: center; justify-content: center; }
.slot.filled { border-style: solid; background: #fff; }
.slot.card { min-height: 100px; font-size: 1.6rem; }
.tile { min-height: 64px; min-width: 72px; padding: 0 1rem; font-size: 1.9rem; line-height: 2; font-weight: 600; text-align: center; background: #fff; border: 3px solid var(--line); border-radius: 18px; box-shadow: 0 3px 0 var(--line); }
.slot.tile { box-shadow: none; }
.slot.tile.filled.tint-m, .tile.tint-m { background: var(--m); border-color: var(--m-dark); color: var(--m-ink); }
.slot.tile.filled.tint-f, .tile.tint-f { background: var(--f); border-color: var(--f-dark); color: var(--f-ink); }
.ghost { opacity: 0.3; }
.bank { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.picture { font-size: 3.4rem; line-height: 1.3; display: flex; gap: 10px; }
.run-strip { position: relative; width: 100%; height: 4.6rem; overflow: hidden; }
.run-strip span { position: absolute; inset-inline: 0; font-size: 3.4rem; line-height: 1.3; animation: cross 2.6s ease-in-out both; }

/* ---------- parent corner ---------- */
dialog { max-width: min(92vw, 440px); padding: 1rem 1.3rem; border: 4px solid var(--line); border-radius: 24px; font-family: var(--font); color: var(--ink); direction: rtl; }
dialog::backdrop { background: rgba(40, 30, 60, 0.5); }
dialog h2 { font-size: 1.6rem; margin-bottom: 0.4rem; }
dialog button { display: block; width: 100%; margin-top: 10px; border-radius: 16px; border: 3px solid var(--line); background: #fff; font-size: 1.1rem; }
dialog .danger { border-color: #b3261e; color: #8c1d18; }
.levels { list-style: none; margin: 0.5rem 0; padding: 0; }
.levels li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.3rem 0; border-bottom: 1px solid var(--line); }
.pips-s { color: #a35f00; white-space: nowrap; }
.hint-note { margin: 0; font-size: 0.95rem; }
.toggle { display: flex; align-items: center; gap: 0.5rem; min-height: 56px; font-size: 1.1rem; }
.toggle input { width: 26px; height: 26px; }
.notice { background: #fff3cd; border-radius: 12px; padding: 0.5rem 0.8rem; font-size: 0.95rem; }

/* ---------- motion ---------- */
.pulse { animation: pulse 1.2s ease-in-out infinite; }
.win { animation: jump 0.6s ease-in-out 2; }
.shake { animation: shake 0.45s; }
@keyframes pulse { 50% { transform: scale(1.07); box-shadow: 0 0 0 8px rgba(255, 255, 255, 0.7); } }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
@keyframes jump { 40% { transform: translateY(-14px) scale(1.05); } }
@keyframes pop { 0% { transform: scale(0.6); opacity: 0; } 70% { transform: scale(1.1); } 100% { transform: scale(1); opacity: 1; } }
@keyframes bob { 50% { transform: translateY(-5px); } }
@keyframes tilt { 25% { transform: rotate(-10deg); } 75% { transform: rotate(10deg); } }
@keyframes float { 50% { transform: translateY(-10px); } }
@keyframes fall { to { transform: translateY(110vh) rotate(360deg); } }
@keyframes dimdown { 0% { transform: scale(1.5); } 100% { transform: scale(1); } }
@keyframes brighten { 0% { transform: scale(0.8); } 100% { transform: scale(1); } }
@keyframes fadehl { 0%, 60% { background: #ffe066; } 100% { background: transparent; } }
@keyframes glowpop { 50% { background: #ffbf00; box-shadow: 0 0 0.5em #ffbf00; } }
@keyframes scaleto { to { transform: scale(var(--s)); } }
@keyframes stretch { to { transform: scaleY(1.9); } }
@keyframes squash { to { transform: scale(1.3, 0.55); } }
@keyframes zoom { 45% { transform: translateX(-140%) skewX(-25deg); filter: blur(3px); } 46% { transform: translateX(140%) skewX(-25deg); } }
@keyframes slow { to { transform: translateX(-30px); } }
@keyframes twinkle { 50% { transform: scale(1.2) rotate(8deg); } }
@keyframes cross { from { transform: translateX(0); } to { transform: translateX(calc(-100% + 4rem)); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; animation-delay: 0s !important; transition-duration: 0.01ms !important; }
  .hl.brief { animation-duration: 2.8s !important; } /* a colour fade, not motion: keep it long enough to see */
  .confetti { display: none; }
}
@media (max-width: 420px) {
  body { font-size: 16px; }
  .ar { font-size: 2rem; }
  .gender-board .card { min-width: 96px; }
  .side .kid { font-size: 2.6rem; }
}
