:root {
    --bg-dark: #070913;
    --bg-card: rgba(18, 22, 43, 0.65);
    --bg-card-border: rgba(255, 255, 255, 0.08);
    --accent-cyan: #00f2fe;
    --accent-blue: #4facfe;
    --accent-violet: #8b5cf6;
    --accent-emerald: #10b981;
    --accent-rose: #f43f5e;
    --accent-amber: #f59e0b;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

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

body {
    min-height: 100vh;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-sans);
    overflow-x: hidden;
    position: relative;
    -webkit-font-smoothing: antialiased;
}

/* Ambient Background */
.app-background {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.ambient-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.35;
    animation: floatGlow 12s ease-in-out infinite alternate;
}

.glow-1 {
    width: 600px;
    height: 600px;
    top: -150px;
    left: 20%;
    background: radial-gradient(circle, #7c3aed 0%, #1e1b4b 60%, transparent 100%);
}

.glow-2 {
    width: 550px;
    height: 550px;
    bottom: -100px;
    right: 15%;
    background: radial-gradient(circle, #0284c7 0%, #082f49 60%, transparent 100%);
    animation-delay: -6s;
}

.ambient-grid {
    position: absolute;
    inset: 0;
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 40px 40px;
    mask-image: radial-gradient(ellipse at center, rgba(0,0,0,0.8) 0%, transparent 80%);
}

@keyframes floatGlow {
    0% { transform: translateY(0) scale(1); }
    100% { transform: translateY(40px) scale(1.08); }
}

/* App Container */
.app-container {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Topbar */
.topbar {
    height: 72px;
    padding: 0 36px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(7, 9, 19, 0.75);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--bg-card-border);
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-orb {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: linear-gradient(135deg, #00f2fe, #4facfe, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 20px rgba(0, 242, 254, 0.45);
    position: relative;
}

.brand-spark {
    width: 10px;
    height: 10px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 0 10px #fff;
}

.brand-title {
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 2px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.badge-version {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1px;
    padding: 2px 6px;
    border-radius: 6px;
    background: rgba(0, 242, 254, 0.15);
    color: var(--accent-cyan);
    border: 1px solid rgba(0, 242, 254, 0.3);
}

.brand-sub {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 1px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.telemetry-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 20px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.25);
    color: var(--accent-emerald);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    font-family: var(--font-mono);
}

.telemetry-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent-emerald);
    box-shadow: 0 0 8px var(--accent-emerald);
    animation: blink 2s infinite;
}

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

.icon-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--bg-card-border);
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    transform: translateY(-1px);
}

/* Main Viewport */
.main-viewport {
    width: min(840px, 94%);
    flex: 1;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 0 24px;
}

/* Voice Orb Section */
.orb-stage {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 10px 0 14px;
}

.sound-waves {
    position: absolute;
    width: 280px;
    height: 280px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -65%);
    pointer-events: none;
}

.wave {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 1px solid rgba(0, 242, 254, 0.2);
    opacity: 0;
}

/* Voice Orb Core */
.voice-orb {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    margin-bottom: 12px;
}

.orb-core {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #00f2fe 0%, #4facfe 35%, #7c3aed 75%, #180d38 100%);
    box-shadow: 
        0 0 40px rgba(0, 242, 254, 0.35),
        0 0 80px rgba(124, 58, 237, 0.25),
        inset 0 0 25px rgba(255, 255, 255, 0.4);
    animation: orbFloat 4s ease-in-out infinite alternate;
}

.orb-plasma {
    position: absolute;
    inset: 8px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, rgba(0, 242, 254, 0.7), rgba(124, 58, 237, 0.7), rgba(79, 172, 254, 0.7), rgba(0, 242, 254, 0.7));
    filter: blur(12px);
    opacity: 0.6;
    animation: plasmaRotate 8s linear infinite;
}

.orb-ring {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

.ring-primary {
    inset: -12px;
    border: 1.5px solid rgba(0, 242, 254, 0.3);
    border-top-color: rgba(255, 255, 255, 0.8);
    animation: ringSpin 5s linear infinite;
}

.ring-secondary {
    inset: -22px;
    border: 1px dashed rgba(139, 92, 246, 0.25);
    animation: ringSpin 9s linear infinite reverse;
}

@keyframes orbFloat {
    0% { transform: scale(0.97) translateY(2px); }
    100% { transform: scale(1.03) translateY(-3px); }
}

@keyframes plasmaRotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes ringSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Orb States */
.orb-stage.listening .orb-core {
    background: radial-gradient(circle at 35% 35%, #10b981 0%, #059669 40%, #0284c7 80%, #064e3b 100%);
    box-shadow: 0 0 55px rgba(16, 185, 129, 0.6), inset 0 0 25px rgba(255, 255, 255, 0.5);
    animation: pulseListen 1.2s ease-in-out infinite alternate;
}

.orb-stage.listening .wave-1 { animation: waveRipple 1.4s 0s infinite; border-color: rgba(16, 185, 129, 0.5); }
.orb-stage.listening .wave-2 { animation: waveRipple 1.4s 0.35s infinite; border-color: rgba(16, 185, 129, 0.35); }
.orb-stage.listening .wave-3 { animation: waveRipple 1.4s 0.7s infinite; border-color: rgba(16, 185, 129, 0.2); }

.orb-stage.thinking .orb-core {
    background: radial-gradient(circle at 35% 35%, #f59e0b 0%, #d97706 40%, #7c3aed 80%, #451a03 100%);
    box-shadow: 0 0 50px rgba(245, 158, 11, 0.6);
}
.orb-stage.thinking .ring-primary { animation-duration: 1.2s; border-color: rgba(245, 158, 11, 0.6); }

.orb-stage.speaking .orb-core {
    background: radial-gradient(circle at 35% 35%, #00f2fe 0%, #3b82f6 40%, #9333ea 80%, #1e1b4b 100%);
    box-shadow: 0 0 65px rgba(0, 242, 254, 0.75), inset 0 0 30px rgba(255, 255, 255, 0.6);
    animation: pulseSpeak 0.6s ease-in-out infinite alternate;
}

.orb-stage.speaking .wave-1 { animation: waveRipple 0.9s 0s infinite; border-color: rgba(0, 242, 254, 0.6); }
.orb-stage.speaking .wave-2 { animation: waveRipple 0.9s 0.25s infinite; border-color: rgba(59, 130, 246, 0.4); }
.orb-stage.speaking .wave-3 { animation: waveRipple 0.9s 0.5s infinite; border-color: rgba(147, 51, 234, 0.3); }

.orb-stage.stopped .orb-core {
    opacity: 0.6;
    background: radial-gradient(circle at 35% 35%, #f43f5e 0%, #be123c 50%, #111827 100%);
    box-shadow: 0 0 25px rgba(244, 63, 94, 0.4);
}

@keyframes pulseListen {
    0% { transform: scale(1.0); }
    100% { transform: scale(1.12); }
}

@keyframes pulseSpeak {
    0% { transform: scale(0.98); }
    100% { transform: scale(1.15); }
}

@keyframes waveRipple {
    0% { transform: scale(0.6); opacity: 0.8; }
    100% { transform: scale(1.5); opacity: 0; }
}

/* Status text */
.status-indicator {
    text-align: center;
    margin-bottom: 12px;
}

.status-badge {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 2.5px;
    background: rgba(0, 242, 254, 0.12);
    color: var(--accent-cyan);
    border: 1px solid rgba(0, 242, 254, 0.3);
    text-transform: uppercase;
}

.status-sub {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 6px;
    font-weight: 500;
}

/* Live Latency Telemetry HUD */
.latency-hud {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(16px);
    border-radius: 16px;
    padding: 8px 18px;
    margin-top: 4px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
}

.hud-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.hud-label {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 0.5px;
}

.hud-val {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
}

.hud-val.highlight {
    color: var(--accent-cyan);
    font-size: 13px;
    font-weight: 800;
}

.hud-val.fast {
    color: var(--accent-emerald);
}

.hud-divider {
    width: 1px;
    height: 24px;
    background: rgba(255, 255, 255, 0.08);
}

/* Audio Visualizer Canvas */
.visualizer-canvas {
    width: 340px;
    height: 34px;
    margin-top: 8px;
    opacity: 0.7;
}

/* Conversation Container */
.conversation-container {
    width: 100%;
    max-height: 230px;
    flex: 1;
    overflow-y: auto;
    padding: 12px 14px;
    background: var(--bg-card);
    border: 1px solid var(--bg-card-border);
    border-radius: 20px;
    backdrop-filter: blur(20px);
    margin: 12px 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.empty-state {
    margin: auto;
    text-align: center;
    padding: 24px 10px;
    color: var(--text-muted);
}

.empty-glow {
    font-size: 24px;
    color: var(--accent-cyan);
    margin-bottom: 8px;
    filter: drop-shadow(0 0 10px rgba(0, 242, 254, 0.5));
}

.empty-state h4 {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 600;
}

.empty-state p {
    font-size: 12px;
    margin-top: 4px;
}

/* Messages */
.message {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 13.5px;
    line-height: 1.5;
    animation: slideMessage 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}

.message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.25), rgba(79, 172, 254, 0.25));
    border: 1px solid rgba(124, 58, 237, 0.4);
    max-width: 85%;
    border-bottom-right-radius: 4px;
}

.message.ai {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.09);
    max-width: 90%;
    border-bottom-left-radius: 4px;
}

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

.message-sender {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1.5px;
    color: var(--accent-cyan);
}

.message.user .message-sender {
    color: #c084fc;
}

.message-latency {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--accent-emerald);
    background: rgba(16, 185, 129, 0.12);
    padding: 1px 6px;
    border-radius: 4px;
}

.message-text {
    word-break: break-word;
}

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

/* Controls Deck */
.controls-deck {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding-top: 4px;
}

.timer-pill {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-muted);
    letter-spacing: 1px;
}

.mic-cluster {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.mic-button {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00f2fe 0%, #4facfe 50%, #7c3aed 100%);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 35px rgba(0, 242, 254, 0.45);
    position: relative;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mic-button:hover {
    transform: scale(1.08);
    box-shadow: 0 0 50px rgba(0, 242, 254, 0.65);
}

.mic-pulse-ring {
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 2px solid var(--accent-cyan);
    opacity: 0;
}

.mic-button.active {
    background: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
    box-shadow: 0 0 45px rgba(16, 185, 129, 0.65);
}

.mic-button.active .mic-pulse-ring {
    animation: micPulse 1.4s ease-out infinite;
}

.mic-button.recording {
    background: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%);
    box-shadow: 0 0 45px rgba(244, 63, 94, 0.7);
}

@keyframes micPulse {
    0% { transform: scale(1); opacity: 0.9; }
    100% { transform: scale(1.4); opacity: 0; }
}

.mic-caption {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 2.5px;
    color: var(--text-muted);
}

.quick-actions {
    display: flex;
    gap: 8px;
    min-height: 28px;
}

.action-chip {
    background: rgba(244, 63, 94, 0.15);
    border: 1px solid rgba(244, 63, 94, 0.35);
    color: #fecdd3;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.action-chip:hover {
    background: rgba(244, 63, 94, 0.25);
}

/* Footer */
.app-footer {
    height: 44px;
    border-top: 1px solid var(--bg-card-border);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: rgba(7, 9, 19, 0.85);
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 1px;
}

.tech-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tech-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.tech-dot.groq { background: #f97316; box-shadow: 0 0 6px #f97316; }
.tech-dot.eleven { background: #a855f7; box-shadow: 0 0 6px #a855f7; }
.tech-dot.fast { background: #10b981; box-shadow: 0 0 6px #10b981; }

.tech-sep {
    color: rgba(255, 255, 255, 0.15);
}

@media (max-width: 680px) {
    .topbar { padding: 0 18px; }
    .telemetry-pill { display: none; }
    .latency-hud {
        gap: 6px;
        padding: 6px 12px;
    }
    .hud-label { font-size: 9px; }
    .hud-val { font-size: 11px; }
    .voice-orb { width: 115px; height: 115px; }
    .conversation-container { max-height: 180px; }
}