#ai-chat-widget {
  position: fixed;
  inset: auto 24px 24px auto;
  z-index: 10000;
  pointer-events: none;
}

#ai-chat-widget * {
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

#ai-face-btn {
  position: relative;
  width: 64px;
  height: 64px;
  background-color: #111;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s ease;
  pointer-events: auto;
  border: none;
  padding: 0;
}

#ai-face-btn:hover {
  transform: scale(1.05);
}

#eyes-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  gap: 10px;
  align-items: center;
  transition: transform 0.05s linear;
}

.eye {
  position: relative;
  width: 14px;
  height: 14px;
  background-color: #fff;
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.45);
  flex-shrink: 0;
}

.pupil {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 6px;
  background-color: #111;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: transform 0.05s linear;
}

#ai-chat-popup {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 320px;
  height: 450px;
  max-height: calc(100vh - 120px);
  background-color: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

#ai-chat-popup.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.chat-header {
  background-color: #111;
  color: #fff;
  padding: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.close-btn {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

.chat-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background-color: #fafafa;
}

.msg {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.4;
}

.msg.ai {
  background-color: #e9ecef;
  color: #111;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  white-space: pre-wrap;
}

.msg.user {
  background-color: #111;
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.chat-input-area {
  padding: 12px;
  border-top: 1px solid #eee;
  display: flex;
  gap: 8px;
  background: #fff;
}

.chat-input-area input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #ccc;
  border-radius: 20px;
  outline: none;
  font-size: 14px;
}

.chat-input-area input:focus {
  border-color: #111;
}

.chat-input-area button {
  background-color: #111;
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 0 16px;
  font-weight: 600;
  cursor: pointer;
}

@media (max-width: 480px) {
  #ai-chat-widget {
    right: 16px;
    bottom: 16px;
  }

  #ai-chat-popup {
    width: min(320px, calc(100vw - 32px));
    height: min(450px, calc(100vh - 120px));
  }
}
