﻿/* 全局重置与基础样式 - 适配1080×1920竖屏 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "微软雅黑", sans-serif;
    touch-action: manipulation; /* 优化触控体验 */
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden; /* 禁止页面滚动 */
    background-color: #f5f7fa;
}
/* 表格样式优化 */
.dialog-item .content table {
    font-size: 16px;
    line-height: 1.5;
}

.dialog-item .content th {
    background-color: #e6f2ff !important;
    color: #003366;
    font-weight: bold;
}

.dialog-item .content td {
    background-color: #fff;
}

.dialog-item .content tr:hover td {
    background-color: #f5faff;
}

body {
    width: 1080px;
    height: 1920px;
    /*padding: 15px;*/
    /*display: flex;
    flex-direction: column;*/ /*竖屏垂直布局 */
    /*align-items: end;
    justify-content: end;
    background-image: url('../images/bg.png');
    background-repeat: no-repeat;
    background-size: cover;*/
    margin: 0 auto;
}
.body-content {
    width: 100%;
    height: 100%;
    display: flex;
    /* display: flex; */
    flex-direction: column;
    /*align-items: end;*/
    align-items: center;
    /*justify-content: end;*/
    justify-content: space-between;
    background-image: url(../images/bg.png);
    background-repeat: no-repeat;
    background-size: cover;
    position: relative;
}
.head-image {
    position: relative;
    top: 14%;
}
    .head-image img {
        /* 你可以自己改宽高 */
        width: 100%;
        height: auto;
        /* 关键：呼吸动画 */
        animation: breathZoom 3s infinite ease-in-out alternate;
    }

@keyframes breathZoom {
    0% {
        transform: scale(1);
    }

    100% {
        transform: scale(1.05); /* 放大一点点，避免太夸张 */
    }
}

/* 人物容器 - 核心：唯一的人物展示区域，竖屏居中 */
/*.character-wrapper {
    position: relative;*/
    /*width: 240px;
    height: 340px;*/
    /*width: 80%;
    height: 80%;
    margin: 0 auto 30px;
}*/
/* 人物容器 - 右下角定位 */
.character-wrapper {
    position: relative;
    /*width: 51%;
    height: 82%;*/
    width: 51%;
    height: 54%;
    margin: 0 auto;
    bottom: 21%;
    display: flex;
    /* justify-content: center; */
    flex-direction: column;
    align-items: center;
    justify-content: end;
    /*right: 50px;
    bottom: 50px;*/
    /* width: 260px;
    height: 360px;*/
}

/* 身体图层（静态） */
/*.character-body {
    position: absolute;
    width: 100%;
    height: 100%;
    background-size: contain;
    background-repeat: no-repeat;
    z-index: 1;
    background-position: center;
}*/

/* 眼睛图层 */
.character-body {
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: url('../images/body.png');
    background-size: contain;
    background-repeat: no-repeat;
    z-index: 1;
    background-position: center;
    /* 开启硬件加速，提升动画流畅度 */
    transform: translateZ(0);
}

/* 嘴巴图层 */
.character-mouth {
    position: absolute;
    width: 10%;
    height: 100%;
    /* margin: 0 auto; */
    /*left: 40%;*/
    left: 44.9%;
    /*bottom: -2%;*/
    bottom: -4%;
    background-image: url('../images/mouth-0.png');
    background-size: contain;
    background-repeat: no-repeat;
    z-index: 3;
    background-position: center;
    transition: none;
}

/* 眼睛眨眼动画 */
@keyframes blink {
    0% {
        background-image: url('../images/eye-1.png');
    }
    /* 睁眼 */
    98% {
        background-image: url('../images/eye-1.png');
    }
    /* 前3.43秒保持睁眼 */
    99% {
        background-image: url('../images/eye-3.png');
    }
    /* 3.465秒：半闭眼（10ms） */
    99.5% {
        background-image: url('../images/eye-5.png');
    }
    /* 3.4825秒：全闭眼（5ms） */
    100% {
        background-image: url('../images/eye-1.png');
    }
    /* 3.5秒：瞬间睁眼（总共仅70ms） */
}

@keyframes talk {
    0% {
        background-image: url('../images/mouth-0.png');
    }
    33.33% {
        background-image: url('../images/mouth-3.png');
    }
    66.66% {
        background-image: url('../images/mouth-4.png');
    }

    88.88% {
        background-image: url('../images/mouth-3.png');
    }

    100% {
        background-image: url('../images/mouth-0.png');
    }
}

.speaking {
    animation: talk 0.8s steps(9) infinite;
}




/* 状态提示文字 */
.dialog-status {
    display: none;
    position: absolute;
    top: 500px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 18px;
    color: #ffffff;
    text-align: center;
    z-index: 9;
}


/* 按钮内容器强制横向 */
.btn-content {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 12px !important;
    white-space: nowrap !important;
    flex-wrap: nowrap !important;
    background-image: url('/images/startBtn.png');
    width: 493px;
    height: 149px;
}
/* 开始按钮 - 人物左侧 */
.start-btn {
    position: absolute;
    bottom: -24%;
    background-color: #f0f8ff24;
    border-radius: 80px;
    /* bottom: 128px;
    left: -204px;*/
    /*bottom: 100px;
    left: -180px;*/ /* 调整到人物左侧 */
    transform: translateX(0);
    /*padding: 15px 35px;*/
    /*padding: 25px 45px;*/
    /*background: #624aff;*/
    color: #fff;
    border: none;
    /*border-radius: 30px;*/
    /*border-radius: 40px;*/
    /*font-size: 29px;*/
    cursor: pointer;
    transition: background 0.3s;
    z-index: 10;
    min-width: 320px; /* 加宽避免内容挤在一起 */
    width: auto;
    display: flex;
    flex-flow: row nowrap !important; /* 关键：!important 防止被覆盖 */
    align-items: center;
    justify-content: center;
    gap: 12px; /* 文字和动画之间的间距 */
    /* 核心修复3：禁止内容换行 */
    white-space: nowrap;
    flex-wrap: nowrap;
}
#startBtnText {
    display: inline-block;
    flex-shrink: 0; /* 关键：禁止文字容器收缩 */
    white-space: nowrap;
    font-size: 52px;
    letter-spacing: 0.1em;
    font-weight: bold;
}

.start-btn:hover {
    background: #bfb7f1;
}

.start-btn:disabled {
    background: #bfb7f1; /* 和加载状态背景一致 */
    cursor: wait;
    opacity: 1; /* 不透明 */
}

/* 跳动原点加载动画容器 - 放在按钮内部 */
.loading-animation {
    display: none; /* 默认隐藏 */
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 100%;
    height: 24px; /* 固定高度，避免变形 */
    width: auto;
    flex-shrink: 0;
}

/* 单个原点 */
.loading-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: #ffffff;
    animation: bounce 1.4s infinite ease-in-out both;
}

    .loading-dot:nth-child(1) {
        animation-delay: -0.32s;
    }

    .loading-dot:nth-child(2) {
        animation-delay: -0.16s;
    }

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* 按钮加载状态样式 */
.start-btn.loading {
    background: #bfb7f1; /* 稍微暗一点 */
    cursor: wait;
}

    .start-btn.loading .loading-animation {
        display: flex; /* 显示动画 */
    }

/* 控制按钮容器（结束/隐藏记录） */
/*.control-buttons {
    display: none;*/ /* 初始隐藏 */
    /*margin-top: 20px;
    text-align: center;
}*/

/* 结束/切换按钮样式 */
.end-btn, .toggle-dialog-btn {
    /*padding: 12px 30px;*/
    /*padding: 25px 60px;*/
    border: none;
    border-radius: 40px;
    /*font-size: 29px;*/
    font-size: 52px;
    font-weight: bold;
    text-align: center;
    line-height: 187px;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: background 0.3s;
    /*margin: 0 5px 10px;*/
    min-width: 180px;
}

.end-btn {
    /*background: #ff4d4f;*/
    background-image: url('/images/endBtn.png');
    color: #fff;
    width: 530px;
    height: 187px;
    background-color: #f0f8ff00;
}

/*.control-buttons:hover {
    background: #d9363e;
}*/

.toggle-dialog-btn {
    background: #40a9ff;
    color: #fff;
}

    .toggle-dialog-btn:hover {
        background: #1890ff;
    }

/* 对话记录区域 - 顶部开始往下显示 */
.dialog-history {
    display: none;
    position: absolute;
    /*top: 5%;*/
    top: 8%;
    left: 8%;
    /*top: 4%;
    left: 50%;*/
    /*transform: translateX(-50%);*/
    width: 90%;
    max-width: 900px;
    /*height: 80%;*/
    height: 74%;
    /*height: 450px;*/
    /*border: 1px solid #eee;*/
    /*border-radius: 8px;*/
    /*padding: 15px;*/
    overflow-y: auto;
    /*background: #f9f9f9;*/
    font-size: 25px;
    flex-direction: column;
    justify-content: flex-start;
    z-index: 999;
    /* ========== 新增：隐藏滚动条 ========== */
    /* Chrome, Safari, Edge */
    scrollbar-width: none;
    -ms-overflow-style: none;
}
    /* Chrome, Safari, Edge 隐藏滚动条 */
    .dialog-history::-webkit-scrollbar {
        display: none;
    }

/* 对话状态提示 */
.dialog-status {
    display: none;
    position: absolute;
    top: 500px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 18px;
    color: #624aff;
    text-align: center;
}

/* 控制按钮容器 */
.control-buttons {
    display: none;
    position: absolute;
    bottom: -26%;
    /*top: 80%;*/
    /*top: 86%;*/
    /*top: 550px;*/
    /*left: 49%;*/
    /*transform: translateX(-60%);*/
    /*margin-top: 20px;*/
    text-align: center;
    z-index: 9999;
    transform: translateX(0);
    width: 530px;
    height: 187px;
    border-radius: 80px;
}



.dialog-item {
    margin: 10px 0;
    padding: 8px 12px;
    border-radius: 8px;
    max-width: 80%;
    clear: both;
}

    /* 用户提问样式（右对齐，蓝色） */
    .dialog-item.user {
        /*background-color: #007bff;*/
        background-color: #358fef;
        color: white;
        float: right;
    }

    /* 机器人回答样式（左对齐，灰色） */
    .dialog-item.bot {
        background-color: #f0f0f0;
        color: #333;
        float: left;
    }

    /* 系统消息样式（居中，浅灰色） */
    .dialog-item.system {
        background-color: #e9ecef;
        color: #666;
        float: none;
        margin: 8px auto;
        text-align: center;
        max-width: 60%;
    }

/* 角色标签 */
.role-label {
    font-weight: bold;
    margin-bottom: 4px;
    font-size: 0.9em;
}

.dialog-item.user .role-label {
    color: #1976d2;
}

.dialog-item.bot .role-label {
    color: #43a047;
}

.dialog-item.system .role-label {
    color: #757575;
}

.content {
    word-wrap: break-word;
    line-height: 1.4;
}

.time {
    font-size: 0.8em;
    color: #9e9e9e;
    margin-top: 4px;
    text-align: right;
}
/*.dialog-item .content {
    white-space: pre-wrap;*/ /* 保留换行符，让合并的消息自动换行 */
    /*word-wrap: break-word;
    line-height: 1.4;
}*/
/* 先添加CSS样式，解决背景跳动问题 */
.dialog-item .content {
    min-width: 120px; /* 最小宽度，防止收缩 */
    min-height: 30px; /* 最小高度，防止跳动 */
    white-space: pre-wrap; /* 保留换行符，排版更稳定 */
    padding: 8px 12px;
    border-radius: 8px;
    transition: all 0.2s ease; /* 平滑过渡尺寸变化 */
    word-wrap: break-word;
    line-height: 1.4;
}




/* 时间样式 */
.time {
    font-size: 0.8em;
    opacity: 0.7;
    margin-top: 4px;
    text-align: right;
}




/* 对话状态提示 */
/*.dialog-status {
    display: none;*/ /* 初始隐藏 */
    /*font-size: 18px;
    color: #624aff;
    margin: 10px 0;
    text-align: center;
}*/

/* 音频播放器和错误提示 */
.audio-player {
    display: none;
    width: 100%;
    max-width: 90vw;
    margin-top: 10px;
}

.audio-worklet-error {
    display: none;
    color: #ff4d4f;
    padding: 10px;
    margin: 10px 0;
    background: #fff2f0;
    border-radius: 4px;
    font-size: 16px;
    max-width: 90vw;
}

/* 适配1080×1920竖屏 */
@media screen and (width: 1080px) and (height: 1920px) {
    .character-wrapper {
        width: 51%;
        height: 82%;
    }

    .dialog-history {
        height: 80%;
    }

    .start-btn {
        font-size: 29px;
        padding: 25px 45px;
    }

    .dialog-status {
        font-size: 20px;
    }
}
