/* KulliQ — كيبورد الصغار: a bright day sky with white clouds (the owner, 2026-10-30: «ألوان أطفال أكثر»), candy-coloured
   letters with a white outline, big 3D pictures that move, nothing that flashes */
:root {
  --sky1: #63C7FF; --sky2: #CFF0FF; --panel: #FFFFFF; --chip: #EEF6FF; --chipLine: #D3E6FA; --sel: #FFF6CC;
  --ink: #1B2A4A; --soft: #4C5B7A; --dim: #6E7B96;
  --sun: #FFD23F; --sunD: #E0A800; --sunInk: #3A2600; --mint: #2EC4B6; --pink: #FF4D6D;
  --display: "Baloo Bhaijaan 2", "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;
  --emoji: "Noto Color Emoji", "Segoe UI Emoji", "Apple Color Emoji", sans-serif;
  --cloud: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 64'%3E%3Cg fill='%23fff'%3E%3Ccircle cx='32' cy='40' r='20'/%3E%3Ccircle cx='58' cy='28' r='26'/%3E%3Ccircle cx='88' cy='38' r='20'/%3E%3Crect x='30' y='38' width='60' height='22' rx='11'/%3E%3C/g%3E%3C/svg%3E");
  --sky: var(--cloud) 6% 9% / 150px auto no-repeat, var(--cloud) 92% 5% / 190px auto no-repeat, var(--cloud) 78% 44% / 110px auto no-repeat,
    var(--cloud) 12% 90% / 120px auto no-repeat, linear-gradient(180deg, var(--sky1) 0%, var(--sky2) 100%);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--sky2); color: var(--ink); font-family: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, system-ui, sans-serif; }
button { font-family: inherit; cursor: pointer; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- the grown-up's screen: one page. The first screen holds what to learn and a big «ابدأ اللعب», in the middle and
   a little low (dvh: the height a phone's browser bars leave, so the button stays clear of them); «المزيد» opens the
   rest under it ---- */
.setup { position: relative; min-height: 100vh; min-height: 100dvh; background: var(--sky); background-attachment: fixed; }
.first { position: relative; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; padding: 84px 16px 36px; }
.more { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 0 16px 44px; }
/* with «المزيد» open the first screen is only as tall as what is on it, so the rest follows right under the button */
.setup.open .first { min-height: 0; padding-bottom: 16px; }
.back { position: absolute; top: 16px; inset-inline-start: 16px; display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 999px; background: rgba(255, 255, 255, .9); color: var(--ink); text-decoration: none; font-weight: 600; box-shadow: 0 4px 12px rgba(27, 42, 74, .12); }
.back:hover { background: #fff; }
.sHead { display: flex; align-items: center; gap: 16px; width: min(700px, 100%); justify-content: center; }
.logo { flex: 0 0 72px; height: 72px; border-radius: 20px; background: var(--sun); box-shadow: 0 7px 0 var(--sunD); display: flex; align-items: center; justify-content: center; font: 800 42px/1 var(--display); color: var(--sunInk); }
.sHead h1 { margin: 0; font: 800 clamp(30px, 7vw, 50px)/1.15 var(--display); color: var(--ink); }
.sHead p { margin: 2px 0 0; color: var(--soft); font-size: 16px; }
.sCard { width: min(700px, 100%); background: var(--panel); border-radius: 26px; padding: 22px clamp(16px, 4vw, 28px); display: flex; flex-direction: column; gap: 22px; box-shadow: 0 10px 30px rgba(27, 42, 74, .12); }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 12px; font-size: 17px; font-weight: 700; }
.modes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.timers { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.chip { background: var(--chip); border: 2px solid var(--chipLine); border-radius: 16px; color: var(--ink); font-size: 15px; font-weight: 600; min-height: 48px; padding: 10px 6px; }
.chip:hover { border-color: #A9CDF2; }
.chip[aria-pressed="true"] { background: var(--sel); border-color: var(--sun); box-shadow: 0 4px 0 var(--sunD); }
.chip:focus-visible, .start:focus-visible, .switch:focus-visible, .back:focus-visible, .lock:focus-visible, .plBtn:focus-visible, .moreBtn:focus-visible { outline: 3px solid var(--pink); outline-offset: 3px; }
.mode { display: flex; flex-direction: column; align-items: center; gap: 4px; border-radius: 18px; padding: 12px 6px; min-height: 92px; }
.mode .g { font: 800 32px/1.1 var(--display); }
.soundRow { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.soundRow > div { display: flex; flex-direction: column; gap: 2px; }
.soundRow b { font-size: 17px; font-weight: 700; }
.soundRow span { color: var(--soft); font-size: 14px; }
.switch { flex: 0 0 64px; height: 36px; border-radius: 18px; border: 0; padding: 4px; background: #C8D3E6; display: flex; justify-content: flex-start; }
.switch span { width: 28px; height: 28px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); }
.switch[aria-checked="true"] { background: var(--mint); justify-content: flex-end; }
/* the big sun-yellow button, with a little nudge now and then: the first thing a grown-up sees */
.start { width: min(560px, 100%); display: flex; align-items: center; justify-content: center; gap: 12px; border: 0; border-radius: 22px; padding: 18px 0 15px; background: var(--sun); color: var(--sunInk); box-shadow: 0 7px 0 var(--sunD), 0 14px 28px rgba(27, 42, 74, .2); font: 800 32px/1.2 var(--display); }
.start:active { transform: translateY(4px); box-shadow: 0 3px 0 var(--sunD); }
.first .start { animation: nudge 3s ease-in-out 1.5s infinite; }
.first .start:active { animation: none; }
@keyframes nudge { 0%, 76%, 100% { transform: scale(1); } 84% { transform: scale(1.045); } 92% { transform: scale(.99); } }
.moreBtn { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 20px; border: 0; border-radius: 999px; background: rgba(255, 255, 255, .82); color: var(--ink); font-size: 16px; font-weight: 700; box-shadow: 0 4px 12px rgba(27, 42, 74, .1); }
.moreBtn:hover { background: #fff; }
.moreBtn svg { transition: transform .2s; }
.moreBtn[aria-expanded="true"] svg { transform: rotate(180deg); }
.about h2 { margin: 0; font-size: 18px; }
/* what only a computer's keyboard needs, hidden on a phone or a tablet */
@media (pointer: coarse) { .notes .kbOnly { display: none; } }
.notes { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; color: var(--soft); font-size: 15px; line-height: 1.7; }
.notes li { display: flex; align-items: flex-start; gap: 10px; }
.notes svg { flex: 0 0 20px; margin-top: 3px; }
.note { margin: 0; width: min(560px, 100%); font-size: 14px; line-height: 1.7; text-align: center; }
.note.warn { color: #9A4B00; }
.also { width: min(700px, 100%); display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.also a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px; border-radius: 999px; background: rgba(255, 255, 255, .85); color: var(--ink); text-decoration: none; font-size: 15px; font-weight: 600; box-shadow: 0 4px 12px rgba(27, 42, 74, .1); }
.also a:hover { background: #fff; }
.credits { margin: 0; width: min(700px, 100%); color: var(--dim); font-size: 12px; text-align: center; }
.credits a { color: var(--soft); }
/* a phone: a little smaller all round */
@media (max-width: 560px) {
  .first { gap: 16px; padding: 74px 14px 28px; }
  .more { padding: 0 14px 32px; }
  .sHead { gap: 12px; }
  .logo { flex-basis: 52px; height: 52px; font-size: 30px; border-radius: 16px; box-shadow: 0 5px 0 var(--sunD); }
  .sHead h1 { font-size: 30px; }
  .sHead p { font-size: 14px; }
  .sCard { padding: 16px 14px; gap: 16px; border-radius: 22px; }
  legend { margin-bottom: 10px; font-size: 16px; }
  .modes { gap: 8px; }
  .mode { min-height: 74px; padding: 8px 4px; }
  .mode .g { font-size: 26px; }
  .timers { gap: 8px; }
  .chip { font-size: 14px; min-height: 44px; }
  .start { font-size: 28px; padding: 15px 0 12px; }
}

/* ---- the child's screen ---- */
/* --kb: the on-screen keyboard's height (0 without it); --top: room for the top bar's second row on narrow screens */
.play { --kb: 0px; --top: 0px; position: fixed; inset: 0; overflow: hidden; background: var(--sky); touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; overscroll-behavior: none; }
.layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.stage { position: absolute; inset: var(--top) 0 calc(var(--kb) + 18vh); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1vh; pointer-events: none;
  container-type: size; }
/* the letter and its picture side by side, as big as the room left between the buttons and the keyboard allows
   (cqh/cqw: the stage's height and width; the vh sizes before them are for browsers without container units) */
.hero { position: relative; display: flex; align-items: center; justify-content: center; gap: 4vw; }
.big { font: 800 min(18vh, 30vw)/1.2 var(--display); font-size: min(44cqh, 40cqw); color: var(--pink); transform-origin: 50% 55%; white-space: nowrap;
  -webkit-text-stroke: .07em #fff; paint-order: stroke fill; text-shadow: 0 .05em 0 rgba(27, 42, 74, .22); }
.row { display: flex; align-items: center; justify-content: center; gap: 3vw; }
.pic { font-family: var(--emoji); font-size: min(15vh, 26vw); font-size: min(36cqh, 30cqw); line-height: 1; }
.pic.art { display: inline-block; width: 1.15em; height: 1.15em; background-repeat: no-repeat; filter: drop-shadow(0 8px 10px rgba(27, 42, 74, .28)); }
.word { font: 800 min(5.5vh, 8vw)/1.15 var(--display); font-size: min(11cqh, 8cqw); color: var(--ink); white-space: nowrap; -webkit-text-stroke: .08em #fff; paint-order: stroke fill; }
.say { margin-top: .6vh; display: flex; align-items: center; gap: 10px; padding: 7px 20px; border-radius: 999px; background: rgba(255, 255, 255, .92); color: var(--soft); font-size: clamp(15px, 2.4vh, 22px); box-shadow: 0 4px 12px rgba(27, 42, 74, .12); }
.balloons { display: flex; justify-content: center; align-items: flex-start; gap: min(1.6vw, 2vh); gap: min(1.2cqw, 2cqh); }
/* --n: how many balloons (keyboard.js); a few are big, ten still fit in a row */
.balloons { --bw: min(7.4vw, 10vh); }
@supports (width: 1cqh) { .balloons { --bw: min(88cqw / var(--n, 10), 18cqh); } }
.balloon { position: relative; width: var(--bw); animation: rise .6s ease-out both; }
.balloon svg { display: block; width: 100%; height: auto; }
.balloon span { position: absolute; top: 9%; inset-inline: 0; text-align: center; font: 800 calc(var(--bw) * .46)/1.2 var(--display); color: #fff; -webkit-text-stroke: .1em rgba(27, 42, 74, .45); paint-order: stroke fill; }
.line { position: absolute; bottom: calc(var(--kb) + 3vh); left: 50%; transform: translateX(-50%); min-width: min(420px, 80vw); max-width: 92vw; height: 12vh; padding: 0 34px; border-radius: 26px; background: rgba(255, 255, 255, .95); border: 3px solid #BFE2FF; display: flex; align-items: center; justify-content: center; gap: 8px; pointer-events: none; box-shadow: 0 6px 16px rgba(27, 42, 74, .12); }
#typed { font: 800 7vh/1.4 var(--display); color: var(--ink); white-space: pre; overflow: hidden; }
.caret { flex: 0 0 5px; height: 7vh; border-radius: 3px; background: var(--pink); animation: caret 1.1s steps(1) infinite; }
/* the grown-ups' way out: a labelled pill, held for a second */
.lock { position: absolute; top: 2.4vh; left: 2.4vh; z-index: 8; direction: ltr; height: 56px; padding: 0 18px 0 6px; border: 0; border-radius: 28px; background: rgba(255, 255, 255, .88); color: var(--soft); display: flex; align-items: center; gap: 6px; font-size: 16px; font-weight: 600; touch-action: none; box-shadow: 0 4px 12px rgba(27, 42, 74, .14); }
.lock:hover { color: var(--ink); }
.lockIcon { position: relative; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; }
.lockIcon .ring { position: absolute; inset: 0; width: 44px; height: 44px; }
.hint { position: absolute; top: calc(2.4vh + 66px); left: 2.4vh; z-index: 8; padding: 8px 14px; border-radius: 12px; background: #fff; color: var(--ink); font-size: 15px; font-weight: 600; box-shadow: 0 8px 24px rgba(27, 42, 74, .25); pointer-events: none; }
/* the child's buttons: letters, numbers, English */
.modeBar { position: absolute; top: 2vh; left: 50%; transform: translateX(-50%); z-index: 5; display: flex; gap: 16px; }
.modeBar button { width: 72px; height: 64px; padding: 0; border: 0; border-radius: 20px; background: linear-gradient(180deg, rgba(255, 255, 255, .45), rgba(255, 255, 255, 0) 50%), var(--c); color: var(--i); box-shadow: 0 6px 0 var(--d); font: 800 25px/1 var(--display); white-space: nowrap; opacity: .6; transform: scale(.88); transition: transform .15s, opacity .15s; touch-action: none; }
.modeBar button:hover { opacity: .9; }
.modeBar button[aria-pressed="true"] { opacity: 1; transform: scale(1.06); outline: 4px solid #fff; outline-offset: 3px; }
/* a star follows the mouse and leaves sparkles behind */
.play.wandOn, .play.wandOn button { cursor: none; }
.wand { position: absolute; left: 0; top: 0; z-index: 9; width: 46px; height: 46px; margin: -23px 0 0 -23px; pointer-events: none; filter: drop-shadow(0 0 8px rgba(255, 160, 0, .8)); }
.wand svg { display: block; width: 100%; height: 100%; animation: spin 5s linear infinite; }
.clock { position: absolute; top: 2.4vh; right: 2.4vh; z-index: 5; display: flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; background: rgba(255, 255, 255, .88); color: var(--soft); font-size: 15px; pointer-events: none; box-shadow: 0 4px 12px rgba(27, 42, 74, .12); }
.clock.soon { color: #B04A00; }

/* what a press leaves behind */
.p { position: absolute; pointer-events: none; animation: fly .9s cubic-bezier(.2, .7, .3, 1) forwards; }
.p.dot { border-radius: 50%; }
.p.ring { border-radius: 50%; border: 4px solid; }
.p svg { display: block; width: 100%; height: 100%; }
.trail { position: absolute; pointer-events: none; animation: fall .9s ease-out forwards; }
.trail.dot { border-radius: 50%; }
.trail svg { display: block; width: 100%; height: 100%; }
.bubble { position: absolute; border-radius: 50%; border: 3px solid; pointer-events: none; animation: floatUp 2.4s ease-out forwards; }
.ghost { position: absolute; font: 800 12vmin/1 var(--display); pointer-events: none; animation: drift 2.6s ease-out forwards; -webkit-text-stroke: .05em #fff; paint-order: stroke fill; }
.pop { animation: pop .45s cubic-bezier(.2, .9, .3, 1.25) both; }
@keyframes pop { 0% { transform: scale(.5); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes fly { 0% { transform: translate(0, 0) scale(.3); opacity: 1; } 100% { transform: translate(var(--dx), var(--dy)) scale(1) rotate(var(--r)); opacity: 0; } }
@keyframes fall { 0% { opacity: 1; transform: translate(0, 0) scale(1); } 100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(.3) rotate(var(--r)); } }
@keyframes floatUp { 0% { opacity: .9; transform: translateY(0) scale(.6); } 100% { opacity: 0; transform: translateY(-26vh) scale(1.15); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes drift { 0% { opacity: .35; transform: rotate(var(--r)); } 100% { opacity: 0; transform: rotate(var(--r)) translateY(-6vh); } }
@keyframes rise { 0% { transform: translateY(12vh); opacity: 0; } 100% { transform: translateY(0); opacity: 1; } }
@keyframes caret { 0%, 45% { opacity: 1; } 55%, 100% { opacity: 0; } }

/* ---- each thing moves its own way (keyboard.js MOTION) ---- */
.mv-jelly { animation: jelly .7s cubic-bezier(.3, .8, .3, 1.2) both; }
@keyframes jelly { 0% { transform: scale(.3) rotate(-14deg); } 50% { transform: scale(1.14) rotate(6deg); } 75% { transform: scale(.96) rotate(-3deg); } 100% { transform: scale(1) rotate(0); } }
/* the ball: from the child's hands in an arc, then three bounces that squash it. keyboard.js sets where it comes from:
   --from (how far, to the left or the right) and --s (1 from the left, -1 from the right) */
.mv-throw { animation: throwIn 1.9s cubic-bezier(.3, .6, .4, 1) both; }
@keyframes throwIn { 0% { transform: translate(var(--from, -26vw), 4vh) scale(.5) rotate(calc(var(--s, 1) * -220deg)); opacity: 0; } 10% { opacity: 1; }
  42% { transform: translate(calc(var(--from, -26vw) * .42), -12vh) scale(.8) rotate(calc(var(--s, 1) * -100deg)); }
  60% { transform: translate(0, 0) scale(1.1, .84) rotate(0); } 70% { transform: translate(0, -8vh) scale(.95, 1.05); } 80% { transform: translate(0, 0) scale(1.06, .9); }
  87% { transform: translate(0, -3vh); } 94% { transform: translate(0, 0) scale(1.02, .96); } 100% { transform: translate(0, 0) scale(1); } }
.thrower { position: absolute; background-repeat: no-repeat; pointer-events: none; animation: thrower 2s ease-out both; transform-origin: 50% 100%; }
@keyframes thrower { 0% { transform: translateX(calc(var(--s, 1) * -18vw)); opacity: 0; } 14% { transform: translateX(0); opacity: 1; } 26% { transform: rotate(calc(var(--s, 1) * -10deg)) scale(1.04); }
  36% { transform: rotate(calc(var(--s, 1) * 8deg)); } 48% { transform: rotate(0); } 82% { opacity: 1; transform: translateX(0); } 100% { opacity: 0; transform: translateX(calc(var(--s, 1) * -12vw)); } }
.mv-hop { animation: hop 1.6s ease-in-out both; }
@keyframes hop { 0%, 100% { transform: translateY(0) scale(1); } 10% { transform: translateY(0) scale(1.1, .88); } 25% { transform: translateY(-9vh) scale(.95, 1.06); } 40% { transform: translateY(0) scale(1.08, .9); }
  55% { transform: translateY(-6vh); } 70% { transform: translateY(0) scale(1.05, .93); } 82% { transform: translateY(-2.5vh); } 92% { transform: translateY(0); } }
.mv-walk { animation: walk 1.7s linear both; }
@keyframes walk { 0% { transform: translateX(-40vw) rotate(-4deg); opacity: 0; } 10% { opacity: 1; } 20% { transform: translateX(-30vw) translateY(-2vh) rotate(4deg); } 35% { transform: translateX(-21vw) rotate(-4deg); }
  50% { transform: translateX(-12vw) translateY(-2vh) rotate(4deg); } 65% { transform: translateX(-4vw) rotate(-3deg); } 80% { transform: translateX(0) translateY(-1.5vh) rotate(2deg); } 100% { transform: translate(0, 0) rotate(0); } }
.mv-wobble { animation: wobble 1.4s ease-in-out both; transform-origin: 50% 90%; }
@keyframes wobble { 0% { transform: scale(.4); } 15% { transform: scale(1.1) rotate(-16deg); } 30% { transform: rotate(13deg); } 45% { transform: rotate(-9deg); } 60% { transform: rotate(6deg); } 75% { transform: rotate(-3deg); } 100% { transform: rotate(0) scale(1); } }
.mv-swim { animation: swim 1.9s ease-out both; }
@keyframes swim { 0% { transform: translateX(32vw) rotate(0); opacity: 0; } 10% { opacity: 1; } 25% { transform: translateX(21vw) translateY(-2.5vh) rotate(-7deg); } 50% { transform: translateX(9vw) translateY(2.5vh) rotate(7deg); }
  75% { transform: translateX(2vw) translateY(-1vh) rotate(-4deg); } 100% { transform: translateX(0) rotate(0); } }
.mv-launch { animation: launch 1.7s cubic-bezier(.3, .7, .3, 1) both; }
@keyframes launch { 0% { transform: translateY(45vh) scale(.8); } 12% { transform: translateY(44vh) rotate(-2deg); } 18% { transform: translateY(44vh) rotate(2deg); } 55% { transform: translateY(-14vh) scale(1.05); } 72% { transform: translateY(2vh); } 86% { transform: translateY(-2vh); } 100% { transform: translateY(0) scale(1); } }
.mv-fly { animation: flyIn 1.8s cubic-bezier(.25, .7, .3, 1) both; }
@keyframes flyIn { 0% { transform: translateX(46vw) translateY(-9vh) rotate(-10deg); opacity: 0; } 10% { opacity: 1; } 55% { transform: translateX(-5vw) translateY(3vh) rotate(5deg); } 78% { transform: translateX(1.5vw) translateY(-1.5vh) rotate(-3deg); } 100% { transform: translate(0, 0) rotate(0); } }
.mv-buzz { animation: buzz 1.9s ease-in-out both; }
@keyframes buzz { 0% { transform: translate(0, 0) scale(.5); } 12% { transform: translate(7vw, -6vh) rotate(12deg); } 25% { transform: translate(11vw, 2vh) rotate(-10deg); } 37% { transform: translate(4vw, 7vh) rotate(8deg); }
  50% { transform: translate(-7vw, 5vh) rotate(-12deg); } 62% { transform: translate(-11vw, -2vh) rotate(10deg); } 75% { transform: translate(-4vw, -7vh) rotate(-8deg); } 88% { transform: translate(2vw, -1vh) rotate(4deg); } 100% { transform: translate(0, 0) scale(1); } }
.mv-float { animation: floatDown 2.1s ease-in-out both; }
@keyframes floatDown { 0% { transform: translate(-7vw, -32vh) rotate(-35deg); opacity: 0; } 15% { opacity: 1; } 35% { transform: translate(7vw, -19vh) rotate(25deg); } 60% { transform: translate(-5vw, -8vh) rotate(-18deg); } 85% { transform: translate(2vw, -1vh) rotate(8deg); } 100% { transform: translate(0, 0) rotate(0); } }
.mv-rise { animation: riseUp 1.7s ease-out both; }
@keyframes riseUp { 0% { transform: translateY(42vh) scale(.7); } 60% { transform: translateY(-4vh) rotate(5deg); } 80% { transform: translateY(1vh) rotate(-3deg); } 100% { transform: translateY(0) scale(1); } }
.mv-drift { animation: sway 2s ease-in-out both; }
@keyframes sway { 0% { transform: translateX(-20vw) scale(.8); opacity: 0; } 20% { opacity: 1; } 45% { transform: translateX(3vw); } 70% { transform: translateX(-2vw); } 100% { transform: translateX(0) scale(1); } }
.mv-spin { animation: spinIn 1.4s cubic-bezier(.3, .8, .3, 1.1) both; }
@keyframes spinIn { 0% { transform: rotate(-200deg) scale(.4); } 60% { transform: rotate(20deg) scale(1.12); } 100% { transform: rotate(0) scale(1); } }
.mv-shake { animation: shake 1.4s ease-in-out both; }
@keyframes shake { 0% { transform: scale(.5); } 10%, 30%, 50%, 70% { transform: rotate(-12deg) scale(1.04); } 20%, 40%, 60% { transform: rotate(12deg) scale(1.04); } 85% { transform: scale(1.25); } 100% { transform: rotate(0) scale(1); } }
.mv-flip { animation: flip 1.1s cubic-bezier(.3, .8, .3, 1.1) both; }
@keyframes flip { 0% { transform: perspective(500px) rotateY(-200deg) scale(.6); } 100% { transform: perspective(500px) rotateY(0) scale(1); } }
.mv-drop { animation: drop 1.3s cubic-bezier(.5, 0, .5, 1) both; }
@keyframes drop { 0% { transform: translateY(-42vh); } 55% { transform: translateY(0) scale(1.12, .84); } 70% { transform: translateY(-5vh) scale(.95, 1.05); } 85% { transform: translateY(0) scale(1.04, .95); } 100% { transform: translateY(0) scale(1); } }
.mv-wave { animation: wave 1.6s ease-in-out both; transform-origin: 70% 90%; }
@keyframes wave { 0% { transform: scale(.5); } 20%, 60% { transform: rotate(-24deg); } 40%, 80% { transform: rotate(18deg); } 100% { transform: rotate(0) scale(1); } }
.mv-dance { animation: dance 1.6s ease-in-out both; }
@keyframes dance { 0%, 100% { transform: translateY(0) rotate(0); } 20% { transform: translateY(-4vh) rotate(-12deg); } 40% { transform: translateY(0) rotate(9deg); } 60% { transform: translateY(-3vh) rotate(-7deg); } 80% { transform: translateY(0) rotate(5deg); } }
.mv-drive { animation: drive 1.6s cubic-bezier(.3, .7, .3, 1) both; }
@keyframes drive { 0% { transform: translateX(-55vw); } 20% { transform: translateX(-40vw) translateY(-.8vh); } 40% { transform: translateX(-24vw) translateY(0); } 60% { transform: translateX(-8vw) translateY(-.8vh); }
  75% { transform: translateX(2vw) rotate(-3deg); } 88% { transform: translateX(-1vw) rotate(1deg); } 100% { transform: translateX(0) rotate(0); } }
.mv-yoyo { animation: yoyo 1.7s ease-in-out both; }
@keyframes yoyo { 0%, 100% { transform: translateY(0); } 25% { transform: translateY(14vh) rotate(360deg); } 50% { transform: translateY(0) rotate(720deg); } 75% { transform: translateY(9vh) rotate(1080deg); } }
.mv-glow { animation: glow 1.4s ease-in-out 2 both; }
@keyframes glow { 0%, 100% { transform: scale(1); filter: drop-shadow(0 8px 10px rgba(27, 42, 74, .28)); } 50% { transform: scale(1.12); filter: drop-shadow(0 0 26px rgba(255, 200, 60, 1)); } }
.mv-grow { animation: grow 1.2s cubic-bezier(.3, .8, .3, 1.2) both; transform-origin: 50% 100%; }
@keyframes grow { 0% { transform: scale(.15, 0); } 60% { transform: scale(1.1); } 100% { transform: scale(1); } }
.raindrop { position: absolute; width: 6px; height: 14px; margin-left: -3px; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; background: #3A86FF; opacity: .8; pointer-events: none; animation: rain .8s ease-in forwards; }
@keyframes rain { to { transform: translateY(18vh); opacity: 0; } }
.puff { position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .95); box-shadow: 0 2px 6px rgba(27, 42, 74, .15); pointer-events: none; animation: puff 1.1s ease-out forwards; }
@keyframes puff { 0% { transform: scale(.3); opacity: 1; } 100% { transform: scale(1.6) translateY(4vh); opacity: 0; } }
.mnote { position: absolute; font: 800 34px/1 var(--display); pointer-events: none; -webkit-text-stroke: .08em #fff; paint-order: stroke fill; animation: noteUp 1.4s ease-out forwards; }
@keyframes noteUp { 0% { transform: translateY(0) scale(.6); opacity: 1; } 100% { transform: translateY(-16vh) rotate(20deg) scale(1.2); opacity: 0; } }

/* ---- phones and tablets ---- */
/* with the child's keyboard the letter starts under the top row, and the line of what was typed sits on the keyboard */
.play.osk { --top: calc(2.4vh + 76px); }
.play.osk .stage { bottom: calc(var(--kb) + 74px); gap: .4vh; }
.play.osk .line { bottom: calc(var(--kb) + 12px); height: 52px; border-radius: 18px; min-width: min(420px, 88vw); }
.play.osk #typed { font-size: 30px; }
.play.osk .caret { height: 30px; }
/* the room is short there: no «what it says» pill, so the letter and its picture can be bigger */
.play.osk .say { display: none; }
.play.osk .big { font-size: clamp(60px, 12vh, 140px); font-size: min(50cqh, 36cqw); }
.play.osk .pic { font-size: clamp(50px, 10.5vh, 120px); font-size: min(42cqh, 28cqw); }
.play.osk .word { font-size: clamp(22px, 4vh, 40px); font-size: min(13cqh, 8cqw); }
/* numbers: a smaller number, and the balloons under it */
.play.num .big { font-size: min(13vh, 24vw); font-size: min(30cqh, 30cqw); }
/* narrow screens: the child's buttons go under «خروج» and the clock, the letter starts below them... */
@media (max-width: 640px) {
  .play { --top: calc(2.4vh + 118px); }
  .modeBar { top: calc(2.4vh + 64px); }
  .hint { top: calc(2.4vh + 124px); }
  /* ...but with the keyboard every row counts: the child's buttons beside «خروج», and no clock */
  .play.osk { --top: calc(2.4vh + 62px); }
  .play.osk .modeBar { top: 2.4vh; left: auto; right: 2.4vh; transform: none; gap: 10px; }
  .play.osk .modeBar button { width: 60px; height: 50px; font-size: 20px; border-radius: 16px; box-shadow: 0 5px 0 var(--d); }
  .play.osk .clock { display: none; }
  .play.osk .hint { top: calc(2.4vh + 66px); }
}
@media (max-width: 360px) { .play.osk .modeBar button { width: 50px; } }
/* the child's keyboard: candy keys on a white tray, each with its letter and its picture */
.kbd { position: absolute; z-index: 3; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 12px max(10px, env(safe-area-inset-right, 0px)) calc(14px + env(safe-area-inset-bottom, 0px)) max(10px, env(safe-area-inset-left, 0px));
  border-radius: 24px 24px 0 0; background: rgba(255, 255, 255, .92); box-shadow: 0 -6px 24px rgba(27, 42, 74, .14); touch-action: none; }
.kr { width: 100%; max-width: 760px; display: flex; justify-content: center; gap: 6px; }
.kr button { position: relative; flex: 0 1 calc((100% - 36px) / 7); max-width: 96px; height: clamp(46px, 6.6vh, 74px); padding: 0; border: 0; border-radius: 16px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .5) 0%, rgba(255, 255, 255, .1) 46%, rgba(0, 0, 0, .07) 100%), var(--c); color: var(--i);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .75), inset 0 -4px 0 rgba(0, 0, 0, .12), 0 6px 0 var(--d), 0 9px 14px rgba(27, 42, 74, .22);
  font: 800 clamp(22px, 3.4vh, 34px)/1 var(--display); touch-action: none; transition: transform .06s, box-shadow .06s; }
.kr button b { font: inherit; text-shadow: 0 1px 0 rgba(255, 255, 255, .5); pointer-events: none; }
.kr button .kp { flex: none; width: 56%; aspect-ratio: 1; background-repeat: no-repeat; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .3)); pointer-events: none; }
.kr button.down { transform: translateY(5px) scale(.96); box-shadow: inset 0 2px 0 rgba(255, 255, 255, .6), inset 0 -2px 0 rgba(0, 0, 0, .12), 0 1px 0 var(--d), 0 2px 4px rgba(27, 42, 74, .2); }
.kbd.pics .kr:not(.tools) button { height: clamp(56px, 7.8vh, 92px); font-size: clamp(18px, 2.6vh, 30px); }
.kbd.big .kr:not(.tools) button { flex-basis: calc((100% - 24px) / 5); max-width: 130px; height: clamp(62px, 9vh, 100px); font-size: clamp(30px, 4.6vh, 48px); }
.kr.tools { margin-top: 2px; }
.kr.tools button { --c: #E9F0FB; --d: #B8C7E2; --i: #1B2A4A; flex: 0 0 76px; max-width: none; height: 48px; display: flex; align-items: center; justify-content: center; font: 600 15px/1 "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif; }
.kr.tools .space { flex: 1 1 auto; max-width: 520px; color: var(--soft); }
.kr.tools svg { width: 24px; height: 24px; }
/* a phone held sideways: the keyboard on the right half, the letter on the left */
.play.osk.side { --top: calc(2.4vh + 62px); }
.play.osk.side .kbd { top: 0; left: auto; right: 0; width: 56%; justify-content: center; gap: 6px; border-radius: 24px 0 0 24px;
  padding: 8px max(10px, env(safe-area-inset-right, 0px)) 8px 10px; }
.play.osk.side .kbd .kr:not(.tools) button { height: clamp(34px, 14vh, 62px); }
.play.osk.side .kbd.big .kr:not(.tools) button { height: clamp(44px, 20vh, 84px); }
.play.osk.side .kr.tools button { height: clamp(30px, 11vh, 44px); }
.play.osk.side .stage { right: 56%; bottom: 64px; }
.play.osk.side .line { left: 22%; bottom: 10px; height: 46px; min-width: 0; width: 38vw; }
.play.osk.side .modeBar { left: calc(2.4vh + 120px); right: auto; transform: none; top: calc(2.4vh + 6px); gap: 8px; }
.play.osk.side .modeBar button { width: 56px; height: 42px; font-size: 18px; border-radius: 14px; }
.play.osk.side .clock { display: none; }
.play.osk.side .hint { top: calc(2.4vh + 66px); }

/* the grown-up's card on a phone: lock the phone itself */
.phoneLock { width: min(700px, 100%); padding: 16px; border-radius: 22px; border: 3px solid var(--sun); background: var(--panel); display: flex; flex-direction: column; gap: 10px; box-shadow: 0 10px 30px rgba(27, 42, 74, .12); }
.plHead { display: flex; align-items: center; gap: 12px; }
.plIcon { flex: 0 0 40px; height: 40px; border-radius: 12px; background: var(--ink); display: flex; align-items: center; justify-content: center; }
.plHead div { display: flex; flex-direction: column; gap: 2px; }
.plHead b { font-size: 16px; }
.plHead span { color: var(--soft); font-size: 14px; line-height: 1.6; }
.plBtn { display: flex; align-items: center; justify-content: center; min-height: 46px; border: 2px solid var(--chipLine); border-radius: 14px; background: var(--chip); color: var(--ink); text-decoration: none; font-size: 16px; font-weight: 600; }
.plBtn:hover { border-color: #A9CDF2; }
.plLink { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; color: var(--soft); text-decoration: none; font-size: 14px; font-weight: 600; }
.plLink:hover { color: var(--ink); }

/* bedtime and a pause stay dark: the sky has gone to sleep */
.sleep, .paused { position: absolute; inset: 0; z-index: 6; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; background: rgba(21, 23, 61, .9); color: #fff; text-align: center; padding: 16px; }
.sleep h2 { margin: 10px 0 0; font: 800 clamp(34px, 7vh, 60px)/1.2 var(--display); }
.sleep p, .paused p { margin: 0; color: #C3C6EC; font-size: clamp(16px, 2.6vh, 22px); }
.paused .start { width: min(420px, 90vw); }
.plain { margin-top: 10px; min-height: 44px; padding: 0 18px; border: 0; border-radius: 999px; background: rgba(255, 255, 255, .14); color: #C3C6EC; font-size: 16px; font-weight: 600; }
.plain:hover { color: #fff; }

/* ---- the grown-ups' question ---- */
.gateWrap { position: fixed; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(27, 42, 74, .55); }
.gate { width: min(460px, 100%); background: #fff; color: var(--ink); border-radius: 26px; padding: 26px 30px 22px; box-shadow: 0 24px 60px rgba(27, 42, 74, .35); display: flex; flex-direction: column; gap: 16px; }
.gHead { display: flex; align-items: center; gap: 14px; }
.gIcon { flex: 0 0 48px; height: 48px; border-radius: 14px; background: var(--ink); display: flex; align-items: center; justify-content: center; }
.gHead h2 { margin: 0; font-size: 22px; }
.gHead p { margin: 2px 0 0; color: var(--soft); font-size: 15px; }
.q { display: flex; align-items: center; justify-content: center; gap: 16px; background: var(--chip); border-radius: 18px; padding: 14px 10px; }
#question { font-size: 44px; font-weight: 700; letter-spacing: 1px; white-space: nowrap; }
#answer { width: 110px; height: 58px; border-radius: 14px; border: 2px solid var(--chipLine); background: #fff; text-align: center; font-family: inherit; font-size: 34px; font-weight: 700; line-height: 1; color: var(--ink); }
#answer:focus { outline: none; border-color: var(--mint); }
#answer.bad, #answer.bad:focus { border-color: #C62828; }
.gMsg { margin: -6px 0 0; min-height: 1.4em; text-align: center; font-size: 15px; color: #C62828; }
.pad { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.pad button { min-height: 52px; border-radius: 14px; border: 2px solid var(--chipLine); background: #fff; color: var(--ink); font-size: 24px; font-weight: 600; }
.pad button:hover { background: var(--chip); }
.pad .soft { background: var(--chip); color: var(--soft); font-size: 16px; }
.pad .ok { background: var(--mint); border-color: var(--mint); color: #fff; font-size: 16px; }
.pad .ok:hover { background: #22A99D; }
.gFoot { display: flex; flex-direction: column; gap: 6px; }
.bar { height: 6px; border-radius: 3px; background: var(--chipLine); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 3px; background: var(--sun); }
.gRow { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 14px; color: var(--soft); }
.link { border: 0; background: none; color: #1B7C74; font-weight: 600; font-size: 14px; min-height: 44px; padding: 0 4px; }
/* a phone: the question and its answer box on one line */
@media (max-width: 420px) {
  .gate { padding: 22px 18px 18px; }
  #question { font-size: 36px; }
  #answer { width: 88px; height: 52px; font-size: 30px; }
}

@media (prefers-reduced-motion: reduce) {
  .pop, .ghost, .balloon, .wand svg, [class*="mv-"], .thrower, .first .start { animation: none !important; }
  .p, .bubble, .raindrop, .puff, .mnote { animation-duration: .5s; }
  .caret { animation: none; }
}
