/* 通用盒模型重置 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* 移除内联样式在旧版浏览器中的一些默认样式 */
body,
h1,
h2,
h3,
h4,
h5,
h6,
p,
blockquote,
pre,
hr,
dl,
dd,
ol,
ul,
figure {
  margin: 0;
  padding: 0;
}

/* 清除列表样式 */
ul,
ol {
  list-style: none;
}

/* 清除图片、iframe、对象和嵌入元素的内边距 */
img,
iframe,
object,
embed {
  max-width: 100%;
}

html,
document,
body {
  width: 100%;
  height: 100%;
  padding: 0;
  margin: 0;
  position: relative;
}

/* 设置统一的字体和背景 */
body {
  font-family: Arial, sans-serif;
  line-height: 1.5;
  background-color: #fff;
  color: #333;
}

.wrap-box {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
}

.option {
  margin-bottom: 8px;
}

#media {
  width: 100%;
  height: 100%;
  max-width: 1280px;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  top: 0;
  z-index: 0;
}

#startmask {
  position: absolute;
  z-index: 10;
  left: 0;
  right: 0;
  bottom: 0;
  top: 0;
  background-color: rgba(0, 0, 0, 0.9);
  /* display: none; */
}

#start {
  position: fixed;
  left: 50%;
  top: 50%;
  line-height: 1.6rem;
  z-index: 1000;
  transform: translate(-50%, -50%);
  padding: 16px 32px;
  font-size: 20px;
  color: white;
  border: none;
  border-radius: 10px;
  background: linear-gradient(45deg, #ff00cc, #3333ff);
  box-shadow: 0 4px 15px rgba(255, 0, 204, 0.5), 0 5px 20px rgba(51, 51, 255, 0.5);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
}

#start:hover {
  transform: translate(-50%, -50%) scale(1.05);
  box-shadow: 0 8px 20px rgba(255, 0, 204, 0.7), 0 10px 30px rgba(51, 51, 255, 0.7);
}

#start:active {
  transform: translate(-50%, -50%) scale(0.95);
  box-shadow: 0 2px 10px rgba(255, 0, 204, 0.5), 0 3px 15px rgba(51, 51, 255, 0.5);
}

#loading {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  top: 0;
  background-color: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.loader {
  display: flex;
  justify-self: center;
  align-items: center;
  width: auto;
  height: 100px;
}

.dot {
  width: 32px;
  height: 32px;
  line-height: 32px;
  border-radius: 50%;
  background-color: #ff00cc;
  display: inline-block;
  margin: 4px;
  animation: spin 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
  color: white;
  text-align: center;
}

.dot:nth-child(1) {
  animation-delay: -0.48s;
}

.dot:nth-child(2) {
  animation-delay: -0.36s;
}

.dot:nth-child(3) {
  animation-delay: -0.24s;
}

.dot:nth-child(4) {
  animation-delay: -0.12s;
}

.dot:nth-child(5) {
  animation-delay: 0s;
}

@keyframes spin {
  0% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-20px);
  }

  100% {
    transform: translateY(0);
  }
}

.form-inline {
  padding: 0 10px 10px;
  display: flex;
  flex-direction: row;
  justify-content: space-around;
}

.form-group {
  flex: 1;
  height: 100%;
  margin-left: 10px;
}

#message-input {
  width: 100%;
  height: 100%;
  text-indent: 10px;
}

.chat-input {
  border: 1px solid #ced4da;
  border-radius: 5px;
  resize: none;
  outline: none;
  font-size: 16px;
  background: transparent;
  font-size: 12px;
}

.chat-input:focus {
  border-color: #80bdff;
  box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.chat-submit {
  height: 10vw;
  max-height: 48px;
  min-height: 30px;
  margin-left: 10px;
  background-color: #007bff;
  margin: 0 10px;
  color: white;
  border: none;
  border-radius: 5px;
  font-size: 16px;
  cursor: pointer;
  transition: background-color 0.3s ease;
  width: 46%;
  /* 宽度也使用视口单位 */
  min-width: 40px;
  /* 设置最小宽度 */
  display: flex;
  justify-content: center;
  align-items: center;
}

#clear-chat {
  background-color: transparent;
}
#clear-chat svg {
  color: #007bff;
}

.chat-submit.manual {
  margin-left: 0px;
  margin-right: 10px;
  animation: 0.5s;
}

.chat-submit svg {
  width: 90%;
  height: 60%;
  stroke: white;
}

#human-talking {
  animation: breathing 2s infinite;
}

#submit-button.hidden,
#human-talking.hidden {
  display: none;
}

.slide-btn {
  width: 40px;
  height: 40px;
  cursor: pointer;
  border-radius: 50%;
  background-color: #007bff;
  border: none;
}

.bottom-btn {
  position: fixed;
  width: 60px;
  height: 100%;
  right: 0;
  top: 0;
  transition: 0.3s;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.bottom-btn.active {
  /* bottom: 114px; */
  height: calc(100% - 300px);
}

.bottom-btn > button {
  margin: 8px;
}

.listening {
  background-color: #868686;
  color: white;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.mic-button.active,
.listening.active {
  background-color: #007bff;
}

.force-stop,
.setting-btn {
  color: white;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  animation: 0.3s;
}

.slide-btn svg {
  width: 24px;
  height: 24px;
}

.mic-button {
  background-color: #868686;
  border: none;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  z-index: 1;
  cursor: pointer;
}

/* .mic-button.manual {
  position: fixed;
  left: -200%;
} */

.chat-submit.manual.recording {
  background-color: #007bff;
  /* 录音时的背景颜色 */
  background-color: orangered;
  /* 录音时的背景颜色 */
}

.chat-submit.manual.recording svg {
  animation: breathing 2s infinite;
}

@keyframes breathing {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }

  50% {
    transform: scale(1.15);
    opacity: 0.8;
  }
}

.mic-button.recording svg path {
  stroke: white;
  /* 录音时的图标颜色 */
}

.mic-button.recording svg .recording-icon {
  display: block;
}

.mic-button.recording svg .static-icon {
  display: none;
}

.mic-button:active {
  background-color: #004494;
}

.mic-button svg {
  width: 24px;
  height: 24px;
  stroke: white;
}

.mic-button svg .recording-icon {
  display: none;
}

.mic-button svg .static-icon {
  display: block;
}

#video,
#media-bg,
#canvas-box {
  height: 100%;
  position: absolute;
  top: 0;
  left: 50%;
  transform: translate(-50%, 0);
  transform-origin: center;
}

#video.green-off {
  z-index: -11000;
  left: -2000px;
}

.stop-button {
  position: fixed;
  bottom: -15%;
  /* 调整位置以放在麦克风按钮的上面 */
  left: 20px;
  background-color: #dc3545;
  /* 红色背景 */
  border: none;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  z-index: 1;
  cursor: pointer;
}

.stop-button:hover {
  background-color: #c82333;
  /* 悬停时更深的红色 */
}

.stop-button:active {
  background-color: #b11d24;
  /* 激活时更深的红色 */
}

.stop-button svg {
  width: 24px;
  height: 24px;
  stroke: white;
}

#chat-container {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background-color: transparent;
  transition: transform 0.3s ease;
  transform: translateY(100%);
  z-index: 1;
  display: flex;
  flex-direction: column;
}

#chat-container.show {
  transform: translateY(0);
}

#chat-container.show .chat-submit.manual {
  position: inherit;
}

/* #chat-container .chat-submit.manual {
  position: fixed;
  top: -32px;
  left: 10px;
} */

#arrow {
  position: absolute;
  right: 10px;
  top: -24px;
  opacity: 0.5;
  cursor: pointer;
}

#arrow svg {
  width: 24px;
  height: auto;
  transition: 0.3s;
}

#arrow.active svg {
  transform: rotate(180deg);
}

.chat-history {
  flex: 1;
  padding: 8px;
  overflow-y: auto;
  height: 100vh;
  left: 0;
  width: 100%;
  bottom: 0;
}

/* .chat-history::before {
  content: "";
  width: 100%;
  height: 20%;
  position: absolute;
  left: 0;
  top: 0;
  z-index: 100;
} */

.chat-item {
  display: flex;
  align-items: flex-start;
  margin-bottom: 10px;
  color: #3f3f3f;
  margin: 20px 10px;
  opacity: 0.8;
}

.chat-content {
  display: inline-block;
  line-height: 32px;
  padding: 6px;
  font-size: 20px;
  border-radius: 4px;
  background: white;
  transition: 0.8s;
  box-shadow: none;
  background: linear-gradient(to right, white, rgba(255, 255, 255, 0.5), rgba(0, 0, 0, 0));
}
.chat-item:last-child {
  opacity: 1;
}

.chat-item:last-child .chat-content {
  box-shadow: 2px 2px 8px 0px #72adff;
  opacity: 1;
}


.tts {
  cursor: pointer;
}
.tts svg {
  vertical-align: middle;
  margin-right: 4px;
}

.dividing-line {
  width: 90%;
  margin: 4px auto;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.chat-user {
  flex-direction: row-reverse;
}

.chat-user svg {
  color: #007bff;
}

.chat-user .chat-content {
  background: linear-gradient(to left, white, rgba(255, 255, 255, 0.5), rgba(0, 0, 0, 0));
  /* 从上到下的灰度渐变 */
  /* border: 1px solid rgb(137, 217, 97); */
  border: 1px solid rgb(200, 200, 200);
  position: relative;
}

.chat-user .chat-content::before {
  content: "";
  display: block;
  position: absolute;
  right: -4px;
  top: 25%;
  background: white;
  width: 4px;
  height: 4px;
  border: 1px solid rgb(200, 200, 200);
  border-bottom: none;
  border-left: none;
  transform: rotate(45deg);
}

.chat-robot .chat-content {
  border: 1px solid rgb(222, 222, 222);
  position: relative;
}

.chat-robot .chat-content::after {
  content: "";
  display: block;
  position: absolute;
  left: -4px;
  top: 25%;
  background: white;
  width: 4px;
  height: 4px;
  border: 1px solid rgb(200, 200, 200);
  border-bottom: none;
  border-left: none;
  transform: rotate(225deg);
}

.chat-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  width: 40px;
  height: 40px;
  background-color: #f3f7fb;
  margin: 4px 10px;
  font-size: 12px;
}

.chat-avatar svg {
  width: 40px;
  height: 24px;
}

/* 修改 .recording-indicator 样式 */
.recording-indicator {
  position: fixed;
  left: 50%;
  bottom: 5%;
  transform: translate(-50%, 0);
  width: 100px;
  /*加宽容器容纳竖条 */
  height: 60px;
  /* 增高容器 */
  border-radius: 8px;
  /* 圆角矩形 */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 10px;
  background-color: rgb(210 206 206 / 50%);
  z-index: 1000;
}

.recording-indicator.hidden {
  display: none;
}

/* 竖条容器 */
.wave-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  border-radius: 8px;
}

/* 竖条样式 */
.wave {
  position: absolute;
  width: 1px;
  /* 竖条宽度 */
  background: linear-gradient(transparent, #007bff, transparent);
  /* 渐变透明度 */
  opacity: 0;
  animation: verticalWave 1s linear infinite;
}

/* 三个竖条层 */
.wave-1 {
  left: 10%;
  height: 45%;
  animation-delay: -0.8s;
}

.wave-2 {
  left: 30%;
  height: 58%;
  animation-delay: -0.6s;
}

.wave-3 {
  left: 50%;
  height: 100%;
  animation-delay: -0.4s;
}

.wave-4 {
  left: 70%;
  height: 58%;
  animation-delay: -0.2s;
}

.wave-5 {
  left: 90%;
  height: 45%;
  animation-delay: -0s;
}

/* 竖条动画 */
@keyframes verticalWave {
  0%,
  100% {
    transform: translateY(0);
    opacity: 0.8;
  }

  50% {
    transform: translateY(-5px);
    opacity: 1;
  }
}

/* 弹窗容器 */
#message-container {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 20px;
  width: 300px;
}

/* 单条消息样式 */
.message {
  text-align: center;
  padding: 8px 14px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  animation: slideIn 0.3s ease-out;
  opacity: 0.95;
  transition: all 0.3s;
}

/* 消息类型颜色 */
.message.success {
  background: #f0f9eb;
  color: #236a00;
  border: 1px solid #e1f3d8;
}

.message.error {
  background: #fef0f0;
  color: #f56c6c;
  border: 1px solid #fde2e2;
}

.message.warning {
  background: #fdf6ec;
  color: #f99500;
  border: 1px solid #faecd8;
}

/* 图标样式 */
.message::before {
  font-family: "iconfont";
  /* 需引入图标字体 */
  margin-right: 12px;
  font-size: 34px;
}

.success::before {
  content: "\2714";
}

.error::before {
  content: "\26A0";
}

.warning::before {
  content: "\26A0";
}

/* 动画效果 */
@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 0.95;
  }
}

.message.hide {
  animation: fadeOut 0.3s ease-in forwards;
}

@keyframes fadeOut {
  to {
    opacity: 0;
    transform: translateY(-20px);
  }
}

#bg-img {
  display: inline-block;
  width: 90px;
}

#controls {
  position: fixed;
  box-sizing: border-box;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(6, 6, 6, 0.8);
  color: white;
  padding: 10px;
  z-index: 10;
  border-radius: 10px;
  font-size: 12px;
  overflow: hidden;
  visibility: hidden;
  transition: 0.3s;
  animation: 0.3s;
  width: 95%;
  max-width: 360px;
  height: auto;
}

#controls.active {
  visibility: visible;
}

#controls input {
  vertical-align: middle;
}

.close-btn {
  position: absolute;
  right: 10px;
  top: 10px;
  width: 20px;
  height: 20px;
  font-size: 16px;
  text-align: center;
  cursor: pointer;
}

.lable {
  display: inline-block;
  width: 80px;
  line-height: 30px;
  vertical-align: middle;
}

.switch {
  position: relative;
  width: 60px;
  height: 34px;
  background: gray;
  border-radius: 17px;
  cursor: pointer;
  /* transition: 0.2s; */
  font-size: 17px;
}

.switch::after {
  content: "";
  display: inline-block;
  width: 40px;
  height: 15px;
  border-radius: 8px;
  background: transparent;
}

.switch::before {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  left: 1px;
  bottom: 1px;
  background: white;
  border-radius: 50%;
  /* transition: 0.2s; */
}

input:checked + .switch {
  background: #2196f3;
}

input:checked + .switch::before {
  transform: translateX(22px);
}

.controls-btn {
  padding: 0 6px;
  min-width: 50px;
  height: 24px;
  background: #007bff;
  color: white;
  border: none;
  border-radius: 6px;
  margin-right: 10px;
}

@media (max-width: 768px) {
  #chat-container {
    width: 100%;
  }

  .slide-btn {
    width: 12vw;
    height: 12vw;
    min-width: 45px;
    min-height: 45px;
  }

  .slide-btn svg {
    width: 6vw;
    height: 6vw;
    min-width: 20px;
    min-height: 20px;
  }
}

@media (max-width: 480px) {
  .form-inline {
    align-items: stretch;
  }

  .chat-submit.manual {
    margin-right: 0;
  }

  .form-group {
    margin-right: 0;
  }
}

/* 语言选择器样式 */
.language-selector {
  display: flex;
  flex: row;
  justify-content: center;
  gap: 20px;
  background-color: #f5f5f5;
  border-radius: 8px;
  margin: 10px;
}

.language-group {
  flex: 1;
  display: flex;
  width: 50%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.language-group label {
  font-weight: bold;
  margin-bottom: 5px;
  color: #333;
}
.language-group .quiet-button {
  cursor: pointer;
  font-size: 26px;
}

.language-dropdown {
  padding: 8px 12px;
  border: 2px solid #ddd;
  border-radius: 6px;
  background-color: white;
  font-size: 14px;
  cursor: pointer;
  transition: border-color 0.3s ease;
}

.language-dropdown:focus {
  outline: none;
  border-color: #4caf50;
}

.language-dropdown:hover {
  border-color: #999;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .language-selector {
    gap: 10px;
  }

  .language-group {
    width: 100%;
  }

  .language-dropdown {
    width: 100%;
  }
}

#translation-download-indicator {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
}

.download-overlay {
  background: white;
  padding: 30px;
  border-radius: 10px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  min-width: 300px;
}

.download-spinner {
  border: 4px solid #f3f3f3;
  border-top: 4px solid #3498db;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

.download-text {
  font-size: 16px;
  margin-bottom: 20px;
  color: #333;
}

.download-progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.progress-bar {
  width: 70%;
  height: 10px;
  background-color: #f0f0f0;
  border-radius: 5px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background-color: #3498db;
  width: 0%;
  transition: width 0.3s ease;
}

.progress-text {
  width: 25%;
  text-align: right;
  font-weight: bold;
  color: #333;
}

#load-model-mask {
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: black;
  z-index: 1000;
  opacity: 0.9;
  display: flex;
  justify-content: center;
  align-items: center;
}

#load-model-button {
  cursor: pointer;
  width: 50%;
  padding: 12px;
  max-width: 500px;
  line-height: 40px;
  font-size: 20px;
  background-color: #007bff;
  color: white;
  text-align: center;
  border-radius: 10px;
}
