html, body {
  margin: 0 auto; /* 上下の余白は0、左右は自動で中央揃え */
  background-color: #eeeeee; /* 必要なら背景色を設定 */
  max-width: 450px;
  min-height: 100vh; /* ビューポート全体の高さを確保 */
  flex-direction: column; /* 子要素を縦方向に並べる */
  align-items: center; /* 水平方向で中央揃え */
  justify-content: space-between; /* 上下の配置を調整（中央揃え含む） */
}

body {
  font-family: "Helvetica Neue", sans-serif;
  font-size: 16px; /* 基本のフォントサイズを追加 */
  background: #FFF;
  padding: 5px;
  margin: 0;
  padding-top: 100px;
  padding-bottom: 60px;
}

.section-title {
  max-width: 100%;
  background: linear-gradient(90deg, #1a1a1a, #4d4d4d, #1a1a1a);
}

h1 {
  font-size: 16px;
  color: #FFF;
  padding: 10px 0 10px;
}

.section2-title {
  max-width: 100%;
  background: linear-gradient(90deg, #70d3df, #d0f0f7, #70d3df);
}

h2 {
  font-size: 14px;
  padding: 10px 10px 10px;
}

#character-container {
  position: position;
  background-size: cover;
  background-position: center;
  max-width: 100%; /* 動画の幅を制御 */
  max-height: calc(35vh); /* 画面高さの3分の1を指定 */
  object-fit: contain; /* アスペクト比を保持 */
  margin: 0 auto; /* 横方向の中央揃え */
  padding-bottom: 5px;
}

#character-image {
  display: block; /* 中央揃えするために block 要素に変更 */
  margin: 0 auto; /* 横方向の中央揃え */
  max-width: 80%; /* 動画の幅を制御 */
  max-height: calc(35vh);/* キャラクター画像が親の高さを超えないように */
  object-fit: contain; /* 動画のアスペクト比を保持 */
  transition: opacity 0.1s ease-in-out; /* 切り替えの滑らかさを制御 */
}

#chatbox {
  position: relative; /* absolute ではなく相対に */
  bottom: 0;
  left: 0;
  right: 0;
  width: 90%;
  max-width: 500px;
  height: 60%; /* 画面の下3分の1 */
  overflow-y: auto;
  padding: 10px;
  background-color: rgba(255, 255, 255, 0.1); /* 半透明の白背景 */
  margin: 0 auto 70px auto;
  margin-bottom: 70px;
  overflow-x: hidden;
}

/* モバイル画面向けの調整 */
@media screen and (max-width: 500px) {
  body {
    font-size: 16px; /* モバイルではやや大きく */
  }

  .related-keywords {
    font-size: 16px;
  }

  .message .bubble {
    font-size: 16px;
  }

  input[type="text"], button {
    font-size: 16px;
  }

  #character-container {
    position: relative;
    background-size: cover;
    background-position: center;
    max-width: 90%; /* 動画の幅を制御 */
    max-height: calc(35vh); /* 画面高さの3分の1を指定 */
    object-fit: contain; /* アスペクト比を保持 */
    margin: 0 auto; /* 横方向の中央揃え */
    padding-bottom: 5px;
  }

  #character-image {
    display: block; /* 中央揃えするために block 要素に変更 */
    margin: 0 auto; /* 横方向の中央揃え */
    max-width: 80%; /* 動画の幅を制御 */
    max-height: calc(35vh); /* キャラクター画像が親の高さを超えないように */
    object-fit: contain; /* 動画のアスペクト比を保持 */
    transition: opacity 0.1s ease-in-out; /* 切り替えの滑らかさを制御 */
  }
}

.message {
  display: flex;
  margin: 10px 0;
}

.user {
  justify-content: flex-end;
}

.bot {
  justify-content: flex-start;
}

.message .bubble {
  max-width: 70%;
  padding: 10px 15px;
  border-radius: 18px;
  position: relative;
  word-wrap: break-word;
  line-height: 1.5;
}

.user .bubble {
  background: #dcf8c6;
  color: #000;
  border-bottom-right-radius: 0;
}

.bot .bubble {
  background: #F8F5F3;
  color: #000;
  border-bottom-left-radius: 0;
}

input[type="text"] {
  width: 100%;
  max-width: 450px;
  box-sizing: border-box; /* パディング込みで幅制限 */
  padding: 12px;
  border-radius: 8px;
  border: 1px solid #ccc;
  margin-top: 15px;
  font-size: 16px;
}

/* 入力＆送信ボタンを中央整列させるラッパー */
#chatForm {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

/* 送信ボタン */
#requestButton {
  width: 85%;
  max-width: 300px;
  padding: 12px 20px;
  margin-top: 15px;
  font-size: 16px;
  border: none;
  border-radius: 8px;
  background-color: #4caf50;
  color: white;
  cursor: pointer;
}

#requestButton:hover {
  background-color: #45a049;
}

/* 追加ボタン群 */
#buttonContainer {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 20px;
}

#buttonContainer button {
  width: 300px;
  font-size: 12px;
  background-color: #1E88E5;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 15px;
  font-size: 1rem;
  color: white;
  cursor: pointer;
  margin-top: 10px;
  margin-bottom: 10px;
}

/* モバイル対応 */
@media (max-width: 600px) {
  #buttonContainer {
    flex-direction: column;
    align-items: center;
    gap: 10px;
  }

  #buttonContainer button {
    width: 85%;
  }

  #requestButton {
    width: 85%;
  }
}

.related-keywords {
  background: #f1f0f0;
  padding: 10px;
  border-radius: 10px;
  font-size: 14px;
  margin-top: 15px;
}


