/* Tika kit – sovica Tika (moods, costumes, talking). Motion is the same as in "Učimo sat":
   bob 3.2 s, blink 5 s, hop .45 s, wing flaps .3 s, tilt .6 s, beak .2 s. */

.tika { position: relative; display: block; width: 100%; max-width: 100%; -webkit-tap-highlight-color: transparent; }
.tika[data-fit="all"] { aspect-ratio: 164 / 208; }
.tika[data-fit="all"] > .tk-owl { position: absolute; left: 7.317%; top: 22.115%; width: 85.366%; height: auto; }
@supports not (aspect-ratio: 1 / 1) {
  .tika[data-fit="all"]::before { content: ""; display: block; padding-top: 126.83%; }
}
.tika-btn { cursor: pointer; border-radius: 24px; }
.tika-btn:focus-visible { outline: 4px solid var(--sky, #2A6EE5); outline-offset: 4px; }
.tika-btn:active > .tk-owl { transform: scale(.96); }

.tk-owl { display: block; width: 100%; height: auto; overflow: visible; transition: transform .12s ease; }
.tk-owl * { transform-box: view-box; }
.tk-noclock .tk-pc { display: none; }

/* ---------- base motion (idle) */
.tk-owl .tk-in { animation: tk-bob 3.2s ease-in-out infinite; }
.tk-owl .tk-eyes-open { transform-origin: 70px 64px; animation: tk-blink 5s infinite; animation-delay: var(--tk-blink-delay, 0s); }
.tk-owl .tk-pupils {
  transform: translate(calc(var(--tk-mx, 0px) + var(--tk-fx, 0px)), calc(var(--tk-my, 0px) + var(--tk-fy, 0px)));
  transition: transform .25s ease;
}
.tk-owl .tk-pupil, .tk-owl .tk-glint, .tk-owl .tk-eye-w { transform-box: fill-box; transform-origin: center; transition: transform .2s ease; }
.tk-owl .tk-eyes-happy { display: none; }
.tk-owl .tk-wl { transform-origin: 22px 84px; transition: transform .3s cubic-bezier(.3, 1.4, .6, 1); }
.tk-owl .tk-wr { transform-origin: 118px 84px; transition: transform .3s cubic-bezier(.3, 1.4, .6, 1); }
.tk-owl .tk-tuft-l { transform-origin: 46px 37px; transition: transform .2s ease; }
.tk-owl .tk-tuft-r { transform-origin: 94px 37px; transition: transform .2s ease; }
.tk-owl .tk-x { display: none; }
.tk-owl.tk-reset * { animation: none !important; }

/* ---------- talking: the beak moves like in Učimo sat */
.tk-owl.tk-talking .tk-beak, .tika.tk-talking .tk-beak { transform-origin: 70px 76px; animation: tk-talk .2s ease-in-out infinite; }

/* ---------- happy: ^ ^ eyes, two hops, wing flaps */
.tk-m-happy .tk-eyes-open, .tk-m-celebrate .tk-eyes-open { display: none; }
.tk-m-happy .tk-eyes-happy, .tk-m-celebrate .tk-eyes-happy { display: inline; }
.tk-m-happy .tk-in { animation: tk-hop .45s ease 2, tk-bob 3.2s ease-in-out .9s infinite; }
.tk-m-happy .tk-wl { animation: tk-flapL .3s ease 4; }
.tk-m-happy .tk-wr { animation: tk-flapR .3s ease 4; }

/* ---------- celebrate: hop + flap until it ends, stars twinkle */
.tk-m-celebrate .tk-in { animation: tk-hop .55s ease-in-out infinite; }
.tk-m-celebrate .tk-wl { animation: tk-flapL .3s ease infinite; }
.tk-m-celebrate .tk-wr { animation: tk-flapR .3s ease infinite; }
.tk-m-celebrate .tk-x-stars { display: inline; }
.tk-m-celebrate .tk-x-stars path { transform-box: fill-box; transform-origin: center; animation: tk-twinkle .9s ease-in-out infinite; }
.tk-m-celebrate .tk-x-stars path:nth-child(2) { animation-delay: .3s; }
.tk-m-celebrate .tk-x-stars path:nth-child(3) { animation-delay: .5s; }
.tk-m-celebrate .tk-x-stars path:nth-child(4) { animation-delay: .15s; }
.tk-m-celebrate .tk-wand-star, .tk-m-happy .tk-wand-star { transform-box: fill-box; transform-origin: center; animation: tk-spin 1.2s linear infinite; }

/* ---------- think: pupils up, thought dots, a slow sway */
.tk-m-think .tk-pupils { --tk-mx: 3px; --tk-my: -5px; --tk-fx: 0px; --tk-fy: 0px; }
.tk-m-think .tk-x-think { display: inline; }
.tk-m-think .tk-x-think circle { transform-box: fill-box; transform-origin: center; animation: tk-dots 1.4s ease-in-out infinite; }
.tk-m-think .tk-x-think circle:nth-child(2) { animation-delay: .2s; }
.tk-m-think .tk-x-think circle:nth-child(3) { animation-delay: .4s; }
.tk-m-think .tk-in { transform-origin: 70px 150px; animation: tk-sway 3s ease-in-out infinite; }

/* ---------- oops: pupils down, a little tilt, a sweat drop */
.tk-m-oops .tk-pupils { --tk-mx: -3px; --tk-my: 5px; --tk-fx: 0px; --tk-fy: 0px; }
.tk-m-oops .tk-in { transform-origin: 70px 150px; animation: tk-tilt .6s ease; }
.tk-m-oops .tk-x-sweat { display: inline; }
.tk-m-oops .tk-x-sweat path { animation: tk-drip 1.6s ease-in forwards; }

/* ---------- encourage: waves a wing, a heart floats */
.tk-m-encourage .tk-pupils { --tk-my: 1.5px; }
.tk-m-encourage .tk-wr { animation: tk-wave .42s ease-in-out infinite alternate; }
.tk-m-encourage .tk-in { transform-origin: 70px 150px; animation: tk-lean 1.2s ease-in-out infinite alternate; }
.tk-m-encourage .tk-x-heart { display: inline; }
.tk-m-encourage .tk-x-heart path { transform-box: fill-box; transform-origin: center; animation: tk-heart 1.1s ease-in-out infinite; }
.tk-m-encourage .tk-cheek { opacity: .85; }

/* ---------- surprised: small pupils, wide eyes, tufts up, "!" */
.tk-m-surprised .tk-pupil, .tk-m-surprised .tk-glint { transform: scale(.62); }
.tk-m-surprised .tk-eye-w { transform: scale(1.07); }
.tk-m-surprised .tk-tuft-l { transform: rotate(-9deg); }
.tk-m-surprised .tk-tuft-r { transform: rotate(9deg); }
.tk-m-surprised .tk-in { animation: tk-jolt .4s ease-out; }
.tk-m-surprised .tk-x-excl { display: inline; }
.tk-m-surprised .tk-x-excl { animation: tk-pop .35s cubic-bezier(.3, 1.6, .5, 1); transform-origin: 126px 10px; }

/* ---------- pointing with a wing (pupils look the same way) */
.tk-point-left .tk-wl { transform: rotate(78deg); }
.tk-point-right .tk-wr { transform: rotate(-78deg); }
.tk-point-up .tk-wr { transform: rotate(-150deg); }
.tk-point-down .tk-wr { transform: rotate(-38deg); }

/* ---------- costume change: a little "poof" */
.tk-cos-in .tk-cos-front, .tk-cos-in .tk-cos-back, .tk-cos-in .tk-cos-wr { animation: tk-cos .55s cubic-bezier(.3, 1.6, .5, 1); transform-origin: 70px 60px; }
.tk-owl .tk-waves { animation: tk-waves 1.6s ease-in-out infinite; }

/* ---------- Tika's own bubble (bubble: 'right' | 'left' | 'top') */
/* the bubble never blocks taps on the game underneath */
.tk-tika-bubble { position: absolute; z-index: 2; width: max-content; max-width: min(19rem, 70vw); pointer-events: none; }
.tk-tika-bubble.tk-at-right { left: 96%; top: 18%; }
.tk-tika-bubble.tk-at-left { right: 96%; top: 18%; }
.tk-tika-bubble.tk-at-top { bottom: 94%; left: 50%; transform: translateX(-50%); }
.tk-bubble-in { animation: tk-bubble-in .28s cubic-bezier(.3, 1.5, .5, 1) both; }
.tk-bubble-out { animation: tk-bubble-out .18s ease both; }
.tk-tika-bubble.tk-at-top.tk-bubble-in { animation-name: tk-bubble-in-top; }

/* ---------- keyframes */
@keyframes tk-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes tk-blink { 0%, 94%, 100% { transform: scaleY(1); } 97% { transform: scaleY(.08); } }
@keyframes tk-hop { 0%, 100% { transform: translateY(0); } 45% { transform: translateY(-14px); } }
@keyframes tk-flapL { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(22deg); } }
@keyframes tk-flapR { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-22deg); } }
@keyframes tk-tilt { 0%, 100% { transform: rotate(0); } 30% { transform: rotate(-6deg); } 70% { transform: rotate(4deg); } }
@keyframes tk-talk { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(.55); } }
@keyframes tk-twinkle { 0%, 100% { opacity: 1; transform: scale(1) rotate(0); } 50% { opacity: .35; transform: scale(.7) rotate(20deg); } }
@keyframes tk-spin { to { transform: rotate(360deg); } }
@keyframes tk-dots { 0%, 100% { opacity: .35; transform: scale(.85); } 50% { opacity: 1; transform: scale(1.08); } }
@keyframes tk-sway { 0%, 100% { transform: rotate(3deg); } 50% { transform: rotate(5deg) translateY(-2px); } }
@keyframes tk-drip { 0% { transform: translateY(-4px); opacity: 0; } 20% { opacity: 1; } 100% { transform: translateY(8px); opacity: .9; } }
@keyframes tk-wave { from { transform: rotate(-28deg); } to { transform: rotate(-76deg); } }
@keyframes tk-lean { from { transform: rotate(0); } to { transform: rotate(-2.5deg); } }
@keyframes tk-heart { 0%, 100% { transform: scale(1) translateY(0); } 50% { transform: scale(1.15) translateY(-3px); } }
@keyframes tk-jolt { 0% { transform: translateY(0) scale(1); } 35% { transform: translateY(-9px) scale(1.03, .97); } 100% { transform: translateY(0) scale(1); } }
@keyframes tk-pop { from { transform: scale(0); } to { transform: scale(1); } }
@keyframes tk-cos { 0% { transform: scale(.4) translateY(-18px); opacity: 0; } 100% { transform: scale(1) translateY(0); opacity: 1; } }
@keyframes tk-waves { 0%, 100% { opacity: .2; } 50% { opacity: 1; } }
@keyframes tk-bubble-in { from { opacity: 0; transform: scale(.85) translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes tk-bubble-in-top { from { opacity: 0; transform: translateX(-50%) scale(.85) translateY(6px); } to { opacity: 1; transform: translateX(-50%); } }
@keyframes tk-bubble-out { to { opacity: 0; } }

/* ---------- calm: OS setting or <html data-motion="reduce"> – poses stay, movement stops */
@media (prefers-reduced-motion: reduce) {
  html:not([data-motion="full"]) .tk-owl .tk-in, html:not([data-motion="full"]) .tk-owl .tk-wl, html:not([data-motion="full"]) .tk-owl .tk-wr,
  html:not([data-motion="full"]) .tk-owl .tk-x path, html:not([data-motion="full"]) .tk-owl .tk-x circle, html:not([data-motion="full"]) .tk-owl .tk-x,
  html:not([data-motion="full"]) .tk-owl .tk-eyes-open, html:not([data-motion="full"]) .tk-owl .tk-waves, html:not([data-motion="full"]) .tk-owl .tk-wand-star,
  html:not([data-motion="full"]) .tk-cos-in .tk-cos-front, html:not([data-motion="full"]) .tk-cos-in .tk-cos-back { animation: none !important; }
  html:not([data-motion="full"]) .tk-owl .tk-pupils, html:not([data-motion="full"]) .tk-owl .tk-wl, html:not([data-motion="full"]) .tk-owl .tk-wr { transition: none; }
  html:not([data-motion="full"]) .tk-m-encourage .tk-wr { transform: rotate(-60deg); }
  html:not([data-motion="full"]) .tk-bubble-in { animation: none; }
}
html[data-motion="reduce"] .tk-owl .tk-in, html[data-motion="reduce"] .tk-owl .tk-wl, html[data-motion="reduce"] .tk-owl .tk-wr,
html[data-motion="reduce"] .tk-owl .tk-x path, html[data-motion="reduce"] .tk-owl .tk-x circle, html[data-motion="reduce"] .tk-owl .tk-x,
html[data-motion="reduce"] .tk-owl .tk-eyes-open, html[data-motion="reduce"] .tk-owl .tk-waves, html[data-motion="reduce"] .tk-owl .tk-wand-star,
html[data-motion="reduce"] .tk-cos-in .tk-cos-front, html[data-motion="reduce"] .tk-cos-in .tk-cos-back { animation: none !important; }
html[data-motion="reduce"] .tk-m-encourage .tk-wr { transform: rotate(-60deg); }
html[data-motion="reduce"] .tk-bubble-in { animation: none; }

/* ---------- costumes that also dress the left wing (builder: blueprint roll) poof in with the rest */
.tk-cos-in .tk-cos-wl { animation: tk-cos .55s cubic-bezier(.3, 1.6, .5, 1); transform-origin: 70px 60px; }
@media (prefers-reduced-motion: reduce) {
  html:not([data-motion="full"]) .tk-cos-in .tk-cos-wl { animation: none !important; }
}
html[data-motion="reduce"] .tk-cos-in .tk-cos-wl { animation: none !important; }
