@keyframes jubber-excite {
  0% { transform: translate3d(var(--jub-pull-x, 0), var(--jub-pull-y, 0), 0) scale(1); }
  16% { transform: translate3d(var(--jub-pull-x, 0), calc(var(--jub-pull-y, 0) + 4px), 0) rotate(-5deg) scale(1.14, .82); }
  40% { transform: translate3d(var(--jub-pull-x, 0), calc(var(--jub-pull-y, 0) - 7px), 0) rotate(4deg) scale(.88, 1.17); }
  62% { transform: translate3d(var(--jub-pull-x, 0), var(--jub-pull-y, 0), 0) rotate(-2deg) scale(1.08, .93); }
  82% { transform: translate3d(var(--jub-pull-x, 0), calc(var(--jub-pull-y, 0) - 2px), 0) rotate(1deg) scale(.97, 1.05); }
  100% { transform: translate3d(var(--jub-pull-x, 0), var(--jub-pull-y, 0), 0) scale(1.02, .99); }
}
@keyframes jubber-surface {
  0%, 100% { filter: drop-shadow(0 6px 7px rgba(8, 18, 4, .28)) brightness(1) saturate(1); }
  50% { filter: drop-shadow(0 9px 10px rgba(8, 18, 4, .34)) brightness(1.055) saturate(1.06); }
}
@keyframes jubber-glow {
  0%, 100% { opacity: .17; transform: translateY(5%) scale(.9); }
  50% { opacity: calc(.2 + var(--jub-near, 0) * .12); transform: translateY(4%) scale(1.04); }
}
.jubber-ui {
  --jub-near: 0; --jub-pull-x: 0px; --jub-pull-y: 0px;
  position: fixed; right: clamp(18px, 3vw, 42px); bottom: clamp(18px, 3vw, 36px);
  z-index: 1000; width: clamp(112px, 13vw, 154px); aspect-ratio: 1;
  display: grid; place-items: center; border: 0; padding: 0; background: transparent;
  cursor: pointer; overflow: visible; isolation: isolate; perspective: 440px;
  -webkit-tap-highlight-color: transparent;
}
.jubber-ui__motion {
  position: relative; display: grid; width: 100%; height: 100%; place-items: center;
  transform-origin: 50% 76%; transform-style: preserve-3d; will-change: transform;
}
.jubber-ui__glow {
  position: absolute; z-index: -1; inset: 27% 17% 12%; border-radius: 50%;
  background: radial-gradient(ellipse at 50% 68%, rgba(196, 255, 114, .32), rgba(124, 203, 42, .11) 48%, transparent 72%);
  filter: blur(13px); pointer-events: none; animation: jubber-glow 4.8s ease-in-out infinite;
}
.jubber-ui__visual {
  display: block; width: 100%; height: 100%; max-width: none; object-fit: contain;
  pointer-events: none; user-select: none; -webkit-user-drag: none; transform-origin: 50% 72%;
  transform: translate3d(var(--jub-pull-x), var(--jub-pull-y), 0)
    rotate(calc((var(--jub-near) - .25) * 2deg))
    scaleX(calc(1 + var(--jub-near) * .055))
    scaleY(calc(1 - var(--jub-near) * .025));
  filter: drop-shadow(0 6px 7px rgba(8, 18, 4, .28))
    brightness(calc(1 + var(--jub-near) * .075))
    saturate(calc(1 + var(--jub-near) * .1));
  transition: transform .16s cubic-bezier(.22, .8, .25, 1), filter .18s ease;
  will-change: transform, filter; animation: jubber-surface 4.8s ease-in-out infinite;
}
.jubber-ui:hover .jubber-ui__visual,
.jubber-ui:focus-visible .jubber-ui__visual {
  animation: jubber-excite .76s cubic-bezier(.22, .86, .25, 1.16) 1,
    jubber-surface 1.6s .76s ease-in-out infinite;
}
.jubber-ui:focus-visible {
  outline: 2px solid rgba(202, 255, 139, .9); outline-offset: 8px; border-radius: 44%;
}
.jubber-ui__tip {
  position: absolute; right: 70%; bottom: 78%; width: max-content; max-width: min(230px, 72vw);
  padding: 9px 12px; border: 1px solid rgba(175, 255, 77, .35); border-radius: 999px;
  color: #f5ffe8; background: rgba(15, 28, 10, .94); box-shadow: 0 12px 30px rgba(0, 0, 0, .24);
  font: 800 12px/1.2 system-ui, sans-serif; letter-spacing: .04em; text-transform: uppercase; white-space: normal;
}
@media (max-width: 560px) {
  .jubber-ui { right: 18px; bottom: 18px; width: 112px; }
  .jubber-ui__tip { right: 45%; bottom: 88%; max-width: 190px; }
}
@media (prefers-reduced-motion: reduce) {
  .jubber-ui__motion, .jubber-ui__glow, .jubber-ui__visual,
  .jubber-ui:hover .jubber-ui__visual, .jubber-ui:focus-visible .jubber-ui__visual {
    animation: none !important; transition: none !important;
  }
}

.jubber-ui[data-jub-draggable] { touch-action: none; cursor: grab; }
.jubber-ui[data-jub-dragging] { cursor: grabbing; }
.jubber-ui[data-jub-throwing] { pointer-events: none; }
.jubber-ui[data-jub-emotion="excited"] .jubber-ui__glow { opacity: .42; filter: blur(15px); }
.jubber-ui[data-jub-emotion="scared"] .jubber-ui__visual { filter: drop-shadow(0 6px 7px rgba(8,18,4,.3)) saturate(.86) brightness(1.08); }

.jubber-chat {
  width: min(560px, calc(100vw - 28px));
  height: min(680px, calc(100dvh - 28px));
  max-height: 680px;
  padding: 0;
  color: #edf8e4;
  background: #0b120b;
  border: 1px solid rgba(176,255,83,.28);
  border-radius: 22px;
  box-shadow: 0 28px 90px rgba(0,0,0,.62);
  overflow: hidden;
}
.jubber-chat::backdrop { background: rgba(3,8,4,.72); backdrop-filter: blur(8px); }
.jubber-chat__shell { height: 100%; display: grid; grid-template-rows: auto minmax(0,1fr) auto; }
.jubber-chat__head { display: flex; align-items: center; gap: 10px; padding: 15px 16px; border-bottom: 1px solid rgba(176,255,83,.14); }
.jubber-chat__title { flex: 1; font: 800 16px/1.2 system-ui,sans-serif; }
.jubber-chat__close { border: 0; border-radius: 10px; padding: 8px 10px; color: #d9e7d2; background: #1a2619; cursor: pointer; }
.jubber-chat__log { min-height: 0; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.jubber-chat__message { width: fit-content; max-width: 84%; padding: 10px 12px; border-radius: 15px; font: 500 14px/1.5 system-ui,sans-serif; }
.jubber-chat__message--jubber { align-self: flex-start; color: #e6f7db; background: #182317; border-bottom-left-radius: 5px; }
.jubber-chat__message--user { align-self: flex-end; color: #102006; background: #a6e22e; border-bottom-right-radius: 5px; }
.jubber-chat__composer { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 9px; padding: 12px; border-top: 1px solid rgba(176,255,83,.14); background: #0d150d; }
.jubber-chat__composer input { min-width: 0; border: 1px solid #334432; border-radius: 12px; padding: 11px 12px; color: #f5ffe8; background: #111b10; font: 500 14px system-ui,sans-serif; }
.jubber-chat__composer button { border: 0; border-radius: 12px; padding: 11px 15px; color: #102006; background: #a6e22e; font-weight: 800; cursor: pointer; }
@media (max-width: 560px) {
  .jubber-chat { width: calc(100vw - 16px); height: min(720px, calc(100dvh - 16px)); border-radius: 18px; }
}

/* Production AMH aliases */
.amh-jubber {
  --jub-near: 0;
  --jub-pull-x: 0px;
  --jub-pull-y: 0px;
  isolation: isolate;
  perspective: 440px;
  touch-action: none;
}
.amh-jubber[data-jub],
.amh-jubber[data-flub] {
  cursor: grab !important;
  animation: none !important;
  filter: none !important;
  transition: none !important;
}
.amh-jubber[data-jub-dragging],
.amh-jubber[data-flub][data-jub-dragging] { cursor: grabbing !important; }
.amh-jubber[data-jub-throwing] { pointer-events: none; }
.amh-jubber-body { overflow: visible !important; }
.amh-jubber-motion {
  position: relative;
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  transform-origin: 50% 76%;
  transform-style: preserve-3d;
  will-change: transform;
}
.amh-jubber-glow {
  position: absolute;
  z-index: -1;
  inset: 27% 17% 12%;
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 68%, rgba(196,255,114,.32), rgba(124,203,42,.11) 48%, transparent 72%);
  filter: blur(13px);
  pointer-events: none;
  animation: jubber-glow 4.8s ease-in-out infinite;
}
.amh-jubber .amh-jubber-visual {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  transform-origin: 50% 72%;
  transform: translate3d(var(--jub-pull-x),var(--jub-pull-y),0)
    rotate(calc((var(--jub-near) - .25) * 2deg))
    scaleX(calc(1 + var(--jub-near) * .055))
    scaleY(calc(1 - var(--jub-near) * .025));
  filter: drop-shadow(0 6px 7px rgba(8,18,4,.28))
    brightness(calc(1 + var(--jub-near) * .075))
    saturate(calc(1 + var(--jub-near) * .1)) !important;
  transition: transform .16s cubic-bezier(.22,.8,.25,1),filter .18s ease !important;
  animation: jubber-surface 4.8s ease-in-out infinite !important;
  will-change: transform,filter;
}
.amh-jubber:hover .amh-jubber-visual {
  animation: jubber-excite .76s cubic-bezier(.22,.86,.25,1.16) 1,
    jubber-surface 1.6s .76s ease-in-out infinite !important;
}
.amh-jubber[data-jub-emotion="excited"] .amh-jubber-glow { opacity: .44; filter: blur(15px); }
.amh-jubber[data-jub-emotion="scared"] .amh-jubber-visual {
  filter: drop-shadow(0 6px 7px rgba(8,18,4,.3)) saturate(.84) brightness(1.08) !important;
}
.jubber-chat-overlay {
  align-items: center !important;
  justify-content: center !important;
  padding: max(8px,env(safe-area-inset-top)) max(8px,env(safe-area-inset-right))
    max(8px,env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left)) !important;
}
.jubber-chat-modal {
  position: fixed !important;
  left: 50% !important;
  top: 50% !important;
  right: auto !important;
  bottom: auto !important;
  transform: translate(-50%,-50%) !important;
  width: min(560px,calc(100vw - 24px)) !important;
  max-width: calc(100vw - 24px) !important;
  height: auto;
  max-height: min(720px,calc(100dvh - 24px)) !important;
  overflow-y: auto !important;
  overscroll-behavior: contain;
  z-index: 72 !important;
}
.jubber-chat-user {
  width: fit-content;
  max-width: 86%;
  margin: 10px 0 0 auto;
  padding: 9px 11px;
  border-radius: 12px 12px 4px 12px;
  color: #132007;
  background: #a6e22e;
  font-size: 12.5px;
  line-height: 1.5;
}
.jubber-chat-reply { margin-top: 9px; }
.jubber-chat-composer {
  position: sticky;
  bottom: -1px;
  z-index: 3;
  padding-top: 10px;
  padding-bottom: max(2px,env(safe-area-inset-bottom));
  background: inherit;
}
.jubber-human-check {
  width: 100%;
  margin-top: 6px;
}
.jubber-human-label {
  margin-bottom: 4px;
  color: #78836d;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .07em;
}
#jubber-turnstile { width: 100%; min-height: 65px; }
@media(max-width:560px) {
  .jubber-chat-modal {
    width: calc(100vw - 16px) !important;
    max-width: calc(100vw - 16px) !important;
    max-height: calc(100dvh - 16px) !important;
    border-radius: 18px !important;
  }
  .jubber-human-check { width: 150px; max-width: 46vw; margin-top: 5px; }
  #jubber-turnstile { width: 150px; min-height: 65px; transform: scale(.78); transform-origin: top left; margin-bottom: -28px; }
  .jubber-human-label { font-size: 8px; }
}
@media(prefers-reduced-motion:reduce) {
  .amh-jubber-motion,.amh-jubber-glow,.amh-jubber .amh-jubber-visual { animation:none !important; transition:none !important; }
}

/* v5: the floating host is the true visible bound; ambient motion stays inside it. */
.amh-jubber[data-jub],
.amh-jubber[data-flub] { contain: layout style; }
.amh-jubber[data-jub-busy] { cursor: progress !important; }
.amh-jubber-showcase { touch-action: auto; cursor: default; overflow: visible; }
.amh-jubber-showcase .amh-jubber-motion { width: 100%; height: 100%; }
.amh-jubber-showcase .amh-jubber-visual { width: 100% !important; height: 100% !important; }
.amh-jubber-chat-avatar { overflow: visible; touch-action: auto; cursor: default; }
.amh-jubber-chat-avatar .amh-jubber-motion { width: 100%; height: 100%; }
.amh-jubber-chat-avatar .amh-jubber-visual { width: 100% !important; height: 100% !important; }
