:root {
    --glow-1: rgba(59, 130, 246, 0.6);
    --glow-2: rgba(147, 51, 234, 0.6);
    --glow-3: rgba(236, 72, 153, 0.6);
    --bg-dark: #000000;
    
    /* Modernere Gradients für Bubbles */
    --msg-user-bg: linear-gradient(135deg, #4f46e5 0%, #9333ea 100%);
    --msg-ai-bg: rgba(20, 20, 25, 0.6);
    --glass-border: rgba(255, 255, 255, 0.08);
}

body {
    margin: 0;
    background-color: var(--bg-dark);
    color: #f0f0f0;
    font-family: 'Nunito', sans-serif;
    overflow: hidden;
    height: 100vh;
    height: 100dvh; /* Mobile Fix */
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;
}

/* --- Hintergrund Animation (Aurora) --- */
.aurora-bg {
    position: fixed; inset: 0; z-index: -1;
    background: radial-gradient(circle at center, #111 0%, #000 100%);
}

.aurora-blob {
    position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.45;
    mix-blend-mode: screen;
    transition: background-color 3s ease-in-out; /* Smooth Color Change */
    animation: floatBlob 25s infinite ease-in-out alternate;
}

.blob-1 { width: 70vw; height: 70vw; background: var(--glow-1); top: -10%; left: -10%; }
.blob-2 { width: 80vw; height: 80vw; background: var(--glow-2); bottom: -10%; right: -10%; animation-delay: -5s; }
.blob-3 { width: 60vw; height: 60vw; background: var(--glow-3); top: 30%; left: 20%; animation-delay: -10s; }

@keyframes floatBlob {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(5%, 10%) scale(1.1); }
}

/* --- LOADING SCREEN (Wiederhergestellt) --- */
.loading-orb {
    width: 80px; height: 80px; border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.8), rgba(255,255,255,0.1));
    box-shadow: 0 0 30px var(--glow-1), 0 0 60px var(--glow-2);
    filter: blur(1px); 
    animation: pulseOrb 2s infinite ease-in-out;
    margin-bottom: 2rem;
}
@keyframes pulseOrb {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.2); opacity: 1; box-shadow: 0 0 50px var(--glow-1), 0 0 90px var(--glow-3); }
}

/* --- Container & Layout --- */
#app-container {
    width: 100%; height: 100%;
    display: flex; justify-content: center; align-items: flex-end; /* Mobile Bottom Focus */
}

@media (min-width: 768px) {
    #app-container { align-items: center; padding: 20px; }
}

.glass-panel {
    width: 100%; height: 100%;
    display: flex; flex-direction: column;
    background: rgba(10, 10, 10, 0.4);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    position: relative;
}

@media (min-width: 768px) {
    .glass-panel {
        max-width: 900px; height: 90vh;
        border-radius: 24px;
        border: 1px solid var(--glass-border);
        box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5);
    }
}

/* --- Header --- */
.chat-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--glass-border);
    background: rgba(0,0,0,0.2);
    display: flex; justify-content: space-between; align-items: center;
    backdrop-filter: blur(10px);
}

/* --- Chat Area --- */
#chat-box {
    flex: 1; overflow-y: auto;
    padding: 20px;
    display: flex; flex-direction: column; gap: 20px;
    scroll-behavior: smooth;
}

/* Message Rows */
.message-row {
    display: flex; align-items: flex-end; gap: 12px;
    opacity: 0; animation: slideUp 0.4s ease forwards;
    max-width: 100%;
}
.row-user { justify-content: flex-end; }
.row-ai { justify-content: flex-start; }

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

/* Avatars */
.avatar {
    width: 32px; height: 32px; border-radius: 50%;
    box-shadow: 0 0 10px var(--glow-1);
    border: 1px solid rgba(255,255,255,0.2);
    object-fit: cover;
}

/* Bubbles */
.bubble {
    padding: 14px 18px;
    font-size: 1rem; line-height: 1.5;
    position: relative;
    max-width: 85%;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    user-select: text; -webkit-user-select: text;
}

.bubble-user {
    background: var(--msg-user-bg);
    color: white;
    border-radius: 20px 20px 4px 20px;
}

.bubble-ai {
    background: var(--msg-ai-bg);
    color: #eee;
    border-radius: 20px 20px 20px 4px;
    border: 1px solid var(--glass-border);
}

/* --- Word Animation (Fast & Bouncy) --- */
.word-span {
    display: inline-block; opacity: 0;
    margin-right: 4px;
    animation: bounceIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes bounceIn {
    0% { opacity: 0; transform: translateY(8px) scale(0.8); filter: blur(4px); }
    100% { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

/* --- Thinking Animation (Cosmic Ring) --- */
.thinking-container {
    padding: 10px 15px;
    display: flex; align-items: center; gap: 10px;
    background: rgba(255,255,255,0.03);
    border-radius: 20px;
    border: 1px solid var(--glass-border);
}

.cosmic-loader {
    width: 20px; height: 20px;
    border-radius: 50%;
    position: relative;
    background: conic-gradient(from 0deg, transparent, var(--glow-2), var(--glow-1));
    animation: spin 1s linear infinite;
    filter: blur(4px);
}
.cosmic-loader::after { content: ''; position: absolute; inset: 3px; background: #000; border-radius: 50%; }

.thinking-text { font-size: 0.8rem; color: #aaa; letter-spacing: 1px; animation: pulseText 1.5s infinite; }

@keyframes spin { 100% { transform: rotate(360deg); } }
@keyframes pulseText { 50% { opacity: 0.5; } }

/* --- Input Area --- */
.input-area {
    padding: 15px 20px;
    background: rgba(0,0,0,0.3);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--glass-border);
    padding-bottom: max(15px, env(safe-area-inset-bottom));
}

.input-wrapper {
    position: relative;
    background: rgba(255,255,255,0.05);
    border-radius: 25px;
    border: 1px solid var(--glass-border);
    transition: all 0.3s ease;
}

.input-wrapper:focus-within {
    border-color: var(--glow-2);
    box-shadow: 0 0 15px var(--glow-2);
    background: rgba(0,0,0,0.2);
}

#questionInput {
    width: 100%; background: transparent; border: none;
    padding: 14px 50px 14px 20px;
    color: white; font-size: 1rem;
    outline: none;
    user-select: text; -webkit-user-select: text;
}

#sendBtn {
    position: absolute; right: 5px; top: 50%; transform: translateY(-50%);
    width: 36px; height: 36px; border-radius: 50%;
    background: white; border: none; cursor: pointer;
    display: flex; justify-content: center; align-items: center;
    transition: transform 0.2s;
}
#sendBtn:active { transform: translateY(-50%) scale(0.9); }
#sendBtn:disabled { opacity: 0.5; cursor: default; }

/* 3D Entrance Animation für Screens */
.animate-entrance { animation: entrance3D 1.2s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; }
@keyframes entrance3D {
    0% { opacity: 0; transform: scale(0.95) translateY(30px); filter: blur(10px); }
    100% { opacity: 1; transform: scale(1) translateY(0); filter: blur(0); }
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 3px; }