.chat-window {
  font-family: 'Zen Maru Gothic', "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  background-color: #fff;
  margin: 0;
  padding: 0;
  position: fixed;
  bottom: 180px;
  right: 20px;
  width: 450px;
  max-width: 90vw;
  height: 700px;
  max-height: 80vh;
  border: 1px solid #ccc;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  z-index: 1000000;!important;
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #f2f2f2;
  padding: 8px 12px;
  font-weight: bold;
  border-bottom: 1px solid #ccc;
  position: sticky;
  top: 0;
  z-index: 10;
}

.chat-title {
  color: #233d5d;
  font-size: 14px;
}

.chat-close {
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
}


.chat-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 16px;
  line-height: 1.5;
  word-wrap: break-word;
}

.bot-message {
  background-color: #f0f0f0;
  font-size: 16px;
  align-self: flex-start;
}

.user-message {
  background-color: #d0ebff;
  font-size: 16px;
  align-self: flex-end;
  text-align: right;
}

.chat-input {
  display: flex;
  padding: 8px;
  background-color: #f2f2f2;
  border-top: 1px solid #ddd;
  box-sizing: border-box;
}

#userInput {
  flex: 1;
  height: 45px;
  font-size: 16px;
  padding: 8px 12px;
  border: 1px solid #ccc;
  border-radius: 8px;
  outline: none;
  box-sizing: border-box;

}


.chat-input button {
  background-color: #007bff;
  color: white;
  border: none;
  padding: 0 16px;
  border-radius: 8px;
  cursor: pointer;
}

.chat-messages button {
  margin: 6px 0;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid #ccc;
  background-color: white;
  font-weight: bold;
  cursor: pointer;
  display: block;
  width: 100%;
}

.chat-messages button:hover {
  background-color: #f0f8ff;
}

.chat-close-btn {
  position: absolute;
  top: 8px;
  right: 10px;
  background: transparent;
  border: none;
  font-size: 20px;
  cursor: pointer;
  z-index: 10000;
}
#chatWindow {
  display: none;
}
.chat-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 12px;
}

.chat-row.bot {
  justify-content: flex-start;
}

.chat-row.user {
  justify-content: flex-end;
  flex-direction: row-reverse;
}

.chat-icon {
  width: 50px;
  height: 50px;
  border-radius: 70%;
}
.chat-row.bot {
  display: flex;
  align-items: flex-start; /* 上寄せ */
  margin-bottom: 10px;
}

.chat-row.bot .chat-icon {
  width: 50px;
  height: 50px;
  /* margin-right: 10px; */
  flex-shrink: 0;
}

.chat-row.bot .chat-icon img {
  width: 100%;
  height: auto;
  border-radius: 50%;
}

.chat-row.bot .chat-bubble {
  max-width: 80%;
}

#userInput {
  height: 45px; /* ← お好みの高さに変えてOK！ */
  font-size: 16px;
  padding: 8px 12px;
  border-radius: 8px;
}

#sendButton {
  height: 45px;  /* 入力欄と同じ高さにそろえるのがオススメ！ */
  width: 50px;
  border-radius: 8px;
  margin-left: 5px;
}
/* #chatMessages {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow-y: auto;
  height: 590px;
  padding: 1em;
  scroll-behavior: smooth;
  max-height: 100%;
} */

#chatMessages {
  display: flex;
  flex-direction: column;
  justify-content: flex-start; /* ✅ ← 上から詰める */
  overflow-y: auto;
  height: 560px;  /* 必要なら固定値のままでOK */
  padding: 1em;
  scroll-behavior: smooth;
  max-height: 600px; /* 必ず上限を指定！ */
}


.chat-messages {
  flex: 1;
  overflow-y: auto; /* ✅ スクロールはここに */
  padding: 1em;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}
/* 全画面モード */
.chat-window.fullscreen {
  width: 100vw;
  height: 100vh;
  bottom: 0;
  right: 0;
  border-radius: 0;
}
