/* ── hilfe/style.css – altersgerechte, ruhige Oberfläche ────────────────────
   Große Schrift, hoher Kontrast, große Bedienelemente. Warm wie die Hauptseite. */

:root {
  --bg:      #FAF8F3;
  --ink:     #2A2622;
  --muted:   #6B635B;
  --accent:  #B03A2E;
  --accent-d:#8E2C22;
  --klara:   #EFEAE0;
  --sie:     #DCEBE4;
  --line:    #E3DCD0;
  --ok:      #2E7D46;
  font-size: 21px;               /* große Grundschrift */
}

* { box-sizing: border-box; }

/* hidden-Attribut muss auch gegen eigene display-Regeln gewinnen. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, "Segoe UI", Roboto, Georgia, serif;
  line-height: 1.5;
}

body { min-height: 100vh; }

/* ── Anmeldung ───────────────────────────────────────────────────────────── */
.login-view { display: flex; align-items: center; justify-content: center; padding: 1.2rem; }

.card {
  width: 100%;
  max-width: 30rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: 1.8rem;
  box-shadow: 0 6px 24px rgba(0,0,0,.06);
}

.card h1 { margin: 0 0 .4rem; font-size: 1.9rem; color: var(--accent); }
.lead { margin: 0 0 1.4rem; color: var(--muted); }

.field { display: block; margin-bottom: 1.1rem; }
.field span { display: block; margin-bottom: .35rem; font-weight: 600; }
.field input {
  width: 100%;
  font-size: 1.05rem;
  padding: .8rem .9rem;
  border: 2px solid var(--line);
  border-radius: .7rem;
  background: #fff;
  color: var(--ink);
}
.field input:focus { outline: 3px solid #cfe3d8; border-color: var(--accent); }

.big-btn {
  width: 100%;
  font-size: 1.15rem;
  font-weight: 700;
  padding: .95rem 1rem;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: .8rem;
  cursor: pointer;
}
.big-btn:hover { background: var(--accent-d); }
.big-btn:disabled { opacity: .6; cursor: default; }

.note { margin: 1rem 0 0; padding: .7rem .9rem; border-radius: .6rem; background: #FBECEA; color: var(--accent-d); }

/* ── Chat: zweispaltig – links der Verlauf, rechts die Antwort ───────────────
   Die Seite selbst scrollt nicht; Verlauf und Antwort haben eigene
   Scrollbereiche. So beginnt jede Antwort immer oben an derselben Stelle. */
.chat-view { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: .8rem 1rem;
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.who { display: flex; align-items: center; gap: .6rem; font-weight: 700; }
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.1rem; height: 2.1rem; border-radius: 50%;
  background: var(--accent); color: #fff; font-family: Georgia, serif;
}
.link-btn { background: none; border: none; color: var(--accent); font-size: 1rem; text-decoration: underline; cursor: pointer; padding: .4rem; }

.workspace { flex: 1; min-height: 0; display: flex; }

/* ── Linke Spalte (1/3): Verlauf und Eingabe ─────────────────────────────── */
.side {
  flex: 0 0 33%;
  min-width: 15rem; max-width: 26rem;
  display: flex; flex-direction: column; min-height: 0;   /* min-height:0 → innen scrollbar */
  background: #fff;
  border-right: 1px solid var(--line);
}
.side-head { margin: 0; padding: .8rem 1rem .5rem; font-size: .8rem; color: var(--muted); }

.thread {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: 0 .8rem .8rem;
  display: flex; flex-direction: column; gap: .45rem;
  font-size: .85rem;
}
.turn {
  display: block; width: 100%; text-align: left;
  font: inherit; color: var(--ink);
  padding: .5rem .7rem;
  border: 1px solid transparent; border-radius: .7rem;
  word-wrap: break-word;
}
.turn.sie   { background: var(--sie); }
.turn.klara { background: var(--klara); cursor: pointer; }
.turn.klara:hover { border-color: var(--line); }
.turn.klara.active { background: #fff; border-color: var(--accent); box-shadow: inset .22rem 0 0 var(--accent); }
.turn.timnote { background: #EAF3EE; color: var(--ok); border: 1px dashed #B9D8C6; }
.turn-who { display: block; font-size: .72rem; font-weight: 700; color: var(--muted); margin-bottom: .1rem; }
.turn.klara.active .turn-who { color: var(--accent); }
/* Vorschau auf zwei Zeilen kürzen – der volle Text bleibt im DOM (für app.js). */
.turn-text { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.composer {
  padding: .7rem .8rem .4rem;
  border-top: 1px solid var(--line);
  background: #fff;
}
.composer-row { display: flex; gap: .5rem; align-items: flex-end; margin-bottom: .5rem; }
.composer textarea {
  flex: 1; min-width: 0;
  font-size: 1rem;
  font-family: inherit;
  padding: .7rem .8rem;
  border: 2px solid var(--line);
  border-radius: .8rem;
  resize: none;
  background: #fff; color: var(--ink);
}
.composer textarea:focus { outline: 3px solid #cfe3d8; border-color: var(--accent); }
.big-btn.send { width: 100%; padding: .8rem 1rem; }

/* ── Rechte Spalte (2/3): die aktuelle Antwort ───────────────────────────── */
.answer { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.answer-bar {
  display: flex; align-items: center; gap: .8rem; flex-wrap: wrap;
  padding: .55rem .9rem;
  background: #FBF3E8; border-bottom: 1px solid var(--line);
  font-size: .85rem; color: var(--muted);
}
.answer-bar .big-btn { width: auto; padding: .5rem 1rem; font-size: .95rem; }

.answer-body { flex: 1; min-height: 0; overflow-y: auto; padding: 1.5rem 1.8rem 3rem; }
.answer-text {
  max-width: 34rem;
  font-size: 1.12rem; line-height: 1.65;
  white-space: pre-wrap; word-wrap: break-word;
}
.answer-text.thinking { color: var(--muted); font-style: italic; }
.answer-text.error { background: #FBECEA; color: var(--accent-d); padding: .9rem 1.1rem; border-radius: .8rem; }
.answer-extra { max-width: 40rem; }

.badge-tim { font-size: .85rem; color: var(--ok); margin-top: 1rem; }

.icon-btn {
  font-size: 1.5rem; line-height: 1;
  width: 3.2rem; height: 3.2rem;
  border: 2px solid var(--line); border-radius: .8rem;
  background: #fff; cursor: pointer;
}
.icon-btn.listening { background: #FBECEA; border-color: var(--accent); animation: pulse 1.2s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(176,58,46,.35);} 50% { box-shadow: 0 0 0 .5rem rgba(176,58,46,0);} }

.hint { margin: 0; padding: 0 .9rem .8rem; background: #fff; color: var(--muted); font-size: .78rem; text-align: center; }

/* ── Suchergebnisse (Karten) ─────────────────────────────────────────────── */
.results { display: flex; flex-direction: column; gap: .7rem; margin-top: 1.2rem; }
.result-card { background: #fff; border: 1px solid var(--line); border-radius: .9rem; padding: .9rem 1rem; }
.result-thumb { display: block; width: 100%; max-height: 200px; object-fit: cover; border-radius: .6rem; margin-bottom: .6rem; cursor: pointer; background: #f0ece4; }
.result-title { font-weight: 700; font-size: 1.08rem; }
.result-host { color: var(--muted); font-size: .9rem; margin: .15rem 0 .4rem; }
.result-desc { margin-bottom: .8rem; }
.big-btn.view-btn { width: auto; padding: .7rem 1.4rem; font-size: 1.05rem; }

/* ── „Ansehen"-Ansicht (geteilt / Vollbild) ──────────────────────────────── */
body.viewer-open { overflow: hidden; }
.viewer { position: fixed; inset: 0; z-index: 50; background: var(--bg); display: flex; flex-direction: column; }
.viewer-bar { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; padding: .6rem .8rem; background: #fff; border-bottom: 1px solid var(--line); }
.viewer-bar .big-btn { width: auto; padding: .7rem 1.1rem; font-size: 1.05rem; }
.viewer-title { flex: 1; min-width: 7rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.big-btn.newtab { text-decoration: none; display: inline-block; text-align: center; }
.viewer-frame { position: relative; flex: 1; }
.viewer-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #fff; }
.viewer-hint { position: absolute; top: .6rem; left: 50%; transform: translateX(-50%); margin: 0; z-index: 1; background: rgba(255,255,255,.92); color: var(--muted); font-size: .9rem; padding: .35rem .8rem; border-radius: .5rem; pointer-events: none; }

/* Inhaltsbereich der „Ansehen"-Ansicht (Vorschau / Karte) */
.viewer-body { flex: 1; overflow: auto; padding: 1rem 1.2rem 2rem; display: flex; flex-direction: column; }
.reader-status { color: var(--muted); }
.reader-note { margin: 0 0 .6rem; color: var(--muted); font-size: .95rem; }
.reader-frame { flex: 1; min-height: 22rem; width: 100%; border: 1px solid var(--line); border-radius: .6rem; background: #fff; }
.reader-text { max-width: 42rem; margin: 0 auto; white-space: pre-wrap; word-wrap: break-word; font-size: 1.08rem; line-height: 1.6; }
.map-large { display: block; max-width: 100%; width: 42rem; margin: 0 auto; border-radius: .8rem; border: 1px solid var(--line); }
.map-info { max-width: 42rem; margin: 1rem auto 0; text-align: center; }
.map-info p { margin: 0 0 .8rem; }
.map-info .big-btn { width: auto; padding: .8rem 1.4rem; text-decoration: none; display: inline-block; }

/* Orte-Karten (Google Maps) */
.place-card { background: #fff; border: 1px solid var(--line); border-radius: .9rem; overflow: hidden; }
.place-map { display: block; width: 100%; height: auto; cursor: pointer; border-bottom: 1px solid var(--line); }
.place-body { padding: .8rem 1rem 1rem; }
.place-btns { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: .7rem; }
.place-btns .big-btn { width: auto; padding: .7rem 1.3rem; font-size: 1.05rem; text-decoration: none; display: inline-block; }

/* Vorlesen-Knopf unter der Antwort */
.speak-btn {
  display: block;
  margin-top: 1.1rem;
  padding: .45rem 1rem;
  font-size: 1rem;
  color: var(--muted);
  background: rgba(255,255,255,.65);
  border: 1px solid var(--line);
  border-radius: .5rem;
  cursor: pointer;
}
.speak-btn:hover { color: var(--ink); background: #fff; }

/* ── Schmales Fenster: untereinander, Antwort oben ────────────────────────
   Hier scrollt wieder die Seite. Alle flex:1-Regeln müssen zurückgesetzt
   werden – in einem Spaltencontainer mit height:auto würden Kinder mit
   flex:1 und min-height:0 sonst auf Höhe 0 zusammenfallen. */
@media (max-width: 62rem) {
  .chat-view { height: auto; min-height: 100vh; overflow: visible; }
  .workspace { flex: none; flex-direction: column; }
  .answer { order: 1; flex: none; }
  .answer-body { flex: none; overflow: visible; padding: 1.1rem 1.1rem 1.6rem; }
  .side {
    order: 2; flex: none; max-width: none;
    border-right: 0; border-top: 1px solid var(--line);
  }
  .thread { flex: none; max-height: 30vh; padding-top: .2rem; }
  .composer { position: sticky; bottom: 0; }
}

@media (max-width: 30rem) {
  :root { font-size: 20px; }
  .viewer-title { display: none; }
}
