.mpl-ai-bubble {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9500;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2.5px solid var(--ink);
  background: var(--maniaci);
  box-shadow: 5px 5px 0 0 var(--ink);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease);
  animation: mplAiBounce 2.2s ease-in-out infinite;
  padding: 0;
}
.mpl-ai-bubble:hover {
  transform: translate(-3px, -3px) scale(1.04);
  box-shadow: 8px 8px 0 0 var(--ink);
  animation-play-state: paused;
}
.mpl-ai-bubble svg { width: 28px; height: 28px; }
.mpl-ai-bubble-img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: top center;
  border-radius: 50%;
}
/* Two stacked expanding rings — clearly signal interactivity */
.mpl-ai-bubble::before,
.mpl-ai-bubble::after {
  content: "";
  position: absolute;
  inset: -2.5px;
  border-radius: 50%;
  border: 2px solid var(--maniaci);
  pointer-events: none;
  animation: mplAiRing 2.2s cubic-bezier(0.15, 0.6, 0.3, 1) infinite;
  opacity: 0;
  z-index: -1;
}
.mpl-ai-bubble::after { animation-delay: 1.1s; }
@keyframes mplAiRing {
  0%   { transform: scale(0.92); opacity: 0.8; border-width: 3px; }
  70%  { transform: scale(1.7);  opacity: 0;   border-width: 1px; }
  100% { transform: scale(1.7);  opacity: 0;   border-width: 1px; }
}
@keyframes mplAiBounce {
  0%, 100% { transform: translateY(0)    scale(1); }
  50%      { transform: translateY(-3px) scale(1.04); }
}
/* Notification dot — there's something to discover */
.mpl-ai-bubble-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 18px;
  height: 18px;
  background: #ef4444;
  color: #fff;
  border: 2.5px solid var(--paper);
  border-radius: 50%;
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  animation: mplAiBadgePulse 1.6s ease-in-out infinite;
  z-index: 2;
}
@keyframes mplAiBadgePulse {
  0%, 100% { transform: scale(1);    box-shadow: 0 0 0 0 rgba(239,68,68,0.5); }
  50%      { transform: scale(1.15); box-shadow: 0 0 0 6px rgba(239,68,68,0); }
}
.mpl-ai-bubble-label {
  position: absolute;
  right: 76px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 8px 14px;
  border-radius: var(--r-full);
  white-space: nowrap;
  box-shadow: 3px 3px 0 0 var(--maniaci);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s var(--ease);
}
.mpl-ai-bubble:hover .mpl-ai-bubble-label { opacity: 1; }

/* Modal */
html.mpl-ai-lock,
html.mpl-ai-lock body {
  overflow: hidden;
}
.mpl-ai-modal {
  position: fixed;
  inset: 0;
  z-index: 9700;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  --mpl-ai-vv-height: 100dvh;
  --mpl-ai-vv-top: 0px;
  transition: opacity 0.3s var(--ease), visibility 0.3s;
}
.mpl-ai-modal.active { opacity: 1; visibility: visible; }
.mpl-ai-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10,10,10,0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.mpl-ai-card {
  position: relative;
  background: var(--paper);
  border: 2.5px solid var(--ink);
  border-radius: var(--r-lg);
  box-shadow: 8px 8px 0 0 var(--maniaci);
  width: 100%;
  max-width: 440px;
  height: min(640px, 80vh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(20px) scale(0.96);
  transition: transform 0.4s var(--ease);
}
.mpl-ai-modal.active .mpl-ai-card { transform: translateY(0) scale(1); }

.mpl-ai-close {
  position: absolute;
  top: 14px; right: 14px;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--ink);
  cursor: pointer;
  z-index: 5;
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 3px 3px 0 0 var(--maniaci);
  transition: transform 0.15s, box-shadow 0.15s;
  padding: 0;
  line-height: 1;
}
.mpl-ai-close:hover {
  transform: translate(-2px, -2px);
  box-shadow: 5px 5px 0 0 var(--maniaci);
}

.mpl-ai-header {
  padding: 28px 24px 18px;
  border-bottom: 2px solid var(--ink-05);
  background: var(--paper);
}
.mpl-ai-header-top {
  display: flex;
  align-items: center;
  gap: 16px;
}
.mpl-ai-avatar {
  position: relative;
  flex-shrink: 0;
  width: 56px; height: 56px;
  border-radius: 50%;
  border: 2.5px solid var(--maniaci);
  overflow: hidden;
  box-shadow: 3px 3px 0 0 var(--ink);
}
.mpl-ai-avatar img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: top center;
}
.mpl-ai-avatar-dot {
  position: absolute;
  bottom: 2px; right: 2px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #00D26A;
  border: 2.5px solid var(--paper);
  box-shadow: 0 0 6px rgba(0,210,106,0.5);
  animation: dotPulse 2.4s ease-in-out infinite;
}
.mpl-ai-header-text { flex: 1; }
.mpl-ai-eyebrow {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--maniaci);
  margin-bottom: 10px;
}
.mpl-ai-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 22px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0;
}
.mpl-ai-subtitle {
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--ink-40);
  margin: 6px 0 0;
}

.mpl-ai-chat {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 20px 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--ink-05);
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.mpl-ai-msg {
  max-width: 88%;
  padding: 12px 14px;
  border-radius: 14px;
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.55;
  word-wrap: break-word;
  white-space: pre-wrap;
}
.mpl-ai-msg--user {
  align-self: flex-end;
  background: var(--ink);
  color: var(--paper);
  border-bottom-right-radius: 4px;
}
.mpl-ai-msg--assistant {
  align-self: flex-start;
  background: var(--paper);
  color: var(--ink);
  border: 1.5px solid var(--ink-10);
  border-bottom-left-radius: 4px;
}
.mpl-ai-msg--assistant a {
  color: var(--maniaci-800);
  text-decoration: underline;
  font-weight: 600;
}
.mpl-ai-msg--error {
  background: var(--maniaci-50);
  border-color: var(--maniaci-200);
}
.mpl-ai-msg.typing::after {
  content: '●';
  display: inline-block;
  margin-left: 4px;
  color: var(--maniaci);
  animation: mplAiTypingDot 1.1s ease-in-out infinite;
}
@keyframes mplAiTypingDot {
  0%, 100% { opacity: 0.25; }
  50%      { opacity: 1; }
}

.mpl-ai-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 20px 14px;
  background: var(--ink-05);
  border-top: 1px solid var(--ink-10);
}
.mpl-ai-suggest {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 7px 12px;
  border-radius: var(--r-full);
  border: 1.5px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.mpl-ai-suggest:hover {
  transform: translate(-1px, -1px);
  box-shadow: 2px 2px 0 0 var(--maniaci);
}

.mpl-ai-input-form {
  display: flex;
  gap: 8px;
  padding: 14px 16px;
  border-top: 2px solid var(--ink-05);
  background: var(--paper);
}
.mpl-ai-input-form input {
  flex: 1;
  min-width: 0;
  padding: 11px 14px;
  border: 1.5px solid var(--ink-10);
  border-radius: var(--r-md);
  background: var(--paper);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.2;
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s;
  -webkit-text-size-adjust: 100%;
}
.mpl-ai-input-form input:focus { border-color: var(--maniaci); }
.mpl-ai-input-form input::placeholder { color: var(--ink-40); }
.mpl-ai-send {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: var(--maniaci);
  color: var(--paper);
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 3px 3px 0 0 var(--ink);
  transition: transform 0.15s, box-shadow 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.mpl-ai-send svg { width: 20px; height: 20px; }
.mpl-ai-send:hover {
  transform: translate(-2px, -2px);
  box-shadow: 5px 5px 0 0 var(--ink);
}
.mpl-ai-send:disabled {
  opacity: 0.5;
  pointer-events: none;
  background: var(--ink-20);
}

.mpl-ai-disclaimer {
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.08em;
  color: var(--ink-40);
  text-align: center;
  padding: 4px 16px 10px;
  background: var(--paper);
}

/* WhatsApp handoff button in chat */
.mpl-ai-wa-footer {
  display: flex;
  justify-content: center;
  padding: 8px 16px 12px;
  background: var(--paper);
  border-top: 1px solid var(--ink-05);
}
.mpl-ai-wa-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--r-full);
  border: 2px solid #25D366;
  background: #25D366;
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  box-shadow: 3px 3px 0 0 var(--ink);
  transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease);
  white-space: nowrap;
}
.mpl-ai-wa-btn:hover {
  transform: translate(-2px, -2px);
  box-shadow: 5px 5px 0 0 var(--ink);
}
.mpl-ai-wa-btn svg { width: 13px; height: 13px; }

@media (max-width: 700px) {
  .mpl-ai-modal {
    inset: var(--mpl-ai-vv-top, 0px) 0 auto 0;
    height: var(--mpl-ai-vv-height, 100dvh);
    padding: 0;
    align-items: stretch;
    justify-content: flex-end;
  }
  .mpl-ai-backdrop {
    background: rgba(10,10,10,0.66);
  }
  .mpl-ai-card {
    width: 100%;
    max-width: none;
    height: 100%;
    max-height: 100%;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 22px 22px 0 0;
    box-shadow: 0 -7px 0 0 var(--maniaci);
    transform: translateY(18px);
  }
  .mpl-ai-modal.active .mpl-ai-card {
    transform: translateY(0);
  }
  .mpl-ai-close {
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    box-shadow: 2px 2px 0 0 var(--maniaci);
  }
  .mpl-ai-header {
    flex: 0 0 auto;
    padding: 18px 54px 12px 16px;
  }
  .mpl-ai-header-top {
    gap: 12px;
  }
  .mpl-ai-avatar {
    width: 44px;
    height: 44px;
  }
  .mpl-ai-eyebrow {
    font-size: 8px;
    margin-bottom: 5px;
  }
  .mpl-ai-title {
    font-size: 19px;
  }
  .mpl-ai-subtitle {
    display: none;
  }
  .mpl-ai-chat {
    flex: 1 1 auto;
    padding: 14px 14px 10px;
    gap: 10px;
  }
  .mpl-ai-msg {
    max-width: 92%;
    font-size: 14px;
    line-height: 1.48;
  }
  .mpl-ai-suggestions {
    flex: 0 0 auto;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 8px;
    padding: 8px 12px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .mpl-ai-suggestions::-webkit-scrollbar {
    display: none;
  }
  .mpl-ai-suggest {
    flex: 0 0 auto;
    white-space: nowrap;
    font-size: 8px;
    padding: 7px 10px;
  }
  .mpl-ai-input-form {
    flex: 0 0 auto;
    position: sticky;
    bottom: 0;
    z-index: 6;
    gap: 8px;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    border-top: 2px solid var(--ink);
    box-shadow: 0 -10px 24px rgba(10,10,10,0.08);
  }
  .mpl-ai-input-form input {
    height: 46px;
    padding: 0 14px;
    border: 2px solid var(--ink);
    border-radius: var(--r-full);
    font-size: 16px;
  }
  .mpl-ai-send {
    width: 46px;
    height: 46px;
    flex-basis: 46px;
    box-shadow: 2px 2px 0 0 var(--ink);
  }
  .mpl-ai-wa-footer {
    flex: 0 0 auto;
    padding: 6px 12px 8px;
  }
  .mpl-ai-wa-btn {
    width: 100%;
    justify-content: center;
    padding: 8px 12px;
    font-size: 8px;
    box-shadow: none;
  }
  .mpl-ai-disclaimer {
    display: none;
  }
  .mpl-ai-bubble {
    width: 56px;
    height: 56px;
    bottom: calc(18px + env(safe-area-inset-bottom));
    right: 18px;
  }
  .mpl-ai-bubble svg {
    width: 24px;
    height: 24px;
  }
  .mpl-ai-bubble-label {
    display: none;
  }
}
