html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: "Noto Sans JP", sans-serif;
  background: #f5f5f5;
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 1em 1em 0 1em; /* 上を広げて、下は詰める */
  font-family: sans-serif;
  background: #f9f9f9;
  box-sizing: border-box;
}

/* 全体の高さ管理 */
#faq-chat-container {
  max-width: 800px;
  margin: 0.5em auto 1em auto;
  background: white;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 1em;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

#faq-chat-log {
  overflow-y: visible;
  background: #fff;
  padding: 1em;
  border-radius: 8px;
  margin-bottom: 0.8em;
  min-height: 100px; /* ← これが重要 */
}


#faq-input-area {
  display: flex;
  gap: 0.5em;
  align-items: center;
}

#userInput {
  flex: 1;
  padding: 0.6em;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  box-sizing: border-box;
}

#sendButton {
  padding: 0.6em 1em;
  font-size: 1rem;
  background-color: #007b7b;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}

a {
  color: #007b7b;
  word-break: break-word;
  text-decoration: underline;
}

/* チャットログのエリア */
#chatlog {
  max-height: 50vh;
  overflow-y: auto;
  margin-bottom: 1em;
  padding-right: 1em;
}


/* モバイル専用調整 */
@media screen and (max-width: 768px) {
  #faq-chat-container {
    margin-top: 1em;
    padding: 1em;
    box-shadow: none;
    border-radius: 0;
    border: none;
  }

  #chatlog {
    max-height: 40vh;
  }
}


@media screen and (max-width: 768px) {
  #faq-chat-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 1em;
    box-sizing: border-box;
  }

  #chatlog {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 1em;
  }

  /* 入力欄とボタンは縦に並べる */
  #input-area {
    display: flex;
    flex-direction: column;
    gap: 0.5em;
  }
}

@media screen and (max-width: 768px) {
  html, body {
    height: 100%;
    margin: 0;
    padding: 0;
  }

  #faq-chat-container {
    padding: 1em;
    box-sizing: border-box;
  }

  #faq-chat-log {
    overflow-y: visible;
    margin-bottom: 1em;
  }

  #faq-input-area {
  display: flex;
    flex-direction: row;     /* ← ここ！ column → row に戻す */
    align-items: center;
    gap: 0.5em;
  }


 #userInput {
    flex: 1;
    font-size: 16px;
    width: auto;
    padding: 0.6em;
    box-sizing: border-box;
  }
  
  #sendButton {
    flex-shrink: 0; /* ← 押し出されず、自然な幅になるように */
    font-size: 16px;
    padding: 0.6em 1em;
    white-space: nowrap;
  }
}


.faq-user-message {
  background-color: #dff5d1;
  color: #000;
  text-align: right;
  padding: 10px 14px;
  border-radius: 16px;
  margin: 0.5em 0 0.5em auto;
  max-width: 70%;
  border-top-right-radius: 0;
}

.faq-bot-message {
  display: flex;
  align-items: flex-start;
  margin: 0.5em 0;
}

.faq-bot-message .icon-wrap {
  flex-shrink: 0;
  width: 48px;
  margin-right: 8px;
}

.faq-bot-message .icon {
  width: 48px;
  height: auto;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
  border-radius: 4px;
}

.faq-bot-message .bubble {
  background-color: #f0f0f0;
  color: #000;
  padding: 10px 14px;
  border-radius: 16px;
  border-top-left-radius: 0;
  max-width: 70%;
  white-space: pre-wrap;
  line-height: 1.5;

}
.faq-bot-message .bubble p {
  margin: 0;
  padding: 0;
}

.speaker-label {
  font-weight: bold;
  margin-bottom: 0.3em;
}
.bubble-text {
  white-space: pre-wrap;
}

.bubble.speaker-たのみ {
  background-color: #ffe6f0; /* 薄いピンク */
}

.bubble.speaker-たみお {
  background-color: #e6f0ff; /* 薄い水色 */
}

.bubble.speaker-社長 {
  background-color: #f0f0f0; /* 従来の灰色 */
}

/* FAQチャットの選択肢ボタン */
.choice-button {
  display: inline-block;
  margin-right: 0.8em;        /* ボタン同士の間隔 */
  margin-bottom: 0.4em;       /* ボタン下にも少し余白 */
  padding: 0.4em 1.2em;
  border: none;
  border-radius: 18px;
  background: #caeaff;
  color: #155fa0;
  font-size: 1em;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(30,60,90,0.07);
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
  vertical-align: middle;
}
.choice-button:hover, .choice-button:focus {
  background: #155fa0;
  color: #fff;
  box-shadow: 0 2px 8px rgba(30,60,90,0.12);
}
.choice-button:last-child {
  margin-right: 0;  /* 最後のボタンだけ右余白なし */
}

/* ボタンのコンテナを左揃え・バブルと同じ列に */
.faq-bot-message + div > .choice-button,
.faq-bot-message + .choice-button {
  margin-left: 52px; /* アイコン＋バブル余白分で調整（実UI幅に合わせて調整を） */
}

