/* ── Floating Message Blobs ── */

#fmb-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 99999;
}

/* ── Individual Blob ── */
.fmb-blob {
  position: fixed;
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  border-radius: 100px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.4;
  width: max-content;
  max-width: min(320px, calc(100vw - 40px));
  box-shadow:
    0 4px 24px rgba(0, 0, 0, 0.18),
    0 1px 4px rgba(0, 0, 0, 0.10),
    inset 0 1px 0 rgba(255,255,255,0.15);
  cursor: default;
  user-select: none;
  will-change: transform, opacity;
  backdrop-filter: blur(4px);

  /* Entry state */
  opacity: 0;
  transform: translateY(20px) scale(0.88);
  transition:
    opacity 0.45s cubic-bezier(0.34, 1.56, 0.64, 1),
    transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── Visible state ── */
.fmb-blob.fmb-in {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* ── Exit state ── */
.fmb-blob.fmb-out {
  opacity: 0;
  transform: translateY(-14px) scale(0.94);
  transition:
    opacity 0.35s ease-in,
    transform 0.35s ease-in;
}

/* ── Float animation (subtle hover) ── */
@keyframes fmb-float {
  0%   { transform: translateY(0px); }
  50%  { transform: translateY(-6px); }
  100% { transform: translateY(0px); }
}

.fmb-blob.fmb-in {
  animation: fmb-float 3.5s ease-in-out infinite;
  animation-delay: 0.5s;
}

.fmb-blob.fmb-out {
  animation: none;
}

/* ── Blob text ── */
.fmb-blob-text {
  flex: 1;
}

/* ── Close button ── */
.fmb-blob-close {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
  opacity: 0.55;
  color: inherit;
  flex-shrink: 0;
  transition: opacity 0.2s, background 0.2s;
}

.fmb-blob-close:hover {
  opacity: 1;
  background: rgba(255,255,255,0.2);
}

/* ── Blob dot (decorative) ── */
.fmb-blob::before {
  content: "";
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.6);
  flex-shrink: 0;
  animation: fmb-pulse 2s ease-in-out infinite;
}

@keyframes fmb-pulse {
  0%, 100% { transform: scale(1);   opacity: 0.6; }
  50%       { transform: scale(1.5); opacity: 1; }
}

/* ── Position offsets ── */
.fmb-blob[data-pos="bottom-left"]  { bottom: 28px; left: 28px; }
.fmb-blob[data-pos="bottom-right"] { bottom: 28px; right: 28px; }
.fmb-blob[data-pos="top-left"]     { top: 28px; left: 28px; }
.fmb-blob[data-pos="top-right"]    { top: 28px; right: 28px; }

/* ── Stacking for multiple blobs ── */
.fmb-blob[data-pos="bottom-left"]:nth-child(2)  { bottom: calc(28px + var(--fmb-stack-offset, 0px)); }
.fmb-blob[data-pos="bottom-right"]:nth-child(2) { bottom: calc(28px + var(--fmb-stack-offset, 0px)); }

/* ── Clickable blob link ── */
.fmb-blob.fmb-has-link {
  cursor: pointer;
}

.fmb-blob-link {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  z-index: 0;
}

.fmb-blob-link:focus-visible {
  outline: 2px solid rgba(255,255,255,0.8);
  outline-offset: 2px;
}

.fmb-blob.fmb-has-link .fmb-blob-text,
.fmb-blob.fmb-has-link .fmb-blob-close {
  position: relative;
  z-index: 1;
}

/* ── Mobile adjustments ── */
@media (max-width: 480px) {
  .fmb-blob {
    font-size: 13px;
    padding: 11px 16px;
    width: max-content;
    max-width: calc(100vw - 32px);
  }
  .fmb-blob[data-pos="bottom-left"],
  .fmb-blob[data-pos="bottom-right"] { bottom: 16px; }
  .fmb-blob[data-pos="bottom-left"],
  .fmb-blob[data-pos="top-left"]     { left: 16px; }
  .fmb-blob[data-pos="bottom-right"],
  .fmb-blob[data-pos="top-right"]    { right: 16px; }
}
