/* Serenity App - Farben wie theserenitysystem.com */
:root {
  --navy: #152b4e; --navy-tief: #0e1f3a;
  --tuerkis: #2aa198; --tuerkis-hell: #e6f4f2; --tuerkis-text: #1b7a72;
  --ink: #1c2530; --ink-soft: #55606e; --line: #dfe3e8;
  --paper: #ffffff; --sand: #f7f6f3;
}
* , *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
/* Auch auf dem Desktop im Handyformat: eine schmale Spalte auf dunklem Grund */
html { background: var(--navy-tief); }
body {
  max-width: 430px; margin: 0 auto; position: relative;
  box-shadow: 0 0 40px rgba(0, 0, 0, .35);
  background: var(--sand); color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 1.0625rem; line-height: 1.6;
  display: flex; flex-direction: column; height: 100dvh;
  -webkit-text-size-adjust: 100%;
}
.top {
  background: var(--navy-tief); color: #fff;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .55rem 16px; padding-top: max(.55rem, env(safe-area-inset-top));
}
.logo { display: flex; align-items: center; gap: .6rem; }
.logo img { width: 2.1rem; height: 2.1rem; filter: brightness(0) invert(1); }
.wm { display: flex; flex-direction: column; line-height: 1.1; }
.wm b { font-weight: 800; font-size: .82rem; letter-spacing: .07em; white-space: nowrap; }
#neu, #menue-knopf { white-space: nowrap; }
.top { gap: .6rem; }
.logo { min-width: 0; }
.logo img { width: 1.9rem; height: 1.9rem; flex: none; }
.kopf-rechts { flex: none; }
.wm small { font-size: .7rem; color: var(--tuerkis); text-transform: uppercase; font-weight: 700; letter-spacing: .12em; }
#neu {
  background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.35);
  border-radius: 999px; padding: .35rem .85rem; font: inherit; font-size: .85rem; cursor: pointer;
}
#neu:hover { border-color: var(--tuerkis); }

#log {
  flex: 1; overflow-y: auto; padding: 1.25rem 16px 1rem;
  display: flex; flex-direction: column; gap: .9rem;
  max-width: 46rem; width: 100%; margin: 0 auto;
  position: relative;                 /* Bezugspunkt für offsetTop beim Ankern */
  scrollbar-width: none;              /* kein Scrollbalken (Firefox) */
  -ms-overflow-style: none;
}
#log::-webkit-scrollbar { display: none; }   /* kein Scrollbalken (Chrome, Safari, Edge) */
/* Platzhalter am Ende: hält Raum frei, damit die eigene Nachricht oben stehen bleiben kann */
.luecke { flex: none; width: 100%; margin-top: -.9rem; pointer-events: none; }
.msg.app.neu { animation: einblenden .4s ease-out; }
@keyframes einblenden { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.hallo { color: var(--ink); padding: .5rem 0 .25rem; }
.hallo p { margin: 0 0 .5rem; }
.hallo .hinweis { color: var(--ink-soft); font-size: .875rem; }
.msg { max-width: 88%; padding: .7rem .95rem; border-radius: 1.1rem; overflow-wrap: anywhere; }
.msg p { margin: 0 0 .6em; }
.msg p:last-child { margin-bottom: 0; }
.msg ul, .msg ol { margin: 0 0 .6em; padding-left: 1.3em; }
.ich { align-self: flex-end; background: var(--navy); color: #fff; border-bottom-right-radius: .35rem; white-space: pre-wrap; }
.app { align-self: flex-start; background: var(--paper); border: 1px solid var(--line); border-bottom-left-radius: .35rem; }
.app strong { color: var(--navy); }
.app.denkt::after {
  content: ""; display: inline-block; width: .5rem; height: .5rem; margin-left: .2rem;
  border-radius: 50%; background: var(--tuerkis); animation: puls 1s ease-in-out infinite;
}
@keyframes puls { 50% { opacity: .2; } }
.fehler { align-self: center; color: #9b2c2c; font-size: .9rem; text-align: center; }
.eingabe {
  display: flex; gap: .5rem; align-items: flex-end;
  max-width: 46rem; width: 100%; margin: 0 auto;
  padding: .6rem 16px; padding-bottom: max(.75rem, env(safe-area-inset-bottom));
  background: var(--sand); border-top: 1px solid var(--line);
}
#in {
  flex: 1; resize: none; font: inherit; color: var(--ink); background: var(--paper);
  border: 1px solid var(--line); border-radius: 1.2rem; padding: .6rem .9rem;
  max-height: 10rem; line-height: 1.45; outline: none; overflow-y: hidden;
}
#in:focus { border-color: var(--tuerkis); box-shadow: 0 0 0 3px var(--tuerkis-hell); }
#senden {
  flex: none; width: 2.75rem; height: 2.75rem; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--tuerkis); color: #fff; display: grid; place-items: center;
}
#senden:disabled { background: #a8cfcb; cursor: default; }
#mikro {
  flex: none; width: 2.75rem; height: 2.75rem; border-radius: 50%; cursor: pointer;
  background: var(--paper); color: var(--tuerkis-text); border: 1px solid var(--line);
  display: grid; place-items: center;
}
#mikro:hover { border-color: var(--tuerkis); }
#mikro.an { background: #c0392b; color: #fff; border-color: #c0392b; animation: mikro-puls 1.4s ease-in-out infinite; }
@keyframes mikro-puls { 0%, 100% { box-shadow: 0 0 0 0 rgba(192,57,43,.45); } 50% { box-shadow: 0 0 0 7px rgba(192,57,43,0); } }
.vorschau {
  max-width: 46rem; width: 100%; margin: 0 auto; padding: .5rem 16px .2rem;
  display: flex; gap: .6rem; align-items: flex-start;
  background: var(--sand); border-top: 1px solid var(--line);
  font-size: .9rem; color: var(--ink-soft); line-height: 1.45;
}
.vorschau + .eingabe { border-top: 0; }
.vorschau-kopf { flex: none; display: inline-flex; align-items: center; gap: .35rem; font-variant-numeric: tabular-nums; color: #c0392b; font-weight: 600; }
.vorschau-kopf .punkt { width: .55rem; height: .55rem; border-radius: 50%; background: #c0392b; animation: puls 1s ease-in-out infinite; }
.vorschau-text { font-style: italic; max-height: 4.4em; overflow-y: auto; overflow-wrap: anywhere; }
.vorschau.wandelt .vorschau-kopf { color: var(--ink-soft); }
.vorschau.wandelt .punkt { background: var(--tuerkis); }
#mikro.wartet { opacity: .55; cursor: default; animation: mikro-warten 1s ease-in-out infinite; }
@keyframes mikro-warten { 50% { opacity: .25; } }
@media (prefers-color-scheme: dark) { #mikro { color: #8fd3cc; } }
/* Vorlesen */
.app { position: relative; }
.vorlesen {
  display: grid; place-items: center; margin: .45rem 0 -.15rem auto;
  width: 1.9rem; height: 1.9rem; border-radius: 50%; cursor: pointer;
  background: transparent; color: var(--tuerkis-text); border: 1px solid var(--line);
}
.vorlesen:hover { border-color: var(--tuerkis); }
.vorlesen.spielt { background: var(--tuerkis); color: #fff; border-color: var(--tuerkis); }
.vorlesen.laedt { opacity: .5; animation: mikro-warten 1s ease-in-out infinite; }
@media (prefers-color-scheme: dark) { .vorlesen { color: #8fd3cc; } }
/* Gespräch beenden */
.ende-knopf {
  align-self: flex-start; margin-top: -.35rem;
  background: none; border: 0; padding: .15rem .3rem; cursor: pointer;
  font: inherit; font-size: .8rem; color: var(--ink-soft);
  text-decoration: underline; text-underline-offset: 3px;
}
.ende-knopf:hover { color: var(--tuerkis-text); }
[hidden] { display: none !important; }
.modal {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(14, 31, 58, .55);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal-karte {
  background: var(--paper); color: var(--ink); border-radius: 1rem;
  width: 100%; max-width: 26rem; padding: 1.5rem 1.25rem 1.25rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .25);
}
.modal-karte h2 { font-size: 1.15rem; margin: 0 0 1rem; color: var(--navy); }
.wahlen { display: flex; flex-direction: column; gap: .5rem; }
.wahl {
  font: inherit; text-align: left; cursor: pointer;
  background: var(--sand); color: var(--ink);
  border: 1px solid var(--line); border-radius: .7rem; padding: .7rem .9rem;
}
.wahl:hover, .wahl:focus-visible { border-color: var(--tuerkis); background: var(--tuerkis-hell); outline: none; }
.leise {
  margin-top: .9rem; background: none; border: 0; padding: 0; cursor: pointer;
  font: inherit; font-size: .875rem; color: var(--ink-soft); text-decoration: underline;
}
.bitte, .danke { margin: 0 0 1.1rem; line-height: 1.55; }
.knopfreihe { display: flex; gap: .6rem; justify-content: flex-end; flex-wrap: wrap; }
.haupt, .zweit { font: inherit; cursor: pointer; border-radius: 999px; padding: .55rem 1.1rem; }
.haupt { background: var(--tuerkis); color: #fff; border: 0; font-weight: 600; }
.zweit { background: transparent; color: var(--ink); border: 1px solid var(--line); }
/* Kopfzeile, Menü, Verlauf */
.kopf-rechts { display: flex; gap: .4rem; }
#menue-knopf {
  background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.35);
  border-radius: 999px; padding: .35rem .85rem; font: inherit; font-size: .85rem; cursor: pointer;
}
#menue-knopf[aria-expanded="true"], #menue-knopf:hover { border-color: var(--tuerkis); }
.menue {
  position: absolute; z-index: 40; right: 12px; top: 3.6rem;
  width: min(22rem, calc(100% - 24px)); max-height: calc(100dvh - 5rem); overflow-y: auto;
  background: var(--paper); border: 1px solid var(--line); border-radius: 1rem;
  box-shadow: 0 12px 32px rgba(0,0,0,.18); padding: 1rem;
}
.menue h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-soft); margin: .8rem 0 .4rem; }
.wer { font-size: .8rem; color: var(--ink-soft); margin: 0; overflow-wrap: anywhere; }
.leer { font-size: .9rem; color: var(--ink-soft); margin: .2rem 0 .6rem; }
.verlauf-box { display: flex; flex-direction: column; gap: .3rem; }
.eintrag { display: flex; align-items: stretch; border: 1px solid var(--line); border-radius: .6rem; }
.eintrag.aktiv { border-color: var(--tuerkis); }
.eintrag-auf {
  flex: 1; min-width: 0; text-align: left; background: none; border: 0; cursor: pointer;
  font: inherit; color: var(--ink); padding: .5rem .7rem; display: flex; flex-direction: column;
}
.eintrag-titel { font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.eintrag-zeit { font-size: .75rem; color: var(--ink-soft); }
.eintrag-weg { background: none; border: 0; cursor: pointer; color: var(--ink-soft); font-size: 1.1rem; padding: 0 .7rem; }
.eintrag-weg:hover { color: #9b2c2c; }
.menue-knoepfe { margin-top: .6rem; display: flex; flex-direction: column; gap: .4rem; }
.menue .leise { margin-top: .8rem; }
/* Formulare in Dialog und Anmeldung */
.modal-karte label, .anmelden label { display: block; font-size: .85rem; color: var(--ink-soft); margin: .7rem 0 .25rem; text-align: left; }
.modal-karte input, .anmelden input {
  width: 100%; font: inherit; color: var(--ink); background: var(--sand);
  border: 1px solid var(--line); border-radius: .6rem; padding: .6rem .75rem;
}
.modal-karte input:focus, .anmelden input:focus { outline: none; border-color: var(--tuerkis); box-shadow: 0 0 0 3px var(--tuerkis-hell); }
.modal-karte p { margin: 0 0 .8rem; line-height: 1.55; }
.warnung { background: #fff6e5; color: #6b4a00; border-radius: .6rem; padding: .6rem .75rem; font-size: .9rem; }
.meldung { margin: .8rem 0 0; font-size: .9rem; line-height: 1.5; text-align: left; }
.meldung a { color: var(--tuerkis-text); font-weight: 600; }
.haupt.breit { width: 100%; margin-top: 1rem; padding: .7rem 1rem; }
.anmelden { max-width: 28rem; text-align: left; }
.anmelden h1, .anmelden .zeichen { display: block; text-align: center; margin-left: auto; margin-right: auto; }
.anmelden .leise { display: block; margin: .8rem auto 0; }
.kleingedruckt { margin-top: 1.4rem; border-top: 1px solid var(--line); padding-top: .9rem; font-size: .78rem; color: var(--ink-soft); line-height: 1.5; }
.kleingedruckt p { margin: 0 0 .6rem; }
details.kleingedruckt summary { cursor: pointer; text-align: center; color: var(--ink-soft); font-size: .85rem; list-style: none; text-decoration: underline; text-underline-offset: 3px; }
details.kleingedruckt summary::-webkit-details-marker { display: none; }
details.kleingedruckt[open] summary { margin-bottom: .7rem; }
.kleingedruckt a { color: var(--tuerkis-text); }
/* Schnuppern */
a.haupt, a.zweit { display: inline-block; text-decoration: none; text-align: center; }
.schranke {
  background: var(--paper); border: 1px solid var(--tuerkis); border-radius: 1rem;
  padding: 1.1rem 1.1rem 1rem; margin-top: .4rem;
}
.schranke h2 { font-size: 1.05rem; margin: 0 0 .5rem; color: var(--navy); }
.schranke p { margin: 0 0 1rem; line-height: 1.55; }
#in:disabled { opacity: .6; }
.hallo .hinweis a { color: var(--tuerkis-text); }
.link-knopf {
  background: none; border: 0; padding: 0; font: inherit; cursor: pointer;
  color: var(--tuerkis-text); text-decoration: underline; text-underline-offset: 3px;
}
.beispiele { display: flex; flex-wrap: wrap; gap: .45rem; margin: .2rem 0 .7rem; }
.beispiele button {
  font: inherit; font-size: .92rem; cursor: pointer; color: var(--ink);
  background: var(--paper); border: 1px solid var(--line); border-radius: 999px; padding: .4rem .85rem;
}
.beispiele button:hover, .beispiele button:focus-visible { border-color: var(--tuerkis); background: var(--tuerkis-hell); outline: none; }
@media (prefers-color-scheme: dark) {
  .link-knopf { color: #8fd3cc; }
  .beispiele button:hover, .beispiele button:focus-visible { background: #1d3a3c; }
}
.schnuppern { margin-top: 1.2rem; border-top: 1px solid var(--line); padding-top: 1rem; text-align: center; }
.schnuppern .zweit { width: 100%; padding: .65rem 1rem; color: var(--ink) !important; font-weight: 600; }
.schnuppern p { margin: .5rem 0 0; font-size: .85rem; color: var(--ink-soft); }
/* Start: Anmelden oder schnuppern */
.wahl-start { display: flex; flex-direction: column; gap: .7rem; margin-top: .5rem; }
.wahl-start .breit { width: 100%; margin: 0; padding: .75rem 1rem; }
.karte a.haupt { color: #fff; }
a.zweit.breit { color: var(--ink) !important; font-weight: 600; }
.leise-reihe { display: flex; justify-content: space-between; }
.anmelden .leise-reihe .leise { display: inline; margin: .8rem 0 0; }
.leise.gefahr { color: #9b2c2c; }
.haupt.gefahr-voll { background: #9b2c2c; }
.menue .leise-reihe .leise { margin-top: .8rem; }
.anmelden .warnung { font-size: .85rem; line-height: 1.5; margin: .8rem 0 0; }
.fuer { margin: 0 0 .4rem; color: var(--ink-soft); font-size: .9rem; overflow-wrap: anywhere; }
@media (prefers-color-scheme: dark) { .leise.gefahr { color: #f1a3a3; } }
/* geschlossene Seite */
body.zu {
  align-items: center; justify-content: safe center; background: var(--navy-tief);
  height: auto; min-height: 100dvh; padding: 16px 0;
}
.karte { background: var(--paper); border-radius: 1rem; padding: 2rem 1.5rem; margin: 16px; max-width: 26rem; text-align: center; }
.karte .zeichen { width: 3rem; height: 3rem; }
.karte h1 { font-size: 1.4rem; margin: .5rem 0 1rem; color: var(--navy); }
.karte a { color: var(--tuerkis-text); font-weight: 600; }
@media (prefers-color-scheme: dark) {
  :root { --sand: #0f1722; --paper: #172231; --ink: #e6e9ee; --ink-soft: #9aa5b3; --line: #2a3646; --navy: #2c4a7a; }
  .app strong { color: #8fd3cc; }
  .karte h1, .modal-karte h2, .schranke h2 { color: #e6e9ee; }
  .wahl:hover, .wahl:focus-visible { background: #1d3a3c; }
  .warnung { background: #3a2f12; color: #f3d9a0; }
  .meldung a, .kleingedruckt a { color: #8fd3cc; }
  .karte a { color: #8fd3cc; }
  #in:focus { box-shadow: 0 0 0 3px rgba(42,161,152,.25); }
}

/* Sprachumschalter DE · EN · ES - Startseite, Passwortseite, Menü */
.sprachwahl { text-align: center; color: var(--ink-soft); font-size: .8rem; margin: 1rem 0 0; }
.sprachwahl button {
  background: none; border: 0; padding: .25rem .35rem; font: inherit; font-size: .8rem;
  color: var(--ink-soft); cursor: pointer; letter-spacing: .06em;
}
.sprachwahl button:hover { color: var(--tuerkis-text); }
.sprachwahl button[aria-current="true"] { color: var(--tuerkis-text); font-weight: 700; cursor: default; }
.menue .sprachwahl { margin-top: .75rem; }

/* Gesprächsmodus: Knopf oben, Tonwelle beim Sprechen (wie im SmartChat) */
.gm-knopf {
  background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.35);
  border-radius: 999px; width: 2.2rem; height: 2.2rem; display: grid; place-items: center;
  cursor: pointer; padding: 0;
}
.gm-knopf:hover { border-color: var(--tuerkis); }
.gm-knopf.an { background: var(--tuerkis); border-color: var(--tuerkis); }
.gm-welle {
  display: flex; align-items: center; justify-content: center; gap: 5px;
  width: 100%; max-width: 46rem; margin: 0 auto; height: 3rem; padding: 0;
  background: none; border: 0; cursor: pointer;
}
.gm-welle[hidden] { display: none; }
.gm-welle span {
  width: 5px; border-radius: 3px; background: var(--tuerkis);
  animation: gm-welle 0.9s ease-in-out infinite;
}
.gm-welle span:nth-child(1) { height: 10px; animation-delay: 0s; }
.gm-welle span:nth-child(2) { height: 18px; animation-delay: .12s; }
.gm-welle span:nth-child(3) { height: 26px; animation-delay: .24s; }
.gm-welle span:nth-child(4) { height: 18px; animation-delay: .36s; }
.gm-welle span:nth-child(5) { height: 10px; animation-delay: .48s; }
@keyframes gm-welle { 0%, 100% { transform: scaleY(.45); } 50% { transform: scaleY(1); } }
@media (prefers-reduced-motion: reduce) { .gm-welle span { animation: none; } }
