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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.container {
    text-align: center;
    max-width: 720px;
    width: 92%;
}

.logo {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #e94560;
}

.subtitle {
    font-size: 1.1rem;
    color: #a0a0b0;
    margin-bottom: 2rem;
}

.card {
    background: rgba(255,255,255,0.08);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 2.5rem;
    border: 1px solid rgba(255,255,255,0.1);
}

.status {
    font-size: 1rem;
    margin-bottom: 1.5rem;
    color: #a0a0b0;
    min-height: 1.5rem;
}

.status.connected { color: #4ade80; }
.status.error { color: #f87171; }

/* Avatar selector */
.agent-select-wrapper {
    margin-bottom: 1.5rem;
}

.agent-select-wrapper label {
    display: block;
    margin-bottom: 0.5rem;
    color: #a0a0b0;
    font-size: 0.9rem;
}

#agentSelect {
    padding: 0.5rem 1rem;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.1);
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
    text-align: center;
}

#agentSelect option { color: #000; }

#voiceSelect {
    padding: 0.5rem 1rem;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.1);
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
    text-align: center;
}

#voiceSelect option { color: #000; }

#userGenderSelect {
    padding: 0.5rem 1rem;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.1);
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
    text-align: center;
}

#userGenderSelect option { color: #000; }

#languageSelect {
    padding: 0.5rem 1rem;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.1);
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
    text-align: center;
}

#languageSelect option { color: #000; }

.emotion-mode-wrapper {
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: #a0a0b0;
    font-size: 0.95rem;
}

.emotion-mode-wrapper input {
    width: 18px;
    height: 18px;
    accent-color: #4ade80;
}

.emotion-control {
    display: none;
    margin-bottom: 1.5rem;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.emotion-control.active { display: flex; }

.emotion-control-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

#emotionSelect {
    padding: 0.5rem 1rem;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.1);
    color: #fff;
    font-size: 0.95rem;
    cursor: pointer;
    text-align: center;
}

#emotionSelect option { color: #000; }

/* Level slider */
.level-control {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    background: rgba(255,255,255,0.05);
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.1);
}

.level-control label {
    color: #a0a0b0;
    font-size: 0.85rem;
    white-space: nowrap;
}

#levelSlider {
    width: 120px;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(to right, rgba(74,222,128,0.3), rgba(74,222,128,0.8));
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

#levelSlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, #4ade80, #22c55e);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    transition: transform 0.15s ease;
}

#levelSlider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

#levelSlider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, #4ade80, #22c55e);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.level-value {
    min-width: 36px;
    text-align: center;
    color: #4ade80;
    font-weight: 600;
    font-size: 0.9rem;
}

.level-labels {
    display: flex;
    justify-content: space-between;
    width: 120px;
    margin-top: 2px;
}

.level-labels span {
    font-size: 0.65rem;
    color: #666;
}

/* Video avatar */
.avatar-container {
    display: none;
    margin-bottom: 1.5rem;
}

.avatar-container.active {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.avatar-loading {
    width: min(82vmin, 540px);
    aspect-ratio: 1 / 1;
    border-radius: 18px;
    background: radial-gradient(circle at 50% 45%, rgba(74,222,128,0.18), rgba(0,0,0,0.65) 60%);
    border: 1px solid rgba(255,255,255,0.16);
    display: none;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.avatar-loading.active { display: flex; }

.signal-bar {
    width: 8px;
    height: 16px;
    border-radius: 4px;
    background: linear-gradient(180deg, #4ade80, #22c55e);
    opacity: 0.8;
    animation: signal 1.1s infinite ease-in-out;
}

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

@keyframes signal {
    0%, 100% { transform: scaleY(0.6); opacity: 0.5; }
    50% { transform: scaleY(1.6); opacity: 1; }
}

#srs_video_element {
    width: min(82vmin, 540px);
    aspect-ratio: 1 / 1;
    height: auto;
    border-radius: 18px;
    background: #000;
    object-fit: cover;
    display: none;
}

#srs_video_element.active { display: block; }

.btn {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 8px;
}

.btn-connect {
    background: linear-gradient(135deg, #4ade80, #22c55e);
    color: #fff;
    box-shadow: 0 0 30px rgba(74,222,128,0.3);
}

.btn-connect:hover {
    transform: scale(1.05);
    box-shadow: 0 0 40px rgba(74,222,128,0.5);
}

.btn-disconnect {
    background: linear-gradient(135deg, #f87171, #ef4444);
    color: #fff;
    box-shadow: 0 0 30px rgba(248,113,113,0.3);
}

.btn-disconnect:hover {
    transform: scale(1.05);
    box-shadow: 0 0 40px rgba(248,113,113,0.5);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.btn-ending {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #fff;
    box-shadow: 0 0 30px rgba(251,191,36,0.3);
}

/* Tap to talk button */
.btn-talk {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.15s ease;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 6px;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: #fff;
    box-shadow: 0 0 20px rgba(99,102,241,0.3);
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

.btn-talk.active {
    display: inline-flex;
}

.btn-talk:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(99,102,241,0.5);
}

.btn-talk.talking {
    background: linear-gradient(135deg, #4ade80, #22c55e);
    box-shadow: 0 0 40px rgba(74,222,128,0.6);
    transform: scale(1.1);
}

.btn-talk .btn-icon {
    font-size: 2rem;
}

.btn-icon {
    font-size: 2.5rem;
}

.visualizer {
    display: none;
    margin-top: 1.5rem;
    height: 60px;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.visualizer.active { display: flex; }

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

/* Prompt textarea */
.prompt-wrapper {
    margin-bottom: 1.5rem;
}

.prompt-wrapper label {
    display: block;
    margin-bottom: 0.5rem;
    color: #a0a0b0;
    font-size: 0.9rem;
}

.prompt-textarea {
    width: 100%;
    min-height: 100px;
    padding: 0.75rem;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.1);
    color: #fff;
    font-size: 0.85rem;
    font-family: inherit;
    resize: vertical;
}

.prompt-textarea::placeholder {
    color: rgba(255,255,255,0.4);
}

.prompt-hint {
    font-size: 0.75rem;
    color: #666;
    margin-top: 0.3rem;
}

/* Emotion badge */
.emotion-badge {
    display: none;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 999px;
    padding: 6px 16px;
    font-size: 0.9rem;
    color: #e2e8f0;
    transition: all 0.3s ease;
}

.emotion-badge.active { display: inline-flex; }

.emotion-badge .emotion-emoji { 
    font-size: 1.3rem;
    transition: transform 0.3s ease;
}

.emotion-badge .emotion-label { font-size: 0.8rem; color: #a0a0b0; }

.emotion-badge .level-bar {
    width: 40px;
    height: 6px;
    background: rgba(255,255,255,0.15);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.emotion-badge .level-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #4ade80, #22c55e);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.emotion-badge .level-percent {
    font-size: 0.7rem;
    color: #4ade80;
    font-weight: 600;
    min-width: 28px;
}

/* Call buttons row */
.call-buttons {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
}
