/* PUZZLE — vzhled. Vše začíná .hra-puzzle */
.hra-puzzle {
  background:
    radial-gradient(circle at 20% 15%, rgba(255,255,255,.55) 0 60px, transparent 61px),
    radial-gradient(circle at 85% 80%, rgba(255,255,255,.35) 0 90px, transparent 91px),
    linear-gradient(160deg, #b9f0c5 0%, #c9ecff 55%, #e5dcff 100%);
}
.hra-puzzle .pz-sonda { position: absolute; visibility: hidden; pointer-events: none; width: 0; height: 0;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px); }

/* ---------- výběr obrázku ---------- */
.hra-puzzle .pz-vyber { grid-template-columns: repeat(auto-fill, minmax(min(150px, 42vw), 1fr)); gap: 16px; }
.hra-puzzle .pz-karta { position: relative; border-radius: 24px; padding: 7px 7px 4px; background: var(--b);
  box-shadow: inset 0 -6px 0 rgba(0,0,0,.15), inset 0 4px 0 rgba(255,255,255,.3), 0 6px 14px rgba(0,0,0,.14);
  display: flex; flex-direction: column; align-items: stretch; transition: transform .12s;
  animation: pz-prilet .45s cubic-bezier(.3,1.6,.5,1) both; }
.hra-puzzle .pz-karta:active { transform: scale(.94) translateY(3px); }
.hra-puzzle .pz-karta img { display: block; width: 100%; aspect-ratio: 4 / 3; border-radius: 17px; background: #fff;
  border: 3px solid #fff; pointer-events: none; }
.hra-puzzle .pz-hvezdy { display: flex; justify-content: center; gap: 1px; height: 22px; align-items: center; }
.hra-puzzle .pz-hvezdy svg { width: 21px; height: 21px; filter: drop-shadow(0 1px 0 rgba(0,0,0,.2)); }
.hra-puzzle .pz-karta.zlata { box-shadow: 0 0 0 4px #ffd93d, inset 0 -6px 0 rgba(0,0,0,.15), 0 6px 14px rgba(0,0,0,.14); }

/* přepínač obtížnosti (pro rodiče) */
.hra-puzzle .pz-obtiznost { --v: clamp(40px, calc((100vw - 130px) / 5), 56px);
  position: absolute; z-index: 5; top: calc(10px + env(safe-area-inset-top, 0px)); right: calc(10px + env(safe-area-inset-right, 0px));
  display: flex; gap: 6px; padding: 6px; border-radius: calc(var(--v) / 2 + 6px); background: rgba(255,255,255,.55);
  box-shadow: 0 4px 12px rgba(0,0,0,.08); }
.hra-puzzle .pz-ob { width: var(--v); height: var(--v); border-radius: 50%; background: #fff; color: #9aa7b4;
  box-shadow: inset 0 -4px 0 rgba(0,0,0,.1), 0 2px 6px rgba(0,0,0,.12); display: grid; place-items: center; transition: transform .1s, background .2s; }
.hra-puzzle .pz-ob svg { width: 74%; height: 74%; fill: currentColor; }
.hra-puzzle .pz-ob.vybrano { background: #6bcb77; color: #fff; transform: scale(1.08); box-shadow: inset 0 -4px 0 rgba(0,0,0,.15), 0 3px 8px rgba(0,0,0,.2); }
.hra-puzzle .pz-ob:active { transform: scale(.9); }
@media (max-height: 500px) and (orientation: landscape) {
  .hra-puzzle .pz-obtiznost { --v: 48px; }
  .hra-puzzle .pz-vyber { padding-top: calc(76px + env(safe-area-inset-top, 0px)); grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

/* ---------- hrací plocha ---------- */
.hra-puzzle .pz-plocha { position: absolute; inset: 0; }
.hra-puzzle .pz-podlozka { position: absolute; border-radius: 30px; background: rgba(255,255,255,.32);
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.5); }
.hra-puzzle .pz-deska { position: absolute; }
.hra-puzzle .pz-deska::before { content: ""; position: absolute; inset: -9px; border-radius: 22px; background: #fff;
  box-shadow: 0 8px 0 rgba(0,0,0,.08), 0 12px 30px rgba(40,80,120,.18); }
.hra-puzzle .pz-obraz { position: absolute; inset: 0; border-radius: 10px; overflow: hidden; background: #eef3f7; }
.hra-puzzle .pz-predloha { position: absolute; inset: 0; width: 100%; height: 100%; filter: grayscale(1) contrast(.8); opacity: .3; pointer-events: none; }
.hra-puzzle .pz-sloty { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.hra-puzzle .pz-sloty path { fill: none; stroke: rgba(70,95,120,.35); stroke-width: 2; stroke-dasharray: 7 6; stroke-linejoin: round; vector-effect: non-scaling-stroke; }

/* dílky */
.hra-puzzle .pz-dilek { position: absolute; left: 0; top: 0; z-index: 3; transform-origin: 50% 50%; will-change: transform;
  pointer-events: none; filter: drop-shadow(0 3px 2px rgba(0,0,0,.25)); }
.hra-puzzle .pz-dilek svg { display: block; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.hra-puzzle .pz-hrana { fill: none; stroke: rgba(255,255,255,.85); stroke-width: 2.2; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.hra-puzzle .pz-zasah { fill: transparent; stroke: transparent; stroke-width: 22; pointer-events: none; }
.hra-puzzle.pz-rozhazuje .pz-zasah { pointer-events: all; }
.hra-puzzle .pz-dilek.drzi { filter: drop-shadow(0 16px 12px rgba(0,0,0,.28)); }
.hra-puzzle .pz-dilek.sedi { filter: none; animation: pz-zablesk .5s ease-out; }
.hra-puzzle .pz-dilek.sedi .pz-hrana { stroke: rgba(255,255,255,.35); }
.hra-puzzle .pz-dilek.sedi .pz-zasah { pointer-events: none; }
.hra-puzzle.pz-hotovo .pz-dilek { opacity: 0; transition: opacity .5s !important; }

/* tlačítka */
.hra-puzzle .pz-tl-vyber { position: absolute; z-index: 40; width: 58px; height: 58px; border-radius: 50%; }
.hra-puzzle .pz-tl-vyber svg, .hra-puzzle .pz-zpet svg { width: 62%; height: 62%; }
.hra-puzzle .pz-konec { position: absolute; z-index: 45; display: flex; align-items: center; justify-content: center; gap: 22px;
  pointer-events: none; opacity: 0; transform: scale(.4); transition: opacity .3s, transform .45s cubic-bezier(.3,1.6,.5,1); }
.hra-puzzle.pz-dalsi-vidi .pz-konec { opacity: 1; transform: none; pointer-events: auto; }
.hra-puzzle .pz-dalsi { width: 118px; height: 118px; border-radius: 50%; background: #6bcb77; border: 6px solid #fff; display: grid; place-items: center;
  box-shadow: inset 0 -8px 0 rgba(0,0,0,.16), 0 8px 20px rgba(0,0,0,.2); animation: pz-pulz 1.2s ease-in-out infinite; }
.hra-puzzle .pz-dalsi svg { width: 64%; height: 64%; }
.hra-puzzle .pz-dalsi:active { transform: scale(.9); }
.hra-puzzle .pz-zpet { width: 70px; height: 70px; border-radius: 50%; }
.hra-puzzle.pz-hotovo .pz-tl-vyber { opacity: 0; pointer-events: none; }

/* hotový obrázek */
.hra-puzzle .pz-ziva { position: absolute; inset: 0; animation: pz-objev .35s ease-out both; }
.hra-puzzle .pz-ziva svg { display: block; width: 100%; height: 100%; }
.hra-puzzle .pz-obraz.houpe { animation: pz-houpe 1s ease-in-out; }
.hra-puzzle .pz-lesk { position: absolute; inset: 0; z-index: 3; pointer-events: none; opacity: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.75) 48%, transparent 64%); background-size: 250% 100%; }
.hra-puzzle .houpe .pz-lesk { animation: pz-lesk 1.1s ease-in-out .15s; }
.hra-puzzle.pz-hotovo .pz-podlozka { opacity: .5; }

/* oživení jednotlivých částí obrázku */
.hra-puzzle .pz-ziva .a-ocas { animation: pz-vrti .26s ease-in-out infinite alternate; }
.hra-puzzle .pz-ziva .a-naklon { animation: pz-naklon 1.3s ease-in-out infinite alternate; }
.hra-puzzle .pz-ziva .a-hlava { animation: pz-kyva 1.1s ease-in-out infinite alternate; }
.hra-puzzle .pz-ziva .a-hop { animation: pz-hop .7s cubic-bezier(.3,0,.6,1) infinite alternate; }
.hra-puzzle .pz-ziva .a-jede { animation: pz-jede 3.2s ease-in-out infinite; }
.hra-puzzle .pz-ziva .a-kolo { animation: pz-toc .9s linear infinite; }
.hra-puzzle .pz-ziva .a-majak { animation: pz-blik .35s steps(1) infinite alternate; }
.hra-puzzle .pz-ziva .a-kour { animation: pz-kour 1.5s ease-out infinite; }
.hra-puzzle .pz-ziva .a-rameno { animation: pz-rameno 2.2s ease-in-out infinite; }
.hra-puzzle .pz-ziva .a-klubko { animation: pz-klubko 1.1s ease-in-out infinite alternate; }
.hra-puzzle .pz-ziva .a-ryba { animation: pz-plave 2.6s ease-in-out infinite; }
.hra-puzzle .pz-ziva .a-ryba2 { animation: pz-plave 2.2s ease-in-out -.6s infinite; }
.hra-puzzle .pz-ziva .a-ryba3 { animation: pz-plave-l 2.4s ease-in-out infinite; }
.hra-puzzle .pz-ziva .a-bublina { animation: pz-bublina 2.4s ease-in infinite; }
.hra-puzzle .pz-ziva .a-chaluha { animation: pz-naklon 1.8s ease-in-out infinite alternate; }
.hra-puzzle .pz-ziva .a-chobot { animation: pz-chobot .6s ease-in-out infinite alternate; }
.hra-puzzle .pz-ziva .a-sprcha { animation: pz-sprcha 1.2s ease-out infinite; }
.hra-puzzle .pz-ziva .a-let { animation: pz-let 1.6s ease-in-out infinite alternate; }
.hra-puzzle .pz-ziva .a-vrtule { animation: pz-vrtule .1s linear infinite alternate; }
.hra-puzzle .pz-ziva .a-mrak { animation: pz-mrak 3.5s ease-in-out infinite alternate; }
.hra-puzzle .pz-ziva .a-raketa { animation: pz-raketa .9s ease-in-out infinite alternate; }
.hra-puzzle .pz-ziva .a-plamen { animation: pz-plamen .12s linear infinite alternate; }
.hra-puzzle .pz-ziva .a-trpyt { animation: pz-trpyt 1s ease-in-out infinite alternate; }
.hra-puzzle .pz-ziva .a-paprsky { animation: pz-toc 7s linear infinite; }
.hra-puzzle .pz-ziva .a-oblouk { animation: pz-oblouk 1.4s ease-in-out infinite; }

@keyframes pz-prilet { from { transform: scale(.4) translateY(30px); opacity: 0; } }
@keyframes pz-zablesk { 0% { filter: brightness(1.45) drop-shadow(0 0 10px #fff); } 100% { filter: none; } }
@keyframes pz-pulz { 50% { transform: scale(1.07); } }
@keyframes pz-objev { from { opacity: 0; } }
@keyframes pz-houpe { 0% { transform: none; } 20% { transform: scale(1.05) rotate(-2deg); } 45% { transform: scale(1.03) rotate(1.6deg); }
  70% { transform: scale(1.01) rotate(-.8deg); } 100% { transform: none; } }
@keyframes pz-lesk { 0% { opacity: 1; background-position: 120% 0; } 100% { opacity: 1; background-position: -60% 0; } }
@keyframes pz-vrti { from { transform: rotate(-16deg); } to { transform: rotate(16deg); } }
@keyframes pz-naklon { from { transform: rotate(-5deg); } to { transform: rotate(5deg); } }
@keyframes pz-kyva { from { transform: rotate(-3deg); } to { transform: rotate(7deg); } }
@keyframes pz-hop { from { transform: translateY(0); } to { transform: translateY(-22px); } }
@keyframes pz-jede { 0%, 100% { transform: translateX(0); } 12% { transform: translateX(-5px); } 50% { transform: translateX(26px) translateY(-1px); } 60% { transform: translateX(24px); } }
@keyframes pz-toc { to { transform: rotate(360deg); } }
@keyframes pz-blik { 0% { opacity: 1; } 50% { opacity: .35; } }
@keyframes pz-kour { 0% { transform: translate(0, 6px) scale(.5); opacity: 0; } 25% { opacity: .9; } 100% { transform: translate(16px, -38px) scale(1.5); opacity: 0; } }
@keyframes pz-rameno { 0%, 100% { transform: rotate(0); } 40% { transform: rotate(-12deg); } 70% { transform: rotate(6deg); } }
@keyframes pz-klubko { from { transform: translateX(0) rotate(0); } to { transform: translateX(22px) rotate(110deg); } }
@keyframes pz-plave { 0%, 100% { transform: translate(0, 0) rotate(0); } 50% { transform: translate(22px, -10px) rotate(-4deg); } }
@keyframes pz-plave-l { 0%, 100% { transform: translate(0, 0) rotate(0); } 50% { transform: translate(-22px, 8px) rotate(4deg); } }
@keyframes pz-bublina { 0% { transform: translateY(0) scale(1); opacity: 1; } 100% { transform: translateY(-110px) scale(1.3); opacity: 0; } }
@keyframes pz-chobot { from { transform: rotate(4deg); } to { transform: rotate(-10deg); } }
@keyframes pz-sprcha { 0% { opacity: 0; transform: translate(0, 10px) scale(.4); } 30% { opacity: 1; } 100% { opacity: 0; transform: translate(-12px, -26px) scale(1.2); } }
@keyframes pz-let { from { transform: translateY(6px) rotate(1.5deg); } to { transform: translateY(-10px) rotate(-2.5deg); } }
@keyframes pz-vrtule { from { transform: scaleY(1); } to { transform: scaleY(.12); } }
@keyframes pz-mrak { from { transform: translateX(-10px); } to { transform: translateX(14px); } }
@keyframes pz-raketa { from { transform: translateY(6px); } to { transform: translateY(-16px); } }
@keyframes pz-plamen { from { transform: scaleY(.85); } to { transform: scaleY(1.25); } }
@keyframes pz-trpyt { from { transform: scale(.6); opacity: .5; } to { transform: scale(1.3); opacity: 1; } }
@keyframes pz-oblouk { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }

@media (prefers-reduced-motion: reduce) {
  .hra-puzzle .pz-ziva *, .hra-puzzle .pz-dalsi { animation-duration: 3s !important; }
}
