/* Screen feel: item curtain, cascading panels, victory and defeat, map,
   album, streak flame and living background. Everything seen here is art (assets/fx, items, faces) moved only with
   transform/opacity. "Reduced motion" (body.reduced) cuts the curtain, cascade, confetti and the background movement.
   The code is in src/ui/fx.js, src/ui/party.js and src/ui/ambient.js. */

/* front layer (outside #ui): loose sparkles and curtain */
#fxf {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9;
  overflow: hidden;
}
.spk {
  position: absolute;
  width: calc(var(--u) * 6);
  translate: -50% -50%;
  pointer-events: none;
}
.spk.s {
  width: calc(var(--u) * 3.4);
}
.spk.big {
  width: calc(var(--u) * 22);
}

/* --- item curtain rolling (the whole strip moves; each item spins in place) --- */
.curt {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  pointer-events: auto;
  will-change: transform;
}
.curt > i {
  position: absolute;
  top: 0;
  bottom: 0;
  background: #24104e;
} /* the dark between the items (the edges stay behind them) */
.cf {
  position: absolute;
  animation: roll 1.3s linear infinite;
}
.cf img {
  position: absolute;
  left: -8%;
  top: -8%;
  width: 116%;
  height: 116%;
}
.cf img + img {
  left: 16%;
  top: 32.5%;
  width: 68%;
  height: auto;
} /* face: same calculation as the globe (render/face.js) */
@keyframes roll {
  to {
    transform: rotate(var(--turn, 360deg));
  }
}

/* --- panels spring in and the items inside appear one after another (class .in, removed at the end: changing a
   setting never replays it). The ribbon, the X and the kitten belong to the frame and arrive with it. --- */
.modal.in .panel > :not(.ribbon):not(.x):not(.wm):not(.wc):not(.hm) {
  animation: item-in 0.36s var(--pop) both;
  animation-delay: calc(0.1s + var(--i, 0) * 0.055s);
}
@keyframes item-in {
  from {
    opacity: 0;
    transform: translateY(calc(var(--u) * 2.6)) scale(0.94);
  }
}
/* defeat: arrives slowly, no spring (gentle) */
#m-lose.in .panel {
  animation: soft-in 0.5s cubic-bezier(0.2, 0.7, 0.3, 1) both;
}
@keyframes soft-in {
  from {
    opacity: 0;
    transform: translateY(calc(var(--u) * 4));
  }
}
body.reduced .modal.in .panel > * {
  animation: none !important;
}
body.reduced #m-lose.in .panel {
  animation: fade-in 0.18s both;
}

/* --- the kitten of the win screen hops in place (feet planted, within 8% either way); the one of the defeat screen sways slowly --- */
#m-win .wm {
  transform-origin: 50% 96%;
  animation: wm-hop 1.6s ease-in-out infinite;
}
@keyframes wm-hop {
  0%,
  55%,
  100% {
    transform: none;
  }
  66% {
    transform: scale(1.05, 0.93);
  }
  78% {
    transform: scale(0.96, 1.07);
  }
  90% {
    transform: scale(1.03, 0.97);
  }
}
#m-lose .pm {
  transform-origin: 50% 96%;
  animation: pm-sway 3.4s ease-in-out infinite;
}
@keyframes pm-sway {
  0%,
  100% {
    transform: rotate(-1.6deg);
  }
  50% {
    transform: rotate(1.6deg) scale(1, 1.02);
  }
}
body.reduced #m-win .wm,
body.reduced #m-lose .pm {
  animation: none;
}

/* --- confetti of little items: born behind the panel, rises, falls and bounces on the scenery floor (position from code) --- */
.conf {
  position: fixed;
  left: 0;
  top: 0;
  width: calc(var(--u) * 7);
  z-index: -1;
  pointer-events: none;
  will-change: transform;
}

/* --- level tip (one line, in the voice of the kitten) --- */
.fun {
  flex: none;
  font-size: calc(var(--u) * 3.8);
  color: #ffe9a0;
  max-width: 88%;
  text-align: center;
} /* long sentence (ru) with room from the edges */

/* --- main button breathes and a shine passes slowly until touched (nothing blinks) --- */
[data-live] {
  animation: live 2.6s ease-in-out infinite;
}
@keyframes live {
  50% {
    scale: 1.035;
  }
}
[data-live][data-p='dn'] {
  animation: none;
}
.shn {
  position: absolute;
  pointer-events: none;
  overflow: hidden;
  border-radius: calc(var(--u) * 6);
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}
.shn img {
  position: absolute;
  top: -20%;
  left: 0;
  height: 140%;
  opacity: 0.5;
  animation: shine 3.6s ease-in-out infinite;
}
@keyframes shine {
  0%,
  62% {
    transform: translateX(-140%);
  }
  100% {
    transform: translateX(calc(var(--sw) + 40%));
  }
}
body.reduced [data-live] {
  animation: none;
}
body.reduced .shn {
  display: none;
}

/* --- streak flame (grows with the streak: 1 to 2, 3 to 6, 7 or more) --- */
.mstat {
  display: flex;
  align-items: center;
  gap: calc(var(--u) * 1.2);
}
.flame {
  flex: none;
  height: calc(var(--u) * 5.6);
  margin: calc(var(--u) * -0.6) 0;
  transform-origin: 50% 92%;
  animation: flame 1.5s ease-in-out infinite;
}
.flame[data-f='2'] {
  height: calc(var(--u) * 7.4);
} /* the row grows with the flame: it never rises over the text above */
.flame[data-f='3'] {
  height: calc(var(--u) * 9.4);
}
@keyframes flame {
  0%,
  100% {
    transform: none;
  }
  35% {
    transform: scale(0.96, 1.06) rotate(-3deg);
  }
  70% {
    transform: scale(1.03, 0.97) rotate(2deg);
  }
}
body.reduced .flame {
  animation: none;
}

/* --- living background. #amb has the exact size of the background art (src/ui/ambient.js): each piece stays attached to a point
   of the scenery at any aspect ratio. --a = 1% of the art height; --aw = art width. --- */
#amb {
  contain: layout;
}
#amb img {
  position: absolute;
  pointer-events: none;
}
.a-cloud {
  opacity: 0.8;
  animation: a-drift var(--t) linear var(--d) infinite;
}
@keyframes a-drift {
  from {
    transform: translateX(calc(var(--a) * -40));
  }
  to {
    transform: translateX(calc(var(--aw) + var(--a) * 10));
  }
}
.a-fly {
  animation:
    a-wander var(--t) ease-in-out var(--d) infinite alternate,
    a-glow var(--g) ease-in-out var(--d) infinite;
}
@keyframes a-wander {
  0% {
    transform: translate(0, 0);
  }
  33% {
    transform: translate(calc(var(--a) * var(--x)), calc(var(--a) * var(--y) * -1));
  }
  66% {
    transform: translate(calc(var(--a) * var(--x) * -0.6), calc(var(--a) * var(--y) * -1.6));
  }
  100% {
    transform: translate(calc(var(--a) * var(--x) * 0.4), calc(var(--a) * var(--y) * 0.7));
  }
}
@keyframes a-glow {
  0%,
  100% {
    opacity: 0.15;
  }
  50% {
    opacity: 1;
  }
}
.a-glint {
  animation: a-twinkle var(--t) ease-in-out var(--d) infinite;
}
@keyframes a-twinkle {
  0%,
  55%,
  100% {
    transform: scale(0);
    opacity: 0;
  }
  78% {
    transform: scale(1);
    opacity: 0.9;
  }
}
.a-fall {
  animation: a-fall var(--t) linear var(--d) infinite;
}
@keyframes a-fall {
  0% {
    transform: translate(0, 0) rotate(0deg);
    opacity: 0;
  }
  6% {
    opacity: var(--o, 1);
  }
  25% {
    transform: translate(calc(var(--a) * var(--x)), calc(var(--a) * var(--y) * 0.25)) rotate(calc(var(--r) * 0.25));
  }
  50% {
    transform: translate(calc(var(--a) * var(--x) * -0.5), calc(var(--a) * var(--y) * 0.5)) rotate(calc(var(--r) * 0.5));
  }
  75% {
    transform: translate(calc(var(--a) * var(--x) * 0.8), calc(var(--a) * var(--y) * 0.75))
      rotate(calc(var(--r) * 0.75));
  }
  92% {
    opacity: var(--o, 1);
  }
  100% {
    transform: translate(0, calc(var(--a) * var(--y))) rotate(var(--r));
    opacity: 0;
  }
}
body.reduced #amb img {
  animation: none;
}
body.reduced #amb .a-glint,
body.reduced #amb .a-fall,
body.reduced #amb .a-meteor {
  display: none;
}
#amb .a-meteor {
  opacity: 0;
} /* it only moves with Web Animations (src/ui/ambient.js); without them it stays hidden */

/* --- the edges of the screen darken a little (last 3 items, last 10 s). Night-blue picture with a transparent middle
   (assets/fx/vignette.webp), used as a 9-slice frame: the corners are never distorted. It sits between the globe canvas and the
   interface (the HUD, the tray and the kitten stay bright). The opacity comes from src/fx/stage.js; nothing blinks. --- */
#vig {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  box-sizing: border-box;
  border: 36vmin solid transparent;
  border-image: url(../assets/fx/vignette.webp) 128 fill / 36vmin;
  will-change: opacity;
}
/* End of css/fx.css (complete file). */
