* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: linear-gradient(135deg, #0c1624 0%, #1a2a47 30%, #0d1f3c 70%, #081224 100%);
  color: #fff;
  font-family: 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', sans-serif;
  overflow: hidden;
  min-height: 100vh;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    radial-gradient(circle at 20% 30%, rgba(0, 204, 136, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(0, 170, 255, 0.06) 0%, transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(102, 102, 255, 0.04) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

#container {
  width: 100vw;
  height: 100vh;
  position: relative;
  z-index: 1;
}

#avatar {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 5;
}

#avatar canvas {
  width: 100% !important;
  height: 100% !important;
}

#avatar-image {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 70%;
  max-height: 80%;
  object-fit: contain;
  filter: drop-shadow(0 20px 60px rgba(0, 0, 0, 0.5));
  z-index: 6;
  transition: transform 0.3s ease, filter 0.3s ease;
}

#avatar-image:hover {
  filter: drop-shadow(0 25px 70px rgba(0, 0, 0, 0.6));
}

.avatar-placeholder {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 500px;
  height: 650px;
  border-radius: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 4px 20px rgba(0,0,0,0.3);
  box-shadow: 
    0 30px 80px rgba(0,0,0,0.4),
    0 0 0 1px rgba(255,255,255,0.1) inset;
  z-index: 6;
  overflow: hidden;
}

.avatar-placeholder::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 50%);
  pointer-events: none;
}

.avatar-placeholder span {
  font-size: 72px;
  margin-bottom: 16px;
  display: block;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

#digitalHumanVideo {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80%;
  height: 80%;
  object-fit: contain;
  border-radius: 20px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.5);
  display: none;
  z-index: 10;
}

.avatar-animate {
  animation: avatarBounce 3s ease-in-out infinite;
}

.avatar-speaking {
  animation: avatarTalk 0.15s ease-in-out infinite;
}

@keyframes avatarBounce {
  0%, 100% { transform: translate(-50%, -50%) translateY(0px); }
  50% { transform: translate(-50%, -50%) translateY(-8px); }
}

@keyframes avatarTalk {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.02); }
}

.lip-indicator {
  position: absolute;
  bottom: 18%;
  left: 50%;
  transform: translateX(-50%);
  width: 70px;
  height: 35px;
  border: 3px solid #ff6b6b;
  border-radius: 0 0 35px 35px;
  border-top: none;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 20;
  box-shadow: 0 0 20px rgba(255, 107, 107, 0.4);
}

.lip-indicator.active {
  opacity: 1;
  animation: lipMove 0.15s ease-in-out infinite;
}

@keyframes lipMove {
  0%, 100% { height: 25px; }
  50% { height: 45px; }
}

#loading {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(8, 18, 36, 0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(10px);
}

.loader {
  width: 60px;
  height: 60px;
  border: 4px solid rgba(0, 204, 136, 0.2);
  border-top-color: #00cc88;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 24px;
  box-shadow: 0 0 30px rgba(0, 204, 136, 0.3);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

#loading div:last-child {
  font-size: 16px;
  color: rgba(255, 255, 255, 0.85);
  letter-spacing: 0.5px;
}

.panel {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  z-index: 100;
  padding: 14px 20px;
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  box-shadow: 
    0 20px 60px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(255, 255, 255, 0.05) inset;
}

.panel button {
  padding: 10px 20px;
  background: linear-gradient(135deg, #00cc88 0%, #00a870 100%);
  border: none;
  border-radius: 12px;
  color: white;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 
    0 4px 15px rgba(0, 204, 136, 0.3),
    0 0 0 1px rgba(0, 204, 136, 0.2) inset;
}

.panel button:hover {
  transform: translateY(-3px);
  box-shadow: 
    0 8px 25px rgba(0, 204, 136, 0.4),
    0 0 0 1px rgba(0, 204, 136, 0.3) inset;
  background: linear-gradient(135deg, #00dd94 0%, #00b87a 100%);
}

.panel button:active {
  transform: translateY(-1px);
}

.panel button.secondary {
  background: linear-gradient(135deg, #00aaff 0%, #0088cc 100%);
  box-shadow: 
    0 4px 15px rgba(0, 170, 255, 0.3),
    0 0 0 1px rgba(0, 170, 255, 0.2) inset;
}

.panel button.secondary:hover {
  background: linear-gradient(135deg, #11bbff 0%, #0099dd 100%);
  box-shadow: 
    0 8px 25px rgba(0, 170, 255, 0.4),
    0 0 0 1px rgba(0, 170, 255, 0.3) inset;
}

.panel button.accent {
  background: linear-gradient(135deg, #ff6b6b 0%, #ee5253 100%);
  box-shadow: 
    0 4px 15px rgba(255, 107, 107, 0.3),
    0 0 0 1px rgba(255, 107, 107, 0.2) inset;
}

.panel button.accent:hover {
  background: linear-gradient(135deg, #ff7b7b 0%, #ff5253 100%);
  box-shadow: 
    0 8px 25px rgba(255, 107, 107, 0.4),
    0 0 0 1px rgba(255, 107, 107, 0.3) inset;
}

.view-toggle {
  position: absolute;
  top: 20px;
  right: 20px;
  display: flex;
  gap: 10px;
  z-index: 100;
}

.view-toggle button {
  padding: 10px 18px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  letter-spacing: 0.3px;
}

.view-toggle button:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

.avatar-selector {
  position: absolute;
  top: 90px;
  right: 20px;
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 14px;
  z-index: 100;
  max-height: 480px;
  overflow-y: auto;
  width: 185px;
  box-shadow: 
    0 20px 60px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(255, 255, 255, 0.05) inset;
}

.avatar-selector::-webkit-scrollbar {
  width: 6px;
}

.avatar-selector::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
}

.avatar-selector::-webkit-scrollbar-thumb {
  background: rgba(0, 204, 136, 0.4);
  border-radius: 3px;
}

.avatar-selector::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 204, 136, 0.6);
}

.avatar-selector h4 {
  margin: 0 0 12px 0;
  font-size: 14px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.95);
  letter-spacing: 0.5px;
}

.avatar-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  margin: 6px 0;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 2px solid transparent;
}

.avatar-option:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateX(-3px);
}

.avatar-option.active {
  background: rgba(0, 204, 136, 0.15);
  border-color: rgba(0, 204, 136, 0.5);
  box-shadow: 0 0 20px rgba(0, 204, 136, 0.2);
}

.avatar-option img {
  width: 40px;
  height: 52px;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.avatar-option span {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 500;
}

.info-panel {
  position: absolute;
  top: 20px;
  left: 20px;
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 16px 18px;
  z-index: 100;
  box-shadow: 
    0 20px 60px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(255, 255, 255, 0.05) inset;
  max-width: 280px;
}

.info-title {
  font-size: 14px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.95);
  margin-bottom: 12px;
  letter-spacing: 0.5px;
}

.info-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.info-item:last-child {
  border-bottom: none;
}

.info-dot {
  width: 8px;
  height: 8px;
  background: linear-gradient(135deg, #00cc88 0%, #00a870 100%);
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(0, 204, 136, 0.4);
}

.info-item span {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.85);
}

.plugin-panel {
  position: absolute;
  top: 100px;
  left: 30px;
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 24px;
  width: 280px;
  z-index: 50;
  box-shadow: 
    0 20px 60px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(255, 255, 255, 0.05) inset;
}

.voice-panel {
  position: absolute;
  top: 190px;
  left: 20px;
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 12px 18px;
  z-index: 100;
  max-height: 360px;
  width: 280px;
  overflow-y: auto;
  box-shadow: 
    0 20px 60px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(255, 255, 255, 0.05) inset;
}

.voice-type-switch {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 10px;
}

.voice-type-btn {
  flex: 1;
  padding: 8px 12px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.voice-type-btn:hover {
  color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.05);
}

.voice-type-btn.active {
  background: linear-gradient(135deg, #00cc88 0%, #00a870 100%);
  color: white;
  box-shadow: 0 2px 10px rgba(0, 204, 136, 0.3);
}

.voice-panel::-webkit-scrollbar {
  width: 6px;
}

.voice-panel::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
}

.voice-panel::-webkit-scrollbar-thumb {
  background: rgba(0, 204, 136, 0.4);
  border-radius: 3px;
}

.voice-panel .info-title {
  margin-bottom: 14px;
  font-size: 14px;
}

#voiceList {
  font-size: 13px;
  max-height: 180px;
  overflow-y: auto;
  margin-bottom: 16px;
}

#voiceList div {
  padding: 10px 14px;
  margin: 6px 0;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.85);
  font-weight: 500;
}

#voiceList div:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateX(-3px);
}

#voiceList div[style*="background: rgba(0,204,136,0.2)"] {
  background: rgba(0, 204, 136, 0.18) !important;
  border: 1px solid rgba(0, 204, 136, 0.5);
  color: #fff;
}

.voice-panel input[type="range"] {
  width: 120px;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
  -webkit-appearance: none;
}

.voice-panel input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00cc88 0%, #00a870 100%);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 204, 136, 0.4);
  transition: all 0.2s ease;
}

.voice-panel input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 3px 12px rgba(0, 204, 136, 0.5);
}

#particles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.particle {
  position: absolute;
  width: 6px;
  height: 6px;
  background: linear-gradient(135deg, rgba(0, 204, 136, 0.6) 0%, rgba(0, 170, 255, 0.4) 100%);
  border-radius: 50%;
  animation: particleFloat 20s linear infinite;
  box-shadow: 0 0 10px rgba(0, 204, 136, 0.3);
}

@keyframes particleFloat {
  0% {
    transform: translateY(100vh) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    transform: translateY(-100px) rotate(360deg);
    opacity: 0;
  }
}
