/* Jarvis – Gestaltung. Mobil zuerst (~412 px), Tablet/Desktop mit zwei Spalten.
   Dunkel: Nachtblau + kühles Cyan, warme Akzentfarbe für Warnungen. Hell nach System. */

:root {
  color-scheme: dark light;
  --grund: #0A1222;
  --grund-tief: #070D1B;
  --flaeche: #111C33;
  --flaeche-2: #16233E;
  --flaeche-3: #1E2E4E;
  --linie: rgba(140, 170, 220, 0.16);
  --linie-stark: rgba(140, 170, 220, 0.3);
  --text: #E7EEF9;
  --text-2: #A3B4CE;
  --text-3: #7A8DAB;
  --akzent: #3CCFEA;
  --akzent-text: #03222C;
  --akzent-weich: rgba(60, 207, 234, 0.13);
  --akzent-linie: rgba(60, 207, 234, 0.45);
  --warm: #F5A524;
  --warm-text: #2A1A00;
  --warm-weich: rgba(245, 165, 36, 0.12);
  --warm-linie: rgba(245, 165, 36, 0.5);
  --gefahr: #FF7F7F;
  --gefahr-weich: rgba(255, 127, 127, 0.12);
  --ok: #4ED7A0;
  --ok-weich: rgba(78, 215, 160, 0.13);
  --eigen: #0F4B60;
  --eigen-text: #EAF8FC;
  --eigen-neben: rgba(234, 248, 252, 0.7);
  --blase: #132039;
  --kopf: rgba(10, 18, 34, 0.86);
  --schatten: 0 10px 28px rgba(0, 0, 0, 0.4);
  --marke-j: #EAF6FC;
  --mono: ui-monospace, "Cascadia Mono", "Roboto Mono", "SF Mono", Menlo, Consolas, monospace;
  --oben: env(safe-area-inset-top, 0px);
  --unten: env(safe-area-inset-bottom, 0px);
  --links: env(safe-area-inset-left, 0px);
  --rechts: env(safe-area-inset-right, 0px);
}

@media (prefers-color-scheme: light) {
  :root {
    --grund: #EEF2F8;
    --grund-tief: #E2E8F1;
    --flaeche: #FFFFFF;
    --flaeche-2: #F3F6FA;
    --flaeche-3: #E6ECF4;
    --linie: rgba(20, 40, 80, 0.12);
    --linie-stark: rgba(20, 40, 80, 0.24);
    --text: #0E1A2E;
    --text-2: #46566F;
    --text-3: #5A6A83;
    --akzent: #077A97;
    --akzent-text: #FFFFFF;
    --akzent-weich: rgba(7, 122, 151, 0.1);
    --akzent-linie: rgba(7, 122, 151, 0.4);
    --warm: #A65F00;
    --warm-text: #FFFFFF;
    --warm-weich: #FFF4E0;
    --warm-linie: rgba(166, 95, 0, 0.45);
    --gefahr: #B42318;
    --gefahr-weich: #FDECEA;
    --ok: #157F55;
    --ok-weich: #E3F6EE;
    --eigen: #D2EEF6;
    --eigen-text: #0B2530;
    --eigen-neben: rgba(11, 37, 48, 0.62);
    --blase: #FFFFFF;
    --kopf: rgba(238, 242, 248, 0.88);
    --schatten: 0 8px 24px rgba(20, 40, 80, 0.14);
    --marke-j: #0E1A2E;
  }
}

/* ---------------------------------------------------------------- Grundlagen */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--grund);
  color: var(--text);
}

body {
  font: 400 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overscroll-behavior: none;
}

button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--akzent); }
h1, h2, p { margin: 0; }

:focus-visible {
  outline: 2px solid var(--akzent);
  outline-offset: 2px;
}

.nur-sr {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.ohne-js { padding: 24px; text-align: center; }

.symbol {
  width: 22px;
  height: 22px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.symbol--klein { width: 16px; height: 16px; }

.marke {
  display: block;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.marke-ring { stroke: var(--akzent); stroke-width: 2.4; }
.marke-punkt { fill: var(--akzent); stroke: none; }
.marke-j { stroke: var(--marke-j); stroke-width: 3.6; }

.kreisel {
  display: inline-block;
  width: 20px;
  height: 20px;
  flex: none;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: drehen 0.8s linear infinite;
  vertical-align: -4px;
}
.kreisel--klein { width: 14px; height: 14px; vertical-align: -2px; }

@keyframes drehen { to { transform: rotate(360deg); } }
@keyframes hinein { from { opacity: 0; transform: translateY(8px); } }
@keyframes pulsieren {
  0%, 100% { box-shadow: 0 0 0 0 var(--warm-linie); }
  50% { box-shadow: 0 0 0 8px transparent; }
}
@keyframes tippen {
  0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

/* ---------------------------------------------------------------- Knöpfe */

.knopf {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--flaeche-3);
  color: var(--text);
  font-weight: 650;
  font-size: 15px;
  text-decoration: none;
  transition: transform 0.08s ease, background-color 0.15s ease, opacity 0.15s ease;
}
.knopf:active:not(:disabled) { transform: scale(0.98); }
.knopf:disabled { opacity: 0.55; cursor: default; }
.knopf--primaer { background: var(--akzent); color: var(--akzent-text); }
.knopf--warm { background: var(--warm); color: var(--warm-text); }
.knopf--leise { background: transparent; border-color: var(--linie-stark); }
.knopf--gefahr { background: transparent; border-color: var(--gefahr); color: var(--gefahr); }
.knopf--breit { width: 100%; }

.symbolknopf {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-2);
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.symbolknopf:hover { background: var(--flaeche-2); color: var(--text); }
.symbolknopf:disabled { opacity: 0.5; cursor: default; }

/* ---------------------------------------------------------------- App-Gerüst */

.app {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.startbild {
  flex: 1;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 18px;
  padding: calc(24px + var(--oben)) 24px calc(24px + var(--unten));
  color: var(--text-2);
  text-align: center;
}
.startbild .marke { width: 76px; height: 76px; }
.marke--dreht .marke-ring { transform-origin: 24px 24px; animation: drehen 2.4s linear infinite; }
.marke--dreht .marke-punkt { transform-origin: 24px 24px; animation: drehen 2.4s linear infinite; }

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

.seitenleiste,
.hauptbereich {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

@media (max-width: 899.98px) {
  .hauptlayout[data-route="raeume"] .hauptbereich { display: none; }
  .hauptlayout:not([data-route="raeume"]) .seitenleiste { display: none; }
}

@media (min-width: 900px) {
  .seitenleiste {
    flex: 0 0 340px;
    border-right: 1px solid var(--linie);
    background: color-mix(in oklab, var(--grund) 70%, var(--grund-tief));
  }
  .nur-mobil { display: none !important; }
}
@media (min-width: 1280px) {
  .seitenleiste { flex-basis: 380px; }
}

/* Kopfzeilen */
.kopf {
  position: relative;
  z-index: 3;
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: calc(60px + var(--oben));
  padding: var(--oben) max(10px, var(--rechts)) 0 max(10px, var(--links));
  background: var(--kopf);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--linie);
}
.kopf--marke { padding-left: max(18px, var(--links)); gap: 12px; }
.marke-klein { width: 34px; height: 34px; }
.marke-name { flex: 1; font-size: 21px; font-weight: 750; letter-spacing: 0.02em; }
.kopf-text { flex: 1; min-width: 0; padding-left: 4px; }
/* Titel ist nur Fokusziel nach dem Ansichtswechsel (tabindex=-1, Screenreader) – kein Bedienelement, kein Rahmen */
.kopf-titel[tabindex="-1"]:focus { outline: none; }
.kopf-titel {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kopf-unter {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kopf-stumm { display: inline-flex; color: var(--text-3); }

/* Verbindungshinweis */
.verbindung {
  position: fixed;
  z-index: 40;
  top: calc(var(--oben) + 68px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100vw - 32px);
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--warm);
  color: var(--warm-text);
  font-size: 13px;
  font-weight: 650;
  box-shadow: var(--schatten);
  animation: hinein 0.2s ease-out;
}

/* Toasts */
.hinweise {
  position: fixed;
  z-index: 60;
  left: 50%;
  bottom: calc(92px + var(--unten));
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(calc(100vw - 32px), 460px);
  pointer-events: none;
}
.hinweis {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--linie-stark);
  border-radius: 14px;
  background: var(--flaeche-3);
  color: var(--text);
  font-size: 14.5px;
  box-shadow: var(--schatten);
  pointer-events: auto;
  animation: hinein 0.2s ease-out;
}
.hinweis--fehler { border-color: var(--gefahr); }
.hinweis--ok { border-color: var(--ok); }
.hinweis-text { flex: 1; }
.hinweis-aktion {
  flex: none;
  min-height: 36px;
  padding: 0 6px;
  border: 0;
  background: none;
  color: var(--akzent);
  font-weight: 700;
}

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

.anmelden {
  flex: 1;
  overflow-y: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(28px + var(--oben)) max(20px, var(--rechts)) calc(28px + var(--unten)) max(20px, var(--links));
  background:
    radial-gradient(120% 70% at 50% -10%, var(--akzent-weich), transparent 65%),
    var(--grund);
}
.anmelden-karte { width: min(100%, 400px); }
.anmelden-marke { width: 88px; height: 88px; margin: 0 auto 14px; }
.anmelden h1 { text-align: center; font-size: 32px; font-weight: 750; letter-spacing: 0.02em; }
.anmelden-unterzeile { margin: 4px 0 28px; text-align: center; color: var(--text-2); }

.feld { display: block; margin-bottom: 16px; }
.feld-label { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 600; color: var(--text-2); }
.feld-eingabe {
  width: 100%;
  min-height: 50px;
  padding: 0 14px;
  border: 1px solid var(--linie-stark);
  border-radius: 12px;
  background: var(--flaeche);
  font-size: 16px;
}
.feld-eingabe:focus {
  outline: none;
  border-color: var(--akzent);
  box-shadow: 0 0 0 3px var(--akzent-weich);
}
.feld-hilfe { display: block; margin-top: 6px; font-size: 13px; color: var(--text-3); }
.passwort-rahmen { position: relative; }
.passwort-rahmen .feld-eingabe { padding-right: 52px; }
.passwort-zeigen { position: absolute; top: 3px; right: 3px; }
.formfehler {
  margin-bottom: 16px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--gefahr-weich);
  color: var(--gefahr);
  font-size: 14.5px;
}
.anmelden-form .knopf { margin-top: 8px; min-height: 50px; font-size: 16px; }

/* ---------------------------------------------------------------- Raumliste */

.raumliste {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px max(8px, var(--rechts)) calc(20px + var(--unten)) max(8px, var(--links));
}
.raumliste-liste { margin: 0; padding: 0; list-style: none; }
.raumliste-leer { padding: 24px 16px; color: var(--text-2); text-align: center; }

.raum-eintrag {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 72px;
  padding: 10px 12px;
  border-radius: 16px;
  color: inherit;
  text-decoration: none;
  transition: background-color 0.15s ease;
}
.raum-eintrag:hover { background: var(--flaeche-2); }
.raum-eintrag[aria-current="page"] { background: var(--akzent-weich); }

.raum-avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--flaeche-2);
  border: 1px solid var(--linie);
  color: var(--akzent);
}
.raum-avatar .symbol { width: 24px; height: 24px; }
.raum-avatar .marke { width: 34px; height: 34px; }
.raum-avatar--direkt { border-color: var(--akzent-linie); background: var(--flaeche); }
.raum-avatar--meldungen { color: var(--warm); }
.raum-avatar--klein { width: 38px; height: 38px; }
.raum-avatar--klein .symbol { width: 20px; height: 20px; }
.raum-avatar--klein .marke { width: 28px; height: 28px; }

.raum-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.raum-zeile { display: flex; align-items: center; gap: 8px; min-width: 0; }
.raum-name {
  flex: 1;
  min-width: 0;
  font-weight: 650;
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.raum-zeit { flex: none; font-size: 12.5px; color: var(--text-3); }
.raum-eintrag--ungelesen .raum-zeit { color: var(--akzent); font-weight: 650; }
.raum-vorschau {
  flex: 1;
  min-width: 0;
  font-size: 14.5px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.raum-eintrag--ungelesen .raum-vorschau { color: var(--text); }
.raum-vorschau--status { color: var(--akzent) !important; font-style: italic; }
.raum-stumm { color: var(--text-3); }

.zaehler {
  display: inline-grid;
  place-items: center;
  flex: none;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 11px;
  background: var(--akzent);
  color: var(--akzent-text);
  font-size: 12.5px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}
.zaehler--stumm { background: var(--flaeche-3); color: var(--text-2); }

/* Leere Hauptfläche (Desktop) */
.leer {
  flex: 1;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  padding: 24px;
  color: var(--text-2);
  text-align: center;
}
.leer p { max-width: 420px; }
.leer-titel { font-size: 20px; font-weight: 700; color: var(--text); }
.marke-leer { width: 96px; height: 96px; margin-bottom: 4px; }

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

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

.verlauf-rahmen {
  position: relative;
  flex: 1;
  display: flex;
  min-height: 0;
}

.verlauf {
  position: relative;
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 6px max(10px, var(--rechts)) 14px max(10px, var(--links));
}
.verlauf:focus-visible { outline-offset: -3px; }

.verlauf-anfang {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 8px 0;
  font-size: 13px;
  color: var(--text-3);
}
.verlauf-anfang:empty { min-height: 0; padding: 0; }

.verlauf-innen {
  display: flex;
  flex-direction: column;
  max-width: 860px;
  margin: 0 auto;
}

/* Ein Container je Kalendertag: der klebende Datumstrenner bleibt nur innerhalb seines Tages oben stehen und wird
   vom nächsten Tag hinausgeschoben – so stapeln sich keine Trenner. */
.tag {
  display: flex;
  flex-direction: column;
}

.datum-trenner {
  position: sticky;
  top: 4px;
  z-index: 2;
  align-self: center;
  margin: 16px 0 4px;
  padding: 4px 12px;
  border: 1px solid var(--linie);
  border-radius: 999px;
  background: color-mix(in oklab, var(--flaeche-2) 84%, transparent);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 650;
  pointer-events: none; /* verdeckt nie einen Knopf darunter */
  transition: opacity 0.3s ease;
}
/* Nach dem Scrollen blendet der oben klebende Trenner aus und gibt die oberste Nachricht frei. */
.verlauf:not(.verlauf--rollt) .tag--klebt > .datum-trenner { opacity: 0; }

.neu-trenner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0 2px;
  color: var(--akzent);
  font-size: 11.5px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.neu-trenner::before,
.neu-trenner::after { content: ""; flex: 1; height: 1px; background: var(--akzent-linie); }

/* Zeilen und Blasen */
.zeile {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 12px;
}
.zeile--neu { animation: hinein 0.18s ease-out; }
.zeile--folge { margin-top: 3px; }
.zeile--eigen { justify-content: flex-end; }
.zeile--system { justify-content: center; }

.avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--farbe, #6E83A3);
  color: #0A1222;
  font-size: 14px;
  font-weight: 750;
}
.avatar--platz { height: 1px; background: none; }
.avatar--jarvis { background: var(--flaeche); border: 1px solid var(--akzent-linie); }
.avatar--jarvis .marke { width: 24px; height: 24px; }
.avatar--gross { width: 44px; height: 44px; font-size: 18px; }

.blase {
  position: relative;
  max-width: min(82%, 620px);
  min-width: 0;
  padding: 7px 12px 5px;
  border: 1px solid var(--linie);
  border-radius: 18px;
  background: var(--blase);
  overflow-wrap: anywhere;
}
.blase--breit { width: min(82%, 520px); }
.zeile--person:not(.zeile--folge) .blase,
.zeile--jarvis:not(.zeile--folge) .blase { border-top-left-radius: 6px; }
.zeile--eigen .blase {
  border-color: transparent;
  background: var(--eigen);
  color: var(--eigen-text);
}
.zeile--eigen:not(.zeile--folge) .blase { border-top-right-radius: 6px; }
.zeile--jarvis .blase {
  border-color: var(--akzent-linie);
  background:
    linear-gradient(180deg, var(--akzent-weich), transparent 60px),
    var(--blase);
}

.blase-name {
  display: block;
  margin-bottom: 1px;
  font-size: 13px;
  font-weight: 700;
  color: color-mix(in oklab, var(--farbe, var(--text-2)) 72%, var(--text));
}
.zeile--jarvis .blase-name { color: var(--akzent); }

.blase-fuss {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  margin-top: 2px;
  font-size: 11.5px;
  line-height: 1.3;
  color: var(--text-3);
}
.zeile--eigen .blase-fuss { color: var(--eigen-neben); }

.zeit { white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Per Sprache gesendet (inhalt.sprache) und „Vorlesen" (nur in der Android-App) */
.blase-sprache { display: inline-flex; color: inherit; }
.blase-sprache .symbol { width: 13px; height: 13px; stroke-width: 2.2; }
.vorlesen-knopf {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 28px;
  flex: none;
  margin: -4px auto -4px -8px; /* links in der Fußzeile, ohne die Blase höher zu machen */
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--text-3);
  transition: background-color 0.15s ease, color 0.15s ease;
}
.vorlesen-knopf:hover { background: var(--flaeche-2); color: var(--akzent); }
.vorlesen-knopf:active { background: var(--akzent-weich); color: var(--akzent); }
.vorlesen-knopf .symbol { width: 18px; height: 18px; }
.app-ohne-vorlesen .vorlesen-knopf { display: none; }

/* Markdown-light */
.md { line-height: 1.45; }
.md p + p,
.md p + ul, .md p + ol, .md p + pre,
.md ul + p, .md ol + p, .md pre + p,
.md ul + ul, .md ol + ol, .md pre + pre,
.md ul + pre, .md ol + pre, .md pre + ul, .md pre + ol { margin-top: 6px; }
.md ul, .md ol { margin: 0; padding-left: 1.35em; }
.md li + li { margin-top: 2px; }
.md li > ul, .md li > ol { margin-top: 2px; }
.md code {
  padding: 1px 5px;
  border-radius: 6px;
  background: var(--flaeche-3);
  font-family: var(--mono);
  font-size: 0.88em;
  overflow-wrap: anywhere;
}
.md pre {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--grund-tief);
  font-size: 13px;
  line-height: 1.5;
  overflow-x: auto;
}
.md pre code { padding: 0; background: none; font-size: inherit; overflow-wrap: normal; }
.md a { color: var(--akzent); text-underline-offset: 2px; }
.zeile--eigen .md a { color: inherit; }
.zeile--eigen .md code { background: rgba(255, 255, 255, 0.14); }
.md-ueberschrift { font-weight: 750; }

/* Systemzeile */
.systemtext {
  max-width: 85%;
  padding: 2px 8px;
  font-size: 12.5px;
  color: var(--text-3);
  text-align: center;
}

/* Hausmeldung */
.zeile--haus { padding-left: 40px; }
.chat--meldungen .zeile--haus { padding-left: 0; }
.hauskarte {
  width: min(100%, 600px);
  padding: 9px 12px 10px;
  border: 1px solid var(--linie);
  border-left: 3px solid var(--text-3);
  border-radius: 14px;
  background: var(--flaeche);
}
.hauskarte-kopf {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 3px;
  font-size: 13px;
  color: var(--text-3);
}
.haus-symbol { font-size: 16px; line-height: 1; }
.hauskarte-titel { flex: 1; min-width: 0; font-weight: 700; color: var(--text-2); }

/* Anhänge */
.anhaenge {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  margin: 4px -7px 4px;
}
.anhaenge--mehrere { grid-template-columns: 1fr 1fr; }
.md + .anhaenge, .anhaenge + .galerie { margin-top: 8px; }
.anhang-bild {
  position: relative;
  display: block;
  padding: 0;
  border: 0;
  border-radius: 12px;
  overflow: hidden;
  background: var(--flaeche-3);
  cursor: zoom-in;
}
.anhang-bild img {
  display: block;
  width: 100%;
  max-height: 340px;
  min-height: 90px;
  object-fit: cover;
}
.anhaenge--mehrere .anhang-bild { aspect-ratio: 1; }
.anhaenge--mehrere .anhang-bild img { height: 100%; max-height: none; min-height: 0; }
.anhang-datei {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--flaeche-2);
  color: inherit;
  text-decoration: none;
}
.kaputt { min-height: 90px; cursor: default; }
.kaputt img { visibility: hidden; }
.kaputt-text {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 13px;
  color: var(--text-3);
}

/* Galerie */
.galerie { margin-top: 4px; }
.galerie-kopf {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 13.5px;
}
.galerie-titel { font-weight: 650; }
.galerie-anzahl { flex: none; color: var(--text-3); font-size: 12.5px; }
.galerie-leer { font-size: 14px; color: var(--text-2); }
.galerie-raster {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  margin: 0 -6px;
  border-radius: 12px;
  overflow: hidden;
}
.galerie-kachel {
  position: relative;
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  background: var(--flaeche-3);
  overflow: hidden;
  cursor: zoom-in;
}
.galerie-kachel img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 0.2s ease; }
.galerie-kachel:hover img { transform: scale(1.04); }
.galerie-mehr {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(5, 10, 20, 0.62);
  color: #fff;
  font-size: 20px;
  font-weight: 750;
}

/* Werkzeug-Chips */
.werkzeuge { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.werkzeug {
  padding: 1px 7px;
  border: 1px solid var(--linie);
  border-radius: 999px;
  background: var(--flaeche-2);
  color: var(--text-3);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.6;
}
.ohne-werkzeuge .werkzeuge { display: none; }

/* Bestätigungskarte */
.aktion {
  margin: 6px -4px 2px;
  padding: 12px;
  border: 1px solid var(--warm-linie);
  border-radius: 14px;
  background: var(--warm-weich);
  color: var(--text);
}
.md + .aktion { margin-top: 8px; }
.aktion:not([data-status="offen"]) { border-color: var(--linie); background: var(--flaeche-2); }
/* Kopf: offen → „Bestätigung nötig" + Restzeit; entschieden → Status-Abzeichen + wer entschieden hat. */
.aktion-kopf {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px 8px;
  flex-wrap: wrap;
  min-height: 24px;
}
.aktion-marke {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--warm);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.aktion-von {
  flex: 1;
  min-width: 0;
  color: var(--text-2);
  font-size: 12.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.aktion-titel { margin: 8px 0 2px; font-size: 16px; font-weight: 750; line-height: 1.3; }
.aktion-details { color: var(--text-2); font-size: 14.5px; white-space: pre-wrap; }
.aktion-yaml { margin-top: 8px; }
.aktion-yaml summary {
  padding: 4px 0;
  color: var(--akzent);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.aktion-yaml pre {
  max-height: 340px;
  margin: 4px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--grund-tief);
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.5;
  overflow: auto;
}
.aktion-hinweis { margin-top: 8px; color: var(--text-2); font-size: 13.5px; }
.aktion-fuss {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}
.aktion-frist {
  color: var(--text-2);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.aktion-knoepfe { display: flex; gap: 8px; margin-left: auto; }
.aktion-eingabe { margin: 12px 0 0; }
.aktion-code { max-width: 220px; letter-spacing: 0.2em; }
.aktion[data-abgelaufen] .aktion-knoepfe,
.aktion[data-abgelaufen] .aktion-eingabe,
.aktion:not([data-status="offen"]) .aktion-eingabe { display: none; }
.aktion[data-abgelaufen] .aktion-frist { color: var(--warm); font-weight: 650; }
.aktion-fehler {
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--gefahr-weich);
  color: var(--gefahr);
  font-size: 14px;
}

.abzeichen {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 650;
  white-space: nowrap;
}
.abzeichen--offen { background: var(--warm-weich); color: var(--warm); }
.abzeichen--laeuft { background: var(--akzent-weich); color: var(--akzent); }
.abzeichen--erledigt { background: var(--ok-weich); color: var(--ok); }
.abzeichen--fehler { background: var(--gefahr-weich); color: var(--gefahr); }
.abzeichen--unklar { background: var(--warm-weich); color: var(--warm); }
.abzeichen--abgelehnt,
.abzeichen--abgelaufen,
.abzeichen--unbekannt { background: var(--flaeche-3); color: var(--text-2); }

/* „Neue Nachrichten"-Knopf */
.runter {
  position: absolute;
  z-index: 4;
  right: max(16px, var(--rechts));
  bottom: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: var(--akzent);
  color: var(--akzent-text);
  font-size: 14px;
  font-weight: 700;
  box-shadow: var(--schatten);
  animation: hinein 0.2s ease-out;
}

/* Jarvis-Status */
.jarvis-status {
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  max-width: 860px;
  height: 0;
  margin: 0 auto;
  padding: 0 max(18px, var(--rechts)) 0 max(18px, var(--links));
  overflow: hidden;
  color: var(--akzent);
  font-size: 13.5px;
  transition: height 0.2s ease;
}
.jarvis-status.aktiv { height: 30px; }
.status-name { font-weight: 700; }
.status-text { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.punkte { display: inline-flex; gap: 3px; margin-right: 2px; }
.punkte span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  animation: tippen 1.2s infinite ease-in-out;
}
.punkte span:nth-child(2) { animation-delay: 0.15s; }
.punkte span:nth-child(3) { animation-delay: 0.3s; }

/* Eingabe */
.eingabe {
  flex: none;
  padding: 8px max(8px, var(--rechts)) calc(10px + var(--unten)) max(8px, var(--links));
  border-top: 1px solid var(--linie);
  background: var(--kopf);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}
.eingabe-innen { max-width: 860px; margin: 0 auto; }
.eingabe-zeile { display: flex; align-items: flex-end; gap: 6px; }
.eingabe-feldrahmen {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: flex-end;
  min-height: 46px;
  padding: 0 2px;
  border: 1px solid var(--linie-stark);
  border-radius: 23px;
  background: var(--flaeche);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.eingabe-feldrahmen:focus-within {
  border-color: var(--akzent);
  box-shadow: 0 0 0 3px var(--akzent-weich);
}
.eingabe-feld {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  max-height: 40vh;
  padding: 11px 2px;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 16px;
  line-height: 1.4;
  resize: none;
  overflow-y: hidden;
}
.eingabe-feld--rollt { overflow-y: auto; }
.eingabe-feld::placeholder { color: var(--text-3); font-size: 15px; }
.eingabe-feldrahmen .symbolknopf { width: 40px; height: 44px; border-radius: 20px; }
.mikro.aktiv {
  background: var(--warm-weich);
  color: var(--warm);
  animation: pulsieren 1.4s infinite;
}
/* Android-App wertet die Aufnahme aus */
.mikro.aktiv.mikro--verarbeitet {
  background: var(--akzent-weich);
  color: var(--akzent);
  animation: none;
}
.senden {
  display: grid;
  place-items: center;
  flex: none;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--akzent);
  color: var(--akzent-text);
  transition: background-color 0.15s ease, transform 0.08s ease;
}
.senden:active:not(:disabled) { transform: scale(0.94); }
.senden:disabled { background: var(--flaeche-3); color: var(--text-3); cursor: default; }
.senden--laeuft .symbol { animation: hinein 0.6s ease-in-out infinite alternate; }

.anhang-leiste {
  display: flex;
  gap: 8px;
  padding: 2px 2px 10px;
  overflow-x: auto;
}
.anhang-chip {
  position: relative;
  flex: none;
  width: 68px;
  height: 68px;
  border: 1px solid var(--linie);
  border-radius: 12px;
  background: var(--flaeche-3);
  overflow: hidden;
}
.anhang-chip img { display: block; width: 100%; height: 100%; object-fit: cover; }
.anhang-chip--ohne-bild img { visibility: hidden; }
.anhang-chip > .kreisel { display: none; }
.anhang-chip--laedt > .kreisel {
  position: absolute;
  top: 50%;
  left: 50%;
  display: block;
  margin: -10px 0 0 -10px;
  color: #fff;
}
.anhang-chip--laedt img { opacity: 0.45; }
.anhang-chip-weg {
  position: absolute;
  top: 3px;
  right: 3px;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(5, 10, 20, 0.7);
  color: #fff;
}
.anhang-chip-weg::before { content: ""; position: absolute; inset: -8px; }
.anhang-chip-weg .symbol { width: 14px; height: 14px; stroke-width: 2.5; }

/* ---------------------------------------------------------------- Vollbild */

.vollbild-offen,
.vollbild-offen body { overflow: hidden; }

.vollbild {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  background: rgba(3, 6, 12, 0.96);
  color: #fff;
  animation: hinein 0.15s ease-out;
}
.vollbild-leiste {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(6px + var(--oben)) max(8px, var(--rechts)) 6px max(16px, var(--links));
}
.vollbild-zaehler { flex: 1; font-size: 14px; opacity: 0.8; font-variant-numeric: tabular-nums; }
.vollbild .symbolknopf { color: #fff; }
.vollbild .symbolknopf:hover { background: rgba(255, 255, 255, 0.12); }
.vollbild-buehne {
  position: relative;
  flex: 1;
  display: grid;
  place-items: center;
  min-height: 0;
  overflow: hidden;
  touch-action: none; /* Wischen, Zwei-Finger-Zoom und Doppeltipp übernimmt vollbild.js */
  user-select: none;
  outline: none; /* nur per Zeiger fokussiert (tabindex=-1), damit Tasten im Dialog bleiben */
}
.vollbild-bild {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transform-origin: 50% 50%;
  transition: transform 0.2s ease-out;
  -webkit-user-drag: none;
}
.vollbild-bild.gezoomt { cursor: grab; }
.vollbild-bild.zieht { transition: none; }
.vollbild-laden { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.vollbild-laden .kreisel { width: 32px; height: 32px; }
.vollbild-fehler { position: absolute; color: rgba(255, 255, 255, 0.75); }
.vollbild-nav {
  position: absolute;
  top: 50%;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-top: -24px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}
.vollbild-nav:hover { background: rgba(255, 255, 255, 0.22); }
.vollbild-nav--links { left: max(12px, var(--links)); }
.vollbild-nav--rechts { right: max(12px, var(--rechts)); }
@media (hover: none) {
  .vollbild-nav { display: none; }
}
.vollbild-text {
  min-height: 56px;
  padding: 10px max(16px, var(--rechts)) calc(14px + var(--unten)) max(16px, var(--links));
  font-size: 14.5px;
  text-align: center;
}
.vollbild-text p + p { margin-top: 2px; }
.vollbild-text .neben { font-size: 13px; opacity: 0.75; }

/* ---------------------------------------------------------------- Einstellungen */

.einstellungen-ansicht { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.einstellungen {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px max(16px, var(--rechts)) calc(28px + var(--unten)) max(16px, var(--links));
}
.einstellungen-innen {
  display: flex;
  flex-direction: column;
  gap: 22px;
  max-width: 640px;
  margin: 0 auto;
}
.gruppe-titel {
  margin: 0 6px 8px;
  font-size: 12.5px;
  font-weight: 750;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-3);
}
.karte {
  border: 1px solid var(--linie);
  border-radius: 16px;
  background: var(--flaeche);
  overflow: hidden;
}
.einstellung {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 60px;
  padding: 12px 16px;
}
.karte .einstellung + .einstellung { border-top: 1px solid var(--linie); }
.einstellung-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; cursor: inherit; }
label.einstellung-text { cursor: pointer; }
.einstellung-titel { font-weight: 650; }
.einstellung-hilfe { font-size: 13.5px; color: var(--text-2); }

.schalter {
  position: relative;
  flex: none;
  width: 52px;
  height: 32px;
  margin: 0;
  border: 1px solid var(--linie-stark);
  border-radius: 16px;
  background: var(--flaeche-3);
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}
.schalter::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--text-2);
  transition: transform 0.2s ease, background-color 0.2s ease;
}
.schalter:checked { border-color: var(--akzent); background: var(--akzent); }
.schalter:checked::before { transform: translateX(20px); background: var(--akzent-text); }
.schalter:disabled { opacity: 0.5; cursor: default; }

.dienste { display: flex; flex-direction: column; gap: 8px; width: 100%; margin: 0; padding: 0; list-style: none; }
.dienst { display: flex; align-items: center; gap: 10px; font-size: 14.5px; }
.dienst-punkt { width: 9px; height: 9px; border-radius: 50%; background: var(--text-3); }
.dienst--an .dienst-punkt { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-weich); }
.dienst-status { margin-left: auto; font-size: 13px; color: var(--text-2); }

.version { text-align: center; font-size: 12.5px; color: var(--text-3); }

/* ---------------------------------------------------------------- Bewegung reduzieren */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .kreisel { animation: drehen 1.6s linear infinite !important; }
}
