:root {
    --bg: #f4f6f9;
    --panel: #ffffff;
    --border: #e2e8f0;
    --text: #1f2937;
    --muted: #6b7280;
    --accent: #1f4e79;
    --accent-contrast: #ffffff;
    --bot-bubble: #eef2f7;
    --user-bubble: #1f4e79;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
}

.chat {
    max-width: 760px;
    margin: 0 auto;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--panel);
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
}

.chat__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
}

.chat__header h1 {
    font-size: 1.1rem;
    margin: 0;
    color: var(--accent);
}

.chat__reset {
    font-size: 0.8rem;
    color: var(--accent);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
}
.chat__reset:hover { background: var(--bot-bubble); }

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

.msg { display: flex; }
.msg--user { justify-content: flex-end; }
.msg--bot { justify-content: flex-start; }

.msg__bubble {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 12px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.msg--bot .msg__bubble {
    background: var(--bot-bubble);
    border-bottom-left-radius: 4px;
}

.msg--user .msg__bubble {
    background: var(--user-bubble);
    color: var(--accent-contrast);
    border-bottom-right-radius: 4px;
}

.msg--bot.is-typing .msg__bubble { color: var(--muted); font-style: italic; }

.chat__form {
    display: flex;
    gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid var(--border);
}

.chat__input {
    flex: 1;
    resize: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    font: inherit;
    max-height: 160px;
}
.chat__input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.chat__send {
    background: var(--accent);
    color: var(--accent-contrast);
    border: none;
    border-radius: 8px;
    padding: 0 18px;
    font: inherit;
    cursor: pointer;
}
.chat__send:disabled { opacity: 0.5; cursor: not-allowed; }

.chat__disclaimer {
    margin: 0;
    padding: 8px 20px 14px;
    font-size: 0.72rem;
    color: var(--muted);
    text-align: center;
}

.chat { height: 100dvh; }
.chat__messages { min-height: 0; }
details { margin-top: 1rem; white-space: normal; }
summary { cursor: pointer; font-weight: 600; }
blockquote { margin: 1rem 0; padding-left: 1rem; border-left: 3px solid var(--accent); white-space: pre-wrap; font-size: .9rem; }
button:disabled { opacity: .5; cursor: not-allowed; }
@media (max-width: 480px) { .msg__bubble { max-width: 95%; } .chat__header, .chat__form { padding: 12px; } .chat__input { min-width: 0; } }


/* Einstieg und Gespräch teilen sich denselben einbettbaren Bereich. */
.chat__eyebrow { margin: 0 0 5px; font-size: .72rem; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.chat__header { padding: 20px 24px; gap: 12px; }
.chat__header h1 { font-size: 1.35rem; }
.chat__welcome { padding: 30px 28px 12px; overflow-y: auto; }
.chat__welcome[hidden] { display: none; }
.chat__welcome h2 { font-size: clamp(1.45rem, 4vw, 2rem); line-height: 1.2; max-width: 530px; margin: 20px 0 14px; letter-spacing: -.025em; }
.chat__welcome p { line-height: 1.6; color: var(--muted); }
.chat__badge { display: inline-block; background: #edf3f8; color: #345575; font-size: .72rem; padding: 6px 10px; border-radius: 20px; }
.chat__suggestions { display: grid; gap: 8px; margin: 24px 0 18px; }
.chat__suggestions button { display: flex; justify-content: space-between; gap: 12px; text-align: left; font: inherit; font-size: .9rem; padding: 14px 16px; border: 1px solid var(--border); border-radius: 10px; background: white; color: var(--accent); cursor: pointer; }
.chat__suggestions button:hover { background: var(--bot-bubble); border-color: var(--accent); }
.chat__scope { font-size: .8rem; }
.chat__input { min-width: 0; }
.msg__meta { display: block; margin-top: 14px; color: var(--muted); font-size: .7rem; }
.chat__messages:empty { padding: 0; }
button:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
@media (max-width: 480px) { .chat__welcome { padding: 20px 16px 8px; } .chat__header { padding: 14px 16px; } .chat__reset { max-width: 120px; } }
@media (max-height: 600px) { .chat__welcome { padding-top: 12px; } .chat__welcome h2 { margin-top: 12px; } .chat__suggestions { margin: 12px 0; } }


/* Aufklappbares HERMAESTRO-Fenster; API und Verlauf bleiben unverändert. */
[hidden] { display: none !important; }
.demo-page { min-height: 100dvh; padding: clamp(28px, 8vw, 110px); background: linear-gradient(135deg, #eefafb, #fff 68%); }
.demo-page__brand { color: #006eb6; font-size: .85rem; letter-spacing: .13em; font-weight: 700; }
.demo-page h1 { color: #174d70; font-size: clamp(2.4rem, 6vw, 4.7rem); line-height: 1.1; letter-spacing: -.04em; margin: 15vh 0 24px; }
.demo-page > p:last-child { color: #597181; font-size: 1.05rem; line-height: 1.7; }
.chat { position: fixed; z-index: 10000; right: 24px; bottom: 128px; width: min(520px, calc(100vw - 32px)); height: min(720px, calc(100dvh - 152px)); margin: 0; max-width: none; border: 1px solid var(--border); border-radius: 22px; box-shadow: 0 18px 64px #14394e30; overflow: hidden; }
.chat__header { padding: 14px 16px; flex-shrink: 0; gap: 8px; }
.chat__identity, .chat__actions { display: flex; align-items: center; gap: 10px; }
.chat__identity img { width: 88px; height: auto; }
.chat__header h2 { margin: 0; font-size: 1rem; color: var(--accent); }
.chat__eyebrow { font-size: .6rem; letter-spacing: .025em; }
.chat__close { border: 0; border-radius: 50%; background: #eef2f7; color: var(--accent); width: 38px; height: 38px; font-size: 26px; cursor: pointer; flex-shrink: 0; }
.chat__welcome { padding: 20px 22px 8px; }
.chat__welcome h2 { font-size: 1.55rem; }
.chat__welcome p { font-size: .9rem; }
.chat__suggestions { margin: 16px 0; }
.chat__suggestions button { font-size: .85rem; padding: 11px 12px; }
.chat__form, .chat__disclaimer { flex-shrink: 0; }
.chat__input { font-size: 16px; }
.chat-launcher { position: fixed; right: 24px; bottom: max(14px, env(safe-area-inset-bottom)); z-index: 10001; width: 160px; padding: 6px 2px; border: none; border-radius: 14px; background: transparent; cursor: pointer; color: #174d70; }
.hermaestro { display: block; width: 100%; height: auto; overflow: visible; filter: drop-shadow(0 3px 3px #15354d15); }
.chat-launcher__label { display: inline-block; margin-top: 3px; padding: 4px 9px; background: #ffffffed; border-radius: 15px; font-size: 11px; }
.hermaestro-wing-left { transform-origin: 387px 287px; }
.hermaestro-wing-right { transform-origin: 873px 280px; }
.is-animated .hermaestro-wing-left { animation: wing-left 1.6s ease-in-out 3; }
.is-animated .hermaestro-wing-right { animation: wing-right 1.6s ease-in-out 3; }
.is-animated .hermaestro-pupil { animation: eye-roll 4.8s ease-in-out 1; }
@keyframes wing-left { 0%, 100% { transform: rotate(0); } 35% { transform: rotate(7deg); } 65% { transform: rotate(-3deg); } }
@keyframes wing-right { 0%, 100% { transform: rotate(0); } 35% { transform: rotate(-7deg); } 65% { transform: rotate(3deg); } }
@keyframes eye-roll { 0%, 20%, 80%, 100% { transform: translate(0,0); } 35% { transform: translate(-6px,-5px); } 48% { transform: translate(0,-12px); } 61% { transform: translate(6px,-5px); } }
@media (prefers-reduced-motion: reduce) { .hermaestro * { animation: none !important; } }
@media (max-width: 580px) {
    .chat { right: 8px; left: 8px; width: auto; bottom: 108px; height: calc(100dvh - 120px); border-radius: 18px; }
    .chat-launcher { right: 14px; width: 135px; bottom: max(8px, env(safe-area-inset-bottom)); }
    .chat__identity { gap: 6px; } .chat__identity img { width: 65px; }
    .chat__header { padding: 12px; } .chat__actions { gap: 6px; }
    .chat__welcome { padding: 16px; } .chat__welcome h2 { font-size: 1.35rem; }
    .chat__eyebrow { display: none; }
    .demo-page h1 { margin-top: 12vh; } .chat-is-open { overflow: hidden; }
}
@media (max-height: 500px) { .chat { bottom: 8px; height: calc(100dvh - 16px); } .chat-is-open .chat-launcher { display: none; } }
