@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("/fonts/atkinson-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("/fonts/atkinson-700.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  /* Umweltpapier, Kugelschreiber-Blau, Formularfeld-Grün, Stempelviolett */
  --paper: #f1f4ef;
  --sheet: #ffffff;
  --ink: #16233b;
  --muted: #4f5b6b;
  --field: #dfeadb;
  --rule: #bcc6b8;
  --stamp: #4a3aa0;
  --stamp-soft: #ebe8f7;
  --danger: #9b1c1c;

  --measure: 44rem;
  --radius-field: 0.25rem;
  --radius-bubble: 1.1rem;
  --font: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.55 var(--font);
}

a { color: var(--stamp); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 3px solid var(--stamp);
  outline-offset: 2px;
}

.sr-only, .skip:not(:focus) {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.skip:focus { position: fixed; top: 0.5rem; left: 0.5rem; z-index: 10; background: var(--sheet); padding: 0.5rem 0.75rem; }

/* ---------- Kopf ---------- */
.masthead {
  background: var(--ink);
  color: var(--paper);
}
.masthead__inner {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: inherit;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: -0.01em;
}
.wordmark__seal { width: 1.75rem; height: 1.75rem; }
.badge {
  font-size: 0.8125rem;
  padding: 0.15rem 0.6rem;
  border: 1px solid currentColor;
  border-radius: 999px;
  opacity: 0.85;
}

.notice {
  margin: 0;
  padding: 0.6rem 1.25rem;
  background: var(--field);
  border-bottom: 1px solid var(--rule);
  font-size: 0.9375rem;
  line-height: 1.4;
  text-align: center;
}

/* ---------- Verlauf ---------- */
.conversation {
  flex: 1;
  width: 100%;
  max-width: var(--measure);
  margin: 0 auto;
  padding: 1.5rem 1.25rem 2rem;
}

.intro h1 {
  font-size: clamp(1.75rem, 1.2rem + 2.4vw, 2.5rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin: 1rem 0 0.75rem;
  max-width: 18ch;
}
.intro p { color: var(--muted); max-width: 36rem; margin: 0 0 1.5rem; }

.examples {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.5rem;
}
.examples button {
  width: 100%;
  text-align: left;
  font: inherit;
  color: var(--ink);
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-left: 4px solid var(--field);
  border-radius: var(--radius-field);
  padding: 0.7rem 0.9rem;
  cursor: pointer;
}
.examples button:hover { border-left-color: var(--stamp); }

.msg { margin: 0 0 1.25rem; }
.msg--user {
  display: flex;
  justify-content: flex-end;
}
.msg--user .msg__text {
  margin: 0;
  max-width: 85%;
  background: var(--ink);
  color: var(--paper);
  padding: 0.65rem 1rem;
  border-radius: var(--radius-bubble) var(--radius-bubble) 0.25rem var(--radius-bubble);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.msg--bot {
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: 0.25rem var(--radius-bubble) var(--radius-bubble) var(--radius-bubble);
  padding: 1rem 1.15rem;
}
.msg--bot .msg__text > :first-child { margin-top: 0; }
.msg--bot .msg__text > :last-child { margin-bottom: 0; }
.msg--bot .msg__text p, .msg--bot .msg__text ul, .msg--bot .msg__text ol { margin: 0 0 0.7rem; }
.msg--bot .msg__text ul, .msg--bot .msg__text ol { padding-left: 1.3rem; }
.msg--bot .msg__text li { margin-bottom: 0.25rem; }
.msg__text.is-pending::after {
  content: "";
  display: inline-block;
  width: 0.55em;
  height: 1.05em;
  vertical-align: text-bottom;
  background: var(--stamp);
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
.msg--error { border-color: var(--danger); color: var(--danger); }

/* Zitatmarken im Text: wie kleine Stempel */
.cite {
  display: inline-block;
  min-width: 1.35em;
  margin: 0 0.1em;
  padding: 0 0.3em;
  font-size: 0.75em;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
  vertical-align: 0.2em;
  color: var(--stamp);
  border: 1.5px solid var(--stamp);
  border-radius: 0.3em;
  text-decoration: none;
}

/* ---------- Quellen: das Erkennungszeichen ---------- */
.sources {
  margin-top: 1rem;
  padding: 0.75rem 0.9rem 0.8rem;
  background: var(--stamp-soft);
  border: 1.5px dashed var(--stamp);
  border-radius: 0.4rem;
}
.sources__title {
  margin: 0 0 0.4rem;
  font-size: 0.9375rem;
  color: var(--stamp);
}
.sources__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.45rem; }
.sources__list li { display: grid; grid-template-columns: auto 1fr; gap: 0.55rem; align-items: baseline; font-size: 0.9375rem; line-height: 1.35; }
.sources__list .cite { vertical-align: 0; font-size: 0.8rem; }
.sources__list a { font-weight: 700; overflow-wrap: anywhere; }
.sources__meta { display: block; color: var(--muted); font-size: 0.8125rem; }

.rate {
  margin-top: 0.8rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--muted);
}
.rate button {
  font: inherit;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 0.15rem 0.8rem;
  cursor: pointer;
}
.rate button:hover { border-color: var(--ink); }

/* ---------- Eingabe ---------- */
.composer {
  position: sticky;
  bottom: 0;
  background: linear-gradient(to top, var(--paper) 75%, transparent);
  padding: 0.75rem 1.25rem calc(0.5rem + env(safe-area-inset-bottom));
}
.composer__inner {
  max-width: calc(var(--measure) - 2.5rem);
  margin: 0 auto;
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  background: var(--sheet);
  border: 2px solid var(--ink);
  border-radius: 0.5rem;
  padding: 0.35rem;
}
.composer__inner:focus-within { border-color: var(--stamp); }
.composer textarea {
  flex: 1;
  min-height: 2.75rem;
  max-height: 10rem;
  resize: none;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font: inherit;
  padding: 0.55rem 0.5rem;
}
.composer textarea::placeholder { color: #6d7684; }
.composer__status {
  max-width: calc(var(--measure) - 2.5rem);
  margin: 0.35rem auto 0;
  min-height: 1.2em;
  font-size: 0.8125rem;
  color: var(--muted);
}

.icon-btn {
  flex: none;
  width: 2.75rem;
  height: 2.75rem;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 0.35rem;
  cursor: pointer;
  position: relative;
}
.icon-btn svg { width: 1.4rem; height: 1.4rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.send { background: var(--ink); color: var(--paper); }
.send:disabled { opacity: 0.45; cursor: progress; }
.mic { background: var(--field); color: var(--ink); }
.mic[aria-pressed="true"] { background: var(--stamp); color: #fff; }
.mic[aria-pressed="true"] svg rect { fill: currentColor; }
.mic__timer {
  position: absolute;
  bottom: calc(100% + 0.4rem);
  left: 50%;
  translate: -50% 0;
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  background: var(--stamp);
  color: #fff;
  padding: 0.05rem 0.4rem;
  border-radius: 0.25rem;
}
.mic__timer:empty { display: none; }

.colophon {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.4rem 1.25rem;
  padding: 0.5rem 1.25rem 1rem;
  font-size: 0.8125rem;
}
.colophon a { color: var(--muted); }

/* ---------- Textseiten (Datenschutz, Impressum, Quellen) ---------- */
.page {
  flex: 1;
  width: 100%;
  max-width: var(--measure);
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}
.page h1 { font-size: 1.9rem; line-height: 1.15; letter-spacing: -0.015em; }
.page h2 { font-size: 1.2rem; margin-top: 1.8rem; }
.page li { margin-bottom: 0.35rem; }

@media (min-width: 40rem) {
  .examples { grid-template-columns: 1fr 1fr; }
  .conversation { padding-top: 2.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  .msg__text.is-pending::after { animation: none; }
}
