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

:root {
    /* Updated color scheme to match landing page dark theme */
    --bg-primary: #000000;
    --bg-secondary: #0a0a0a;
    --bg-tertiary: #141414;
    --bg-card: rgba(255, 255, 255, 0.05);
    
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --text-tertiary: #71717a;
    
    /* Brand colors from landing page */
    --brand-blue: #3b82f6;
    --brand-purple: #8b5cf6;
    --brand-pink: #ec4899;
    --brand-cyan: #06b6d4;
    
    /* Gradients */
    --primary-gradient: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    --secondary-gradient: linear-gradient(135deg, #ec4899 0%, #8b5cf6 100%);
    --gradient-text: linear-gradient(135deg, #3b82f6 0%, #ec4899 50%, #8b5cf6 100%);
    --success-gradient: linear-gradient(135deg, #10B981 0%, #059669 100%);
    --danger-gradient: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
    
    --border-color: rgba(255, 255, 255, 0.1);
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.2);
    --shadow-glow: 0 0 40px rgba(59, 130, 246, 0.5);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    position: relative;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Background Animation - matching landing page */
.background-animation {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    z-index: 0;
    pointer-events: none;
}

.gradient-circle {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
    animation: float 20s infinite ease-in-out;
}

.circle-1 {
    width: 400px;
    height: 400px;
    background: var(--brand-blue);
    top: -200px;
    left: -100px;
    animation-delay: 0s;
}

.circle-2 {
    width: 300px;
    height: 300px;
    background: var(--brand-purple);
    top: 50%;
    right: -150px;
    animation-delay: 5s;
}

.circle-3 {
    width: 500px;
    height: 500px;
    background: var(--brand-pink);
    bottom: -250px;
    left: 30%;
    animation-delay: 10s;
}

@keyframes float {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    25% {
        transform: translate(30px, -30px) scale(1.1);
    }
    50% {
        transform: translate(-20px, 20px) scale(0.9);
    }
    75% {
        transform: translate(-30px, -10px) scale(1.05);
    }
}

.container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}

/* Header - dark theme */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
}

.header-left {
    flex: 1;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 20px;
    transition: all 0.3s ease;
}

.logo:hover {
    transform: translateX(-2px);
}

.logo svg {
    color: var(--brand-blue);
}

.header-center {
    flex: 1;
    display: flex;
    justify-content: center;
}

.session-timer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
}

.timer-icon svg {
    color: var(--text-secondary);
}

.header-right {
    flex: 1;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 16px;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-secondary);
    transition: all 0.3s ease;
}

.connection-status.connected .status-dot {
    background: #10B981;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.end-session-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--danger-gradient);
    color: white;
    border: none;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.end-session-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(239, 68, 68, 0.3);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 20px;
    overflow-y: auto;
    position: relative;
}

/* Avatar Section */
.avatar-section {
    text-align: center;
    margin-bottom: 40px;
    animation: fadeInUp 0.6s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.avatar-container {
    position: relative;
    margin-bottom: 24px;
    width: 160px;
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 200px;
    background: var(--primary-gradient);
    border-radius: 50%;
    filter: blur(40px);
    opacity: 0.3;
    animation: pulse 3s infinite ease-in-out;
    pointer-events: none;
}

.avatar-circle {
    width: 160px;
    height: 160px;
    background: var(--primary-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.3s ease;
    box-shadow: 0 10px 40px rgba(59, 130, 246, 0.3);
}

.avatar-circle.recording {
    animation: recordingPulse 1.5s infinite;
}

.avatar-circle.speaking .avatar-ring {
    opacity: 1;
}

.avatar-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: calc(100% + 40px);
    height: calc(100% + 40px);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.ring-animation {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 3px solid transparent;
    border-top-color: var(--brand-blue);
    border-radius: 50%;
    animation: rotate 1.5s linear infinite;
}

.avatar-icon svg {
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
}

.sound-waves {
    position: absolute;
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.avatar-circle.speaking ~ .sound-waves {
    opacity: 1;
}

.sound-waves span {
    width: 3px;
    height: 20px;
    background: var(--primary-gradient);
    border-radius: 3px;
    animation: wave 1.5s infinite ease-in-out;
}

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

@keyframes wave {
    0%, 100% { height: 20px; }
    50% { height: 40px; }
}

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

@keyframes pulse {
    0%, 100% { opacity: 0.3; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 0.5; transform: translate(-50%, -50%) scale(1.1); }
}

@keyframes recordingPulse {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    50% { box-shadow: 0 0 0 20px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.assistant-name {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
    background: var(--gradient-text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.assistant-status {
    font-size: 16px;
    color: var(--text-secondary);
}

/* Chat Section - dark theme */
.chat-section {
    width: 100%;
    max-width: 800px;
    flex: 1;
    background: var(--bg-tertiary);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

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

.messages-area {
    flex: 1;
    overflow-y: auto;
    padding-right: 10px;
}

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

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

.messages-area::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.messages-area::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.message {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    animation: fadeInUp 0.3s ease;
}

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

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

.ai-message .message-avatar {
    background: var(--primary-gradient);
}

.user-message .message-avatar {
    background: var(--secondary-gradient);
}

.message-avatar svg {
    width: 20px;
    height: 20px;
    color: white;
}

.message-content {
    max-width: 70%;
}

.message-text {
    padding: 14px 18px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.5;
    position: relative;
}

.ai-message .message-text {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-bottom-left-radius: 6px;
    color: var(--text-primary);
}

.user-message .message-text {
    background: var(--primary-gradient);
    color: white;
    border-bottom-right-radius: 6px;
}

.message.error .message-text {
    background: var(--danger-gradient);
    color: white;
}

.message.system .message-text {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    text-align: center;
    max-width: 100%;
}

/* Controls - dark theme */
.controls {
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-color);
}

.controls-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.talk-button {
    position: relative;
    width: 140px;
    height: 140px;
    border: none;
    border-radius: 50%;
    background: var(--primary-gradient);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 10px 40px rgba(59, 130, 246, 0.3);
    overflow: hidden;
}

.talk-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.talk-button:active:not(:disabled) {
    transform: translateY(0);
}

.talk-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.talk-button.recording {
    background: var(--danger-gradient);
    animation: recordingPulse 1.5s infinite;
}

.button-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.2) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.talk-button:hover .button-glow {
    opacity: 1;
}

.button-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    position: relative;
    z-index: 1;
}

.mic-icon {
    width: 32px;
    height: 32px;
}

.button-text {
    font-size: 14px;
    font-weight: 600;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeInUp 0.6s ease;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header {
        padding: 15px 20px;
    }
    
    .header-center {
        display: none;
    }
    
    .end-session-btn span {
        display: none;
    }
    
    .end-session-btn {
        padding: 10px;
    }
    
    .avatar-circle {
        width: 120px;
        height: 120px;
    }
    
    .assistant-name {
        font-size: 24px;
    }
    
    .talk-button {
        width: 100px;
        height: 100px;
    }
    
    .mic-icon {
        width: 28px;
        height: 28px;
    }
    
    .button-text {
        font-size: 12px;
    }
    
    .chat-section {
        margin: 0 10px 20px;
        padding: 16px;
    }
    
    .message-text {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 20px 10px;
    }
    
    .message-content {
        max-width: 85%;
    }
}

.controls-container {
    height: 2%;
}

/* Compact Message Feedback Styles */
.message.user-message {
    position: relative;
}

.message-feedback-toggle {
    position: absolute;
    bottom: -8px;
    right: 0;
    padding: 4px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}

.message-feedback-toggle:hover {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.3);
    color: var(--brand-blue);
}

.message-feedback-toggle svg {
    width: 14px;
    height: 14px;
}

/* Compact Feedback Panel */
.message-feedback {
    margin-top: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    animation: fadeInDown 0.3s ease;
}

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

.feedback-header-compact {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.feedback-score-compact {
    display: flex;
    align-items: center;
    gap: 12px;
}

.score-circle-compact {
    position: relative;
    width: 48px;
    height: 48px;
}

.score-circle-compact svg {
    transform: rotate(-90deg);
}

.score-text-compact {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 14px;
    font-weight: 600;
}

.score-label {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-bottom: 2px;
}

.score-value {
    font-size: 16px;
    font-weight: 600;
    background: var(--gradient-text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Compact Feedback Sections */
.feedback-sections-compact {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.feedback-section-compact {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 12px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.feedback-section-compact:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

.feedback-section-compact.active {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.3);
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.section-score {
    font-size: 14px;
    font-weight: 600;
}

.section-score.excellent { color: #10b981; }
.section-score.good { color: #3b82f6; }
.section-score.needs-work { color: #f59e0b; }

.section-details {
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-tertiary);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.feedback-section-compact.active .section-details {
    max-height: 200px;
}

/* Highlighted Text in Feedback */
.feedback-text-display {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
    font-size: 14px;
    line-height: 1.6;
}

.error-highlight {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    padding: 2px 4px;
    border-radius: 3px;
    cursor: pointer;
    position: relative;
}

.vocab-highlight {
    background: rgba(239, 68, 68, 0.2);
    color: #3b82f6;
    padding: 2px 4px;
    border-radius: 3px;
    cursor: pointer;
    position: relative;
}

.warning-highlight {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
    padding: 2px 4px;
    border-radius: 3px;
    cursor: pointer;
}

.success-highlight {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
    padding: 2px 4px;
    border-radius: 3px;
}

/* Tooltip for errors */
.error-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    margin-bottom: 4px;
}

.error-highlight:hover .error-tooltip {
    opacity: 1;
}

/* Quick Tips */
.feedback-tips {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.tips-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.tip-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 12px;
    color: var(--text-tertiary);
    margin-bottom: 6px;
}

.tip-icon {
    color: var(--brand-blue);
    flex-shrink: 0;
}

/* Responsive */
@media (max-width: 768px) {
    .feedback-sections-compact {
        grid-template-columns: 1fr;
    }
    
    .message-feedback {
        margin-left: -48px; /* Compensate for avatar space */
        margin-right: 0;
    }
}