:root {
    --bg: #0b0d14;
    --surface: #141826;
    --surface-2: #1c2236;
    --ink: #e9ebf2;
    --ink-soft: #9299b0;
    --accent: #8b5cf6;
    --accent-2: #6366f1;
    --line: rgba(255, 255, 255, 0.08);
}

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

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg);
    color: var(--ink);
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.bg-orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(130px);
    opacity: 0.22;
    pointer-events: none;
}
.orb-1 { width: 480px; height: 480px; background: var(--accent); top: -160px; right: -100px; }
.orb-2 { width: 420px; height: 420px; background: #2563eb; bottom: -140px; left: -120px; }

/* Topbar */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 22px;
    border-bottom: 1px solid var(--line);
    background: rgba(11, 13, 20, 0.8);
    backdrop-filter: blur(14px);
    z-index: 10;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-icon {
    width: 42px; height: 42px;
    border-radius: 13px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.35);
}
.brand b { display: block; font-size: 0.98rem; }
.brand span { color: var(--ink-soft); font-size: 0.78rem; }
.back-link { color: var(--ink-soft); text-decoration: none; font-size: 0.88rem; }
.back-link:hover { color: var(--ink); }

/* Chat */
.chat-shell {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 780px;
    width: 100%;
    margin: 0 auto;
    padding: 0 18px 16px;
    min-height: 0;
    z-index: 1;
}
.chat-window {
    flex: 1;
    overflow-y: auto;
    padding: 26px 4px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    scroll-behavior: smooth;
}
.msg { display: flex; gap: 12px; max-width: 88%; animation: msgIn 0.3s ease; }
@keyframes msgIn { from { opacity: 0; transform: translateY(10px); } }
.msg.user { align-self: flex-end; flex-direction: row-reverse; }
.msg-avatar {
    width: 34px; height: 34px;
    border-radius: 11px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.msg.user .msg-avatar { background: var(--surface-2); }
.msg-bubble {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    border-top-left-radius: 6px;
    padding: 13px 17px;
    font-size: 0.94rem;
    line-height: 1.65;
    white-space: pre-wrap;
    word-break: break-word;
}
.msg.user .msg-bubble {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    border: none;
    border-radius: 16px;
    border-top-right-radius: 6px;
}
.msg-bubble.error { border-color: rgba(240, 106, 106, 0.4); color: #f0a0a0; }

/* Typing */
.typing { display: inline-flex; gap: 5px; padding: 4px 0; }
.typing i {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--ink-soft);
    animation: blink 1.2s infinite;
}
.typing i:nth-child(2) { animation-delay: 0.2s; }
.typing i:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 40% { opacity: 0.25; } }

/* Cursor beim Streamen */
.msg-bubble.streaming::after {
    content: '▍';
    color: var(--accent);
    animation: blink 1s infinite;
}

/* Vorschläge */
.suggestions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    padding-bottom: 12px;
}
.suggestions button {
    background: var(--surface);
    border: 1px solid var(--line);
    color: var(--ink-soft);
    font-family: inherit;
    font-size: 0.82rem;
    padding: 8px 16px;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.2s;
}
.suggestions button:hover { border-color: var(--accent); color: var(--ink); }

/* Composer */
.composer {
    display: flex;
    gap: 10px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 8px;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.composer:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.15);
}
.composer input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--ink);
    font-family: inherit;
    font-size: 0.95rem;
    padding: 8px 12px;
}
.composer button {
    width: 44px; height: 44px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.15s, opacity 0.2s;
    flex-shrink: 0;
}
.composer button:hover { transform: scale(1.06); }
.composer button:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.demo-note {
    text-align: center;
    color: var(--ink-soft);
    font-size: 0.74rem;
    padding-top: 10px;
}

/* Scrollbar */
.chat-window::-webkit-scrollbar { width: 8px; }
.chat-window::-webkit-scrollbar-thumb { background: var(--surface-2); border-radius: 4px; }

@media (max-width: 560px) {
    .msg { max-width: 100%; }
    .suggestions { overflow-x: auto; flex-wrap: nowrap; }
    .suggestions button { white-space: nowrap; }
}
