@font-face {
  font-family: "Inter";
  src: url("fonts/inter.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  /* AGT-CI (Konzept Fachstelle Demenz 2027) */
  --red: #ED1C24;
  --red-dark: #C8141B;
  --ink: #231F20;
  --grey: #8B8889;
  --line: #DDDADB;
  --white: #FFFFFF;
  /* Apple SD Gothic Neo = Hausschrift im Konzept; auf Nicht-Apple-Geräten Inter (lokal) */
  --font: "Apple SD Gothic Neo", "Inter", Arial, Helvetica, sans-serif;
  --pad: clamp(16px, 4vw, 56px);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: var(--white);
  color: var(--ink);
  font: 17px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Logo oben rechts, als Text wie im Konzept */
.top {
  display: flex;
  justify-content: flex-end;
  padding: 28px var(--pad) 0;
}
.brand {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.25;
  font-size: 17px;
  color: var(--ink);
  text-decoration: none;
}
.brand strong { color: var(--red); font-weight: 800; }

/* Bühne: im Leerlauf alles mittig, im Gespräch Verlauf + Leiste unten */
.stage {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 0 var(--pad);
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
  overflow: hidden;
}

.title {
  margin: 0 0 28px;
  font-size: clamp(34px, 6vw, 52px);
  line-height: 1.05;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -.005em;
}
.title span { color: var(--red); }

.log { display: none; }

.bar {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 6px 6px 6px 20px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: var(--white);
}
.bar:focus-within { border-color: var(--red); box-shadow: 0 0 0 3px rgba(237, 28, 36, .12); }
.bar textarea {
  flex: 1;
  resize: none;
  border: 0;
  outline: none;
  font: inherit;
  color: inherit;
  background: transparent;
  max-height: 140px;
  padding: 9px 0;
}
.bar textarea::placeholder { color: var(--grey); }
.bar button {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: var(--red);
  color: var(--white);
  cursor: pointer;
}
.bar button:hover { background: var(--red-dark); }
.bar button:disabled { background: var(--line); cursor: default; }

.note {
  margin: 10px 0 0;
  padding: 0 20px;
  font-size: 13px;
  color: var(--grey);
}
.note strong { color: var(--ink); font-weight: 700; }
.reset {
  font: inherit;
  color: var(--ink);
  background: none;
  border: 0;
  padding: 0;
  margin-left: 6px;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.reset:hover { color: var(--red); }

/* Gesprächsmodus */
body.chatting .stage { justify-content: flex-end; padding-bottom: 8px; }
body.chatting .title { display: none; }
body.chatting .log {
  display: block;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding: 32px 12px 20px 0;
}

.msg { margin: 0 0 26px; overflow-wrap: anywhere; }
.msg.user {
  font-weight: 700;
  white-space: pre-wrap;
  margin-bottom: 10px;
}
.msg.bot {
  padding-left: 18px;
  border-left: 3px solid var(--red);
}
.msg.bot p { margin: 0 0 .7em; }
.msg.bot ul, .msg.bot ol { margin: 0 0 .7em; padding-left: 1.2em; }
.msg.bot li { margin: .2em 0; }
.msg.bot > :last-child { margin-bottom: 0; }
.msg.bot strong { font-weight: 800; }
.msg.bot a { color: var(--red); }
.msg.error { color: var(--red-dark); border-left-color: var(--grey); }
.msg.error .code { display: block; margin-top: 6px; font-size: 12px; color: var(--grey); }

.typing { display: inline-flex; gap: 5px; padding: 8px 0; }
.typing span {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--red);
  animation: blink 1.2s infinite ease-in-out;
}
.typing span:nth-child(2) { animation-delay: .15s; }
.typing span:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 80%, 100% { opacity: .2; } 40% { opacity: 1; } }

/* Footer wie Fußzeile im Konzept */
.foot {
  padding: 18px var(--pad) calc(18px + env(safe-area-inset-bottom));
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--grey);
}
.foot p { margin: 0; }
.foot strong { color: var(--ink); font-weight: 700; }
.foot a { color: var(--grey); text-decoration: none; }
.foot a[href^="tel:"] { color: var(--ink); font-weight: 700; }
.foot a:hover { color: var(--red); }
.sep { margin: 0 .45em; }
.nw { white-space: nowrap; }


@media (max-width: 560px) {
  .top { padding-top: 18px; }
  .brand { font-size: 14px; }
  .title { margin-bottom: 20px; }
  .foot .nw { display: block; }
  .foot .sep { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .typing span { animation: none; opacity: .6; }
}
