.may-ai-chatbot {
  --may-chat-gold: #c8a552;
  --may-chat-gold-light: #ddc276;
  --may-chat-ink: #0a223d;
  --may-chat-panel: #0a223d;
  --may-chat-panel-2: #123555;
  --may-chat-paper: #f5f2eb;
  --may-chat-muted: rgba(245, 242, 235, .68);
  --may-chat-border: rgba(200,165,82, .22);
  font-family: Inter, Arial, sans-serif;
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 8500;
  color: var(--may-chat-paper);
}

.may-ai-chatbot * {
  box-sizing: border-box;
}

.may-chat-toggle {
  min-width: 112px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px 0 10px;
  border: 1px solid rgba(200,165,82, .48);
  border-radius: 999px;
  background: linear-gradient(145deg, var(--may-chat-gold), var(--may-chat-gold-light));
  color: var(--may-chat-ink);
  box-shadow: 0 16px 42px rgba(0, 0, 0, .38);
  cursor: pointer;
  font-size:11px;
  font-weight: 800;
  letter-spacing: .04em;
  transition: transform .2s ease, box-shadow .2s ease;
}

.may-chat-toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 54px rgba(0, 0, 0, .46);
}

.may-chat-toggle-icon {
  position: relative;
  width: 24px;
  height: 22px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 9px;
  background: rgba(10, 34, 61, .9);
  color: var(--may-chat-gold-light);
  font-size:11px;
  line-height: 1;
}

.may-chat-toggle-icon::before {
  content: "";
  position: absolute;
  right: 4px;
  bottom: -4px;
  width: 8px;
  height: 8px;
  background: rgba(10, 34, 61, .9);
  clip-path: polygon(0 0, 100% 0, 100% 100%);
}

.may-chat-toggle-icon::after {
  content: "";
  position: absolute;
  top: 4px;
  right: 5px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--may-chat-gold-light);
  box-shadow: -8px 3px 0 rgba(221, 194, 118, .85), -16px 3px 0 rgba(221, 194, 118, .65);
}

.may-chat-toggle-text {
  white-space: nowrap;
  line-height: 1;
}

.may-chat-panel {
  position: absolute;
  right: 0;
  bottom: 58px;
  width: min(390px, calc(100vw - 28px));
  height: min(620px, calc(100vh - 108px));
  display: none;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  border: 1px solid var(--may-chat-border);
  border-radius: 10px;
  background: var(--may-chat-panel);
  box-shadow: 0 30px 90px rgba(0, 0, 0, .58);
}

.may-ai-chatbot.is-open .may-chat-panel {
  display: grid;
}

.may-chat-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  background: #0a223d;
}

.may-chat-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid rgba(200,165,82, .35);
  border-radius: 50%;
  color: var(--may-chat-gold);
  font-family: Georgia, serif;
  font-size: 18px;
  font-weight: 700;
}

.may-chat-title {
  min-width: 0;
  flex: 1;
}

.may-chat-title strong {
  display: block;
  color: var(--may-chat-paper);
  font-size: 13px;
  line-height: 1.2;
}

.may-chat-title span {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
  color: var(--may-chat-muted);
  font-size:12px;
  line-height: 1.3;
}

.may-chat-title span::before {
  content: "";
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #66bb6a;
}

.may-chat-close {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 50%;
  background: transparent;
  color: var(--may-chat-muted);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

.may-chat-log {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  overflow-y: auto;
  background:
    linear-gradient(rgba(200,165,82, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(200,165,82, .035) 1px, transparent 1px),
    var(--may-chat-panel-2);
  background-size: 34px 34px;
}

.may-chat-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.may-chat-row.is-user {
  flex-direction: row-reverse;
}

.may-chat-avatar {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #0a223d;
  color: var(--may-chat-gold);
  border: 1px solid rgba(200,165,82, .22);
  font-size:12px;
  font-weight: 800;
}

.may-chat-row.is-user .may-chat-avatar {
  background: var(--may-chat-gold);
  color: var(--may-chat-ink);
}

.may-chat-bubble {
  max-width: 82%;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 4px 12px 12px 12px;
  background: #123555;
  color: rgba(245, 242, 235, .9);
  font-size: 13px;
  line-height: 1.58;
  white-space: pre-line;
}

.may-chat-row.is-user .may-chat-bubble {
  border-color: rgba(200,165,82, .32);
  border-radius: 12px 4px 12px 12px;
  background: rgba(200,165,82, .16);
  color: var(--may-chat-paper);
}

.may-chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding-left: 36px;
}

.may-chat-suggestion {
  border: 1px solid rgba(200,165,82, .24);
  border-radius: 999px;
  background: rgba(10, 34, 61, .64);
  color: rgba(245, 242, 235, .74);
  cursor: pointer;
  font: inherit;
  font-size:12px;
  line-height: 1;
  padding: 8px 10px;
}

.may-chat-suggestion:hover {
  color: var(--may-chat-gold);
  border-color: rgba(200,165,82, .5);
}

.may-chat-form {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding: 12px;
  border-top: 1px solid rgba(255, 255, 255, .08);
  background: #0a223d;
}

.may-chat-input {
  flex: 1;
  max-height: 104px;
  min-height: 42px;
  resize: none;
  border: 1px solid rgba(200,165,82, .22);
  border-radius: 6px;
  outline: none;
  background: #123555;
  color: var(--may-chat-paper);
  font: inherit;
  font-size: 13px;
  line-height: 1.45;
  padding: 10px 12px;
}

.may-chat-input:focus {
  border-color: rgba(200,165,82, .58);
}

.may-chat-send {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 6px;
  background: var(--may-chat-gold);
  color: var(--may-chat-ink);
  cursor: pointer;
  font-size: 18px;
  font-weight: 800;
}

.may-chat-send:disabled {
  opacity: .58;
  cursor: wait;
}

.may-chat-typing {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.may-chat-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(245, 242, 235, .56);
  animation: may-chat-bounce 1.2s infinite;
}

.may-chat-typing span:nth-child(2) {
  animation-delay: .16s;
}

.may-chat-typing span:nth-child(3) {
  animation-delay: .32s;
}

@keyframes may-chat-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-5px); }
}

@media (max-width: 560px) {
  .may-ai-chatbot {
    right: 12px;
    bottom: 12px;
  }

  .may-ai-chatbot.is-open {
    left: 12px;
  }

  .may-chat-panel {
    right: 0;
    left: 0;
    bottom: 56px;
    width: auto;
    height: min(610px, calc(100vh - 92px));
    height: min(610px, calc(100dvh - 92px));
  }

  .may-chat-toggle {
    min-width: 108px;
    height: 42px;
    padding: 0 12px 0 9px;
    gap: 7px;
  }

  .may-ai-chatbot.is-open .may-chat-toggle {
    margin-left: auto;
  }
}
