html  {/*html で「土台」だけ作る　*/
  margin: 0;
  padding: 0;
  height: 100%;
}
/* 画面全体をスマホの動的viewportに追従させる */


body {/* body で「見た目」全体を調整.これがないとbody がスクロールするかどうかがブラウザ任せ */
  margin: 0;
  padding: 0;
  width: 100%;

  /* スマホの動的表示領域に追従 */
  min-height: 100vh;   /* フォールバック */
  min-height: 100dvh;  /* 本命 */

  font-family: Arial, sans-serif;

  /* ノッチ・ホームバー対策 */
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  
  /* スクロールは中身に任せる */
  /*overflow: hidden;*/
}

#agree-btn {
  width: 60%;
  max-width: 320px;

  padding: 16px 0;
  margin: 16px auto 0;

  font-size: 1rem;
  font-weight: bold;

  border: none;
  border-radius: 10px;

  background-color: #4a90e2;
  color: #fff;

  cursor: pointer;
  display: block;
}
#agree-btn:active {
  transform: scale(0.97);
}
#agree-btn:hover {
  opacity: 0.9;
}

#chat-widget-container {
  width: 100%;

  /* ここが重要：100vhをやめる */
  height: 100vh;     /* フォールバック */
  height: 100dvh;    /* スマホの動的viewportに追従 */

  border: 0;/*1px solid #ccc;*/
  /*border-radius: 10px;*/
  /*box-shadow: 0 4px 8px rgba(0,0,0,0.1);*/

  display: flex;
  flex-direction: column;

  position: relative;
  /*overflow: hidden;*//*要素の外にはみ出した中身を表示もスクロールもさせない指定*/
  background-color: #fff;

  /* iPhoneノッチ/ホームバー対策（コンテナに入れるなら） */
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  /*box-sizing: border-box;*/
}

#chat-header {
    background-color: #007bff;
    color: white;
    padding: 10px;
    text-align: center;
    font-weight: bold;
    position: sticky; /* もしくは fixed */
    top: 0;
    padding-top: env(safe-area-inset-top);
    z-index: 900;
}

/* 例：全体ラッパ */
#chat-app {
  height: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

#chat-body {/* 会話が表示されるボディ部分 */
    flex: 1 1 auto;/*これが重要！残りのスペースをすべて埋める *//*flexはflex:<flex-grow><flex-shrink><flex-basis>の省略形*/
    min-height: 0; /* ← これを追加（置換しない） */
    padding: 10px;
    overflow-y: auto;/* 内容が増えたらスクロールさせる */
    /*border-bottom: 1px solid #ccc;*/
    max-width: 100%;
    display: flex;
    flex-direction: column; /* メッセージを縦並びに */
    gap: 10px;              /* メッセージ同士の余白 */   
    border: none; /* 枠線削除 */
    box-shadow: none; /* 影削除 */
    outline: none; /* アウトライン削除 */
    padding-bottom: calc(120px + env(safe-area-inset-bottom));/* 入力欄の高さ + safe-area 分の余白 */
}
#chat-input-container {
  position: fixed;                 /* 追加：bottomを効かせる */
  left: 0;
  right: 0;

  /* 重要：スマホのホームバー/ブラウザUIを避ける */
  bottom: calc(20px + env(safe-area-inset-bottom));

  width: min(720px, 95%);
  margin: 0 auto;

  display: flex;
  padding: 10px;

  /* padding-bottom: 50px; *//* ここは削除推奨：paddingで下を伸ばすとレイアウトが崩れやすい */
  
  border-top: 1px solid rgba(0,0,0,0.15);
  background: #fff;
  flex-shrink: 0;
  z-index: 1000;
}

#chat-input {

    flex-grow: 1;
    border: 1px solid #ccc;
    border-radius: 20px;
    padding: 10px;
    outline: none;
    font-size: 1.1rem;  
}

/* メッセージ一覧 */
#chat-messages {
  flex: 1;
  overflow-y: auto;

  /* 入力欄の高さに合わせて調整（例：72px） */
  padding-bottom: calc(140px + env(safe-area-inset-bottom));
  padding-top: 12px;
}

#chat-send-button {
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 20px;
    padding: 10px 15px;
    margin-left: 10px;
    cursor: pointer;
    display: flex;      /* インライン要素をブロック化 */
    margin-left: auto;   /* 左側の余白を自動にして右へ寄せる */
}

#chat-footer-fixed {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
     
    box-sizing: border-box;/* ★ はみ出し防止 */
    width: 100%;/* ★ はみ出し防止 */
    
    /*transform: translateX(-50%);*/
    background: transparent;   /* ★外側は透明 */
    border: none;              /* 枠なし */
    box-shadow: none;          /* 影なし */
    pointer-events: none;       /* 操作を邪魔しない */

    padding: 6px 9px;
    padding-bottom: calc(6px + env(safe-area-inset-bottom));/* スマホのホームバー対策 */
    
    background: #f5f5f5;
    border-top: 1px solid #ccc;
    text-align: center;        /* 文字をセンターに */
    font-size: 0.65rem;
    color: #777;               /* 背景透明でも読める色 */
    border-radius: 12px 12px 12px 12px; /* 上左右だけ角丸 */
    z-index: 1000;

    }

.bot-message {
    display: flex; /* アイコンとテキストを横並びに */
    align-items: flex-start;  /* 上揃え */
    margin: 10px 0;
    margin-bottom: 4px;
    padding: 8px 12px;
    border-radius: 15px;
    max-width: 80%;
    background-color: #f1f1f1;
    box-sizing: border-box;/* 長文・URLでレイアウト崩れ防止 */
    overflow-wrap: anywhere;   /* 長いURL等でも折り返す */
    word-break: break-word;    /* 古い環境向け保険 */
}
.bot-message.consent {
  margin-top: 4px;
  margin-bottom: 4px;
}
.bot-text.consent {
  font-size: 0.9rem;  
}
.bot-message img {
    width: 50px;
    height: 50px;
    border-radius: 50%; /* 丸いアイコン */
    margin-right: 10px;
}

.bot-text {
    background: #f1f1f1;
    padding: 10px;
    border-radius: 10px;
    max-width: 100%;
    font-size: 0.9rem;   /*1remが基準で0.9は少し小さめ。remを使うと端末差を自動調整*/
}

.hidden {
  display: none !important;
}
.user-message {
    margin-bottom: 10px;
    padding: 8px 12px;
    border-radius: 15px;
    max-width: 80%;
    background-color: #e6f3ff;
    /*align-self: flex-end;*/
    margin-left: auto;
}
.quick-replies {/* 予測質問部　*/
    display: flex;
    gap: 5px;               /* ボタン間の余白 */
    justify-content: flex-end;/* 右寄せ */
    margin-top: 10px;
    flex-wrap: wrap;        /* はみ出したら折り返し */
    }

.quick-reply-btn {
    background-color: #e0e0e0;
    border: 2px solid #ccc; /* 枠を太く */
    border-radius: 12px;/* 角丸を強調 */
    padding: 10px 14px;/* ボタンの縦x横サイズ拡大 */
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.2s;
    }

.quick-reply-btn:hover {
    background-color: #d0d0d0;
    }




/* Trend Micro等が注入する通知領域を無害化（表示を消す） */
/*#trend_notification_app,
#trend_notification,
.trend_notification_app_outer {
  display: none !important;
  border: 0 !important;
  height: 0 !important;
}*/

mark {
    color: red; font-weight: bold;
    }