:root {
  --hintergrund: #fff8ec;
  --flaeche: #ffffff;
  --text: #3a3226;
  --leise: #7d7262;
  --sonne: #f5a623;
  --sonne-dunkel: #d9860b;
  --bot: #fff1d6;
  --ich: #dff0e6;
  --rot: #c0392b;
  --rand: #eadfcb;
}

@media (prefers-color-scheme: dark) {
  :root {
    --hintergrund: #1f1b16;
    --flaeche: #2a251e;
    --text: #f3ead9;
    --leise: #b7aa95;
    --bot: #3a3123;
    --ich: #233a2d;
    --rand: #3d352a;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--hintergrund);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 20px;
  line-height: 1.45;
}

.seite { height: 100dvh; display: flex; flex-direction: column; }
.seite[hidden] { display: none; }

.mitte {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px 16px;
  text-align: center;
}

h1 { margin: 0; font-size: 1.6rem; }
.logo { width: 96px; height: 96px; }
.hinweis { color: var(--leise); max-width: 20em; }

/* Der große Knopf */
.knopf-gross {
  width: min(70vw, 280px);
  aspect-ratio: 1;
  border: none;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffd27a, var(--sonne) 60%, var(--sonne-dunkel));
  color: #fff;
  font-size: 1.8rem;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 10px 30px rgba(217, 134, 11, 0.35);
  animation: atmen 4s ease-in-out infinite;
  cursor: pointer;
}
.knopf-gross img { width: 45%; height: auto; border-radius: 50%; }
.knopf-gross:active { transform: scale(0.97); }

@keyframes atmen {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

@media (prefers-reduced-motion: reduce) {
  .knopf-gross, .mikro.hoert { animation: none; }
}

.knopf-klein, nav button, dialog .schliessen {
  border: none;
  border-radius: 999px;
  background: var(--sonne);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  padding: 12px 24px;
  cursor: pointer;
}

input {
  font-size: 1.1rem;
  padding: 12px 16px;
  border: 2px solid var(--rand);
  border-radius: 12px;
  background: var(--flaeche);
  color: var(--text);
  width: 100%;
  max-width: 280px;
}

.fehler { color: var(--rot); min-height: 1.4em; }

/* Gespräch */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--rand);
}
.titel { font-weight: 700; }

.symbol {
  border: none;
  background: none;
  font-size: 1.4rem;
  padding: 8px;
  cursor: pointer;
  color: var(--text);
}

#nachrichten {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.blase {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 18px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.blase.bot { background: var(--bot); align-self: flex-start; border-bottom-left-radius: 4px; }
.blase.user { background: var(--ich); align-self: flex-end; border-bottom-right-radius: 4px; }

#status { min-height: 1.6em; padding: 0 16px; color: var(--leise); font-size: 0.9rem; text-align: center; }

.eingabe {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 8px 16px 12px;
}

.mikro {
  width: 88px;
  height: 88px;
  border: none;
  border-radius: 50%;
  background: var(--sonne);
  font-size: 2.2rem;
  box-shadow: 0 6px 18px rgba(217, 134, 11, 0.35);
  cursor: pointer;
}
.mikro.hoert { background: #e74c3c; animation: atmen 1.2s ease-in-out infinite; }
.mikro:disabled { opacity: 0.5; }

#schreiben { display: flex; gap: 8px; width: 100%; }
#schreiben input { max-width: none; flex: 1; }

nav {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  padding: 0 16px calc(12px + env(safe-area-inset-bottom));
}
nav button { background: var(--flaeche); color: var(--text); border: 1px solid var(--rand); font-size: 0.85rem; padding: 8px 16px; }

/* Dialoge */
dialog {
  border: none;
  border-radius: 20px;
  padding: 24px 20px;
  width: calc(100% - 32px);
  max-width: 480px;
  max-height: 85dvh;
  background: var(--flaeche);
  color: var(--text);
}
dialog::backdrop { background: rgba(0, 0, 0, 0.4); }
dialog h2 { margin-top: 0; }
dialog .schliessen { margin-top: 16px; width: 100%; }

.anruf {
  display: block;
  margin: 10px 0;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--bot);
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
}
.anruf small { font-weight: 400; color: var(--leise); }
.anruf.notruf { background: var(--rot); color: #fff; text-align: center; }

.bericht {
  white-space: pre-wrap;
  font-family: ui-monospace, monospace;
  font-size: 0.75rem;
  background: var(--hintergrund);
  border-radius: 12px;
  padding: 12px;
  margin: 12px 0;
  overflow-x: auto;
}
