:root {
    --bg-deep: #fbfbfa;
    --bg-surface: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.9);
    --bg-elevated: rgba(255, 255, 255, 0.98);
    --bg-hover: rgba(212, 168, 75, 0.05);
    --border: rgba(212, 168, 75, 0.22);
    --border-active: rgba(212, 168, 75, 0.6);
    --gold: #b3862b;
    --gold-dim: rgba(179, 134, 43, 0.7);
    --gold-muted: rgba(179, 134, 43, 0.15);
    --gold-glow: 0 4px 20px rgba(179, 134, 43, 0.05);
    --text: #2c2520;
    --text-dim: #5c524a;
    --text-muted: rgba(92, 82, 74, 0.4);
    --font-serif: 'Cormorant Garamond', serif;
    --font-sans: 'Poppins', 'Inter', system-ui, -apple-system, sans-serif;
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 16px;
    --radius-xl: 22px;
    --transition: 0.5s cubic-bezier(0.22, 1, 0.36, 1);
    --transition-fast: 0.2s ease-out;
}


* { margin:0; padding:0; box-sizing:border-box; -webkit-tap-highlight-color:transparent; }
html { scroll-behavior:smooth; }

::selection { background: rgba(212,168,75,0.25); color: #fff; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 4px; }

body {
    background: var(--bg-deep);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.7;
    min-height: 100vh; min-height: 100dvh;
    display: flex; justify-content: center;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.bg-pattern {
    position: fixed; inset: 0; z-index: 0;
    opacity: 0.03;
    background-image:
        radial-gradient(circle at 25% 15%, rgba(212,168,75,0.12) 0%, transparent 45%),
        radial-gradient(circle at 75% 85%, rgba(212,168,75,0.06) 0%, transparent 40%);
    pointer-events: none;
}

.bg-geo {
    position: fixed; inset: 0; z-index: 0;
    opacity: 0.015;
    background-image: url("data:image/svg+xml,%3Csvg width='120' height='120' viewBox='0 0 120 120' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M60 0l14 43h45l-36 26 14 43-37-27-37 27 14-43-36-26h45z' fill='none' stroke='%23d4a84b' stroke-width='0.6'/%3E%3C/svg%3E");
    background-size: 140px 140px;
    pointer-events: none;
}

.noise {
    position: fixed; inset: 0; z-index: 0;
    opacity: 0.008;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 160px 160px;
    pointer-events: none;
}

.app {
    position: relative; z-index: 1;
    width: 100%; max-width: 800px;
    padding: 0 20px;
    display: flex; flex-direction: column;
    min-height: 100vh; min-height: 100dvh;
}

.header {
    position: sticky; top: 0; z-index: 100;
    padding: 18px 0 10px;
    background: linear-gradient(to bottom, var(--bg-deep) 55%, transparent);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    margin-bottom: 36px;
}

.header-inner { display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 12px; }

.brand-icon {
    width: 36px; height: 36px;
    border: 1.5px solid var(--gold-muted);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    color: var(--gold);
    flex-shrink: 0;
}

.brand-text h1 {
    font-family: var(--font-serif);
    font-size: 1.5rem; font-weight: 700;
    letter-spacing: -0.02em; line-height: 1.2;
}
.brand-text h1 .gold { color: var(--gold); }
.brand-sub {
    font-size: 0.6rem; text-transform: uppercase;
    letter-spacing: 0.25em; color: var(--text-muted);
    font-weight: 500;
}

.header-divider {
    border: none; height: 1px;
    margin: 8px 0 0;
    background: linear-gradient(to right, transparent, var(--gold-muted), transparent);
}

.main { flex: 1; padding-bottom: 32px; }
.hidden { display: none !important; }

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes shimmer {
    0% { background-position: -200% center; }
    100% { background-position: 200% center; }
}

.welcome {
    display: flex; flex-direction: column;
    animation: fadeUp 0.9s var(--transition);
}

.welcome-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 48px 40px 36px;
    text-align: center;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 20px 50px rgba(179, 134, 43, 0.08), var(--gold-glow);
    position: relative;
    overflow: hidden;
}

.welcome-card::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0; height: 2px;
    background: linear-gradient(to right, transparent, var(--gold), transparent);
    opacity: 0.6;
}

.welcome-ornament {
    margin-bottom: 16px; opacity: 0.5;
}

.welcome-title {
    font-family: var(--font-serif);
    font-size: 2.4rem; font-weight: 600;
    line-height: 1.15; margin-bottom: 12px;
    letter-spacing: -0.01em;
}
.welcome-title .gold { color: var(--gold); }

.welcome-desc {
    color: var(--text-dim); max-width: 520px;
    margin: 0 auto 28px;
    font-size: 0.92rem; line-height: 1.8;
}

.welcome-input {
    display: flex; gap: 10px;
    max-width: 620px; margin: 0 auto;
}

.welcome-input textarea {
    flex: 1;
    background: rgba(0,0,0,0.01);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 0.95rem; padding: 14px 18px;
    resize: none; outline: none;
    transition: var(--transition-fast);
    line-height: 1.5;
}
.welcome-input textarea:focus {
    border-color: var(--border-active);
    box-shadow: 0 0 0 3px rgba(179,134,43,0.06);
}
.welcome-input textarea::placeholder { color: var(--text-muted); }

.btn-primary {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 14px 26px;
    background: rgba(179,134,43,0.05);
    border: 1px solid var(--gold);
    border-radius: var(--radius);
    color: var(--gold);
    font-family: var(--font-sans);
    font-size: 0.88rem; font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    white-space: nowrap;
    position: relative; overflow: hidden;
}
.btn-primary:hover:not(:disabled) {
    background: var(--gold);
    color: #ffffff;
    box-shadow: 0 6px 28px rgba(179,134,43,0.25);
    transform: translateY(-1px);
}
.btn-primary:disabled { opacity: 0.3; cursor: not-allowed; }

.btn-arrow { transition: transform 0.2s; }
.btn-primary:hover:not(:disabled) .btn-arrow { transform: translateX(4px); }

.welcome-hints {
    display: flex; justify-content: center; gap: 18px;
    margin-top: 14px; font-size: 0.6rem; color: var(--text-muted);
}

.chat { animation: fadeUp 0.5s var(--transition); }
.chat-messages {
    display: flex; flex-direction: column; gap: 28px;
    padding-bottom: 20px;
}

.msg-user { align-self: flex-end; max-width: 78%; }
.msg-user-content {
    background: rgba(179, 134, 43, 0.06);
    border: 1px solid var(--border);
    border-radius: 18px 18px 4px 18px;
    padding: 14px 22px;
    font-family: var(--font-serif);
    font-size: 1.1rem; font-weight: 500;
    line-height: 1.5;
    color: var(--text);
}

.msg-bot {
    border-left: 2px solid var(--gold);
    padding-left: 20px;
    animation: fadeUp 0.5s var(--transition);
}

.msg-bot-label {
    font-size: 0.5rem; text-transform: uppercase;
    letter-spacing: 0.3em; color: var(--gold-dim);
    font-weight: 700; margin-bottom: 8px;
}

.msg-bot-content {
    font-size: 0.92rem; line-height: 1.85;
    color: var(--text-dim);
}
.msg-bot-content p { margin-bottom: 0.7em; }
.msg-bot-content p:last-child { margin-bottom: 0; }
.msg-bot-content strong { color: var(--text); font-weight: 600; }
.msg-bot-content em { color: var(--gold-dim); font-style: italic; }
.msg-bot-content ul, .msg-bot-content ol { padding-left: 20px; margin-bottom: 0.7em; }
.msg-bot-content li { margin-bottom: 0.25em; }
.msg-bot-content code {
    background: rgba(0,0,0,0.03);
    border: 1px solid var(--border);
    border-radius: 4px; padding: 1px 6px;
    font-size: 0.85em;
}
.msg-bot-content blockquote {
    border-left: 2px solid var(--gold-dim);
    padding-left: 14px; margin: 12px 0;
    color: var(--text-muted); font-style: italic;
    font-size: 0.92em;
}

.msg-bot-content hr {
    border: none; height: 1px;
    margin: 16px 0;
    background: linear-gradient(to right, transparent, var(--gold-muted), transparent);
}

.msg-system {
    border-left: 2px solid var(--text-muted);
    padding-left: 20px;
    animation: fadeUp 0.5s var(--transition);
}
.msg-system-content {
    font-size: 0.85rem; line-height: 1.7;
    color: var(--text-muted);
    font-style: italic;
}
.msg-system-content strong { color: var(--text-dim); font-weight: 500; }

.loading {
    display: flex; align-items: center; gap: 14px;
    padding: 24px 20px;
    color: var(--text-muted);
    font-size: 0.82rem;
}
.loading-ring {
    width: 20px; height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.sources-panel {
    margin: 8px 0 4px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: rgba(0,0,0,0.01);
}
.sources-toggle {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 14px;
    cursor: pointer;
    font-size: 0.72rem; color: var(--text-dim);
    transition: var(--transition-fast);
    user-select: none;
}
.sources-toggle:hover { background: var(--bg-hover); }
.sources-count {
    margin-left: auto;
    font-size: 0.58rem;
    background: rgba(179,134,43,0.08);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 2px 8px;
    color: var(--gold);
    font-weight: 600;
}
.sources-body {
    border-top: 1px solid var(--border);
    padding: 10px 14px;
    display: flex; flex-wrap: wrap; gap: 5px;
    max-height: 200px; overflow-y: auto;
}
.source-badge {
    font-size: 0.6rem; padding: 3px 10px;
    background: rgba(0,0,0,0.02);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-muted);
    cursor: help;
    transition: var(--transition-fast);
    white-space: nowrap;
    max-width: 200px; overflow: hidden; text-overflow: ellipsis;
}
.source-badge:hover { border-color: var(--border-active); color: var(--text-dim); }
.source-badge.cache { border-color: rgba(179,134,43,0.2); color: var(--gold); }

.chatbar {
    position: sticky; bottom: 0; z-index: 50;
    padding: 8px 0 16px;
    background: linear-gradient(to top, var(--bg-deep) 55%, transparent);
}
.chatbar-inner {
    display: flex; align-items: flex-end; gap: 6px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 6px 6px 6px 18px;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    box-shadow: 0 4px 30px rgba(179,134,43,0.08);
}
.chatbar-inner textarea {
    flex: 1;
    background: transparent; border: none;
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 0.92rem; padding: 7px 0;
    resize: none; outline: none;
    line-height: 1.4; max-height: 100px;
}
.chatbar-inner textarea::placeholder { color: var(--text-muted); }

.btn-send {
    width: 36px; height: 36px;
    background: rgba(179,134,43,0.1);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--gold);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition-fast);
    flex-shrink: 0;
}
.btn-send:hover:not(:disabled) { background: var(--gold); color: #ffffff; }
.btn-send:disabled { opacity: 0.25; cursor: not-allowed; }

.btn-new {
    width: 32px; height: 32px;
    background: transparent; border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition-fast);
    flex-shrink: 0; opacity: 0.45;
    border-radius: 8px;
}
.btn-new:hover { opacity: 1; color: var(--text-dim); background: var(--bg-hover); }

.modal-overlay {
    position: fixed; inset: 0; z-index: 1000;
    background: rgba(251,251,250,0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    animation: fadeIn 0.25s;
}
.modal-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-active);
    border-radius: var(--radius-xl);
    padding: 36px 32px 28px;
    max-width: 380px; width: 100%;
    text-align: center;
    box-shadow: 0 10px 45px rgba(179,134,43,0.15);
}
.modal-icon { margin-bottom: 16px; opacity: 0.4; }
.modal-card h3 {
    font-family: var(--font-serif);
    font-size: 1.5rem; color: var(--gold);
    margin-bottom: 8px;
}
.modal-card p {
    font-size: 0.85rem; color: var(--text-dim);
    margin-bottom: 24px; line-height: 1.6;
}


.footer {
    text-align: center;
    padding: 36px 0 28px;
    margin-top: auto;
}

.footer-divider {
    border: none; height: 1px;
    margin-bottom: 24px;
    background: linear-gradient(to right, transparent, var(--gold-muted), transparent);
}

.footer-ornament { margin-bottom: 12px; opacity: 0.4; }

.footer-text {
    font-size: 0.65rem; color: var(--text-muted);
    letter-spacing: 0.05em; margin-bottom: 4px;
}

.footer-copy {
    font-size: 0.55rem; color: rgba(176,166,154,0.12);
    margin-top: 4px;
}

/* Burger Nav Menu Overlay */
.menu-btn {
    width: 44px; height: 44px;
    background: transparent; border: none;
    color: var(--text-dim);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition-fast);
    border-radius: 50%;
    position: relative;
    z-index: 2050;
}
.menu-btn:hover {
    color: var(--gold);
    background: var(--bg-hover);
}

.menu-drawer {
    position: fixed; top: 0; right: 0; bottom: 0;
    width: 280px; z-index: 2000;
    background: var(--bg-elevated);
    border-left: 1px solid var(--border);
    padding: 40px 30px;
    box-shadow: -10px 0 40px rgba(179,134,43,0.05);
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.menu-drawer.open {
    transform: translateX(0);
}

.menu-overlay-backdrop {
    position: fixed; inset: 0; z-index: 1999;
    background: rgba(251,251,250,0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: none;
}
.menu-overlay-backdrop.open {
    display: block;
}

.menu-close-btn {
    position: absolute; top: 20px; right: 20px;
    width: 32px; height: 32px;
    background: transparent; border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem; line-height: 1;
    border-radius: 50%;
    transition: var(--transition-fast);
}
.menu-close-btn:hover {
    color: var(--gold);
    background: var(--bg-hover);
}

.menu-links {
    display: flex; flex-direction: column; gap: 24px;
    margin-top: 60px;
}
.menu-link {
    font-family: var(--font-serif);
    font-size: 1.5rem; font-weight: 600;
    color: var(--text-dim);
    text-decoration: none;
    transition: var(--transition-fast);
    border-bottom: 1px dashed transparent;
    padding-bottom: 6px;
}
.menu-link:hover {
    color: var(--gold);
    border-bottom-color: var(--border);
    transform: translateX(4px);
}


.cookie-banner {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 999;
    background: var(--bg-elevated);
    border-top: 1px solid var(--border);
    padding: 16px 20px;
    animation: fadeUp 0.5s var(--transition);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}
.cookie-content {
    max-width: 720px; margin: 0 auto;
    display: flex; align-items: center; gap: 16px;
}
.cookie-icon { flex-shrink: 0; color: var(--gold-dim); opacity: 0.4; }
.cookie-text { flex: 1; }
.cookie-text strong {
    font-size: 0.78rem; color: var(--text);
    font-weight: 600; display: block; margin-bottom: 2px;
}
.cookie-text p { font-size: 0.72rem; color: var(--text-dim); line-height: 1.5; }
.cookie-text a { color: var(--gold); text-decoration: none; }
.cookie-text a:hover { text-decoration: underline; }
.cookie-btn {
    flex-shrink: 0;
    padding: 8px 20px; border-radius: 20px;
    background: var(--gold); color: var(--bg-deep);
    border: none; font-size: 0.75rem; font-weight: 600;
    cursor: pointer; transition: var(--transition-fast);
    font-family: var(--font-sans); white-space: nowrap;
}
.cookie-btn:hover { background: #e0b454; transform: scale(1.02); }

@media (max-width: 640px) {
    .app { padding: 0 14px; }
    .header { padding: 14px 0 8px; margin-bottom: 24px; }
    .brand-icon { width: 30px; height: 30px; }
    .brand-text h1 { font-size: 1.25rem; }
    .brand-sub { display: none; }
    .welcome-card { padding: 32px 20px 28px; border-radius: 18px; }
    .welcome-title { font-size: 1.7rem; }
    .welcome-input { flex-direction: column; }
    .btn-primary { justify-content: center; }
    .msg-user { max-width: 92%; }
    .msg-user-content { font-size: 1rem; }
    .chat-messages { gap: 24px; }
    .cookie-content { flex-wrap: wrap; gap: 10px; }
    .cookie-btn { width: 100%; text-align: center; }
    .sources-body { max-height: 140px; }
    .source-badge { max-width: 150px; }
}

@media (max-width: 400px) {
    .app { padding: 0 10px; }
    .welcome-card { padding: 26px 14px 22px; }
    .welcome-title { font-size: 1.4rem; }
    .welcome-desc { font-size: 0.85rem; }
    .welcome-input textarea { font-size: 0.9rem; padding: 12px 14px; }
    .msg-user { max-width: 100%; }
    .chatbar-inner { padding: 4px 4px 4px 12px; }
    .chatbar-inner textarea { font-size: 0.88rem; }
}

/* Feedback-Buttons unter Analysen */
.feedback-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 10px 0 4px 14px;
    font-size: 0.8rem;
    color: var(--text-dim);
}
.feedback-btn {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 3px 10px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: var(--transition-fast);
}
.feedback-btn:hover:not(:disabled) {
    border-color: var(--border-active);
    background: var(--bg-hover);
}
.feedback-btn.selected {
    border-color: var(--gold);
    background: var(--gold-muted);
}
.feedback-btn:disabled:not(.selected) { opacity: 0.35; cursor: default; }

/* Klickbare Quellen-Badges + Auszug */
.source-badge.clickable { cursor: pointer; }
.source-badge.clickable:hover {
    border-color: var(--border-active);
    background: var(--bg-hover);
}
.source-detail {
    width: 100%;
    margin-top: 10px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-elevated);
    font-size: 0.82rem;
    line-height: 1.55;
    color: var(--text-dim);
}
.source-detail strong { color: var(--gold); }
.source-detail.hidden { display: none; }

/* Cookie Overlay / Modal */
.cookie-overlay {
    position: fixed; inset: 0; z-index: 2000;
    background: rgba(251,251,250,0.9);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    animation: fadeIn 0.3s ease-out;
}
.cookie-modal-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-active);
    border-radius: var(--radius-xl);
    padding: 32px 28px 26px;
    max-width: 440px; width: 100%;
    text-align: center;
    box-shadow: 0 10px 45px rgba(179,134,43,0.12), var(--gold-glow);
}
.cookie-modal-icon { margin-bottom: 14px; opacity: 0.9; }
.cookie-modal-card h3 {
    font-family: var(--font-serif);
    font-size: 1.6rem; color: var(--gold);
    margin-bottom: 10px;
}
.cookie-modal-card p {
    font-size: 0.88rem; color: var(--text-dim);
    margin-bottom: 22px; line-height: 1.65;
}
.cookie-modal-card p strong { color: var(--text); }
.cookie-modal-card p a { color: var(--gold); text-decoration: none; }
.cookie-modal-card p a:hover { text-decoration: underline; }

/* Name Input Field */
.name-field-wrap {
    max-width: 420px; margin: 0 auto 18px;
    text-align: left;
}
.name-label {
    display: flex; align-items: center; gap: 6px;
    font-size: 0.76rem; color: var(--gold-dim);
    margin-bottom: 6px; font-weight: 500;
}
.name-input {
    width: 100%;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 0.9rem; padding: 10px 14px;
    outline: none; transition: var(--transition-fast);
}
.name-input:focus {
    border-color: var(--border-active);
    box-shadow: 0 0 0 3px rgba(212,168,75,0.06);
}
.name-input::placeholder { color: var(--text-muted); }

