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

body {
    background: linear-gradient(160deg, #030712 0%, #0a1330 35%, #0d1b4d 65%, #071029 100%);
    color: #e2e8f0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    height: 100vh;
    height: 100dvh;
    width: 100vw;
    overflow: hidden;
    position: relative;
}

#stars-container {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 0;
    pointer-events: none;
}

.star {
    position: absolute;
    width: 2px;
    height: 2px;
    background: #ffffff;
    border-radius: 50%;
    animation: twinkle linear infinite;
}

@keyframes twinkle {
    0%, 100% { opacity: 0.1; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.6); box-shadow: 0 0 6px 1px rgba(147, 197, 253, 0.8); }
}

.app {
    position: relative;
    z-index: 1;
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    max-width: 780px;
    margin: 0 auto;
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: rgba(10, 15, 35, 0.4);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(96, 165, 250, 0.15);
}

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

.logo-ring {
    position: relative;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-ring::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, var(--logo-cor, #3b82f6), transparent 40%, var(--logo-cor, #3b82f6));
    animation: girar-anel 4s linear infinite;
    opacity: 0.8;
}

.header-logo-img {
    position: relative;
    z-index: 1;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 0 10px 2px var(--logo-cor, rgba(96, 165, 250, 0.7));
    animation: respirar-logo 3s infinite ease-in-out;
    transition: box-shadow 0.5s ease;
}

@keyframes girar-anel {
    to { transform: rotate(360deg); }
}

@keyframes respirar-logo {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

.logo-ring.idle       { --logo-cor: #3b82f6; }
.logo-ring.listening  { --logo-cor: #06b6d4; }
.logo-ring.thinking   { --logo-cor: #a855f7; }
.logo-ring.responding { --logo-cor: #f97316; }
.logo-ring.speaking   { --logo-cor: #22c55e; }

.logo-text {
    font-size: 17px;
    font-weight: 600;
    background: linear-gradient(90deg, #93c5fd, #c4b5fd);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    letter-spacing: 0.5px;
}

.header-right { display: flex; align-items: center; gap: 10px; }

.user-badge {
    font-size: 11px;
    color: #93c5fd;
    background: rgba(59, 130, 246, 0.15);
    padding: 4px 10px;
    border-radius: 12px;
    border: 1px solid rgba(96, 165, 250, 0.2);
}

.icon-btn {
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(96, 165, 250, 0.2);
    color: #93c5fd;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 15px;
    transition: background 0.2s;
}

.icon-btn:hover { background: rgba(59, 130, 246, 0.25); }

.chat-area {
    flex: 1;
    overflow-y: auto;
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.welcome-message {
    margin: auto;
    text-align: center;
    opacity: 0.85;
}

.welcome-title {
    font-size: 28px;
    font-weight: 600;
    background: linear-gradient(90deg, #93c5fd, #c4b5fd, #93c5fd);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 6px;
}

.welcome-subtitle {
    font-size: 15px;
    color: #64748b;
}

.message {
    max-width: 85%;
    padding: 14px 18px;
    border-radius: 16px;
    font-size: 19px;
    line-height: 1.65;
    animation: fadeIn 0.3s ease;
    word-wrap: break-word;
}

@media (max-width: 480px) {
    .message {
        font-size: 23px;
        line-height: 1.9;
        font-weight: 450;
    }
    .welcome-title {
        font-size: 26px;
    }
    .input-area input {
        font-size: 18px;
    }
}

.user-message {
    align-self: flex-end;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

.noach-message {
    align-self: flex-start;
    background: rgba(30, 41, 59, 0.65);
    backdrop-filter: blur(8px);
    color: #f8fafc;
    border: 1px solid rgba(96, 165, 250, 0.15);
    border-bottom-left-radius: 4px;
}

.typing-indicator {
    padding: 6px 20px;
    font-size: 12px;
    color: #93c5fd;
    font-style: italic;
    display: flex;
    align-items: center;
    gap: 8px;
}

.thinking-dots {
    display: inline-flex;
    gap: 4px;
}

.thinking-dots span {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #93c5fd;
    box-shadow: 0 0 6px 1px rgba(147, 197, 253, 0.8);
    animation: thinking-orbit 1.2s infinite ease-in-out;
}

.thinking-dots span:nth-child(2) { animation-delay: 0.15s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes thinking-orbit {
    0%, 100% { transform: translateY(0); opacity: 0.4; }
    50% { transform: translateY(-6px); opacity: 1; }
}

.hidden { display: none; }

.input-area {
    display: flex;
    align-items: center;
    padding: 14px 20px 50px 20px;
    gap: 10px;
    background: rgba(10, 15, 35, 0.4);
    backdrop-filter: blur(12px);
    border-top: 1px solid rgba(96, 165, 250, 0.15);
}

.input-area input {
    flex: 1;
    padding: 12px 16px;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(96, 165, 250, 0.2);
    border-radius: 24px;
    color: #ffffff;
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s;
}

.input-area input:focus { border-color: #60a5fa; }

.send-btn {
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    flex-shrink: 0;
    transition: transform 0.15s;
}

.send-btn:hover { transform: scale(1.08); }

.mic-btn.listening {
    background: rgba(239, 68, 68, 0.25);
    border-color: rgba(239, 68, 68, 0.5);
    color: #f87171;
    animation: pulse-logo 1.2s infinite ease-in-out;
}

.brand-footer {
    text-align: center;
    font-size: 10px;
    color: #94a3b8;
    padding: 4px 0 8px 0;
    letter-spacing: 1px;
    text-shadow: 0 0 10px rgba(96, 165, 250, 0.45);
    flex-shrink: 0;
}

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