/* Puzzlownia polish v19
   One lightweight boot cover, no timer/countdown ownership, no game-state rewrites. */
.pz-game-boot{
  position:fixed;
  inset:0;
  z-index:30000;
  display:grid;
  place-items:center;
  padding:24px;
  background:var(--bg,#f3f5f6);
  overflow:hidden;
  isolation:isolate;
  pointer-events:auto;
  opacity:1;
  visibility:visible;
  transition:opacity .34s ease .20s,visibility 0s linear .68s;
}
html[data-theme="dark"] .pz-game-boot{background:#0d1014;}
.pz-game-boot::before{
  content:"";
  position:absolute;
  width:min(88vw,560px);
  aspect-ratio:1;
  border-radius:50%;
  background:radial-gradient(circle,rgba(255,90,0,.11),rgba(255,90,0,0) 69%);
  opacity:.8;
  pointer-events:none;
}
.pz-game-boot__mark{
  position:relative;
  z-index:1;
  display:grid;
  place-items:center;
  width:min(76vw,420px);
  transform-origin:50% 50%;
  will-change:transform,opacity,filter;
  animation:pzBootFloat 2.5s ease-in-out infinite alternate;
}
.pz-game-boot__logo{
  display:block;
  width:100%;
  max-width:420px;
  max-height:min(50dvh,420px);
  height:auto;
  object-fit:contain;
  object-position:center;
  filter:drop-shadow(0 12px 20px rgba(45,27,12,.17));
  user-select:none;
  -webkit-user-drag:none;
}
.pz-game-boot.is-leaving{opacity:0;visibility:hidden;pointer-events:none;}
.pz-game-boot.is-leaving .pz-game-boot__mark{animation:pzBootOut .70s cubic-bezier(.18,.80,.18,1) both;}
@keyframes pzBootFloat{
  0%{transform:translate3d(0,2px,0) scale(.985) rotate(-3.2deg)}
  50%{transform:translate3d(0,-3px,0) scale(1.01) rotate(1.4deg)}
  100%{transform:translate3d(0,1px,0) scale(.995) rotate(3.2deg)}
}
@keyframes pzBootOut{
  0%{opacity:1;transform:translate3d(0,0,0) scale(1) rotate(0);filter:blur(0)}
  58%{opacity:.96;transform:translate3d(0,-4px,0) scale(.76) rotate(-8deg);filter:blur(0)}
  100%{opacity:0;transform:translate3d(0,-16px,0) scale(.30) rotate(15deg);filter:blur(1.6px)}
}

/* The game top shell remains visible on mobile while the game area is loading. */
@media (max-width:820px) and (orientation:portrait){
  /* Boot zaslania caly viewport. Nie pokazujemy fragmentu maty ani topu zanim gra jest gotowa. */
  .pz-game-boot{inset:0!important;top:0!important;right:0!important;bottom:0!important;left:0!important;}
  .pz-game-boot__mark{width:min(72vw,320px);}
}

/* Never expose the old CSS placeholder in Układanie. The box always has a real image element. */
body.pz-uk-page .pz-jigsaw-box__fallback{display:none!important;}
body.pz-uk-page .pz-jigsaw-box.has-box-art{transition:opacity .22s ease,left .62s cubic-bezier(.18,.82,.24,1),top .62s cubic-bezier(.18,.82,.24,1),width .62s cubic-bezier(.18,.82,.24,1),transform .62s cubic-bezier(.18,.82,.24,1),filter .2s ease;}

/* Native countdown images stay under control of the individual game engines. */
body.pz-game-page #countdown > img,
body.pz-game-page #countdown > .pz-uk-status-art,
body.pz-game-page #countdown > .pz-od-status-art,
body.pz-game-page #countdown > .pz-mem-status-art,
body.pz-game-page #countdown > .pz-sp-status-art,
body.pz-spadajace-page #countdown > img{
  display:block!important;
  width:auto!important;
  height:auto!important;
  max-width:min(72%,320px)!important;
  max-height:min(25dvh,156px)!important;
  margin:auto!important;
  object-fit:contain!important;
  object-position:center!important;
  transform-origin:50% 50%!important;
  animation:pzNativeCountdownIn .34s cubic-bezier(.18,.78,.2,1) both!important;
  will-change:transform,opacity!important;
}
@keyframes pzNativeCountdownIn{
  0%{opacity:.08;transform:scale(.80) rotate(-2.2deg)}
  72%{opacity:1;transform:scale(1.045) rotate(.5deg)}
  100%{opacity:1;transform:scale(1) rotate(0)}
}

/* All campaign/status art must stay complete inside its overlay. */
body.pz-game-page img[src*="assets/game-ui/02_game_states/"],
body.pz-game-page img[src*="assets/game-ui/04_levels/"],
body.pz-game-page img[src*="assets/game-ui/05_status/"],
body.pz-game-page img[src*="assets/game-ui/06_rewards/"]{
  object-fit:contain!important;
  object-position:center!important;
}
body.pz-game-page img[src*="assets/game-ui/04_levels/"]{
  display:block!important;
  box-sizing:border-box!important;
  flex:0 0 auto!important;
  padding:5px!important;
  overflow:visible!important;
  animation:pzSafeLevelIn .38s cubic-bezier(.18,.82,.2,1) both!important;
}
@keyframes pzSafeLevelIn{from{opacity:0;transform:translateY(8px) scale(.92)}to{opacity:1;transform:translateY(0) scale(1)}}

@media (max-width:820px) and (orientation:portrait){
  body.pz-game-page #countdown{overflow:visible!important;padding:8px!important;box-sizing:border-box!important;}

  body.pz-uk-page .pz-uk32-challenge-overlay{padding:12px!important;overflow:visible!important;}
  body.pz-uk-page .pz-uk32-level-card{width:min(94vw,560px)!important;max-width:calc(100vw - 24px)!important;max-height:calc(100dvh - 24px)!important;padding:8px 4px!important;box-sizing:border-box!important;overflow:visible!important;gap:8px!important;}
  body.pz-uk-page .pz-uk32-level-art{width:min(88vw,520px)!important;max-width:100%!important;height:auto!important;max-height:min(28dvh,168px)!important;flex:0 0 auto!important;}
  body.pz-uk-page .pz-uk32-time-art{width:min(58%,230px)!important;max-height:min(13dvh,68px)!important;}

  body.pz-demontaz-page .pz-dem23-level-card{inset:6px!important;width:auto!important;height:auto!important;max-width:none!important;max-height:none!important;padding:8px!important;box-sizing:border-box!important;overflow:visible!important;gap:7px!important;}
  body.pz-demontaz-page .pz-dem23-level-art{width:min(90%,520px)!important;max-width:calc(100% - 8px)!important;height:auto!important;max-height:31%!important;flex:0 0 auto!important;}
  body.pz-demontaz-page .pz-dem23-limit{max-width:calc(100% - 12px)!important;flex-wrap:wrap!important;}
  body.pz-demontaz-page .pz-dem23-limit img{width:min(52%,210px)!important;max-height:72px!important;}

  body.pz-od-page :is(.pz-od-status-art,.pz-od-complete img),
  body.pz-mem-page :is(.pz-mem-status-art,.pz-mem-phase-overlay img),
  body.pz-sp-page :is(.pz-sp-status-art,.pz-sp-phase-overlay img,.pz-sp-gate-state){width:min(76%,340px)!important;max-width:calc(100% - 16px)!important;height:auto!important;max-height:32%!important;object-fit:contain!important;}

  body.pz-uk-page .pz-jigsaw-box.pz-box-portaled{
    position:fixed!important;
    z-index:9800!important;
    margin:0!important;
    transform:none!important;
    pointer-events:auto!important;
    transition:left .28s ease,top .28s ease,width .28s ease,opacity .18s ease,filter .2s ease!important;
  }
  body.pz-uk-page .pz-jigsaw-box.pz-box-portaled.pz-box-portaled-hidden{opacity:0!important;pointer-events:none!important;}
}

@media (prefers-reduced-motion:reduce){
  .pz-game-boot__mark,.pz-game-boot.is-leaving .pz-game-boot__mark,
  body.pz-game-page #countdown > img,
  body.pz-game-page img[src*="assets/game-ui/04_levels/"]{animation:none!important;}
  .pz-game-boot{transition:none!important;}
}
