/* kids-arcade-a.css: owned by area A1 of the fun and navigation round (tools/kids/FUN.md sections 4 and 5; CONTRACT section 16e). Class prefix ka-.
 * Fly the Kite and Star Catch (platform/kids/js/57-arcade-a.js). The scene, the pictures, the meter, the streak mark and the end panel are LR.fx's (kids-fx.css, prefix kx-):
 * this sheet only places things. Light only; a letter or a word always sits on a card of its own (a white cloud, a coloured star, a white plate), never straight on the scene;
 * nothing blinks or flashes (every loop at rest turns in two seconds or more; the tail's wag for a lift is a slower-than-1-hertz swing for 1.7 s, a movement, not a flash); under
 * prefers-reduced-motion every loop stands still and the script fades instead of moving. */

.ka-game { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 100%; box-sizing: border-box; padding: 2px 0 12px; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.ka-game [hidden] { display: none !important; }
.ka-hud { display: flex; align-items: center; gap: 12px; min-height: var(--kids-target, 56px); }
.ka-hud .key { flex: none; min-width: var(--kids-target, 56px); min-height: var(--kids-target, 56px); padding-inline: 12px; }
.ka-game[data-class="1"] { max-width: 920px; margin-inline: auto; }
.ka-game[data-class="1"] .ka-hud .key { min-width: 72px; min-height: 72px; }
/* A class board and Teach at home put the game in a shrink-to-fit grid (.kc-unit inside the flex .kc-stage): a percentage width would shrink to the HUD's (a 240 px strip). The game has a width of its own there:
   at most 920 px and never wider than the board's stage (the window less the board's margins, border and padding: 60 px); the board zooms the whole game down until its stage holds it. */
.kc-gamehost > .ka-game { width: min(920px, calc(100vw - 60px)); margin-inline: auto; }
.ka-meter { flex: 1 1 auto; min-width: 0; }
.ka-meter .kx-meter { max-width: 460px; }
/* no transition on the stage: its height is set from a script and read back at once (under reduced motion every element eases for 1 ms, which would answer with the old height) */
.ka-stage { width: 100%; height: var(--ka-h, 520px); touch-action: manipulation; transition: none !important; }
.ka-streak { position: absolute; top: 8px; right: 8px; z-index: 3; pointer-events: none; }
.ka-streak .kx-streak { min-width: 0; }

/* Arabic in a game: one element, never wrapped; the mushaf face is 1.76em tall, the dotted Yaa (Amiri Quran) about 2.1em */
.ka-ar { display: block; margin: 0; direction: rtl; line-height: 1.6; padding-block: .1em; white-space: nowrap; word-break: keep-all; overflow-wrap: normal; text-align: center; color: var(--ink); pointer-events: none; }   /* a big letter's line box is taller than its star: a tap on it is the star's, and it never covers a neighbour */
.ka-ar.ar-dots { padding-block: .12em .45em; }

/* ---- Fly the Kite ---- */
.ka-stake { position: absolute; width: 40px; height: 46px; z-index: 1; pointer-events: none; }
.ka-stake .kx-art { width: 100%; height: 100%; }
.ka-string { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; overflow: visible; pointer-events: none; }
.ka-string__line { fill: none; stroke: #4A5751; stroke-width: 2; stroke-linecap: round; opacity: .8; }
.ka-kite { position: absolute; left: 0; top: 0; z-index: 2; pointer-events: none; will-change: translate, rotate; }
.ka-kite .ka-kite__body { display: block; width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 5px 5px rgba(40, 70, 120, .25)); }
/* the tail: a chain of bows, each hanging from the one above, each turning a few degrees (the turns add up to a wave); a new bow arrives at every lift */
.ka-tail { position: absolute; left: 50%; top: 94%; width: 0; height: 0; }
.ka-seg { position: absolute; display: block; left: calc(var(--ka-seg, 24px) * -.5); top: 0; width: var(--ka-seg, 24px); height: calc(var(--ka-seg, 24px) * 1.25); transform-origin: 50% 0;
  --ka-amp: var(--ka-base, 3deg); animation: ka-wag 3.2s ease-in-out calc(var(--i, 0) * -.34s) infinite alternate; }
.ka-seg > .ka-seg { top: calc(var(--ka-seg, 24px) * 1.02); left: 0; }
.ka-seg > .kx-art { display: block; width: 100%; height: 100%; overflow: visible; }
.ka-seg.is-new > .kx-art { animation: ka-bowin .55s cubic-bezier(.3, .7, .4, 1) backwards; transform-origin: 50% 0; }
.ka-kite.is-wave .ka-seg { --ka-amp: calc(var(--ka-base, 3deg) * 2.6); animation-duration: 1.05s; }
@keyframes ka-wag { from { rotate: calc(var(--ka-amp, 3deg) * -1); } to { rotate: var(--ka-amp, 3deg); } }
@keyframes ka-bowin { from { opacity: 0; scale: .2; } 60% { opacity: 1; scale: 1.3; } to { opacity: 1; scale: 1; } }

/* the clouds that carry the choices: a wrapper that is placed (and arrives and leaves), a float that bobs and drifts, the button that is tapped (and bounces or wobbles) */
.ka-clouds { position: absolute; inset: 0; z-index: 2; }
.ka-bank { position: absolute; inset: 0; pointer-events: none; }
.ka-cloud { position: absolute; }
.ka-cloud__float { position: absolute; inset: 0; animation: ka-bob 6.4s ease-in-out infinite alternate; animation-delay: var(--kx-d, 0s); }
.ka-cloud__float.is-hint { animation: ka-bob 6.4s ease-in-out infinite alternate, ka-hint 2.4s ease-in-out infinite alternate; animation-delay: var(--kx-d, 0s), 0s; }
@keyframes ka-bob { 0% { translate: -6px 2px; } 50% { translate: 3px -7px; } 100% { translate: 8px 1px; } }
@keyframes ka-hint { from { scale: 1; } to { scale: 1.07; } }
.ka-cloud__btn {
  appearance: none; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; margin: 0; padding: 0; border: 0; border-radius: 42%;
  background: none; color: var(--ink); font-size: var(--ka-fs, 48px); cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.ka-cloud__btn > .kx-art { position: absolute; inset: 0; display: block; width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 6px 7px rgba(30, 60, 110, .2)); }
.ka-cloud__btn .ka-cl { stroke-width: 4px; vector-effect: non-scaling-stroke; }
.ka-cloud__ar { position: relative; z-index: 1; line-height: 1.3; padding-block: .06em; }
.ka-cloud__btn:hover > .kx-art { filter: drop-shadow(0 6px 7px rgba(30, 60, 110, .2)) brightness(1.03); }
.ka-cloud__btn:active { transform: scale(.97); }
.ka-cloud__btn[aria-disabled="true"] { pointer-events: none; }

/* ---- Star Catch ---- */
.ka-field { position: absolute; inset: 0; z-index: 1; touch-action: pan-y; }
/* the basket follows a finger anywhere on the stage, whatever the angle: nothing there scrolls (a steep drag would otherwise be taken for a page scroll and the basket would stop) */
[data-input="basket"] .ka-stage, [data-input="basket"] .ka-field { touch-action: none; }
[data-input="basket"] .ka-stage { cursor: ew-resize; }
.ka-star { position: absolute; left: 0; top: 0; will-change: translate; }
.ka-star__spin { position: absolute; inset: 0; transform-origin: 50% 50%; }
.ka-star__face { appearance: none; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; margin: 0; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--ink); font-size: var(--ka-fs, 36px); }
button.ka-star__face { cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.ka-star__face > .kx-art { position: absolute; inset: -4%; display: block; width: 108%; height: 108%; overflow: visible; filter: drop-shadow(0 4px 6px rgba(20, 10, 70, .4)); }
.ka-sb, .ka-sh { stroke: var(--kx-c-deep); stroke-width: 5.5; stroke-linejoin: round; }
.ka-star__ar { position: relative; z-index: 1; margin: 0; line-height: 1.3; padding-block: .06em; }
.ka-plate { position: relative; z-index: 1; display: flex; align-items: center; padding: 0 .32em; border-radius: 999px; background: #fff; box-shadow: 0 0 0 3px var(--kx-c-deep); }
.ka-plate .ka-star__ar { translate: none !important; }
.ka-basket { position: absolute; left: 0; bottom: 6px; z-index: 2; pointer-events: none; will-change: translate, rotate; transform-origin: 50% 85%; }
.ka-basket .ka-basket__art { position: absolute; inset: 0; display: block; width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 5px 6px rgba(20, 10, 70, .4)); }
.ka-basket:focus-visible { outline: 3px solid var(--lapis, #1F4E8C); outline-offset: 3px; border-radius: 16px; }
.ka-pile { position: absolute; left: 12%; width: 76%; bottom: 52%; height: 46%; }
.ka-pile__star { position: absolute; display: block; translate: -50% 0; }
.ka-pile__star > .kx-art { width: 100%; height: 100%; }
.ka-basket__target { position: absolute; left: 50%; bottom: 9%; translate: -50% 0; display: flex; align-items: center; justify-content: center; border-radius: 999px; background: #fff; box-shadow: 0 0 0 3px var(--kx-amber-deep); color: var(--ink); }
.ka-basket__target .ka-ar { flex: none; line-height: 1; padding: 0; }   /* the plate's size is the script's (its width and height): the letter is centred by its ink and may overflow its line box */
.ka-info { position: absolute; top: 8px; left: 8px; z-index: 3; display: flex; flex-wrap: wrap; gap: 6px; max-width: calc(100% - 130px); pointer-events: none; }
.ka-pill { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 2px 12px 2px 8px; border-radius: 999px; background: #fff; color: var(--ink);
  font: 700 var(--t-sm, .9375rem)/1.3 var(--font-body, sans-serif); font-variant-numeric: tabular-nums; box-shadow: inset 0 0 0 2px var(--kx-violet-deep); }
.ka-time { padding-left: 12px; box-shadow: inset 0 0 0 2px var(--kx-amber-deep); }
.ka-pill .kx-art { width: 22px; height: 22px; }

/* a Little reader and a class board: bigger everything (the sizes themselves come from the script, by the stage) */
.ka-game[data-class="1"] .ka-streak .kx-streak { min-height: 48px; }

/* ---- reduced motion: nothing loops or moves; the script fades instead ---- */
@media (prefers-reduced-motion: reduce) {
  .ka-seg, .ka-cloud__float, .ka-cloud__float.is-hint, .ka-star__spin { animation: none !important; }
  .ka-seg.is-new > .kx-art { animation: kx-fade .3s linear backwards !important; }
  .ka-kite, .ka-star, .ka-basket { will-change: auto; }
}
