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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0f0f13;
    color: #e4e4e7;
    height: 100vh;
    overflow: hidden;
}

/* Layout */
.app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: #18181b;
    border-bottom: 1px solid #27272a;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
}

.logo span {
    color: #ef4444;
}

.badge {
    background: #27272a;
    color: #a1a1aa;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #71717a;
    display: inline-block;
    margin-right: 6px;
}

.status-dot.connected {
    background: #22c55e;
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.4);
}

/* Main Content */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Chat Area */
.chat-area {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-area::-webkit-scrollbar {
    width: 6px;
}

.chat-area::-webkit-scrollbar-track {
    background: transparent;
}

.chat-area::-webkit-scrollbar-thumb {
    background: #3f3f46;
    border-radius: 3px;
}

/* Messages */
.message {
    display: flex;
    gap: 12px;
    max-width: 80%;
    animation: fadeIn 0.3s ease;
}

.message.agent {
    align-self: flex-start;
}

.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.message.agent .message-avatar {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.message.user .message-avatar {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.message-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
}

.message.agent .message-bubble {
    background: #27272a;
    border-top-left-radius: 4px;
}

.message.user .message-bubble {
    background: #1d4ed8;
    border-top-right-radius: 4px;
}

/* Avatar Selection */
.avatar-select {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    text-align: center;
    gap: 16px;
    padding: 40px 20px;
}

.avatar-select h2 {
    font-size: 24px;
    font-weight: 600;
    color: #fff;
}

.avatar-select p {
    color: #a1a1aa;
    font-size: 14px;
}

.avatar-grid {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 12px;
}

.avatar-card {
    background: #1e1e23;
    border: 2px solid #3f3f46;
    border-radius: 16px;
    padding: 20px 16px;
    width: 130px;
    cursor: pointer;
    transition: all 0.25s;
    text-align: center;
}

.avatar-card:hover {
    border-color: #71717a;
    background: #27272a;
    transform: translateY(-2px);
}

.avatar-card.selected {
    border-color: #ef4444;
    background: #1a1a22;
    box-shadow: 0 0 16px rgba(239, 68, 68, 0.15);
}

.avatar-img {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin: 0 auto 10px;
}

.avatar-img.female {
    background: linear-gradient(135deg, #ec4899, #db2777);
}

.avatar-img.male {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.avatar-img.neutral {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}

.avatar-name {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 4px;
}

.avatar-desc {
    font-size: 12px;
    color: #a1a1aa;
}

.avatar-accent {
    font-size: 11px;
    color: #71717a;
    margin-top: 4px;
    background: #27272a;
    display: inline-block;
    padding: 2px 8px;
    border-radius: 8px;
}

/* Welcome Screen */
.welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    text-align: center;
    gap: 16px;
    padding: 40px;
}

.welcome-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    margin-bottom: 8px;
}

.welcome h2 {
    font-size: 24px;
    font-weight: 600;
    color: #fff;
}

.welcome p {
    color: #a1a1aa;
    font-size: 14px;
    max-width: 400px;
    line-height: 1.6;
}

.suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: 8px;
}

.suggestion-chip {
    background: #27272a;
    border: 1px solid #3f3f46;
    color: #d4d4d8;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.suggestion-chip:hover {
    background: #3f3f46;
    border-color: #52525b;
    color: #fff;
}

.suggestion-chip.demo-chip {
    background: linear-gradient(135deg, #1e3a5f, #172554);
    border-color: #2563eb;
    color: #93c5fd;
}

.suggestion-chip.demo-chip:hover {
    background: linear-gradient(135deg, #1e40af, #1d4ed8);
    border-color: #3b82f6;
    color: #fff;
}

/* Demo join link in chat bubbles */
.demo-link {
    display: inline-block;
    margin-top: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #fff;
    text-decoration: none;
    border-radius: 20px;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s;
}

.demo-link:hover {
    box-shadow: 0 0 16px rgba(34, 197, 94, 0.3);
    transform: translateY(-1px);
}

/* Audio Visualizer */
.visualizer-container {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 24px;
    min-height: 80px;
}

.visualizer {
    display: flex;
    align-items: center;
    gap: 3px;
    height: 50px;
}

.visualizer .bar {
    width: 4px;
    background: #ef4444;
    border-radius: 2px;
    transition: height 0.1s ease;
    height: 4px;
}

.visualizer.active .bar {
    animation: pulse 0.6s ease-in-out infinite alternate;
}

.visualizer .bar:nth-child(1) { animation-delay: 0s; }
.visualizer .bar:nth-child(2) { animation-delay: 0.1s; }
.visualizer .bar:nth-child(3) { animation-delay: 0.2s; }
.visualizer .bar:nth-child(4) { animation-delay: 0.3s; }
.visualizer .bar:nth-child(5) { animation-delay: 0.4s; }
.visualizer .bar:nth-child(6) { animation-delay: 0.3s; }
.visualizer .bar:nth-child(7) { animation-delay: 0.2s; }
.visualizer .bar:nth-child(8) { animation-delay: 0.1s; }
.visualizer .bar:nth-child(9) { animation-delay: 0s; }

@keyframes pulse {
    from { height: 4px; }
    to { height: 40px; }
}

/* Controls */
.controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 20px 24px;
    background: #18181b;
    border-top: 1px solid #27272a;
}

.control-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    transition: all 0.2s;
}

.control-btn:hover {
    transform: scale(1.05);
}

.control-btn:active {
    transform: scale(0.95);
}

.btn-connect {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #fff;
    width: 64px;
    height: 64px;
    font-size: 24px;
}

.btn-connect:hover {
    box-shadow: 0 0 20px rgba(34, 197, 94, 0.3);
}

.btn-connect.active {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.btn-connect.active:hover {
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.3);
}

.btn-mic {
    background: #27272a;
    color: #e4e4e7;
}

.btn-mic.muted {
    background: #7f1d1d;
    color: #fca5a5;
}

.btn-text {
    background: #27272a;
    color: #e4e4e7;
}

.btn-text.active {
    background: #1e3a5f;
    color: #93c5fd;
}

/* Text Input */
.text-input-area {
    display: none;
    padding: 12px 24px;
    background: #18181b;
}

.text-input-area.visible {
    display: flex;
    gap: 12px;
    align-items: center;
}

.text-input-area input {
    flex: 1;
    background: #27272a;
    border: 1px solid #3f3f46;
    color: #e4e4e7;
    padding: 12px 16px;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
}

.text-input-area input:focus {
    border-color: #ef4444;
}

.text-input-area input::placeholder {
    color: #71717a;
}

.send-btn {
    background: #ef4444;
    border: none;
    color: #fff;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.2s;
}

.send-btn:hover {
    background: #dc2626;
}

/* Agent State */
.agent-state {
    text-align: center;
    font-size: 13px;
    color: #71717a;
    padding: 4px;
}

.agent-state.listening {
    color: #22c55e;
}

.agent-state.thinking {
    color: #eab308;
}

.agent-state.speaking {
    color: #ef4444;
}

/* Loading dots */
.loading-dots {
    display: inline-flex;
    gap: 4px;
}

.loading-dots span {
    width: 6px;
    height: 6px;
    background: #71717a;
    border-radius: 50%;
    animation: loadingDot 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes loadingDot {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

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

/* Responsive */
@media (max-width: 640px) {
    .header { padding: 12px 16px; }
    .chat-area { padding: 16px; }
    .message { max-width: 90%; }
    .suggestions { flex-direction: column; align-items: center; }
    .avatar-card { width: 110px; padding: 14px 10px; }
    .avatar-grid { gap: 10px; }
}
