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

:root {
  --primary-color: #6366f1;
  --primary-hover: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.3);
  --secondary-color: #64748b;
  --success-color: #22c55e;
  --success-glow: rgba(34, 197, 94, 0.3);
  --danger-color: #ef4444;
  --bg-color: #0a0a0f;
  --bg-secondary: #12121a;
  --card-bg: #16161f;
  --card-hover: #1c1c28;
  --text-color: #f8fafc;
  --text-muted: #94a3b8;
  --border-color: #2a2a3a;
  --border-glow: #3a3a4a;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg-color);
  background-image:
    radial-gradient(ellipse at top, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at bottom, rgba(34, 197, 94, 0.05) 0%, transparent 50%);
  color: var(--text-color);
  min-height: 100vh;
  line-height: 1.6;
}

.container {
  max-width: 1300px;
  margin: 0 auto;
  padding: 15px 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* 状态栏 - 更紧凑 */
.status-bar {
  display: flex;
  justify-content: center;
  gap: 25px;
  padding: 10px 20px;
  background: var(--card-bg);
  border-radius: 50px;
  margin-bottom: 15px;
  flex-wrap: wrap;
  border: 1px solid var(--border-color);
  backdrop-filter: blur(10px);
}

.status-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.status-value {
  color: var(--text-color);
  font-weight: 500;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger-color);
  box-shadow: 0 0 8px var(--danger-color);
}

.status-dot.connected {
  background: var(--success-color);
  box-shadow: 0 0 8px var(--success-color);
}

/* 主内容区 */
.main-content {
  display: flex;
  flex-direction: column;
  gap: 15px;
  flex: 1;
  min-height: 0;
}

/* 视频区域 */
.video-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

@media (max-width: 768px) {
  .video-section {
    grid-template-columns: 1fr;
  }
}

/* 视频面板 */
.video-panel {
  background: var(--card-bg);
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
}

.video-panel:hover {
  border-color: var(--border-glow);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.video-panel.interviewer-panel {
  border-color: rgba(99, 102, 241, 0.3);
}

.video-panel.interviewer-panel:hover {
  border-color: var(--primary-color);
  box-shadow: 0 0 30px var(--primary-glow);
}

.video-panel.ai-panel {
  border-color: rgba(34, 197, 94, 0.3);
}

.video-panel.ai-panel:hover {
  border-color: var(--success-color);
  box-shadow: 0 0 30px var(--success-glow);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
}

.panel-title {
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.video-container {
  aspect-ratio: 4/3;
  position: relative;
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-color) 100%);
}

.panel-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: relative;
  z-index: 1;
}

.video-placeholder {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  background: linear-gradient(135deg, var(--card-bg) 0%, var(--bg-secondary) 100%);
}

.placeholder-icon {
  font-size: 48px;
  margin-bottom: 8px;
  opacity: 0.5;
}

.video-placeholder p {
  font-size: 0.85rem;
  opacity: 0.7;
}

/* 头像区域 */
.avatar-placeholder {
  text-align: center;
  color: var(--text-muted);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--card-bg) 0%, var(--bg-secondary) 100%);
}

.avatar-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
}

.avatar-icon {
  font-size: 48px;
  margin-bottom: 8px;
  opacity: 0.5;
}

.avatar-label {
  position: relative;
  z-index: 1;
  font-size: 0.85rem;
  opacity: 0.7;
}

/* 口型动画层 */
.mouth-overlay {
  position: absolute;
  bottom: 30%;
  left: 50%;
  transform: translateX(-50%);
  width: 30px;
  height: 10px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 50%;
  opacity: 0;
  transition: all 0.1s ease;
}

.avatar-placeholder.speaking .mouth-overlay {
  opacity: 1;
}

.avatar-placeholder.mouth-open .mouth-overlay {
  height: 20px;
  width: 25px;
  border-radius: 50%;
}

.avatar-placeholder.speaking .avatar-image {
  animation: subtle-movement 0.5s ease-in-out infinite;
}

@keyframes subtle-movement {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}

/* 状态标签 */
.avatar-status {
  font-size: 0.75rem;
  padding: 4px 12px;
  background: var(--bg-color);
  border-radius: 20px;
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

.avatar-status.speaking {
  color: var(--success-color);
  border-color: var(--success-color);
  background: rgba(34, 197, 94, 0.1);
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* 摄像头控制按钮 */
.camera-toggle-btn {
  padding: 6px 14px;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  background: var(--bg-color);
  color: var(--text-color);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
}

.camera-toggle-btn:hover {
  border-color: var(--primary-color);
  background: rgba(99, 102, 241, 0.1);
}

.camera-toggle-btn.active {
  background: var(--danger-color);
  border-color: var(--danger-color);
}

/* 直播状态指示 */
.panel-title.live::after {
  content: ' 🔴';
  animation: pulse 1.5s ease-in-out infinite;
}

/* 对话区域 */
.chat-section {
  display: flex;
  flex-direction: column;
  background: var(--card-bg);
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  flex: 1;
  min-height: 200px;
}

.chat-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 150px;
  max-height: 350px;
}

.message {
  padding: 12px 16px;
  border-radius: 16px;
  max-width: 85%;
  word-wrap: break-word;
  overflow-wrap: break-word;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.message p {
  white-space: pre-wrap;
  word-wrap: break-word;
}

.message code {
  background: rgba(0, 0, 0, 0.4);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 0.9em;
}

.message pre {
  background: rgba(0, 0, 0, 0.5);
  padding: 12px;
  border-radius: 10px;
  overflow-x: auto;
  margin: 8px 0;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.message pre code {
  background: none;
  padding: 0;
  font-size: 0.85em;
  line-height: 1.5;
}

.system-message {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(99, 102, 241, 0.05) 100%);
  align-self: center;
  text-align: center;
  max-width: 100%;
  font-size: 0.9rem;
  border: 1px solid rgba(99, 102, 241, 0.2);
}

.system-message.welcome {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2) 0%, rgba(34, 197, 94, 0.1) 100%);
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.system-message .hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.question-message {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 15px var(--primary-glow);
}

.answer-message {
  background: linear-gradient(135deg, #2d2d3a 0%, #252530 100%);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  border: 1px solid var(--border-color);
}

.message-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* 输入区域 */
.input-section {
  padding: 12px 16px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-secondary);
}

.input-wrapper {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

#questionInput {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  background: var(--bg-color);
  color: var(--text-color);
  font-size: 0.95rem;
  resize: none;
  transition: all 0.2s;
}

#questionInput:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.mic-btn {
  width: 48px;
  height: 48px;
  border: 1px solid var(--border-color);
  border-radius: 50%;
  background: var(--bg-color);
  font-size: 1.3rem;
  cursor: pointer;
  transition: all 0.2s;
}

.mic-btn:hover {
  border-color: var(--primary-color);
  background: rgba(99, 102, 241, 0.1);
}

.mic-btn.recording {
  background: var(--danger-color);
  border-color: var(--danger-color);
  animation: pulse 1s ease-in-out infinite;
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.5);
}

.send-btn {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
  color: white;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.send-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--primary-glow);
}

.send-btn:active {
  transform: translateY(0);
}

/* 底部操作区 */
.actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 15px 0;
  flex-wrap: wrap;
}

.action-btn {
  padding: 14px 32px;
  border: none;
  border-radius: 50px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}

.action-btn.primary {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
  color: white;
  box-shadow: 0 4px 15px var(--primary-glow);
}

.action-btn.primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px var(--primary-glow);
}

.action-btn.secondary {
  background: var(--card-bg);
  color: var(--text-color);
  border: 1px solid var(--border-color);
}

.action-btn.secondary:hover {
  border-color: var(--primary-color);
  background: rgba(99, 102, 241, 0.1);
}

.action-btn.danger {
  background: linear-gradient(135deg, var(--danger-color) 0%, #dc2626 100%);
  color: white;
}

.action-btn.danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}

/* 底部信息区（状态栏 + 标题） */
.footer-section {
  margin-top: auto;
  padding-top: 15px;
}

.footer-section .status-bar {
  margin-bottom: 10px;
}

/* 底部标题信息 */
.footer-info {
  text-align: center;
  padding: 15px 0 5px;
  border-top: 1px solid var(--border-color);
}

.footer-info h2 {
  font-size: 1.1rem;
  font-weight: 600;
  background: linear-gradient(135deg, var(--primary-color), var(--success-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 4px;
}

.footer-info p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* 排队提示 */
.queue-notice {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--card-bg);
  padding: 20px 30px;
  border-radius: 20px;
  text-align: center;
  box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border-color);
  z-index: 100;
  backdrop-filter: blur(10px);
}

.queue-notice p {
  margin-bottom: 10px;
}

#queuePosition {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--primary-color);
}

/* 滚动条样式 */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--secondary-color);
}

/* 加载动画 */
.loading-dots {
  display: inline-flex;
  gap: 4px;
}

.loading-dots span {
  width: 8px;
  height: 8px;
  background: var(--primary-color);
  border-radius: 50%;
  animation: bounce 1.4s infinite ease-in-out both;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }

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

/* 思考中动画 */
.thinking-indicator {
  display: flex;
  gap: 6px;
  padding: 10px 0;
}

.thinking-dot {
  width: 10px;
  height: 10px;
  background: var(--primary-color);
  border-radius: 50%;
  animation: thinking-bounce 1.4s infinite ease-in-out both;
}

.thinking-dot:nth-child(1) { animation-delay: -0.32s; }
.thinking-dot:nth-child(2) { animation-delay: -0.16s; }
.thinking-dot:nth-child(3) { animation-delay: 0s; }

@keyframes thinking-bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

.avatar-status.thinking {
  color: var(--primary-color);
  animation: pulse 1.5s ease-in-out infinite;
}

/* 流式输出动画 */
.answer-message.streaming::after {
  content: '▊';
  animation: blink 0.8s infinite;
  margin-left: 2px;
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}
