* {
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.2;
}

body {
  margin: 0;
}

#prolon-chat-container {
  --chat-bubble-size: 84px;
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 999999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

#chat-notification-shell {
  position: absolute;
  right: var(--chat-bubble-size);
  bottom: calc(var(--chat-bubble-size) + 12px);
  display: flex;
  justify-content: flex-end;
  width: min(300px, calc(100vw - 40px));
  pointer-events: none;
  z-index: 2;
}

#chat-notification {
  transition: opacity 0.4s ease;
  pointer-events: auto;
  padding: 12px 18px;
  border-radius: 16px;
  background: radial-gradient(circle at top left, #2E386D, #E65F4A);  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(107, 207, 155, 0.35);
  color: #ffffff;
  font-size: 15px;
  font-weight: 500;
  display: inline-block;
  max-width: 100%;
  line-height: 1.5;
  white-space: normal;
  word-break: break-word;
  text-align: center;
  letter-spacing: 0.01em;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(15, 31, 53, 0.35);
  animation: fadeSlideIn 0.45s ease-out;
}

#chat-bubble {
  cursor: pointer;
  width: var(--chat-bubble-size);
  height: var(--chat-bubble-size);
  padding: 0;
  border: none;
  border-radius: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: transform 0.2s ease;
  background: transparent;
  box-shadow: none;
  flex-shrink: 0;
  align-self: flex-end;
}

#chat-bubble:hover {
  transform: scale(1.08);
}

#chat-bubble img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  transform-origin: center;
  animation: bubble-breathe 2.8s ease-in-out infinite;
}

#chat-bubble:hover img {
  animation-play-state: paused;
}

#chat-window {
  display: none;
  order: -1;
  width: 400px;
  height: 650px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 0 10px rgba(15, 42, 83, 0.3);
  overflow: hidden;
  flex-direction: column;
  opacity: 0;
  transform: scale(0.2);
  transform-origin: bottom right;
  transition: transform 0.25s ease-out, opacity 0.25s ease-out;
}

#chat-window.open {
  opacity: 1;
  transform: scale(1);
}

#chat-header {
  background: linear-gradient(90deg, #2E386D 40%, #E65F4A 100%);
  color: #fff;
  padding: 10px;
  font-size: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#clear-chat {
  background: transparent;
  border: none;
  color: #ddd;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 4px;
}

#chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#chat-input {
  display: flex;
  flex-direction: column;
  padding: 14px 12px 12px;
  gap: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), #f4f6fb 100%);
  border-top: 1px solid rgba(46, 56, 109, 0.08);
}

#chat-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(46, 56, 109, 0.12);
  box-shadow:
    0 12px 24px rgba(21, 33, 62, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

#user-input {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  border: none;
  outline: none;
  background: transparent;
  color: #19233f;
  font-size: 14px;
  line-height: 1.4;
}

#user-input::placeholder {
  color: #73809d;
}

#chat-input-row:focus-within {
  border-color: rgba(230, 95, 74, 0.35);
  box-shadow:
    0 16px 32px rgba(21, 33, 62, 0.12),
    0 0 0 4px rgba(230, 95, 74, 0.12);
}

#send-btn {
  min-width: 96px;
  padding: 12px 18px;
  border: none;
  border-radius: 16px;
  color: #fff;
  font-weight: 600;
  letter-spacing: 0.01em;
  background: linear-gradient(135deg, #e65f4a 0%, #2e386d 100%);
  cursor: pointer;
  box-shadow: 0 12px 22px rgba(46, 56, 109, 0.24);
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

#send-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 28px rgba(46, 56, 109, 0.3);
}

#send-btn:active {
  transform: translateY(0);
  box-shadow: 0 8px 16px rgba(46, 56, 109, 0.22);
}

#send-btn:disabled,
#user-input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.msg {
  margin-bottom: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  max-width: 80%;
  font-size: 15px;
  line-height: 1.35;
}

.msg-user {
  background: #ffa698;
  color: #1f1d1d;
  border: 1px solid #ddebe3;
  align-self: flex-end;
}

.msg-assistant {
  background: #f5f5f5;
  border: 1px solid #ddd;
  color: #000;
  align-self: flex-start;
}

.msg-system {
  background: #f9fbfa;
  border: 1px solid #ddebe3;
  color: #0e2a1d;
  align-self: center;
}

.typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 4px;
}

.typing-indicator span {
  width: 6px;
  height: 6px;
  background: #0f2a53;
  border-radius: 50%;
  display: inline-block;
  animation: typing-bounce 1.2s infinite ease-in-out;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing-bounce {
  0%, 80%, 100% {
    transform: scale(0.3);
    opacity: 0.2;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes fadeSlideIn {
  0% {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes bubble-breathe {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.08);
  }
}

@media (max-width: 768px) {
  #prolon-chat-container {
    --chat-bubble-size: 56px;
  }

  #chat-bubble {
    width: var(--chat-bubble-size);
    height: var(--chat-bubble-size);
  }

  #chat-bubble:hover {
    transform: none;
  }

  #chat-window {
    width: 88vw;
    height: 70vh;
    border-radius: 14px;
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.28);
    transform-origin: bottom center;
  }

  #chat-header {
    padding: 10px 12px;
    font-size: 14px;
    border-radius: 14px 14px 0 0;
  }

  #clear-chat {
    font-size: 16px;
    gap: 4px;
  }

  #chat-body {
    padding: 10px;
    gap: 6px;
  }

  .msg {
    padding: 8px 10px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.35;
    max-width: 86%;
  }

  #chat-input {
    padding: 12px 10px 10px;
    gap: 8px;
  }

  #user-input {
    font-size: 16px;
    padding: 11px 12px;
    line-height: 1.2;
  }

  #send-btn {
    min-width: 88px;
    padding: 11px 14px;
    font-size: 14px;
    border-radius: 14px;
  }

  .typing-indicator span {
    width: 5px;
    height: 5px;
  }

  * {
    font-size: 14px;
  }
}
