:root {
  --primary-color: #3b82f6;
  --primary-hover: #2563eb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-800: #1f2937;
  --blue-100: #dbeafe;
  --red-500: #ef4444;
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

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

body {
  font-family: system-ui, -apple-system, sans-serif;
}

.vcontainer {
  display: flex;
  background-color: var(--gray-100);
}

.main-section {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  padding: 2rem;
}

.video-container {
  position: relative;
  width: 480px;
  height: 360px;
  background-color: black;
  border-radius: 0.5rem;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.video-container video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-container {
  width: 480px;
  height: 360px;
  background-color: white;
  border-radius: 0.5rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar-wrapper {
  position: relative;
}

.avatar-pulse {
  position: absolute;
  inset: 0;
}

.avatar-pulse::before,
.avatar-pulse::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  border: 4px solid var(--primary-color);
  animation: ping 2s ease-out infinite;
  opacity: 0.5;
}

.avatar-pulse::before {
  inset: 0;
  animation-duration: 1.5s;
}

.avatar-pulse::after {
  inset: -15px;
  border-color: rgba(59, 130, 246, 0.3);
}

@keyframes ping {
  75%, 100% {
    transform: scale(2);
    opacity: 0;
  }
}

.avatar-image {
  width: 32rem;
  height: 32rem;
  border-radius: 50%;
  object-fit: cover;
}

.status-indicator {
  position: absolute;
  bottom: 1rem;
  right: 1rem;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background-color: var(--gray-400);
}

.status-indicator.active {
  background-color: #22c55e;
}

.chat-sidebar {
  position: fixed;
  right: 0;
  top: 0;
  height: 100%;
  width: 36rem;
  background-color: white;
  box-shadow: var(--shadow-lg);
  transform: translateX(100%);
  transition: transform 0.3s ease;
}

.chat-sidebar.open {
  transform: translateX(0);
}

.chat-content {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.chat-header {
  padding: 1rem;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--gray-800);
}

.close-button {
  padding: 0.5rem;
  border-radius: 50%;
  border: none;
  background: none;
  cursor: pointer;
}

.close-button:hover {
  background-color: var(--gray-100);
}

.vmessages-container {
  flex: 1;
  overflow-y: auto;
  padding: 3rem;
}

.message {
  padding: 0.75rem;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
}

.message.ai {
  background-color: var(--blue-100);
  margin-left: 1rem;
}

.message.user {
  background-color: var(--gray-100);
  margin-right: 1rem;
}

.message-text {
  font-size: 0.875rem;
}

.message-time {
  font-size: 0.75rem;
  color: var(--gray-500);
  margin-top: 0.25rem;
}

.input-container {
  padding: 1rem;
  border-top: 1px solid var(--gray-200);
}

.input-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  display:none;
}

.mic-button {
  padding: 0.5rem;
  border-radius: 50%;
  border: none;
  background-color: var(--gray-200);
  cursor: pointer;
}

.mic-button.active {
  background-color: var(--red-500);
  color: white;
}

.text-input {
  flex: 1;
  padding: 0.5rem;
  border: 1px solid var(--gray-200);
  border-radius: 0.5rem;
  font-size: 0.875rem;
}

.send-button {
  padding: 0.5rem 1rem;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: background-color 0.2s;
}

.send-button:hover {
  background-color: var(--primary-hover);
}

.open-chat-button {
  
  bottom: 2rem;
  right: 2rem;
  padding: 1rem;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  transition: background-color 0.2s;
}

.open-chat-button:hover {
  background-color: var(--primary-hover);
}

.open-chat-button.hidden {
  display: none;
}

.hidden {
  display: none;
}


  .status { text-align:center; margin: 12px 0; padding: 12px; border-radius:10px; font-weight:700; }
  .connected{ background: rgba(144,238,144,.3); color: #636363; }
  .disconnected{ background: rgba(255,182,193,.3); color: #e8bdbd; }
  .recording{ background: rgba(255,193,7,.3); animation: pulse 1.5s infinite; color: #636363; }
  @keyframes pulse{0%{opacity:1}50%{opacity:.75}100%{opacity:1}}
  .controls{ display:flex; justify-content:center; gap:12px; margin:16px 0; }
  #chat_video button{ padding:12px 20px; font-weight:700; border:none; border-radius:999px; cursor:pointer; }
  .connect-btn{ background: linear-gradient(45deg,#E6FFE6,#D4F4D4); color:#4CAF50;}
  .disconnect-btn{ background: linear-gradient(45deg,#FFE6E6,#FFD4D4); color:#f44336}
  #chat_video button:disabled{ opacity:.6; cursor:not-allowed;}
  .conversation{ background: rgba(255,255,255,.3); border-radius:12px; padding:14px; max-height: 380px; overflow:auto; }
  .message{ margin:8px 0; padding:10px 12px; border-radius:10px; }
  .message.system{ background: rgba(200,200,200,.4); border-left:4px solid #c8c8c8; font-style: italic; color: #636363;}
  .message.user{ background: rgba(184, 248, 177, 0.4); border-left:4px solid #a0a0a0; color: #636363;}
  .message.assistant{ background: rgba(187, 196, 248, 0.4); border-left:4px solid #808080; color: #636363;}
  .message.stats{ background: rgba(248, 220, 187, 0.4); border-left:4px solid #808080; color: #636363;}
  .message.size-1{ font-size: 12px; }
  .message.size-0{ font-size: 8px; margin-left: 50px; }
  .error{ background: rgba(255,182,193,.4); color:#636363; padding:12px; border-radius:8px; }
  .audio-visualizer{ display:flex; justify-content:center; align-items:end; height:50px; gap:4px; margin:8px 0 16px;}
  .bar{ width:4px; height:4px; background:#4CAF50; border-radius:2px; transition:height .09s linear;}
  .hidden{ display:none; }
  .token-form{ margin: 16px 0; text-align: center; text-align: center; display: flex; flex-direction: column; align-items: center;} 
  .token-input{ width: 60%; max-width: 400px; padding: 12px 16px; border: 2px solid rgba(200,200,200,.5); border-radius: 8px; background: rgba(255,255,255,.8); color: #636363; font-size: 14px; }
  .token-input::placeholder{ color: rgba(0,0,0,.5); }
  .token-input:focus{ outline: none; border-color: #90EE90; background: rgba(255,255,255,.9); }
  .instructions-input{ width: 60%; max-width: 400px; padding: 12px 16px; border: 2px solid rgba(200,200,200,.5); border-radius: 8px; background: rgba(255,255,255,.8); color: #636363; font-size: 14px; margin-top: 8px; }
  .instructions-input::placeholder{ color: rgba(0,0,0,.5); }
  .instructions-input:focus{ outline: none; border-color: #90EE90; background: rgba(255,255,255,.9); }
  .voice-select{ width: 60%; max-width: 400px; padding: 12px 16px; border: 2px solid rgba(200,200,200,.5); border-radius: 8px; background: rgba(255,255,255,.8); color: #636363; font-size: 14px; margin-top: 8px; cursor: pointer; }
  .voice-select:focus{ outline: none; border-color: #90EE90; background: rgba(255,255,255,.9); }
  .token-counts-header{ background: rgba(255,255,255,.6); border-radius: 12px; padding: 16px; margin: 16px 0; display: flex; justify-content: space-around; flex-wrap: wrap; gap: 12px; }
  .token-count-item{ display: flex; flex-direction: column; align-items: center; min-width: 120px; }
  .token-label{ font-size: 12px; color: #888; font-weight: 600; margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.5px; }
  .token-value{ font-size: 18px; font-weight: 700; color: #4CAF50; }