#chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 350px; /* チャットウィンドウの幅 */
    height: 500px; /* チャットウィンドウの高さ */
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    z-index: 1000; /* 他の要素より手前に表示 */
    overflow: hidden; /* メッセージがはみ出さないように */
    transition: transform 0.3s ease-out;
    transform: translateX(calc(100% + 20px)); /* 初期状態は完全に隠す */
}

#chatbot-container.open {
    transform: translateX(0); /* 開いた時は表示 */
}

#chatbot-header {
    background-color: #3498db;
    color: #fff;
    padding: 15px;
    font-size: 1.1em;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
}

#chatbot-toggle-button {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5em;
    cursor: pointer;
    line-height: 1; /* xマークの縦位置調整 */
}

#chatbot-messages {
    flex-grow: 1;
    padding: 15px;
    overflow-y: auto; /* メッセージが多い時にスクロール可能に */
    background-color: #f9f9f9;
}

.message {
    padding: 8px 12px;
    margin-bottom: 10px;
    border-radius: 8px;
    max-width: 80%;
    word-wrap: break-word; /* 長い単語も折り返す */
}

.user-message {
    background-color: #e7f3ff;
    align-self: flex-end; /* 右寄せ */
    margin-left: auto;
}

.bot-message {
    background-color: #f0f0f0;
    align-self: flex-start; /* 左寄せ */
    margin-right: auto;
}

#chatbot-input-area {
    display: flex;
    border-top: 1px solid #eee;
    padding: 10px;
    background-color: #fff;
    border-bottom-left-radius: 10px;
    border-bottom-right-radius: 10px;
}

#chatbot-input {
    flex-grow: 1;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 8px;
    font-size: 0.9em;
}

#chatbot-send-button {
    background-color: #3498db;
    color: #fff;
    border: none;
    border-radius: 5px;
    padding: 8px 15px;
    margin-left: 10px;
    cursor: pointer;
    transition: background-color 0.2s;
}

#chatbot-send-button:hover {
    background-color: #2980b9;
}

/* チャットボットを開くためのフローティングボタン */
#chatbot-open-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: #3498db;
    color: #fff;
    border: none;
    border-radius: 50%; /* 丸い形 */
    width: 60px;
    height: 60px;
    font-size: 1.2em;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    z-index: 999;
    transition: transform 0.3s ease-out, background-color 0.2s;
    /* 開いているときは隠す */
    transform: translateX(0);
}

#chatbot-open-button.hidden {
    transform: translateX(calc(100% + 20px)); /* 右外へ移動 */
}

.chat-message-bubble { 
    /* ... 既存のスタイル ... */

    max-width: 80%; /* 吹き出しの幅が制限されているか確認 */

    /* 文字のはみ出しを防ぐために追加 */
    overflow-wrap: break-word; 
    word-break: break-all;}