:root {
  --nacht: #111827;      /* Grund, wie der Hintergrund im Logo */
  --armatur: #1A2234;    /* erhöhte Flächen */
  --linie: #2B3548;      /* Linien, unbeleuchtete Striche */
  --eis: #E8ECF4;        /* Haupttext */
  --nebel: #94A3B8;      /* Nebentext */
  --blau: #2563EB;       /* Logo-Blau: Knöpfe, leuchtende Striche */
  --hell: #7AA2F7;       /* helleres Blau für Text-Akzente (gut lesbar) */
  --rot: #FF6B5A;        /* nur für Fehler */
  --violett: #8B5CF6;    /* zweite Farbe für Verläufe */
  --glas: rgba(30, 41, 64, 0.52);          /* durchscheinende Flächen */
  --glas-stark: rgba(24, 32, 52, 0.78);    /* Menü, Karten über Inhalt */
  --glas-rand: rgba(255, 255, 255, 0.09);
  --glanz: linear-gradient(135deg, #3B82F6 0%, #6366F1 55%, #8B5CF6 100%);
  --unschaerfe: blur(22px) saturate(160%);
  /* Nur Systemschriften: nichts wird von fremden Servern geladen (Datenschutz).
     Auf iPhone und Mac ist das SF Pro, für Überschriften die runde Variante passend zum R. */
  --schrift: -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --anzeige: ui-rounded, "SF Pro Rounded", -apple-system, system-ui, "Segoe UI", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: #0B1020;
  color: var(--eis);
  font: 400 17px/1.5 var(--schrift);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea { font: inherit; color: inherit; }
/* Weiche Farbschleier im Hintergrund, durch die Glasflächen sichtbar */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60vmax 50vmax at 15% -10%, rgba(59, 130, 246, 0.28), transparent 60%),
    radial-gradient(50vmax 45vmax at 105% 30%, rgba(139, 92, 246, 0.22), transparent 60%),
    radial-gradient(55vmax 40vmax at 40% 115%, rgba(37, 99, 235, 0.18), transparent 60%);
}
body.rechtlich::before { opacity: 0.6; }
:focus-visible { outline: 2px solid var(--hell); outline-offset: 3px; border-radius: 6px; }
.unsichtbar { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Gerüst ---------- */
.rahmen {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  grid-template-columns: minmax(0, 1fr);   /* nie breiter als der Bildschirm */
  height: 100dvh;
  max-width: 760px;
  margin: 0 auto;
  padding: env(safe-area-inset-top) 16px 0;
}
.kopf {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0 4px;
}
.marke { display: flex; align-items: baseline; gap: 6px; }
.marke-zeichen { width: 19px; height: 23px; color: var(--eis); margin-right: 4px; align-self: center; }
.marke-name {
  font: 600 24px/1 var(--anzeige);
  letter-spacing: -0.01em;
}
.marke-zusatz {
  font: 500 15px/1 var(--anzeige);
  color: var(--nebel);
  letter-spacing: 0.01em;
}
.kopf-rechts { position: relative; display: flex; align-items: center; gap: 6px; }
.menue-knopf {
  display: grid; place-items: center; width: 44px; height: 44px; margin-right: -10px;
  border: 0; border-radius: 50%; background: transparent; color: var(--nebel); cursor: pointer;
}
.menue-knopf svg { width: 22px; height: 22px; fill: currentColor; }
.menue-knopf[aria-expanded="true"] { color: var(--eis); background: var(--glas); }
.menue {
  position: absolute; top: 48px; right: -6px; z-index: 15;
  display: grid; min-width: 220px; padding: 6px;
  background: var(--glas-stark); border: 1px solid var(--glas-rand); border-radius: 16px;
  -webkit-backdrop-filter: var(--unschaerfe); backdrop-filter: var(--unschaerfe);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
}
.menue[hidden] { display: none; }
.menue a, .menue button {
  display: block; width: 100%; padding: 12px 14px; border: 0; border-radius: 9px;
  background: transparent; color: var(--eis); text-align: left; text-decoration: none; font-size: 16px; cursor: pointer;
}
.menue a:hover, .menue button:hover { background: rgba(255, 255, 255, 0.07); }
.menue [hidden] { display: none; }
.menue .warnung { color: var(--rot); }
.verbindung { display: flex; align-items: center; gap: 7px; font-size: 14px; color: var(--nebel); }
.verbindung .punkt { width: 7px; height: 7px; border-radius: 50%; background: var(--linie); }
.verbindung.ok .punkt { background: #34D399; box-shadow: 0 0 8px rgba(52, 211, 153, 0.7); }
.verbindung.weg .punkt { background: var(--rot); }

/* Schmale Handys: vom Verbindungsstatus nur der Punkt, damit die Kopfzeile passt */
@media (max-width: 430px) {
  #verbindung-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
}

/* ---------- Das lebendige R (ist zugleich der Gesprächs-Knopf) ---------- */
.cockpit { display: grid; justify-items: center; padding: 4px 0 6px; }
.tacho {
  display: grid;
  justify-items: center;
  gap: 3cqw;
  width: min(60vw, 250px);
  padding: 0 0 4px;
  border: 0;
  border-radius: 16px;
  background: transparent;
  cursor: pointer;
  touch-action: manipulation;
  container-type: inline-size;
}
.r-lebendig {
  width: 78cqw; aspect-ratio: 780 / 860; overflow: visible; color: var(--eis);
  filter: drop-shadow(0 0 18px rgba(99, 102, 241, 0.35));
  transition: filter 0.4s ease;
}
.tacho[data-zustand="hoert"] .r-lebendig,
.tacho[data-zustand="spricht"] .r-lebendig { filter: drop-shadow(0 0 30px rgba(99, 102, 241, 0.75)); }
#r-punkt { fill: var(--blau); }
.tacho[data-zustand="fehler"] #r-punkt { fill: var(--rot); }
.tacho-zustand { font: 500 clamp(13px, 6.4cqw, 17px)/1.2 var(--anzeige); color: var(--nebel); }
.tacho[data-zustand="hoert"] .tacho-zustand,
.tacho[data-zustand="spricht"] .tacho-zustand { color: var(--hell); }
.hinweis { min-height: 1.5em; margin: 2px 0 0; font-size: 14px; color: var(--nebel); text-align: center; }
.hinweis.fehler { color: var(--rot); }

/* ---------- Verlauf ---------- */
.verlauf {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 14px 2px 16px;
  scroll-behavior: smooth;
  /* oben weich ausblenden statt harter Linie */
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 22px);
  mask-image: linear-gradient(to bottom, transparent 0, #000 22px);
}
.leer { color: var(--nebel); max-width: 34ch; margin: 18px 0; }
.beitrag { margin: 0 0 18px; max-width: 64ch; }
.beitrag.du {
  margin-left: auto;
  max-width: 85%;
  width: fit-content;
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px 20px 6px 20px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.32), rgba(139, 92, 246, 0.26));
  color: var(--eis);
  font-size: 16px;
}
.beitrag.assistent { font-size: 19px; line-height: 1.5; }
.beitrag.assistent .stark { color: var(--hell); font-size: 14px; display: block; margin-bottom: 2px; }
.beitrag p { margin: 0 0 0.6em; }
.beitrag p:last-child { margin-bottom: 0; }
.beitrag ul { margin: 0.2em 0 0.6em; padding-left: 1.2em; }
.beitrag a { color: var(--hell); text-underline-offset: 3px; }
.beitrag.fehler { color: var(--rot); font-size: 16px; }
.bilder { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin-top: 8px; }
.bilder img { width: 100%; border-radius: 10px; display: block; background: var(--armatur); }
.beitrag.du .bilder { grid-template-columns: minmax(0, 180px); }
.dateien { display: grid; gap: 8px; margin-top: 10px; }
.dateien audio { width: 100%; max-width: 420px; }
.datei {
  display: flex; align-items: center; gap: 12px; max-width: 420px; padding: 10px 14px;
  background: var(--glas); border: 1px solid var(--glas-rand); border-radius: 14px;
  -webkit-backdrop-filter: var(--unschaerfe); backdrop-filter: var(--unschaerfe);
  color: var(--eis); text-decoration: none; font-size: 15px;
}
.datei:hover { border-color: var(--hell); }
.datei-typ {
  flex: none; padding: 3px 7px; border-radius: 6px; background: var(--glanz); color: #fff;
  font: 600 12px/1.2 var(--anzeige); letter-spacing: 0.02em;
}
.datei-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.entwurf {
  margin: 0 0 18px;
  padding: 16px;
  border: 1px solid var(--glas-rand);
  border-radius: 18px;
  background: var(--glas);
  -webkit-backdrop-filter: var(--unschaerfe); backdrop-filter: var(--unschaerfe);
  box-shadow: inset 3px 0 0 var(--blau);
  max-width: 64ch;
}
.entwurf h3 { margin: 0 0 6px; font: 600 17px/1.3 var(--anzeige); }
.entwurf .text { white-space: pre-wrap; font-size: 16px; }
.entwurf .hinweise { font-size: 14px; color: var(--nebel); margin-top: 8px; }
.entwurf .aktionen { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.entwurf .ergebnis { margin-top: 10px; font-size: 15px; color: var(--nebel); white-space: pre-wrap; }

/* Modul nicht gebucht: Angebot mit Knopf zur Buchungsseite */
.angebot {
  margin: 0 0 18px; padding: 16px 18px; max-width: 64ch;
  background: var(--glas); border: 1px solid var(--glas-rand); border-radius: 18px;
  -webkit-backdrop-filter: var(--unschaerfe); backdrop-filter: var(--unschaerfe);
}
.angebot h3 { margin: 0 0 4px; font: 600 17px/1.3 var(--anzeige); }
.angebot p { margin: 0 0 12px; color: var(--nebel); font-size: 15px; line-height: 1.45; }
a.knopf-haupt { display: inline-flex; align-items: center; text-decoration: none; }

.knopf-haupt, .knopf-neben {
  min-height: 44px;
  padding: 0 18px;
  border-radius: 22px;
  border: 1px solid var(--blau);
  cursor: pointer;
}
.knopf-haupt {
  background: var(--glanz); border-color: transparent; color: #FFFFFF; font-weight: 700;
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.35);
}
.knopf-neben { background: rgba(255, 255, 255, 0.05); color: var(--eis); border-color: var(--glas-rand); }
.knopf-haupt:disabled, .knopf-neben:disabled { opacity: 0.5; cursor: default; }

/* ---------- Eingabe ---------- */
.eingabe {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin: 0 0 calc(10px + env(safe-area-inset-bottom));
  padding: 6px;
  background: var(--glas);
  border: 1px solid var(--glas-rand);
  border-radius: 28px;
  -webkit-backdrop-filter: var(--unschaerfe); backdrop-filter: var(--unschaerfe);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}
.eingabe textarea {
  flex: 1;
  min-height: 44px;
  max-height: 140px;
  padding: 10px 6px;
  border: 0;
  border-radius: 22px;
  background: transparent;
  resize: none;
  line-height: 1.4;
}
.eingabe textarea::placeholder { color: var(--nebel); }
.eingabe textarea:focus-visible { outline: none; }
.eingabe:focus-within { border-color: rgba(122, 162, 247, 0.45); }
.foto-knopf, .senden, .diktat-knopf {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 0;
  background: transparent;
  color: var(--nebel);
  cursor: pointer;
}
.foto-knopf:hover, .diktat-knopf:hover { color: var(--eis); background: rgba(255, 255, 255, 0.07); }
.senden { background: var(--glanz); color: #FFFFFF; box-shadow: 0 4px 14px rgba(79, 70, 229, 0.45); }
.foto-knopf svg, .senden svg, .diktat-knopf svg { width: 22px; height: 22px; }
.diktat-knopf[aria-pressed="true"] { background: #DC2626; border-color: #DC2626; color: #FFFFFF; animation: diktat-puls 1.4s ease-in-out infinite; }
.diktat-knopf.arbeitet { opacity: 0.5; cursor: progress; }
@keyframes diktat-puls { 50% { box-shadow: 0 0 0 6px rgba(220, 38, 38, 0.25); } }
@media (prefers-reduced-motion: reduce) { .diktat-knopf[aria-pressed="true"] { animation: none; } }
.foto-knopf:focus-within { outline: 2px solid var(--hell); outline-offset: 3px; }

/* ---------- Anmeldung ---------- */
.anmeldung {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background: transparent;
  z-index: 10;
}
.anmeldung[hidden] { display: none; }
.anmeldung-karte {
  display: grid; gap: 10px; width: min(100%, 380px); padding: 28px 24px;
  background: var(--glas); border: 1px solid var(--glas-rand); border-radius: 24px;
  -webkit-backdrop-filter: var(--unschaerfe); backdrop-filter: var(--unschaerfe);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}
.anmeldung-zeichen { width: 52px; height: 64px; color: var(--eis); margin-bottom: 6px; }
.marke-gross { margin-bottom: 18px; }
.marke-gross .marke-name { font-size: 38px; }
.marke-gross .marke-zusatz { font-size: 20px; }
.anmeldung-karte label { color: var(--nebel); font-size: 15px; }
.anmeldung-karte input {
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--glas-rand);
  border-radius: 12px;
  background: rgba(10, 15, 30, 0.55);
}
.anmeldung-karte input:focus-visible { outline: none; border-color: var(--hell); }
.fehler { color: var(--rot); min-height: 1.4em; margin: 0; font-size: 15px; }
.ki-hinweis { margin: 4px 0 0; color: var(--nebel); font-size: 14px; line-height: 1.45; }
.rechtslinks { display: flex; gap: 18px; margin: 6px 0 0; font-size: 14px; }
.rechtslinks a, .cookie-hinweis a { color: var(--hell); text-underline-offset: 3px; }

/* ---------- Cookie-Hinweis (nur Information: das einzige Cookie ist technisch notwendig) ---------- */
.cookie-hinweis {
  position: fixed; left: 50%; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 20;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 14px;
  width: min(100% - 24px, 560px); padding: 14px 14px 14px 18px;
  background: var(--glas-stark); border: 1px solid var(--glas-rand); border-radius: 18px;
  -webkit-backdrop-filter: var(--unschaerfe); backdrop-filter: var(--unschaerfe);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
}
.cookie-hinweis[hidden] { display: none; }
.cookie-hinweis p { margin: 0; font-size: 14px; line-height: 1.45; color: var(--nebel); }
.cookie-hinweis strong { display: block; color: var(--eis); font-size: 15px; margin-bottom: 2px; }
.cookie-hinweis .knopf-haupt { flex: none; }
@media (max-width: 420px) {
  .cookie-hinweis { flex-direction: column; align-items: stretch; }
}

/* ---------- Impressum und Datenschutz ---------- */
body.rechtlich { height: auto; }
.rechtstext {
  max-width: 68ch; margin: 0 auto;
  padding: calc(20px + env(safe-area-inset-top)) 16px calc(56px + env(safe-area-inset-bottom));
}
.rechtstext h1 { font: 600 32px/1.15 var(--anzeige); margin: 12px 0 4px; }
.rechtstext h2 { font: 600 19px/1.3 var(--anzeige); margin: 30px 0 8px; }
.rechtstext p, .rechtstext li { font-size: 16px; line-height: 1.6; }
.rechtstext ul { padding-left: 1.2em; }
.rechtstext li { margin-bottom: 8px; }
.rechtstext a { color: var(--hell); text-underline-offset: 3px; }
.rechtstext .unterzeile { color: var(--nebel); font-size: 15px; margin: 0 0 16px; }
.rechtstext .zurueck { margin: 0; font-size: 15px; }
mark.fehlt { background: rgba(255, 107, 90, 0.16); color: var(--rot); padding: 0 5px; border-radius: 4px; }

/* ---------- Kompakt: außerhalb des Gesprächs mehr Platz für den Verlauf (nur Handy) ---------- */
@media (max-width: 899px) {
  .tacho { transition: width 0.25s ease; }
  .rahmen.kompakt .tacho { width: min(34vw, 130px); }
  .rahmen.kompakt .tacho-zustand { font-size: 13px; }
  .rahmen.kompakt .hinweis:empty { display: none; }
}

/* ---------- Breite Bildschirme: Cockpit links, Verlauf rechts ---------- */
@media (min-width: 900px) {
  .rahmen {
    max-width: 1180px;
    grid-template-columns: 400px 1fr;
    grid-template-rows: auto 1fr auto;
    column-gap: 48px;
  }
  .kopf { grid-column: 1 / -1; }
  .cockpit { grid-row: 2 / 4; align-content: center; }
  .tacho { width: 300px; }
  .verlauf { grid-column: 2; border-top: 0; }
  .eingabe { grid-column: 2; }
}

@media (prefers-reduced-motion: reduce) {
  .verlauf { scroll-behavior: auto; }
  .tacho { transition: none; }
}
