/* Vertrauter — Oberflaeche des Prototyps.
   Bewusst ohne Rahmenwerk und ohne Fremdquelle: keine Schriftart, kein Skript, kein Bild
   von aussen. Das haelt die strenge Content-Security-Policy ein und ist zugleich die
   Zusage aus dem Plan, dass bei einem Besuch keine Drittverbindung entsteht.
   Mobil zuerst; die Breitbild-Regeln stehen ganz unten. */

:root {
  --grund:      #120f14;
  --flaeche:    #1a151d;
  --flaeche-2:  #231c26;
  --rand:       #322839;
  --schrift:    #ece6ee;
  --schrift-2:  #a89bb0;
  --schrift-3:  #776b80;
  --warm:       #e08a6f;   /* eigene Nachrichten, Akzente */
  --warm-dunkel:#8d4f3c;
  --gold:       #d8b26a;
  --gefahr:     #d9654f;
  --radius:     18px;
  --serif:      Georgia, "Iowan Old Style", "Times New Roman", serif;
  --sans:       system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--grund);
  color: var(--schrift);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}

/* Verlauf scrollt, nicht die Seite — sonst springt auf dem Handy die Tastatur ins Bild.
   Der ganze Seitenaufbau ist dafuer EIN Flex-Stapel: Kopf und etwaige Meldungen nehmen
   ihre Hoehe, der Chat bekommt den Rest. Vorher hatte der Chat fuer sich volle Hoehe und
   der Kopf kam oben drauf — in der Summe mehr als der Bildschirm, und das Eingabefeld
   wurde unten abgeschnitten (gesehen am 17.10.2026 im Bildschirmfoto). `min-height: 0`
   ist dabei entscheidend: ohne das waechst ein Flex-Kind ueber seinen Container hinaus. */
body.seite-chat {
  height: 100vh; height: 100dvh;
  overflow: hidden;
  display: flex; flex-direction: column;
}
body.seite-chat > .kopf,
body.seite-chat > .meldungen { flex: 0 0 auto; }
body.seite-chat > .chat      { flex: 1 1 auto; min-height: 0; }

a { color: var(--warm); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.45rem; margin: 0 0 .3rem; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; margin: 2rem 0 .6rem; color: var(--schrift-2);
     font-weight: 600; letter-spacing: .02em; text-transform: uppercase; font-size: .82rem; }
p  { margin: 0 0 .7rem; }

/* ------------------------------------------------------------------ Kopf */

.kopf {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: .7rem 1rem;
  padding-top: calc(.7rem + env(safe-area-inset-top));
  background: rgba(18,15,20,.92);
  border-bottom: 1px solid var(--rand);
  backdrop-filter: blur(12px);
  position: sticky; top: 0; z-index: 20;
}
/* Im Chat sitzt der Kopf im Flex-Stapel und braucht kein `sticky` — als sticky-Element
   zaehlt er bei der Hoehenverteilung sonst doppelt. */
body.seite-chat > .kopf { position: static; }
.marke {
  font-family: var(--serif); font-size: 1.15rem; letter-spacing: .04em;
  color: var(--schrift); text-decoration: none;
}
.marke::first-letter { color: var(--warm); }
.kopf nav { display: flex; align-items: center; gap: .2rem; }
.kopf nav a, .abmelden button {
  color: var(--schrift-2); font-size: .82rem; padding: .45rem .6rem;
  border-radius: 10px; background: none; border: 0; cursor: pointer;
  font-family: var(--sans);
}
.kopf nav a:hover, .abmelden button:hover {
  background: var(--flaeche-2); color: var(--schrift); text-decoration: none;
}
.abmelden { display: inline; margin: 0; }

/* ------------------------------------------------------------------ Meldungen */

.meldungen { padding: .6rem 1rem 0; }
.meldung {
  margin: 0 auto .5rem; max-width: 34rem; padding: .7rem .9rem;
  border-radius: 12px; font-size: .9rem;
  background: var(--flaeche-2); border: 1px solid var(--rand);
}
.meldung.fehler { border-color: var(--warm-dunkel); color: #f0c3b6; }

/* ------------------------------------------------------------------ Anmeldung */

.seite-login { display: grid; place-items: center; min-height: 100vh; min-height: 100dvh; }
.anmeldung { width: 100%; padding: 1.2rem; }
.karte {
  max-width: 24rem; margin: 0 auto; padding: 2rem 1.6rem;
  background: linear-gradient(170deg, var(--flaeche), var(--grund));
  border: 1px solid var(--rand); border-radius: 24px;
  box-shadow: 0 24px 60px -30px #000, 0 0 0 1px rgba(224,138,111,.05);
  text-align: center;
}
.logo { display: grid; place-items: center; margin-bottom: 1rem; }
.logo-zeichen { width: 56px; height: 56px; color: var(--warm); }
.karte h1 { font-family: var(--serif); font-size: 1.7rem; letter-spacing: .02em; }
.unterzeile { color: var(--schrift-2); font-size: .9rem; }
.karte form { margin-top: 1.6rem; text-align: left; }
label { display: block; margin-bottom: .9rem; }
label span { display: block; font-size: .78rem; color: var(--schrift-2); margin-bottom: .3rem;
             letter-spacing: .03em; text-transform: uppercase; }
input[type=email], input[type=password], input[type=text] {
  width: 100%; padding: .75rem .85rem; font-size: 1rem; font-family: var(--sans);
  color: var(--schrift); background: var(--grund);
  border: 1px solid var(--rand); border-radius: 12px;
}
input:focus, textarea:focus {
  outline: none; border-color: var(--warm);
  box-shadow: 0 0 0 3px rgba(224,138,111,.14);
}
.knopf-haupt {
  width: 100%; padding: .8rem; margin-top: .4rem; cursor: pointer;
  font-size: .95rem; font-weight: 600; font-family: var(--sans);
  color: #2a1a14; background: linear-gradient(180deg, #eb9c80, var(--warm));
  border: 0; border-radius: 12px;
}
.knopf-haupt:hover { filter: brightness(1.06); }
.fussnote { margin-top: 1.4rem; font-size: .76rem; color: var(--schrift-3); }

/* ------------------------------------------------------------------ Inhaltsseiten */

.inhalt { max-width: 52rem; margin: 0 auto; padding: 1.4rem 1rem 3rem; }
.inhalt.schmal { max-width: 36rem; }
.leer { color: var(--schrift-3); font-size: .9rem; }

.figuren { display: grid; gap: .9rem; margin-top: 1.4rem; }
.figurkarte {
  display: block; padding: 1.1rem; text-decoration: none; color: inherit;
  background: var(--flaeche); border: 1px solid var(--rand); border-radius: var(--radius);
  position: relative; transition: border-color .15s, transform .15s;
}
.figurkarte:hover { border-color: var(--warm-dunkel); transform: translateY(-2px);
                    text-decoration: none; }
.figurkarte h2 { margin: .7rem 0 .2rem; font-size: 1.1rem; color: var(--schrift);
                 text-transform: none; letter-spacing: 0; font-weight: 600; }
.figurkarte p { color: var(--schrift-2); font-size: .88rem; margin: 0; }
.figurkarte.bald { opacity: .5; }

.bildnis {
  display: grid; place-items: center;
  width: 42px; height: 42px; border-radius: 50%;
  font-family: var(--serif); font-size: 1.2rem; color: #2a1a14;
  background: linear-gradient(145deg, var(--gold), var(--warm));
  flex: 0 0 auto;
}
.bildnis.gross { width: 54px; height: 54px; font-size: 1.5rem; }

.stufe {
  position: absolute; top: 1.1rem; right: 1.1rem;
  font-size: .68rem; letter-spacing: .04em; padding: .2rem .5rem;
  border-radius: 999px; border: 1px solid var(--rand); color: var(--schrift-2);
}
.stufe-erwachsen { border-color: var(--warm-dunkel); color: var(--warm); }

/* ------------------------------------------------------------------ Chat */

.chat { display: flex; flex-direction: column; height: 100%; min-height: 0; }

.figurkopf {
  display: flex; align-items: center; gap: .8rem;
  padding: .8rem 1rem; border-bottom: 1px solid var(--rand);
  background: var(--flaeche);
}
.figurkopf h1 { font-family: var(--serif); font-size: 1.1rem; margin: 0; }
.figurkopf p { margin: 0; font-size: .78rem; color: var(--schrift-3);
               display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical;
               overflow: hidden; }
.modus {
  margin-left: auto; font-size: .68rem; letter-spacing: .05em; text-transform: uppercase;
  color: var(--schrift-3); border: 1px solid var(--rand); border-radius: 999px;
  padding: .2rem .55rem;
}
.modus[data-wert=intim] { color: var(--warm); border-color: var(--warm-dunkel); }

.verlauf {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  padding: 1.1rem 1rem 1.4rem;
  display: flex; flex-direction: column; gap: .9rem;
  scrollbar-width: thin; scrollbar-color: var(--rand) transparent;
}

.blase {
  max-width: 88%; padding: .8rem 1rem; border-radius: var(--radius);
  animation: auftauchen .22s ease-out;
}
.blase p { margin: 0 0 .6rem; }
.blase p:last-child { margin-bottom: 0; }
.blase.eigen {
  align-self: flex-end; border-bottom-right-radius: 6px;
  background: linear-gradient(165deg, #3a2a2f, #2b1f26);
  border: 1px solid #45313a;
}
.blase.figur {
  align-self: flex-start; border-bottom-left-radius: 6px;
  background: var(--flaeche); border: 1px solid var(--rand);
  font-family: var(--serif); font-size: 1.02rem; line-height: 1.65;
}
.blase.figur .tat { color: var(--schrift-2); font-style: italic; }
.blase.eigen .tat { color: #c9a79b; font-style: italic; }
.blase.schreibt { color: var(--schrift-3); }
.blase.fehler { align-self: center; border-color: var(--warm-dunkel); color: #f0c3b6;
                font-family: var(--sans); font-size: .88rem; }

.punkte span {
  display: inline-block; width: 6px; height: 6px; margin-right: 3px; border-radius: 50%;
  background: var(--schrift-3); animation: wippen 1.1s infinite;
}
.punkte span:nth-child(2) { animation-delay: .15s; }
.punkte span:nth-child(3) { animation-delay: .3s; }

@keyframes wippen { 0%,60%,100% { opacity: .25; transform: translateY(0); }
                    30% { opacity: 1; transform: translateY(-3px); } }
@keyframes auftauchen { from { opacity: 0; transform: translateY(6px); } }

.eingabe {
  flex: 0 0 auto; padding: .7rem 1rem;
  padding-bottom: calc(.7rem + env(safe-area-inset-bottom));
  border-top: 1px solid var(--rand); background: var(--flaeche);
}
.feld { display: flex; align-items: flex-end; gap: .6rem; }
.feld textarea {
  flex: 1 1 auto; resize: none; max-height: 40vh;
  padding: .7rem .9rem; font-size: 1rem; font-family: var(--sans); line-height: 1.5;
  color: var(--schrift); background: var(--grund);
  border: 1px solid var(--rand); border-radius: 14px;
}
#senden {
  flex: 0 0 auto; width: 44px; height: 44px; display: grid; place-items: center;
  cursor: pointer; border: 0; border-radius: 50%; color: #2a1a14;
  background: linear-gradient(180deg, #eb9c80, var(--warm));
}
#senden svg { width: 20px; height: 20px; margin-left: 2px; }
#senden:disabled { opacity: .4; cursor: default; }
.zeile-unten {
  display: flex; justify-content: space-between; gap: 1rem; margin-top: .45rem;
  font-size: .7rem; color: var(--schrift-3);
}
.zaehler.warnung { color: var(--gefahr); }
.hinweis { text-align: right; }

/* ------------------------------------------------------------------ Gedaechtnis */

.fakten { list-style: none; margin: 1.2rem 0 0; padding: 0; display: grid; gap: .7rem; }
.fakt {
  display: grid; grid-template-columns: 1fr; gap: .5rem;
  padding: .8rem; background: var(--flaeche);
  border: 1px solid var(--rand); border-radius: 14px;
}
.fakt .tasten { display: flex; gap: .4rem; }
.fakt .quelle { font-size: .68rem; color: var(--schrift-3); letter-spacing: .03em; }
.fakt.neu { margin-top: 1.1rem; border-style: dashed; }
.knopf-klein {
  padding: .45rem .7rem; font-size: .8rem; cursor: pointer; font-family: var(--sans);
  color: var(--schrift); background: var(--flaeche-2);
  border: 1px solid var(--rand); border-radius: 10px;
}
.knopf-klein:hover { border-color: var(--warm-dunkel); }
.knopf-klein.gefahr:hover { border-color: var(--gefahr); color: #f0c3b6; }

/* ------------------------------------------------------------------ Stilpflege */

.messlatte {
  margin: 1.2rem 0; padding: .8rem 1rem; font-size: .85rem; line-height: 1.6;
  color: var(--schrift-2); background: var(--flaeche);
  border: 1px solid var(--rand); border-left: 3px solid var(--gold);
  border-radius: 0 12px 12px 0;
}
.messlatte strong { color: var(--schrift); }

.beschreibung { margin: 0 0 1.4rem; display: grid; gap: .35rem .9rem;
                grid-template-columns: auto 1fr; font-size: .88rem; }
.beschreibung dt { color: var(--schrift-3); font-size: .75rem; letter-spacing: .04em;
                   text-transform: uppercase; padding-top: .15rem; }
.beschreibung dd { margin: 0; color: var(--schrift-2); }

.beispiel {
  margin-bottom: 1rem; padding: .8rem; background: var(--flaeche);
  border: 1px solid var(--rand); border-radius: 14px;
}
.beispiel.neu  { border-style: dashed; }
.beispiel.fest { background: var(--grund); }
.beispiel .kopfzeile {
  display: flex; flex-wrap: wrap; gap: .5rem; justify-content: space-between;
  align-items: baseline; margin-bottom: .5rem;
  font-size: .75rem; color: var(--schrift-3); letter-spacing: .03em;
}
.beispiel .werte { display: flex; gap: .7rem; flex-wrap: wrap; }
.beispiel .werte .gut { color: var(--gold); }
.beispiel .werte .ab  { color: var(--gefahr); }
.beispiel textarea {
  width: 100%; resize: vertical; min-height: 7rem;
  padding: .7rem .8rem; font-family: var(--serif); font-size: .95rem; line-height: 1.6;
  color: var(--schrift); background: var(--grund);
  border: 1px solid var(--rand); border-radius: 10px;
}
.beispiel pre {
  margin: 0; padding: .7rem .8rem; white-space: pre-wrap; word-break: break-word;
  font-family: var(--serif); font-size: .9rem; line-height: 1.6; color: var(--schrift-2);
  background: var(--flaeche); border: 1px solid var(--rand); border-radius: 10px;
}
.meldung.ok { border-color: #4a6a3a; color: #cde8bd; }

.warnungen {
  margin: 0 0 .6rem; padding: .5rem .8rem .5rem 1.8rem;
  list-style: square; font-size: .8rem; color: #f0c3b6;
  background: rgba(217,101,79,.08);
  border: 1px solid var(--warm-dunkel); border-radius: 10px;
}
.warnungen li { margin: .15rem 0; }

/* ------------------------------------------------------------------ Tabellen */

.tabelle-umhang { overflow-x: auto; border: 1px solid var(--rand); border-radius: 14px; }
.tabelle { width: 100%; border-collapse: collapse; font-size: .85rem; }
.tabelle th {
  text-align: left; padding: .6rem .8rem; white-space: nowrap;
  font-size: .7rem; letter-spacing: .05em; text-transform: uppercase;
  color: var(--schrift-3); background: var(--flaeche); border-bottom: 1px solid var(--rand);
}
.tabelle td { padding: .6rem .8rem; border-bottom: 1px solid #251e29; white-space: nowrap; }
.tabelle tr:last-child td { border-bottom: 0; }
.tabelle td.zahl { text-align: right; font-variant-numeric: tabular-nums; }
.tabelle td.zeit { color: var(--schrift-2); font-variant-numeric: tabular-nums; }
.rolle { font-size: .7rem; padding: .15rem .45rem; border-radius: 999px;
         border: 1px solid var(--rand); }
.rolle-admin { color: var(--gold); border-color: #5a4a2a; }
code { font-size: .82em; background: var(--flaeche-2); padding: .1rem .35rem;
       border-radius: 6px; }

/* ------------------------------------------------------------------ Breitbild */

@media (min-width: 700px) {
  .figuren { grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); }
  .blase { max-width: 72%; }
  .verlauf { padding: 1.6rem 1.6rem 2rem; }
  .verlauf, .eingabe > * { max-width: 46rem; margin-left: auto; margin-right: auto; }
  .eingabe { padding: .9rem 1.6rem 1.1rem; }
  .fakt { grid-template-columns: 1fr auto auto; align-items: center; }
  .fakt .quelle { order: 3; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
