* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Arial', sans-serif;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  background-color: #f5f5f7;
  padding: 20px;
}

.chat-container {
  width: 100%;
  max-width: 500px;
  background-color: white;
  border-radius: 20px;
  padding: 30px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  position: relative;
}

.character-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 30px;
  position: relative;
}

.character-image-container {
  position: relative;
  width: 200px;
  height: 200px;
  margin-top: 20px;
}

#character-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.speech-bubble {
  position: relative;
  background: #007bff;
  color: white;
  padding: 15px;
  border-radius: 12px;
  max-width: 80%;
  min-width: 200px;
  margin-bottom: 15px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.speech-bubble-title {
  position: absolute;
  top: -3.2em; /* 더 위로 이동 */
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Montserrat', 'Arial', sans-serif;
  font-size: 1.1rem;
  font-weight: bold;
  letter-spacing: 0.08em;
  color: #3a7ca5;
  background: #fff;
  padding: 0.72em 2.64em 0.72em 2.64em; /* 20% 증가 */
  border-radius: 1.8em;
  box-shadow: 0 2px 8px rgba(58,124,165,0.08);
  border: 1.5px solid #e0e7ef;
  z-index: 2;
  text-shadow: 0 1px 0 #e0e7ef;
  white-space: nowrap;
  height: 2.88em;
  display: flex;
  align-items: center;
  justify-content: center;
}

.speech-bubble p {
  margin: 0;
  line-height: 1.5;
}

.tail {
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 10px solid #007bff;
}

.input-container {
  display: flex;
  gap: 10px;
}

#user-input {
  flex: 1;
  padding: 12px 15px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 16px;
}

#user-input:focus {
  outline: none;
  border-color: #007bff;
}

#send-button {
  padding: 12px 20px;
  background-color: #007bff;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  transition: background-color 0.3s;
}

#send-button:hover {
  background-color: #0056b3;
}

.loading-indicator {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.7);
  border-radius: 50%;
}

.dot {
  width: 10px;
  height: 10px;
  margin: 0 5px;
  background-color: #007bff;
  border-radius: 50%;
  animation: bounce 1.4s infinite ease-in-out both;
}

.dot:nth-child(1) {
  animation-delay: -0.32s;
}

.dot:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes bounce {
  0%, 80%, 100% {
    transform: scale(0);
  }
  40% {
    transform: scale(1);
  }
}

.hidden {
  display: none;
}

@media (max-width: 600px) {
  .chat-container {
    padding: 20px;
  }
  
  .character-image-container {
    width: 150px;
    height: 150px;
  }
  
  .speech-bubble {
    min-width: 150px;
  }
}
