/* ==========================================================================
   Smart Animals — "feel & juice" effects (assets/js/juice.js)
   Groups can be turned off in the admin panel (Interface tab): app.js then adds
   ui-no-lively, ui-no-msgfx, ui-no-rewards or ui-no-homefx to <html>.
   "Reduce motion" is handled by the rule at the end of style.css and below.
   ========================================================================== */

/* ---- living characters: breathing, talking, hop when a chat opens, secret spin ---- */
html:not(.ui-no-lively) :is(#headRing, #panelRing, .welcome-ring) .ring-pic .sa-av {
  animation: jzBreathe 3.6s ease-in-out infinite; transform-origin: 50% 85%;
}
html:not(.ui-no-lively) #panelRing .ring-pic .sa-av { animation-delay: -1.2s; }
@keyframes jzBreathe { 50% { transform: translateY(-1.6%) scale(1.022, 1.018); } }
html:not(.ui-no-lively) :is(#headRing, #panelRing).speaking .ring-pic .sa-av { animation: jzTalk .48s ease-in-out infinite alternate; }
@keyframes jzTalk { from { transform: rotate(-3deg); } to { transform: rotate(3deg) translateY(-4%) scale(1.03); } }

.ring-pic.jz-hop { animation: jzHop .7s var(--spring); }
@keyframes jzHop {
  0% { transform: translateY(0) scale(.9); }
  35% { transform: translateY(-14%) scale(1.03, .99); }
  65% { transform: translateY(0) scale(1.05, .95); }
  100% { transform: none; }
}
.ring-pic.jz-spin { animation: jzSpin .9s var(--ease); }
@keyframes jzSpin { 50% { transform: rotate(200deg) scale(1.12); } 100% { transform: rotate(360deg); } }

/* Particles (hearts on like, sparkles on the secret spin) */
.jz-bit {
  position: fixed; z-index: 85; pointer-events: none; line-height: 1; font-weight: 700;
  transform: translate(-50%, -50%); animation: jzBit .85s cubic-bezier(.2, .7, .3, 1) forwards;
}
@keyframes jzBit {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(.4); }
  60% { opacity: 1; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) rotate(var(--r)) scale(1); }
}

/* ---- message effects ---- */
.jz-new { animation: jzWord .35s ease-out both; }
@keyframes jzWord { from { opacity: 0; } }

html:not(.ui-no-msgfx) .msg-me { animation: jzWhoosh .5s var(--spring) both; transform-origin: 100% 100%; }
@keyframes jzWhoosh { 0% { opacity: 0; transform: translate(-6px, 44px) scale(.86); } 55% { opacity: 1; } }
html:not(.ui-no-msgfx) .msg-bot { animation: jzSpring .6s var(--spring) both; transform-origin: 0 0; }
@keyframes jzSpring { from { opacity: 0; transform: translateY(14px) scale(.96); } }

.act.js-copy.jz-copied { color: var(--ok); }
.act.js-copy.jz-copied .ic { animation: jzCheck .5s var(--spring); }
@keyframes jzCheck { 0% { opacity: 0; transform: scale(.2) rotate(-45deg); } 60% { opacity: 1; transform: scale(1.25); } 100% { transform: none; } }

/* ---- model tag and AI follow-up questions ---- */
.model-tag {
  display: inline-flex; align-items: center; margin-top: 8px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700;
  color: color-mix(in srgb, var(--a-color) 62%, var(--ink)); background: color-mix(in srgb, var(--a-color) 12%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--a-color) 25%, transparent);
}
.model-tag[hidden] { display: none; }
.prompt.jz-ask { animation: jzAskIn .45s var(--spring) both; }
@keyframes jzAskIn { from { opacity: 0; transform: translateY(8px); } }

/* ---- rewards: new level on the profile card ---- */
.profile-card.jz-lvlup .ring-lg { animation: jzLvlRing 1.2s var(--spring); }
.profile-card.jz-lvlup .profile-art { box-shadow: inset 0 0 0 2px var(--a-color), inset 0 0 40px color-mix(in srgb, var(--a-color) 35%, transparent); }
@keyframes jzLvlRing { 25% { transform: scale(1.12) rotate(-4deg); } 55% { transform: scale(.97) rotate(2deg); } }
.jz-lvl-tag {
  position: absolute; left: 50%; bottom: 12px; z-index: 2; transform: translateX(-50%); max-width: calc(100% - 24px);
  padding: 6px 12px; border-radius: 999px; background: var(--a-color); color: #fff; font-size: 12.5px; font-weight: 800;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; box-shadow: 0 6px 18px color-mix(in srgb, var(--a-color) 45%, transparent);
  animation: jzTagIn .5s var(--spring) both, jzTagOut .3s var(--ease) 2.3s forwards;
}
@keyframes jzTagIn { from { opacity: 0; transform: translate(-50%, 12px) scale(.8); } }
@keyframes jzTagOut { to { opacity: 0; transform: translate(-50%, 6px); } }

/* ---- home & ambience: card tilt, loading cards, tinted chat ---- */
.card.jz-tilt:hover {
  transform: perspective(900px) rotateX(var(--jz-rx, 0deg)) rotateY(var(--jz-ry, 0deg)) translateY(-4px);
  transition: transform .15s ease-out, box-shadow .35s var(--ease), border-color .35s var(--ease);
}

.jz-skel { display: flex; flex-direction: column; gap: 10px; padding: 8px 8px 16px; border: 1px solid var(--line); border-radius: var(--r-xl); background: var(--surface); }
.jz-skel i, .jz-skel b {
  display: block; border-radius: 8px;
  background: linear-gradient(100deg, var(--sunken) 30%, color-mix(in srgb, var(--sunken), var(--ink) 6%) 50%, var(--sunken) 70%);
  background-size: 250% 100%; animation: jzShimmer 1.4s linear infinite;
}
.jz-skel i { aspect-ratio: 4 / 3; border-radius: 14px; }
.jz-skel b { height: 14px; width: 55%; margin: 4px 8px 0; }
.jz-skel b:last-child { height: 11px; width: 80%; margin-top: 0; }
@keyframes jzShimmer { from { background-position: 100% 0; } to { background-position: -150% 0; } }
.ui-no-homefx .jz-skel { visibility: hidden; }

/* The tint covers the whole chat (behind the composer too), over the surface color. */
html:not(.ui-no-homefx) .room {
  background-image:
    radial-gradient(90% 60% at 50% 0%, color-mix(in srgb, var(--a-color) 6%, transparent), transparent 75%),
    linear-gradient(to top, color-mix(in srgb, var(--a-color) 3%, transparent), transparent 45%);
}
html[data-theme="dark"]:not(.ui-no-homefx) .room {
  background-image:
    radial-gradient(90% 60% at 50% 0%, color-mix(in srgb, var(--a-color) 16%, transparent), transparent 75%),
    linear-gradient(to top, color-mix(in srgb, var(--a-color) 6%, transparent), transparent 45%);
}
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]):not(.ui-no-homefx) .room {
    background-image:
      radial-gradient(90% 60% at 50% 0%, color-mix(in srgb, var(--a-color) 16%, transparent), transparent 75%),
      linear-gradient(to top, color-mix(in srgb, var(--a-color) 6%, transparent), transparent 45%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .jz-bit { display: none; }
  .jz-skel i, .jz-skel b { animation: none !important; }
}

/* End of assets/css/juice.css */
