/* ==========================================================================
   fakellm – sieht aus wie eine KI. Ist auch eine. Nur keine gute.
   ========================================================================== */

@font-face { font-family: "IBM Plex Mono"; src: url("fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("fonts/ibm-plex-mono-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }

:root {
  --bg: #f5f6fa;
  --flaeche: #ffffff;
  --leiste: #eceef4;
  --tinte: #1b1e2b;
  --leise: #5f6679;
  --linie: #dde1ea;
  --hover: #e2e5ee;
  --blase: #e8ebf3;
  --knopf: #1b1e2b;
  --knopf-tinte: #ffffff;
  --ki-1: #7b5cff;
  --ki-2: #e24fa8;
  --ki-3: #ff9f43;
  --verlauf: linear-gradient(120deg, var(--ki-1), var(--ki-2) 55%, var(--ki-3));
  --filter-bg: #fff4d8;
  --filter-rand: #e3a21a;
  --filter-tinte: #5a3f00;
  --ernst-bg: #e8f1ff;
  --ernst-rand: #3a78d8;
  --ernst-tinte: #12325c;
  --krise-bg: #e9f7ef;
  --krise-rand: #2e9c5a;
  --krise-tinte: #123d24;
  --code-bg: #151824;
  --code-kopf: #222638;
  --code-tinte: #e4e7f1;
  --schatten: 0 1px 2px rgba(20, 24, 40, .06), 0 8px 24px rgba(20, 24, 40, .08);
  --schrift: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --breite-leiste: 272px;
  --breite-chat: 760px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111319;
    --flaeche: #191c25;
    --leiste: #0c0e13;
    --tinte: #e7e9f1;
    --leise: #9aa1b5;
    --linie: #2a2e3c;
    --hover: #232735;
    --blase: #252a38;
    --knopf: #e7e9f1;
    --knopf-tinte: #111319;
    --filter-bg: #3a2c0a;
    --filter-rand: #d89a1c;
    --filter-tinte: #ffe3a3;
    --ernst-bg: #10233f;
    --ernst-rand: #5b95ee;
    --ernst-tinte: #d5e5ff;
    --krise-bg: #0f2a1b;
    --krise-rand: #42c077;
    --krise-tinte: #d3f3df;
    --code-bg: #0b0d12;
    --code-kopf: #171a25;
    --schatten: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--tinte);
  font: 400 1rem/1.6 var(--schrift);
  -webkit-font-smoothing: antialiased;
}
button, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--ki-1); outline-offset: 2px; }
.defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.vh {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.sprungmarke {
  position: absolute; left: 12px; top: -60px; z-index: 50;
  background: var(--knopf); color: var(--knopf-tinte); padding: 8px 14px; border-radius: 8px; text-decoration: none;
}
.sprungmarke:focus { top: 12px; }

/* Aufbau ------------------------------------------------------------------ */
.app {
  display: grid;
  grid-template-columns: var(--breite-leiste) minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
}

/* Seitenleiste ------------------------------------------------------------ */
.seitenleiste {
  display: flex; flex-direction: column; gap: 14px;
  background: var(--leiste);
  padding: 16px 12px 14px;
  min-height: 0;
}
.marke { display: flex; align-items: center; gap: 8px; padding: 4px 8px 6px; }
.marke-funken { width: 28px; height: 28px; }
.marke-name { font-weight: 700; font-size: 1.2rem; letter-spacing: -.02em; }
.marke-etikett {
  font-size: .68rem; font-weight: 700; letter-spacing: .02em;
  padding: 1px 7px 2px; border-radius: 999px;
  color: #fff; background: var(--verlauf);
}
.neuer-chat {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; border-radius: 10px;
  background: var(--flaeche); border: 1px solid var(--linie);
  font-weight: 600; text-align: left;
}
.neuer-chat:hover { background: var(--hover); }
.neuer-chat svg { width: 18px; height: 18px; }

.verlauf { flex: 1; overflow-y: auto; min-height: 0; margin: 0 -4px; padding: 0 4px; }
.verlauf ul { list-style: none; margin: 0 0 14px; padding: 0; }
.verlauf-gruppe { margin: 6px 10px 4px; font-size: .75rem; font-weight: 600; color: var(--leise); }
.verlauf-eintrag {
  display: block; width: 100%; text-align: left;
  padding: 7px 10px; border: 0; border-radius: 8px; background: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .92rem;
}
.verlauf-eintrag:hover { background: var(--hover); }

.seitenleiste-fuss { display: grid; gap: 10px; padding-top: 10px; border-top: 1px solid var(--linie); }
.pro-knopf {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 12px; border: 0; border-radius: 10px;
  background: var(--verlauf); color: #fff; font-weight: 700;
  box-shadow: 0 6px 18px rgba(226, 79, 168, .28);
}
.pro-knopf svg { width: 16px; height: 16px; }
.pro-knopf:hover { filter: brightness(1.06); }
.rechtliches { margin: 0; padding: 0 6px; font-size: .78rem; color: var(--leise); }
.rechtliches { display: flex; gap: 14px; flex-wrap: wrap; }
.rechtliches a { color: var(--leise); }
.rechtliches a:hover { color: var(--tinte); }

/* Hauptbereich ------------------------------------------------------------ */
.haupt {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 0;
  min-width: 0;
}
.kopf {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
}
.menu-knopf {
  display: none; width: 38px; height: 38px; padding: 7px;
  border: 0; border-radius: 10px; background: none;
}
.menu-knopf:hover { background: var(--hover); }
.modellwahl select {
  appearance: none; -webkit-appearance: none;
  border: 0; border-radius: 10px;
  padding: 7px 34px 7px 12px;
  font-weight: 600; font-size: 1.02rem;
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m7 10 5 5 5-5' fill='none' stroke='%23888ea0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 8px center / 18px;
  max-width: 62vw;
}
.modellwahl select:hover { background-color: var(--hover); }
.modellwahl select option { background: var(--flaeche); color: var(--tinte); }
.sprachwahl { margin-left: auto; display: flex; border: 1px solid var(--linie); border-radius: 999px; padding: 2px; background: var(--flaeche); }
.sprachwahl button {
  border: 0; background: none; border-radius: 999px;
  padding: 3px 10px; font-size: .8rem; font-weight: 600; color: var(--leise);
}
.sprachwahl button[aria-pressed="true"] { background: var(--knopf); color: var(--knopf-tinte); }
.sprachwahl a {
  border-radius: 999px; padding: 3px 10px; font-size: .8rem; font-weight: 600;
  color: var(--leise) !important; text-decoration: none;
}
.sprachwahl a:hover { color: var(--tinte) !important; }
.sprachwahl a[aria-current="page"] { background: var(--knopf); color: var(--knopf-tinte) !important; }

/* Chat -------------------------------------------------------------------- */
.chat { overflow-y: auto; min-height: 0; padding: 0 16px; scroll-padding-bottom: 24px; }

.leer {
  max-width: var(--breite-chat); margin: 0 auto; min-height: 100%;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  text-align: center; padding: 24px 0 32px;
}
.leer[hidden] { display: none; }
.leer-funken { width: 56px; height: 56px; margin-bottom: 10px; }
.leer h1 {
  margin: 0 0 28px;
  font-size: clamp(1.7rem, 4.2vw, 2.4rem); line-height: 1.15; font-weight: 650; letter-spacing: -.025em;
  background: var(--verlauf); -webkit-background-clip: text; background-clip: text; color: transparent;
  text-wrap: balance;
}
.vorschlaege { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; width: 100%; }
.vorschlag {
  text-align: left; padding: 12px 14px; border-radius: 14px;
  background: var(--flaeche); border: 1px solid var(--linie);
  font-size: .94rem; line-height: 1.4; color: var(--tinte);
}
.vorschlag:hover { border-color: var(--leise); }
.privat { margin: 22px 0 0; max-width: 34rem; font-size: .84rem; color: var(--leise); }
.noscript { margin-top: 18px; font-weight: 600; }

.nachrichten { list-style: none; margin: 0 auto; padding: 18px 0 28px; max-width: var(--breite-chat); }
.nachricht { margin: 0 0 22px; }
.nutzer { display: flex; justify-content: flex-end; }
.blase {
  max-width: min(78%, 560px);
  background: var(--blase); padding: 10px 15px; border-radius: 18px 18px 6px 18px;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.assistent { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 12px; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--flaeche); border: 1px solid var(--linie);
}
.avatar svg { width: 18px; height: 18px; }
.assistent[aria-busy="true"] .avatar svg { animation: drehen 2.4s linear infinite; }
@keyframes drehen { to { transform: rotate(360deg); } }
.koerper { min-width: 0; padding-top: 3px; }

/* Nachdenken */
.denken { margin: 0 0 6px; }
.denken summary {
  display: inline-flex; align-items: center; gap: 6px;
  list-style: none; cursor: pointer; color: var(--leise); font-size: .92rem;
  padding: 2px 0;
}
.denken summary::-webkit-details-marker { display: none; }
.denken summary::after {
  content: ""; width: 7px; height: 7px; margin-left: 2px;
  border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor;
  transform: rotate(-45deg); transition: transform .15s;
}
.denken[open] summary::after { transform: rotate(45deg); }
.denken-titel.laeuft {
  background: linear-gradient(90deg, var(--leise) 0%, var(--leise) 35%, var(--tinte) 50%, var(--leise) 65%, var(--leise) 100%);
  background-size: 300% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: schimmer 1.6s linear infinite;
}
@keyframes schimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
.denken-schritte {
  margin: 6px 0 8px; padding: 2px 0 2px 16px;
  border-left: 2px solid var(--linie); list-style: none;
  color: var(--leise); font-size: .9rem; line-height: 1.5;
}
.denken-schritte li + li { margin-top: 4px; }
.denken-aktuell { margin: 0 0 8px; padding-left: 16px; border-left: 2px solid var(--linie); color: var(--leise); font-size: .9rem; font-style: italic; }

/* Antworttext */
.antwort { overflow-wrap: anywhere; }
.antwort > :first-child { margin-top: 0; }
.antwort p { margin: 0 0 .85em; }
.antwort h2, .antwort h3, .antwort h4 { margin: 1.1em 0 .45em; line-height: 1.3; letter-spacing: -.01em; }
.antwort h2 { font-size: 1.25rem; }
.antwort h3 { font-size: 1.1rem; }
.antwort h4 { font-size: 1rem; }
.antwort ul, .antwort ol { margin: 0 0 .9em; padding-left: 1.4em; }
.antwort li { margin: .25em 0; }
.antwort blockquote { margin: 0 0 .9em; padding: .3em 0 .3em 1em; border-left: 3px solid var(--linie); color: var(--leise); }
.antwort blockquote p { margin: 0; }
.antwort hr { border: 0; border-top: 1px solid var(--linie); margin: 1.1em 0; }
.antwort code { font-family: var(--mono); font-size: .88em; background: var(--blase); padding: .1em .35em; border-radius: 5px; }
.antwort em { color: var(--leise); }
.code { margin: 0 0 1em; border-radius: 12px; overflow: hidden; background: var(--code-bg); color: var(--code-tinte); }
.code-kopf {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 10px 6px 14px; background: var(--code-kopf);
  font: 400 .78rem var(--mono); color: #a7aec4;
}
.code-kopieren { border: 0; background: none; color: #c7cce0; font-size: .78rem; padding: 3px 8px; border-radius: 6px; }
.code-kopieren:hover { background: rgba(255, 255, 255, .08); }
.code pre { margin: 0; padding: 14px 16px; overflow-x: auto; }
.code code { font: 400 .88rem/1.6 var(--mono); background: none; padding: 0; color: inherit; }
.tabelle { overflow-x: auto; margin: 0 0 1em; }
.tabelle table { border-collapse: collapse; min-width: 50%; }
.tabelle th, .tabelle td { border: 1px solid var(--linie); padding: 7px 12px; text-align: left; }
.tabelle th { background: var(--blase); font-weight: 600; }
.cursor {
  display: inline-block; width: .55em; height: 1.05em; margin-left: 2px;
  vertical-align: -.15em; border-radius: 2px; background: var(--verlauf);
  animation: blinken 1s steps(1) infinite;
}
@keyframes blinken { 50% { opacity: 0; } }

/* Banner: Filter, ernst gemeint, Krise */
.banner {
  display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; align-items: start;
  margin: 2px 0 12px; padding: 10px 14px; border-radius: 12px;
  border: 1px solid; font-size: .92rem; line-height: 1.45;
}
.banner p { margin: 0; }
.banner-icon svg { width: 22px; height: 22px; display: block; }
.banner-titel { font-weight: 700; }
.banner-filter { background: var(--filter-bg); border-color: var(--filter-rand); color: var(--filter-tinte); }
.banner-ernst { background: var(--ernst-bg); border-color: var(--ernst-rand); color: var(--ernst-tinte); }
.banner-krise { background: var(--krise-bg); border-color: var(--krise-rand); color: var(--krise-tinte); }

/* Aktionen unter der Antwort */
.aktionen { display: flex; gap: 2px; margin-top: 2px; }
.aktion {
  width: 32px; height: 32px; padding: 7px; border: 0; border-radius: 8px;
  background: none; color: var(--leise);
}
.aktion:hover { background: var(--hover); color: var(--tinte); }
.aktion[aria-pressed="true"] { color: var(--ki-1); }
.aktion svg { width: 18px; height: 18px; display: block; }

/* Eingabe ----------------------------------------------------------------- */
.formular { padding: 8px 16px 12px; }
.eingabe-feld {
  position: relative; max-width: var(--breite-chat); margin: 0 auto;
  display: flex; align-items: flex-end; gap: 8px;
  background: var(--flaeche); border: 1px solid var(--linie); border-radius: 26px;
  padding: 8px 8px 8px 18px; box-shadow: var(--schatten);
}
.eingabe-feld:focus-within { border-color: var(--leise); }
.eingabe-feld textarea {
  flex: 1; resize: none; border: 0; outline: 0; background: none;
  padding: 8px 0; max-height: 220px; line-height: 1.5; font-size: 1rem;
}
.eingabe-feld textarea::placeholder { color: var(--leise); }
.senden, .stopp {
  flex: none; width: 38px; height: 38px; padding: 8px;
  border: 0; border-radius: 50%; background: var(--knopf); color: var(--knopf-tinte);
}
.senden:disabled { opacity: .3; cursor: default; }
.senden svg, .stopp svg { width: 22px; height: 22px; display: block; }
.hinweis { max-width: var(--breite-chat); margin: 8px auto 0; text-align: center; font-size: .76rem; color: var(--leise); }

/* Toast ------------------------------------------------------------------- */
.toast {
  position: fixed; left: 50%; bottom: 110px; z-index: 40;
  transform: translate(-50%, 8px); opacity: 0;
  max-width: min(92vw, 460px);
  background: var(--knopf); color: var(--knopf-tinte);
  padding: 10px 16px; border-radius: 12px; font-size: .9rem; line-height: 1.4;
  box-shadow: var(--schatten); transition: opacity .2s, transform .2s;
}
.toast.sichtbar { opacity: 1; transform: translate(-50%, 0); }

/* Pro-Dialog -------------------------------------------------------------- */
.pro {
  width: min(94vw, 860px); max-height: 90vh; padding: 0;
  border: 1px solid var(--linie); border-radius: 20px;
  background: var(--flaeche); color: var(--tinte); box-shadow: var(--schatten);
}
.pro::backdrop { background: rgba(10, 12, 20, .5); }
#pro-inhalt { padding: 26px 24px 22px; }
.pro-titel {
  margin: 0; font-size: 1.6rem; letter-spacing: -.02em; text-align: center;
  background: var(--verlauf); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.pro-untertitel { margin: 4px 0 20px; text-align: center; color: var(--leise); }
.tarife { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.tarif { border: 1px solid var(--linie); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; }
.tarif.hervorgehoben { border: 2px solid transparent; background: linear-gradient(var(--flaeche), var(--flaeche)) padding-box, var(--verlauf) border-box; }
.tarif h3 { margin: 0; font-size: 1.1rem; }
.tarif-preis { margin: 4px 0 10px; font-weight: 700; font-size: 1.15rem; }
.tarif ul { margin: 0 0 14px; padding-left: 1.1em; font-size: .9rem; color: var(--leise); flex: 1; }
.tarif li { margin: .3em 0; }
.tarif-knopf { border: 0; border-radius: 10px; padding: 9px 12px; background: var(--knopf); color: var(--knopf-tinte); font-weight: 600; }
.tarif.hervorgehoben .tarif-knopf { background: var(--verlauf); color: #fff; }
.tarif-aktuell { margin: 0; text-align: center; padding: 9px 12px; border-radius: 10px; background: var(--blase); font-weight: 600; font-size: .9rem; }
.pro-schliessen { display: block; margin: 16px auto 0; border: 0; background: none; color: var(--leise); text-decoration: underline; }

/* Rechtsseiten ------------------------------------------------------------ */
.rechtsseite { max-width: 46rem; margin: 0 auto; padding: 32px 20px 64px; }
.rechtsseite-kopf { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 26px; }
.rechtsseite .zurueck { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 700; }
.rechtsseite .zurueck svg { width: 24px; height: 24px; }
.rechtsseite h1 { font-size: 2rem; letter-spacing: -.02em; margin: 0 0 16px; }
.rechtsseite h2 { font-size: 1.15rem; margin: 28px 0 8px; }
.rechtsseite p, .rechtsseite li { color: var(--tinte); }
.rechtsseite a { color: var(--ki-1); }
.rechtsseite .zurueck { color: var(--tinte); }
.rechtsseite-sprache { font-size: .9rem; color: var(--leise) !important; margin-top: -6px; }
.fehlerseite { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 40px 20px; }
.fehlerseite-funken { width: 56px; height: 56px; }
.fehlerseite-code { margin: 6px 0 0; font: 600 3.4rem/1 var(--mono); background: var(--verlauf); -webkit-background-clip: text; background-clip: text; color: transparent; }
.fehlerseite h1 { font-size: 1.6rem; letter-spacing: -.02em; margin: 14px 0 8px; }
.fehlerseite p { max-width: 34rem; margin: 6px 0; }
.fehlerseite-sprache { margin-top: 14px !important; font-size: .92rem; }
.fehlerseite-sprache a { color: var(--leise); }
.fehlerseite-knopf { display: inline-block; margin-top: 18px; padding: 10px 18px; border-radius: 999px; background: var(--knopf); color: var(--knopf-tinte); text-decoration: none; font-weight: 700; }
.rechtsseite-weiter { margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--linie); }
.rechtsseite-schluss { margin-top: 36px; font-weight: 700; background: var(--verlauf); -webkit-background-clip: text; background-clip: text; color: transparent !important; }

/* Kleine Bildschirme ------------------------------------------------------ */
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .seitenleiste {
    position: fixed; inset: 0 auto 0 0; z-index: 30; width: min(84vw, 300px);
    transform: translateX(-100%); transition: transform .22s ease;
    box-shadow: var(--schatten);
  }
  .menu-offen .seitenleiste { transform: none; }
  .schleier { position: fixed; inset: 0; z-index: 20; background: rgba(10, 12, 20, .45); }
  .menu-knopf { display: block; }
  .kopf { padding: 8px 10px; gap: 4px; }
  .tarife { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .vorschlaege { grid-template-columns: minmax(0, 1fr); }
  .vorschlag:nth-child(n+3) { display: none; }
  .chat { padding: 0 12px; }
  .formular { padding: 6px 10px 10px; }
  .blase { max-width: 88%; }
  .assistent { grid-template-columns: minmax(0, 1fr); }
  .avatar { display: none; }
  .modellwahl select { font-size: .95rem; padding-left: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .denken-titel.laeuft { color: var(--leise); background: none; }
}
