/* 大圆动效样式 */
@keyframes rotate1 {
    0% { transform: translate(0, 0) rotateX(0deg) rotateY(0deg) scale(1); }
    50% { transform: translate(50px, 50px) rotateX(180deg) rotateY(180deg) scale(1.2); }
    100% { transform: translate(0, 0) rotateX(360deg) rotateY(360deg) scale(1); }
}

@keyframes rotate2 {
    0% { transform: translate(0, 0) rotateX(0deg) rotateY(0deg) scale(1); }
    50% { transform: translate(-50px, -50px) rotateX(-180deg) rotateY(-180deg) scale(1.2); }
    100% { transform: translate(0, 0) rotateX(-360deg) rotateY(-360deg) scale(1); }
}

@keyframes rotate3 {
    0% { transform: translate(0, 0) rotateX(0deg) rotateY(0deg) scale(1); }
    50% { transform: translate(-50px, 50px) rotateX(180deg) rotateY(-180deg) scale(1.2); }
    100% { transform: translate(0, 0) rotateX(360deg) rotateY(-360deg) scale(1); }
}

@keyframes rotate4 {
    0% { transform: translate(0, 0) rotateX(0deg) rotateY(0deg) scale(1); }
    50% { transform: translate(50px, -50px) rotateX(-180deg) rotateY(180deg) scale(1.2); }
    100% { transform: translate(0, 0) rotateX(-360deg) rotateY(360deg) scale(1); }
}

@keyframes gradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes scalePulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* 大圆动效容器 */
.siri-like {
    position: relative;
    width: 340px;
    height: 340px;
    perspective: 1000px;
    border-radius: 50%;
    overflow: hidden;
    background: linear-gradient(270deg, #a1c4fd, #c2e9fb, #a1c4fd, #c2e9fb);
    background-size: 400% 400%;
    animation: gradient 15s ease infinite;
    margin-top: 220px;
    margin-bottom: 4rem;
}

.siri-like .inner {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    transform-style: preserve-3d;
    display: flex;
    align-items: center;
    justify-content: center;
}

.siri-like .sphere {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    filter: blur(20px);
    opacity: 0.7;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.5), transparent);
}

.siri-like .sphere:nth-child(1) {
    background: radial-gradient(circle, rgba(255, 0, 0, 0.5), transparent);
    animation: rotate1 5s linear infinite;
}

.siri-like .sphere:nth-child(2) {
    background: radial-gradient(circle, rgba(0, 255, 0, 0.5), transparent);
    animation: rotate2 7s linear infinite;
}

.siri-like .sphere:nth-child(3) {
    background: radial-gradient(circle, rgba(0, 0, 255, 0.5), transparent);
    animation: rotate3 9s linear infinite;
}

.siri-like .sphere:nth-child(4) {
    background: radial-gradient(circle, rgba(255, 255, 0, 0.5), transparent);
    animation: rotate4 11s linear infinite;
}

/* 计时器样式 */
.timer {
    font-size: 24px;
    color: #333;
    display: none;
}

/* 按钮样式 */
.voice-button {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background-color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.voice-button .inner-circle {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background-color: #007bff;
    transition: all 0.3s ease;
}

.voice-button.active .inner-circle {
    border-radius: 8px;
}

.voice-button .progress-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    transform: rotate(-90deg);
    transition: stroke-dashoffset 0.1s linear;
}

.voice-button .progress-ring .gray {
    stroke: #ccc;
    stroke-width: 4;
    fill: transparent;
}

.voice-button .progress-ring .blue {
    stroke: #007bff;
    stroke-width: 4;
    fill: transparent;
    stroke-dasharray: 239;
    stroke-dashoffset: 239;
}

/* 声音脉动图形样式 */
.waveform {
    display: none;
    justify-content: center;
    align-items: flex-end;
    height: 60px;
    position: relative;
}

.waveform div {
    width: 6px;
    background: linear-gradient(to bottom, #007bff, #00bfff);
    margin: 0 2px;
    border-radius: 3px;
    transition: height 0.2s ease;
}

/* 新增样式：将所有内容在页面中心对齐 */
.container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 100vh;
}

.bottom-section {
    margin-top: auto;
    padding-bottom: 2rem;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* 右上角设置按钮样式 */
.settings-button {
    position: absolute;
    top: 1rem;
    right: 1rem;
    cursor: pointer;
    font-size: 1.5rem;
}

.settings-dropdown {
    position: absolute;
    top: 3rem;
    right: 1rem;
    background-color: white;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: none;
    color: black; /* 设置弹窗中的文字始终为黑色 */
}

.settings-dropdown.show {
    display: block;
}

.settings-dropdown div {
    padding: 0.5rem 1rem;
    cursor: pointer;
}

.settings-dropdown div:hover {
    background-color: #f0f0f0;
}

/* 左下角主题切换按钮样式 */
.theme-toggle {
    position: absolute;
    bottom: 1rem;
    left: 1rem;
    cursor: pointer;
    font-size: 1.5rem;
}

/* 左上角图标和标题样式 */
.header {
    position: absolute;
    top: 1rem;
    left: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header img {
    width: 36px;
    height: 36px;
}

.header h1 {
    font-size: 1.5rem;
    font-weight: bold;
    color: #333;
}

/* 暗色主题样式 */
.dark-mode {
    background-color: #000 !important; /* 网页背景为黑色 */
    color: #fff !important; /* 文字颜色为白色 */
}

.dark-mode .timer {
    color: #fff !important; /* 计时器颜色为白色 */
}

.dark-mode .settings-button i,
.dark-mode .theme-toggle i {
    color: #fff !important; /* 图标颜色为白色 */
}

.dark-mode .bottom-section p {
    color: #fff !important; /* 按钮下面的文字颜色为白色 */
}

.dark-mode .header h1 {
    color: #fff !important; /* 标题颜色为白色 */
}

/* 大圆形图形、声音脉动图形、圆形按钮颜色不变 */
.dark-mode .siri-like,
.dark-mode .waveform div,
.dark-mode .voice-button {
    /* 保持原有样式 */
}

/* 新增信息显示模块样式 */
.message-container {
    position: absolute;
    bottom: 150px; /* 向上偏移30像素 */
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    max-width: 600px;
    max-height: 220px; /* 最大高度 */
    overflow-y: auto; /* 超过高度时滚动 */
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: none; /* 默认隐藏 */
    text-align: left; /* 文字左对齐 */
    word-wrap: break-word; /* 自动换行 */
}

.message-container.show {
    display: block; /* 显示 */
}

.message-container .message {
    margin-bottom: 12px;
    font-size: 14px;
    color: #333;
    white-space: pre-wrap; /* 保留换行符 */
}

.message-container .message.user {
    color: #007bff; /* 用户消息颜色 */
}

.message-container .message.assistant {
    color: #28a745; /* AI 消息颜色 */
}

/* 设置按钮点击时变为蓝色 */
.settings-button.active i {
    color: #007bff !important;
}

/* 聊天按钮样式 */
.chat-button {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: black;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    z-index: 1000; /* 确保按钮在最上层 */
}

/* 聊天按钮点击时变为蓝色 */
.chat-button.active {
    background-color: #007bff;
}

/* 聊天窗口样式 */
.chat-popup {
    position: fixed;
    top: 50%; /* 垂直居中 */
    right: -405px; /* 初始位置在页面右侧外 */
    transform: translateY(-50%); /* 垂直居中 */
    width: 405px;
    height: 670px;
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: right 0.5s ease;
    z-index: 1000; /* 确保弹窗在最上层 */
    border: 1px solid #ccc; /* 添加灰色细边 */
}

/* 聊天窗口显示时的样式 */
.chat-popup.show {
    right: 1rem; /* 弹出到页面右侧 */
}

/* 聊天窗口内部样式 */
.chat-window {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 16px;
}

/* 聊天消息区域样式 */
.chat-messages {
    flex-grow: 1;
    overflow-y: auto;
    padding: 8px;
    background-color: #f9f9f9;
    border-radius: 8px;
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* 默认文字样式 */
.default-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: #666;
    font-size: 16px;
}

/* 用户消息样式 */
.message.user {
    align-self: flex-end;
    background-color: #007bff;
    color: white;
    padding: 8px 12px;
    border-radius: 12px 12px 0 12px;
    max-width: 70%;
}

/* AI 消息样式 */
.message.assistant {
    align-self: flex-start;
    background-color: #f0f0f0;
    color: #333;
    padding: 8px 12px;
    border-radius: 12px 12px 12px 0;
    max-width: 70%;
}

/* 聊天输入框样式 */
.chat-input {
    display: flex;
    align-items: center;
    border-top: 1px solid #ddd;
    padding-top: 8px;
}

.chat-input input {
    flex-grow: 1;
    border: none;
    outline: none;
    padding: 8px;
    border-radius: 4px;
    margin-right: 8px;
    color: black; /* 输入框文字始终为黑色 */
}

.chat-input button {
    background-color: transparent;
    border: none;
    cursor: pointer;
    color: black;
    transition: color 0.3s ease;
}

.chat-input button.active {
    color: #007bff; /* 发送按钮变为蓝色 */
}

/* 确保大圆动效在聊天窗口下方 */
.siri-like {
    z-index: 1; /* 大圆动效的层级低于聊天窗口 */
}