* {
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f5f5f5;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

.chat-container {
    width: 100%;
    max-width: 800px;
    height: 90vh;
    background-color: white;
    display: flex;
    flex-direction: column;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: center;
    /* 让标题始终居中 */
    position: relative;
    padding: 16px;
    background: linear-gradient(to bottom, #81c784, #4caf50);
    color: white;
    font-size: 18px;
    font-weight: bold;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    position: relative;
}

.header-spacer {
    flex: 1;
}

#chat-title-text {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.lang-select {
    flex-shrink: 0;
    background-color: white;
    border: none;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 14px;
    color: #4caf50;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s;
    visibility: hidden;
    /* 隐藏但是占位 */
}

.lang-select:hover {
    background-color: #f0f0f0;
}

.chat-box {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background-color: #f0f0f0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.message {
    margin: 8px 0;
    padding: 10px 16px;
    border-radius: 16px;
    max-width: 70%;
    word-wrap: break-word;
    font-size: 16px;
}

.user-message {
    background-color: #c3e6cb;
    color: #212121;
    align-self: flex-end;
    text-align: left;
    margin-left: auto;
    width: auto;
    max-width: 80%;
    word-wrap: break-word;
    padding: 10px 16px;
}

.assistant-message {
    background-color: #f9f9f9;
    color: #212121;
    align-self: flex-start;
    text-align: left;
    margin-right: auto;
}

.assistant-message p {
    margin: 0;
    padding: 0;
    color: #212121;
}

.chat-input {
    display: flex;
    padding: 12px;
    background-color: #fff;
    border-top: 1px solid #ddd;
    align-items: flex-end;
    position: fixed;
    bottom: 0;
    width: 100%;
    max-width: 800px;
}

.chat-input textarea {
    flex: 1;
    max-height: 120px;
    resize: none;
    padding: 10px;
    font-size: 16px;
    font-family: Arial, sans-serif;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow-y: auto;
    line-height: 1.4;
    box-sizing: border-box;
}

.chat-input button {
    padding: 12px 20px;
    font-size: 16px;
    border: none;
    background: linear-gradient(to bottom, #81c784, #45a049);
    color: white;
    border-radius: 8px;
    margin-left: 8px;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: background 0.3s ease, transform 0.1s ease;
}

.chat-input button:hover {
    background: linear-gradient(to bottom, #81c784, #388e3c);
    transform: translateY(-2px);
}

.branch-bubble {
    background-color: #eef6ff;
    border: 1px solid #c9e0ff;
    border-radius: 12px;
    padding: 12px;
    margin: 6px 0;
    max-width: 90%;
    font-size: 14px;
    line-height: 1.5;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.branch-bubble strong {
    font-size: 16px;
    color: #0a58ca;
}

.branch-link {
    display: inline-block;
    margin-top: 6px;
    color: #007bff;
    font-weight: bold;
    text-decoration: underline;
    cursor: pointer;
}


.branch-divider {
    border: none;
    height: 1px;
    background-color: #e2e8f0;
    /* 中性灰色线 */
    margin: 16px 0;
}

.branch_bubble_wrapper .branch-title {
    font-size: 16px;
    font-weight: bold;
    color: #1d4ed8;
    margin-bottom: 6px;
}

.branch_bubble_wrapper .branch-desc {
    font-size: 14px;
    color: #334155;
    line-height: 1.6;
}

.branch_bubble_wrapper .branch-link {
    display: inline-block;
    margin-top: 8px;
    padding: 6px 12px;
    background-color: #3b82f6;
    color: white;
    border-radius: 6px;
    text-decoration: none;
    font-size: 13px;
    transition: background-color 0.2s;
}

.branch_bubble_wrapper .branch-link:hover {
    background-color: #2563eb;
}

.suggestion-text {
    font-size: 14px;
    font-weight: bold;
}

/* ----------------- 适配不同屏幕 ----------------- */

/* 适配桌面端 */
@media (min-width: 768px) {
    .chat-container {
        height: 90vh;
        border-radius: 12px;
    }

    .chat-input {
        position: relative;
        border-radius: 0 0 12px 12px;
    }
}

/* 适配手机端 */
@media (max-width: 767px) {
    .chat-container {
        height: 100vh;
        border-radius: 0;
    }

    .chat-box {
        margin-bottom: 60px;
    }

    .chat-input {
        position: fixed;
        bottom: 0;
        width: 100%;
    }
}