/* Feel and juice of the result, map and deck screens (src/app/resultfx.js, mapfx.js, deckfx.js).
   Everything here moves with transform/opacity/translate/rotate/scale only. */

/* result: a new card waits out of sight until it flies in; the fox lifts her head over "Try again" */
.pz.pending {
  visibility: hidden;
}
.res-hero .char {
  transition: rotate 0.28s ease-out;
}
.res-hero.hope .char {
  rotate: calc(var(--hope, 3deg) * -1);
}
body.calm .res-hero .char {
  transition: none;
}

/* deck: the card in flight from the grid to the tray; 20/20 turns the counter gold and Save glows (steady, one bloom) */
.dk-fly {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 50% 50%;
  pointer-events: none;
  will-change: transform;
}
.dk-fly .card {
  position: relative;
  left: auto;
  top: auto;
  margin: 0;
}
#dk-title.full #dk-count {
  color: var(--gold);
}
#dk-save.ready {
  filter: brightness(1.08) drop-shadow(0 0 calc(var(--u) * 1.5) rgba(255, 214, 90, 0.85));
  animation: dk-ready var(--glow, 2.4s) ease-in-out infinite;
}
#dk-save.bloom {
  animation:
    dk-bloom 0.7s cubic-bezier(0.3, 1.4, 0.5, 1),
    dk-ready var(--glow, 2.4s) ease-in-out 0.7s infinite;
}
@keyframes dk-ready {
  0%,
  100% {
    filter: brightness(1.04) drop-shadow(0 0 calc(var(--u) * 1) rgba(255, 214, 90, 0.6));
  }
  50% {
    filter: brightness(1.12) drop-shadow(0 0 calc(var(--u) * 1.8) rgba(255, 214, 90, 0.9));
  }
}
@keyframes dk-bloom {
  0% {
    scale: 1;
  }
  40% {
    scale: 1.08;
  }
  100% {
    scale: 1;
  }
}
body.calm #dk-save.ready,
body.calm #dk-save.bloom {
  animation: none;
}

/* map: what is new plays in a layer over the art (never over the top bar or the buttons) */
#map-fx {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.mfx-path {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.mfx-fox {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 50% 97%;
  will-change: transform;
  filter: drop-shadow(0 calc(var(--u) * 0.5) 0 rgba(4, 30, 26, 0.45));
}
.mfx-fox img {
  display: block;
  height: 100%;
  width: auto;
  max-width: none;
  transform-origin: 50% 100%;
}
.mfx-star {
  position: absolute;
  left: 0;
  top: 0;
  height: auto;
  transform-origin: 50% 50%;
  will-change: transform;
  filter: drop-shadow(0 calc(var(--u) * 0.4) calc(var(--u) * 0.5) rgba(4, 30, 26, 0.5));
}
.mfx-cloud {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.mfx-cloud img {
  position: absolute;
  max-width: none;
  height: auto;
  will-change: transform, opacity;
}
.node.unlocking > :not(.ghost) {
  opacity: 0;
}
.node .ghost {
  position: absolute;
  inset: 0;
}
.ghost .gb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.ghost .lk {
  position: absolute;
  left: 34%;
  bottom: 4%;
  width: 32%;
  transform-origin: 50% 50%;
}
/* the boss looks out from BEHIND his node while he peeks (his face goes back in front when he is done) */
.node.peeking > .who {
  z-index: 0;
}
.node.peeking > .base {
  z-index: 1;
}
.node.peeking > b,
.node.peeking > .crown,
.node.peeking > .stars,
.node.peeking > .lk {
  z-index: 2;
}

/* ---- map (src/app/mapjuice.js) ---- */
/* 72: a locked world is its own map art, filtered (no veil over it); the boss of its node in silhouette */
.scene.locked .scene-img {
  filter: var(--lock);
}
.scene.locked .scene-back {
  filter: blur(calc(var(--u) * 3.2)) var(--lock) brightness(0.8);
}
.scene.locked .node.boss .who {
  filter: brightness(0) opacity(0.6);
  animation: none;
}
#map-lock,
.cp-map-lock {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
#map-lock img,
.cp-map-lock img {
  position: absolute;
  width: auto;
  max-width: none;
  translate: -50% -50%;
}
.mj-sil {
  filter: brightness(0);
}
.mj-lock {
  filter: drop-shadow(0 calc(var(--u) * 1.2) calc(var(--u) * 1.2) rgba(4, 30, 26, 0.55));
}
/* 73: the page turn: the old map and the new one are copies of the scene, each cut in half */
.mj-page {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}
.mj-half {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.mj-half.l {
  clip-path: inset(0 50% 0 0);
}
.mj-half.r {
  clip-path: inset(0 0 0 50%);
}
.mj-half > .scene {
  pointer-events: none;
}
.mj-copy .cp-map-path {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.mj-copy .cp-map-nodes {
  position: absolute;
  inset: 0;
}
.mj-leaf {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transform-origin: 50% 50%;
}
.mj-leaf > .mj-half,
.mj-back {
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}
.mj-back {
  position: absolute;
  inset: 0;
  transform: rotateY(180deg);
}
.mj-cloud {
  position: absolute;
  height: auto;
  max-width: none;
  will-change: transform, opacity;
  filter: drop-shadow(0 calc(var(--u) * 1) calc(var(--u) * 1.5) rgba(4, 30, 26, 0.3));
}
/* 75: the fox stands by her node, feet on the path; --face turns her (1 = right) */
#map-me,
.cp-map-me {
  position: absolute;
  width: 0;
  pointer-events: none;
  z-index: 1;
  transform-origin: 0 100%;
}
#map-me img,
.cp-map-me img {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 100%;
  width: auto;
  max-width: none;
  translate: -50% 0;
  scale: var(--face, 1) 1;
  transition: scale 0.18s var(--pop);
}
#map-me .shade,
.cp-map-me .shade {
  filter: brightness(0) blur(calc(var(--u) * 0.4));
  opacity: 0.35;
  transform-origin: 50% 100%;
  transform: skewX(-50deg) scaleY(0.32);
}
body.calm #map-me img {
  transition: none;
}
/* 76 + 77: a sparkle over the stars of a 3-star node; the shadow of the hopping node */
.mj-spark {
  position: absolute;
  height: auto;
  translate: -50% -50%;
  pointer-events: none;
}
.node .mj-shadow {
  position: absolute;
  left: 6%;
  bottom: -14%;
  width: 88%;
  height: 30%;
  object-fit: fill;
  filter: brightness(0) blur(calc(var(--ns) * 0.03));
  opacity: 0;
}
/* 78 + 79: the boss pops up beside his node: nothing clips him; he grows from his feet, with the fox's shadow */
.node .mj-peek {
  position: absolute;
  width: 0;
  transform-origin: 0 100%;
  z-index: 0;
  pointer-events: none;
}
.node .mj-peek img {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 100%;
  width: auto;
  max-width: none;
  translate: -50% 0;
  transform-origin: 50% 98%;
}
.node .mj-peek .shade {
  filter: brightness(0) blur(calc(var(--u) * 0.4));
  opacity: 0.35;
  transform: skewX(-50deg) scaleY(0.32);
}
.node.mj-rising > .base {
  z-index: 1;
}
.node.mj-rising > b,
.node.mj-rising > .stars,
.node.mj-rising > .lk,
.node.mj-rising > .hc {
  z-index: 2;
}
.node.mj-rising > .who,
.node.mj-rising > .crown {
  opacity: 0;
  transition: opacity 0.12s;
}
.node.boss.done .who {
  pointer-events: auto;
  cursor: pointer;
}

/* ---- deck builder (src/app/deckjuice.js) ---- */
.cv .stack {
  transform-origin: 50% 100%;
}

/* ---- menu and panels (src/app/paneljuice.js) ---- */
/* 86: the logo copy with the sockets + the letters, over the real logo (it takes the .logo rules, height by its aspect) */
.logo-hop {
  aspect-ratio: 1024 / 407;
  pointer-events: none;
  filter: none;
  z-index: 2;
}
.logo-hop img {
  position: absolute;
  display: block;
}
.logo-hop .sock {
  inset: 0;
  width: 100%;
  height: 100%;
}
.logo-hop .lt {
  transform-origin: 50% 100%;
  will-change: translate, scale;
}
/* the leaves of the corners are their own pieces (cut from the panel), over a panel that keeps only their shadow;
   isolation keeps them under the content of the panel, as the art had them */
#panels .panel.a-panel {
  border-image-source: url(../assets/screens/panel-socket.webp);
  isolation: isolate;
}
#panels .panel .pleaf {
  position: absolute;
  z-index: -1;
  width: var(--bl);
  height: var(--bt);
  pointer-events: none;
}
#panels .panel .pleaf.tl {
  left: calc(var(--bl) * -1);
  top: calc(var(--bt) * -1);
  transform-origin: 14% 14%;
}
#panels .panel .pleaf.tr {
  right: calc(var(--br) * -1);
  top: calc(var(--bt) * -1);
  width: var(--br);
  transform-origin: 86% 14%;
}
#panels .panel .pleaf.bl {
  left: calc(var(--bl) * -1);
  bottom: calc(var(--bb) * -1);
  height: var(--bb);
  transform-origin: 14% 86%;
}
#panels .panel .pleaf.br {
  right: calc(var(--br) * -1);
  bottom: calc(var(--bb) * -1);
  width: var(--br);
  height: var(--bb);
  transform-origin: 86% 86%;
}
.pleaf-fall {
  position: absolute;
  pointer-events: none;
  will-change: translate, rotate, opacity;
}
/* 91: the note of the sound panel follows the volume */
.row > img.ri.note {
  transition: scale 0.25s var(--pop);
}
body.calm .row > img.ri.note {
  transition: none;
}

/* ---- result (src/app/resultfx3.js) ---- */
.rj-shine {
  position: absolute;
  height: auto;
  max-width: none;
  pointer-events: none;
  will-change: translate, rotate, opacity;
}
.res-hero .rj-crownbox {
  aspect-ratio: 744 / 900;
  pointer-events: none;
}
.rj-crownbox .rj-crown {
  position: absolute;
  height: auto;
  filter: drop-shadow(0 calc(var(--u) * 0.3) calc(var(--u) * 0.3) rgba(4, 30, 26, 0.4));
}
/* 97: the scoreboard of the stars, top left corner of the window (the right corner belongs to sound and gear) */
.rj-total {
  position: absolute;
  left: calc(var(--sal) + var(--u) * 2.5 + var(--hud-x));
  top: calc(env(safe-area-inset-top, 0px) + var(--hud-y) + var(--u) * 2.5);
  width: calc(var(--u) * 27);
  z-index: 3;
}
.rj-total img {
  width: calc(var(--h) * 0.7);
  margin-right: calc(var(--u) * 1.4);
}
.rj-total b {
  font-size: calc(var(--u) * 5.2);
  display: inline-block;
}
/* 99: the card the fox points at, beside her (she points to her right) */
.panel.res .res-hero.rj-pointing {
  width: 100%;
} /* the hero row takes the panel's width: fox on the left, the card on the right */
.res-hero .rj-tip {
  position: absolute;
  left: 71%;
  translate: -50% 0;
  bottom: 12%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: calc(var(--u) * 1.2);
  z-index: 2;
}
.rj-tip .rj-card {
  --cw: calc(var(--u) * 17);
  width: var(--cw);
  rotate: 6deg;
  filter: drop-shadow(0 calc(var(--u) * 0.8) calc(var(--u) * 1) rgba(4, 30, 26, 0.55));
}
.rj-tip .tag {
  --h: calc(var(--u) * 8.5);
  min-width: calc(var(--u) * 26);
}
.res-hero.rj-pointing .char,
.res-hero.rj-pointing .shade {
  left: 33%;
}
body.land .res-hero .rj-tip {
  left: 73%;
  bottom: 4%;
  gap: calc(var(--u) * 0.8);
}
body.land .rj-tip .rj-card {
  --cw: calc(var(--u) * 11);
}
body.land .rj-tip .tag {
  --h: calc(var(--u) * 6.4);
  min-width: 0;
}
body.land .res-hero.rj-pointing .char,
body.land .res-hero.rj-pointing .shade {
  left: 30%;
}
/* End of css/screens-juice.css (complete file). */
