/* KulliQ — المزرعة السحرية: a day sky over green hills, a red barn, and 3D animals (Fluent Emoji) that move and sound
   when touched; at night the sky goes dark blue with the moon and stars. The grown-ups' screen, the way out and the
   overlays are those of «كيبورد الصغار» (games/keyboard/keyboard.css), kept here so each game stands on its own. */
:root {
  --sky1: #5EC4FF; --sky2: #D8F4FF; --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;
  --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) 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: the game's name and a big «ابدأ اللعب» in the middle; «المزيد» opens the rest ---- */
.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: 22px; padding: 84px 16px 36px; }
.more { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 0 16px 44px; }
.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; flex-direction: column; align-items: center; gap: 12px; width: min(700px, 100%); text-align: center; }
.logo { width: clamp(120px, 30vw, 170px); height: auto; filter: drop-shadow(0 12px 16px rgba(30, 94, 154, .25)); }
.sHead h1 { margin: 0; font: 800 clamp(36px, 9vw, 60px)/1.15 var(--display); color: var(--ink); -webkit-text-stroke: .1em #fff; paint-order: stroke fill; }
.sHead p { margin: 2px 0 0; color: var(--soft); font-size: 17px; font-weight: 600; }
.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; }
.timers { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.timers.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.timers.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.timers.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.hintLine { margin: 10px 0 0; color: var(--soft); font-size: 14px; line-height: 1.7; }
/* at bedtime, on the first screen: what is going to happen */
.bedNote { width: min(560px, 100%); margin: 0; display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 18px;
  background: rgba(21, 23, 61, .9); color: #fff; font-size: 15px; font-weight: 600; line-height: 1.7; box-shadow: 0 8px 20px rgba(21, 23, 61, .25); }
.bedNote svg { flex: 0 0 26px; }
.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; }
.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; }
.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; }
@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); }
.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; }
@media (max-width: 560px) {
  .first { gap: 18px; padding: 74px 14px 28px; }
  .more { padding: 0 14px 32px; }
  .sCard { padding: 16px 14px; gap: 16px; border-radius: 22px; }
  legend { margin-bottom: 10px; font-size: 16px; }
  .timers { gap: 8px; }
  .chip { font-size: 14px; min-height: 44px; }
  .start { font-size: 28px; padding: 15px 0 12px; }
}

/* ---- the farm ---- */
.play { position: fixed; inset: 0; overflow: hidden; background: linear-gradient(180deg, #5EC4FF 0%, #A9E3FF 58%, #D8F4FF 100%);
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; overscroll-behavior: none; }
.scene { position: absolute; inset: 0; }
.nightSky { position: absolute; inset: 0; background: linear-gradient(180deg, #121A44 0%, #24336E 58%, #3A4B8A 100%); opacity: 0; transition: opacity 1.6s ease; }
.play.night .nightSky { opacity: 1; }
.land { position: absolute; left: 0; top: 0; width: 100%; height: 100%; transition: filter 1.6s; }
.play.night .land { filter: brightness(.62) saturate(.8); }
@media (orientation: portrait) { .land.wide { display: none; } }
@media (orientation: landscape) { .land.tall { display: none; } }
.things { position: absolute; inset: 0; }
/* each thing: where it stands and how wide, in % of the screen: held sideways (--x --y --w) and upright (--px --py --pw) */
.t { position: absolute; left: var(--x); top: var(--y); width: var(--w); aspect-ratio: 1; cursor: pointer; -webkit-tap-highlight-color: transparent; transition: opacity .9s; }
@media (orientation: portrait) { .t { left: var(--px, var(--x)); top: var(--py, var(--y)); width: var(--pw, var(--w)); } .t.wideOnly { display: none; } }
.t .pic { position: absolute; inset: 0; background-repeat: no-repeat; transform: scaleX(var(--f, 1)); pointer-events: none;
  filter: drop-shadow(0 6px 6px rgba(27, 42, 74, .25)); transition: filter 1.6s; }
.play.night .t:not(.nightOnly) .pic, .play.night .barn svg { filter: brightness(.68) saturate(.85) drop-shadow(0 6px 6px rgba(0, 0, 0, .25)); }
.t.barn { aspect-ratio: 200 / 180; }
.t.barn svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; transition: filter 1.6s; }
.barn .doorL, .barn .doorR { transform-box: fill-box; transition: transform .5s cubic-bezier(.3, .8, .3, 1.2); }
.barn .doorL { transform-origin: left center; }
.barn .doorR { transform-origin: right center; }
.barn.open .doorL, .barn.open .doorR { transform: scaleX(.12); }
.play.night .barn .win { fill: #FFE27A; }
/* the animal that comes out of the barn, at its door */
.barn .guest { inset: auto 34% 2% 18%; width: auto; aspect-ratio: 1; opacity: 0; transform-origin: 50% 100%; }
/* a soft shadow on the grass under what stands on it: the 3D pictures sit on the land instead of floating over it */
.t.ground::before { content: ""; position: absolute; left: 10%; right: 10%; bottom: -5%; height: 16%; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(24, 70, 22, .42), rgba(24, 70, 22, 0)); pointer-events: none; }
.play.night .t.ground::before { opacity: .55; }
/* the hen peeks out of her house */
.mv-peek { animation: peek .7s cubic-bezier(.3, .8, .3, 1.3) both; transform-origin: 50% 100%; }
@keyframes peek { 0% { transform: translateY(40%) scale(.3); opacity: 0; } 60% { transform: translateY(-12%) scale(1.08); opacity: 1; } 100% { transform: none; opacity: 1; } }
/* after the barn has said its name */
.barn.open .guest { animation: guest 3.4s ease-in-out 1.1s both; }
@keyframes guest { 0% { opacity: 0; transform: translateY(10%) scale(.4); } 14% { opacity: 1; transform: translateY(-18%) scale(1.08); } 22% { transform: translateY(0) scale(1); }
  40% { transform: translateY(-10%) rotate(-6deg); } 52% { transform: translateY(0) rotate(4deg); } 64% { transform: rotate(0); } 86% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(.4); } }
.t.pond { aspect-ratio: 2.6; }
.t.rainbow { opacity: 0; pointer-events: none; }
.t.rainbow.on { opacity: 1; pointer-events: auto; }
/* day things fade away at night, night things come out */
.play.night .t.dayOnly { opacity: 0; pointer-events: none; }
.t.nightOnly { opacity: 0; pointer-events: none; }
.play.night .t.nightOnly { opacity: 1; pointer-events: auto; }
.t.gone { opacity: 0; pointer-events: none; }
/* asleep at night */
.zz { position: absolute; top: -26%; left: 28%; font: 800 clamp(18px, 2.6vmax, 30px)/1 var(--display); color: #fff; text-shadow: 0 2px 6px rgba(0, 0, 0, .35); opacity: 0; transition: opacity 1s; pointer-events: none; white-space: nowrap; }
.play.night .t.sleeps .zz { opacity: 1; animation: zz 2.4s ease-in-out infinite; }
@keyframes zz { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

/* the rooster, the farm's leader: a crown on his head (he faces right, his picture turned), a ring calling the child
   to wake him at bedtime, and a little bob while he talks */
.t .pic.crown { inset: auto; left: 55%; top: -20%; width: 34%; height: 34%; transform: rotate(12deg); filter: drop-shadow(0 3px 3px rgba(27, 42, 74, .3)); }
.t.lead .zz { left: -4%; top: -12%; }
.t.call::after { content: ""; position: absolute; inset: -16%; border-radius: 50%; border: 4px solid rgba(255, 226, 122, .9); pointer-events: none;
  animation: call 1.8s ease-out infinite; }
@keyframes call { 0% { transform: scale(.7); opacity: 0; } 30% { opacity: 1; } 100% { transform: scale(1.25); opacity: 0; } }
.t.talking > .pic:first-child { animation: talk .5s ease-in-out infinite alternate; transform-origin: 50% 100%; }
@keyframes talk { from { transform: scaleX(var(--f, 1)); } to { transform: scaleX(var(--f, 1)) scale(1.03, .96) translateY(2%); } }

/* bedtime: the animals awake under the night sky while the child plays, then asleep one by one (doze) with a nod, and
   the farm darkens, a little while the rooster says good night, then slowly through the lullaby */
.play.bed.awake .t.sleeps .zz { opacity: 0; }
.play.bed.awake .t.sleeps.doze .zz { opacity: 1; animation: zz 2.4s ease-in-out infinite; }
.mv-nod { animation: nod 1.6s ease-in-out both; transform-origin: 50% 100%; }
@keyframes nod { 0%, 100% { transform: none; } 35% { transform: rotate(-5deg) scale(1.02, .95); } 70% { transform: rotate(3deg) scale(.99, 1.01); } }
.dim { position: absolute; inset: 0; background: #050817; opacity: 0; pointer-events: none; transition: opacity 1s; }
.play.winding .dim { opacity: .3; transition: opacity 10s ease; }
.play.dark .dim { opacity: .86; transition: opacity 150s linear; }
.play.winding .lock, .play.winding .clock { opacity: .4; }

/* what each thing does when touched (farm.js MOTION); the moving part is the thing's box, so a picture turned to face
   the other way (--f) stays turned */
.mv-hop { animation: hop 1.1s ease-in-out both; }
@keyframes hop { 0%, 100% { transform: translateY(0) scale(1); } 12% { transform: translateY(0) scale(1.1, .88); } 30% { transform: translateY(-38%) scale(.95, 1.06); }
  48% { transform: translateY(0) scale(1.08, .9); } 64% { transform: translateY(-16%); } 80% { transform: translateY(0) scale(1.03, .96); } }
.mv-jump { animation: jump 1s cubic-bezier(.3, .6, .4, 1) both; }
@keyframes jump { 0%, 100% { transform: translate(0, 0); } 15% { transform: translate(0, 0) scale(1.12, .85); } 45% { transform: translate(-30%, -90%) rotate(-12deg); } 75% { transform: translate(0, 0) scale(1.1, .9); } }
.mv-wobble { animation: wobble 1.2s ease-in-out both; transform-origin: 50% 95%; }
@keyframes wobble { 0%, 100% { transform: rotate(0); } 15% { transform: rotate(-14deg) scale(1.06); } 30% { transform: rotate(11deg); } 45% { transform: rotate(-8deg); } 60% { transform: rotate(5deg); } 75% { transform: rotate(-2deg); } }
.mv-wag { animation: wag .9s ease-in-out both; transform-origin: 50% 95%; }
@keyframes wag { 0%, 100% { transform: rotate(0); } 20%, 60% { transform: rotate(-7deg) translateY(-6%); } 40%, 80% { transform: rotate(7deg); } }
.mv-gallop { animation: gallop 1.4s ease-in-out both; }
@keyframes gallop { 0%, 100% { transform: translate(0, 0) rotate(0); } 15% { transform: translate(-20%, -20%) rotate(-8deg); } 30% { transform: translate(-40%, 0); } 45% { transform: translate(-60%, -20%) rotate(-8deg); }
  60% { transform: translate(-40%, 0) scaleX(-1); } 75% { transform: translate(-20%, -16%) scaleX(-1); } 90% { transform: translate(0, 0) scaleX(-1); } }
.mv-walk { animation: walk 1.6s ease-in-out both; }
@keyframes walk { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-8%) translateY(-4%) rotate(-3deg); } 40% { transform: translateX(-16%) rotate(3deg); }
  60% { transform: translateX(-8%) translateY(-4%) rotate(-3deg); } 80% { transform: translateX(0) rotate(2deg); } }
.mv-swim { animation: swim 1.8s ease-in-out both; }
@keyframes swim { 0%, 100% { transform: translateX(0) rotate(0); } 25% { transform: translateX(-30%) rotate(-6deg); } 50% { transform: translateX(-10%) translateY(-6%) rotate(5deg); } 75% { transform: translateX(20%) rotate(-4deg); } }
.mv-drive { animation: drive 2.6s ease-in-out both; }
@keyframes drive { 0%, 100% { transform: translateX(0); } 10% { transform: translateX(0) rotate(-2deg); } 40% { transform: translateX(-120%) translateY(-2%); } 50% { transform: translateX(-130%) rotate(1deg); }
  85% { transform: translateX(-10%) translateY(-2%); } }
.mv-buzz { animation: buzz 1.9s ease-in-out both; }
@keyframes buzz { 0%, 100% { transform: translate(0, 0); } 15% { transform: translate(-120%, -80%) rotate(14deg); } 32% { transform: translate(-240%, 10%) rotate(-10deg); } 50% { transform: translate(-140%, 90%) rotate(8deg); }
  68% { transform: translate(-40%, 40%) rotate(-12deg); } 84% { transform: translate(-60%, -40%) rotate(8deg); } }
.mv-flutter { animation: flutter 2s ease-in-out both; }
@keyframes flutter { 0%, 100% { transform: translate(0, 0) scale(1); } 20% { transform: translate(-60%, -90%) scale(.9, 1); } 40% { transform: translate(-150%, -40%) scale(1.05); } 60% { transform: translate(-90%, 30%) scale(.9, 1); } 80% { transform: translate(-30%, -30%) scale(1.05); } }
.mv-fly { animation: flyAbout 2.4s ease-in-out both; }
@keyframes flyAbout { 0%, 100% { transform: translate(0, 0); } 20% { transform: translate(-80%, -160%) rotate(-10deg); } 45% { transform: translate(-260%, -220%) scaleX(-1); } 70% { transform: translate(-120%, -100%) scaleX(-1); } 90% { transform: translate(-20%, -20%); } }
.mv-sway { animation: sway 1.4s ease-in-out both; transform-origin: 50% 100%; }
@keyframes sway { 0%, 100% { transform: rotate(0) scale(1); } 20% { transform: rotate(-12deg) scale(1.12); } 45% { transform: rotate(10deg) scale(1.06); } 70% { transform: rotate(-5deg); } }
.mv-shake { animation: shake .9s ease-in-out both; transform-origin: 50% 100%; }
@keyframes shake { 0%, 100% { transform: rotate(0); } 15%, 45%, 75% { transform: rotate(-4deg); } 30%, 60%, 90% { transform: rotate(4deg); } }
.mv-jelly { animation: jelly .7s cubic-bezier(.3, .8, .3, 1.2) both; }
@keyframes jelly { 0% { transform: scale(.6) rotate(-10deg); } 50% { transform: scale(1.18) rotate(5deg); } 75% { transform: scale(.95) rotate(-3deg); } 100% { transform: scale(1) rotate(0); } }
.mv-twinkle { animation: twinkle 1.2s ease-in-out both; }
@keyframes twinkle { 0%, 100% { transform: scale(1) rotate(0); filter: none; } 40% { transform: scale(1.5) rotate(20deg); filter: drop-shadow(0 0 14px #FFE27A); } }
.mv-drift { animation: cloudDrift 2.6s ease-in-out both; }
@keyframes cloudDrift { 0%, 100% { transform: translateX(0); } 40% { transform: translateX(-30%) scale(1.06); } 70% { transform: translateX(16%); } }
.mv-glow { animation: glow 1.6s ease-in-out both; }
@keyframes glow { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.1); filter: drop-shadow(0 0 22px rgba(255, 215, 80, .95)); } }
.mv-crack { animation: crack .8s ease-in-out both; transform-origin: 50% 100%; }
@keyframes crack { 0%, 100% { transform: rotate(0); } 15%, 55% { transform: rotate(-14deg); } 35%, 75% { transform: rotate(14deg); } }
.mv-chick { animation: chick 3.2s ease-in-out both; }
@keyframes chick { 0% { transform: scale(.6); } 12% { transform: scale(1.2) translateY(-20%); } 20% { transform: scale(1); } 40% { transform: translateX(-60%) translateY(-10%); } 55% { transform: translateX(-90%); } 75% { transform: translateX(-120%) translateY(-10%); } 100% { transform: translateX(-150%); opacity: 0; } }
.mv-grow { animation: grow 1s cubic-bezier(.3, .8, .3, 1.2) both; transform-origin: 50% 100%; }
@keyframes grow { 0% { transform: scale(.1, 0); } 60% { transform: scale(1.1); } 100% { transform: scale(1); } }
/* an apple falls to the grass under the tree (--fall: how far, set by farm.js) and bounces */
.mv-fall { animation: fall 1.1s cubic-bezier(.5, 0, .5, 1) both; }
@keyframes fall { 0% { transform: translateY(0); } 60% { transform: translateY(var(--fall)) scale(1.15, .85); } 72% { transform: translateY(calc(var(--fall) - 40%)) scale(.95, 1.05); }
  86% { transform: translateY(var(--fall)) scale(1.05, .95); } 100% { transform: translateY(var(--fall)) translateX(-30%) rotate(-90deg); } }
.t.down { transform: translateY(var(--fall)) translateX(-30%) rotate(-90deg); }
/* the sun goes down and the moon comes up, and back */
.mv-set { animation: set 1.4s ease-in both; }
@keyframes set { to { transform: translateY(80%) scale(.7); opacity: 0; } }
.mv-up { animation: up 1.2s cubic-bezier(.3, .8, .3, 1.1) both; }
@keyframes up { from { transform: translateY(80%) scale(.7); opacity: 0; } to { transform: none; opacity: 1; } }

/* what a touch leaves behind */
.layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.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: sparkFall .9s ease-out forwards; }
.trail.dot { border-radius: 50%; }
.trail svg { display: block; width: 100%; height: 100%; }
@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 sparkFall { 0% { opacity: 1; transform: translate(0, 0) scale(1); } 100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(.3) rotate(var(--r)); } }
@keyframes spin { to { transform: rotate(360deg); } }
.raindrop { position: absolute; width: 7px; height: 16px; margin-left: -3px; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; background: #3A86FF; opacity: .85; pointer-events: none; animation: rain var(--d, .9s) ease-in forwards; }
@keyframes rain { to { transform: translateY(var(--to, 40vh)); opacity: 0; } }
.ripple { position: absolute; border-radius: 50%; border: 4px solid rgba(255, 255, 255, .9); pointer-events: none; animation: ripple 1.2s ease-out forwards; }
@keyframes ripple { 0% { transform: scale(.2); opacity: 1; } 100% { transform: scale(2.4, 1.2); opacity: 0; } }
/* a flower that grows where the grass is touched, then fades */
.bloom { position: absolute; background-repeat: no-repeat; pointer-events: none; transform-origin: 50% 100%; animation: bloom 6s ease-out forwards; filter: drop-shadow(0 4px 4px rgba(27, 42, 74, .2)); }
@keyframes bloom { 0% { transform: scale(.1, 0); } 12% { transform: scale(1.12); } 18% { transform: scale(1); } 85% { opacity: 1; } 100% { opacity: 0; transform: scale(.9); } }

/* the word, in Arabic and English */
.say { position: absolute; z-index: 5; left: 50%; transform: translateX(-50%); bottom: calc(18px + env(safe-area-inset-bottom, 0px)); max-width: 92vw; display: flex; align-items: baseline; gap: 10px;
  padding: 8px 24px; border-radius: 999px; background: rgba(255, 255, 255, .94); box-shadow: 0 4px 12px rgba(27, 42, 74, .14); pointer-events: none; white-space: nowrap; }
.say span { font: 800 clamp(24px, 4.4vh, 38px)/1.3 var(--display); color: var(--ink); }
.say small { font: 700 clamp(15px, 2.6vh, 22px)/1 "IBM Plex Sans Arabic", sans-serif; color: var(--soft); }
.say.pop { animation: sayPop .4s cubic-bezier(.2, .9, .3, 1.3) both; }
@keyframes sayPop { from { transform: translateX(-50%) scale(.6); opacity: 0; } to { transform: translateX(-50%) scale(1); opacity: 1; } }

/* the rooster's words, in a bubble over him (farm.js places it; --tail: where its point is) */
.bubble { position: absolute; z-index: 5; left: 0; top: 0; max-width: min(84vw, 440px); padding: 12px 20px 10px; border-radius: 22px; background: #fff;
  color: var(--ink); font: 800 clamp(18px, 3vh, 26px)/1.45 var(--display); text-align: center; pointer-events: none;
  box-shadow: 0 10px 26px rgba(27, 42, 74, .25); transform-origin: var(--tail, 50%) 100%; }
.bubble::after { content: ""; position: absolute; left: calc(var(--tail, 50%) - 11px); top: calc(100% - 1px); border: 11px solid transparent; border-top-color: #fff; border-bottom: 0; }
.bubble.below { transform-origin: var(--tail, 50%) 0; }
.bubble.below::after { top: auto; bottom: calc(100% - 1px); border-top: 0; border-bottom: 11px solid #fff; }
.bubble.pop { animation: bubblePop .35s cubic-bezier(.2, .9, .3, 1.3) both; }
@keyframes bubblePop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* bedtime: sheep jump a little fence one by one, slowly, each counted at the top of its jump */
.dream { position: absolute; z-index: 4; left: 50%; bottom: calc(12vh + env(safe-area-inset-bottom, 0px)); width: min(80vw, 560px); height: min(28vh, 220px);
  transform: translateX(-50%); pointer-events: none; }
.dream .fence { position: absolute; left: 50%; bottom: 0; width: 22%; height: auto; transform: translateX(-50%); opacity: .8; }
.sheep { position: absolute; left: 50%; bottom: 2%; width: 22%; aspect-ratio: 1; margin-left: -11%; background-repeat: no-repeat;
  filter: brightness(.82) drop-shadow(0 4px 6px rgba(0, 0, 0, .35)); animation: sheepJump 5.6s linear both; }
@keyframes sheepJump { 0% { transform: translateX(210%); opacity: 0; } 10% { opacity: 1; } 36% { transform: translateX(70%) translateY(0); }
  50% { transform: translateX(0) translateY(-62%) rotate(-8deg); } 64% { transform: translateX(-70%) translateY(0); } 90% { opacity: 1; }
  100% { transform: translateX(-210%); opacity: 0; } }
.count { position: absolute; left: 50%; bottom: 70%; font: 800 clamp(26px, 5vh, 44px)/1 var(--display); color: #FFE9A8;
  text-shadow: 0 2px 10px rgba(0, 0, 0, .45); animation: count 2.6s ease-out both; }
@keyframes count { 0% { opacity: 0; transform: translate(-50%, 12px) scale(.7); } 25% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -26px); } }

/* the grown-ups' way out, the clock, the star that follows the mouse */
.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; }
.play.wandOn, .play.wandOn .t { 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; }
@media (max-width: 640px) { .clock { display: none; } }

/* bedtime and a pause */
.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); }
/* the good-night screen at bedtime: almost black, nothing bright to keep a child awake */
.sleep.bed { background: rgba(4, 6, 18, .97); }
.sleep.bed svg { opacity: .55; }
.sleep.bed h2 { color: #B9BDE6; }
.sleep.bed p { color: #6F74A8; }
.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; }
@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) {
  [class*="mv-"], .first .start, .wand svg, .barn.open .guest, .play.night .t.sleeps .zz, .play.bed.awake .t.sleeps.doze .zz,
  .t.call::after, .t.talking > .pic:first-child { animation: none !important; }
  .t.call::after { opacity: 1; }
  .barn.open .guest { opacity: 1; }
  .p, .raindrop, .ripple, .bloom { animation-duration: .5s; }
}
