/* SPDX-FileCopyrightText: 2026 The UCNG authors (see NOTICE)
   SPDX-License-Identifier: AGPL-3.0-or-later */
/* UCNG – Weboberfläche
   Eigene Schrift? Datei nach web/fonts/ legen, @font-face ergänzen und --font anpassen. */

:root {
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-display: ui-sans-serif, system-ui, -apple-system, "Segoe UI Variable Display", "Segoe UI", Roboto, sans-serif;

  --canvas: #f2f3f7;
  --surface: #ffffff;
  --ink: #15172e;          /* Seitenleiste */
  --ink-raised: #21243f;
  --ink-text: #b7bad0;
  --ink-muted: #777b98;
  --text: #171927;
  --muted: #6e7287;
  --line: #e4e6ee;
  --accent: #5848f4;
  --accent-hover: #4a3be0;
  --accent-soft: #ecebfe;
  --accent-text: #5848f4;  /* Akzent als Schrift (Links), immer gut lesbar */
  --on-accent: #ffffff;
  --ink-strong: #ffffff;   /* hervorgehobene Schrift in der Seitenleiste */
  --ink-line: #262a45;
  --warn-bg: #fff6e0;
  --warn-text: #a86a00;
  --ok-text: #0d7a52;
  --auto-text: #9a6b00;
  --online: #16b67a;
  --danger: #d93f4c;

  --bubble-other: var(--surface);
  --bubble-other-line: var(--line);
  --shadow-float: 0 1px 2px rgba(21, 23, 46, .06), 0 8px 24px -6px rgba(21, 23, 46, .14);
  --radius-bubble: 20px;
  --radius-tight: 6px;
  --column: 860px;
}

/* Dunkelmodus, eigene Akzent- und Seitenleistenfarben: kommen aus /theme.css
   (vom Server erzeugt, im Admin-Bereich unter „Allgemein“ einstellbar). */

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }

body {
  font: 15px/1.5 var(--font);
  background: var(--canvas);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { display: block; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Felder, deren Container den Fokus bereits zeigt */
.join input:focus-visible, .composer textarea:focus-visible, dialog input:not([type=checkbox]):not([type=radio]):focus-visible { outline: none; }

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

.app { display: flex; height: 100vh; height: 100dvh; overflow: hidden; }

/* ---------- Avatare ---------- */

.avatar {
  --size: 32px;
  width: var(--size); height: var(--size); flex-shrink: 0;
  border-radius: 50%;
  display: inline-grid; place-items: center;
  font-size: calc(var(--size) * .42); font-weight: 650; line-height: 1;
  color: #fff;
  background: var(--avatar, var(--accent));
  user-select: none;
}

/* ---------- Seitenleiste ---------- */

.sidebar {
  width: 272px; flex-shrink: 0;
  background: var(--ink); color: var(--ink-text);
  display: flex; flex-direction: column;
  padding: 20px 14px 14px;
  gap: 18px;
}

.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 0 8px;
  color: var(--ink-strong);
  font: 700 19px/1 var(--font-display);
  letter-spacing: -.02em;
}
.brand-mark { width: 30px; height: 30px; color: var(--accent); }

.join {
  display: flex; align-items: center;
  background: var(--ink-raised);
  border-radius: 12px;
  padding: 4px 4px 4px 12px;
  border: 1px solid transparent;
  transition: border-color .15s;
}
.join:focus-within { border-color: var(--accent); }
.join-hash { color: var(--ink-muted); font-weight: 600; margin-right: 4px; }
.join input {
  flex: 1; min-width: 0;
  background: none; border: 0; outline: none;
  padding: 6px 0; color: var(--ink-strong); font-size: 14px;
}
.join input::placeholder { color: var(--ink-muted); }
.join button {
  width: 32px; height: 32px; border: 0; border-radius: 9px;
  background: var(--accent); color: var(--on-accent);
  display: grid; place-items: center;
}
.join button:hover { background: var(--accent-hover); }
.join button svg { width: 16px; height: 16px; }

.rooms-nav {
  flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 6px;
  overflow-y: auto; overscroll-behavior: contain; margin: 0 -6px; padding: 0 6px;
  scrollbar-width: thin; scrollbar-color: var(--ink-line) transparent;
}
.rooms-nav::-webkit-scrollbar { width: 6px; }
.rooms-nav::-webkit-scrollbar-thumb { background: var(--ink-line); border-radius: 3px; }
.nav-title {
  margin: 0; padding: 0 10px;
  font-size: 13px; font-weight: 600; color: var(--ink-muted);
}
.rooms { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; flex-shrink: 0; }
.rooms a {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border-radius: 10px;
  color: inherit; text-decoration: none; font-size: 14.5px;
}
.rooms a:hover { background: var(--ink-raised); color: var(--ink-strong); }
.rooms .hash { color: var(--ink-muted); font-weight: 600; width: 12px; }
.rooms .room-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rooms .online {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; color: var(--ink-muted); font-variant-numeric: tabular-nums;
}
.rooms .online::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--online); }
.rooms a[aria-current="page"] { background: var(--accent); color: var(--on-accent); }
.rooms a[aria-current="page"] .hash,
.rooms a[aria-current="page"] .online { color: var(--on-accent); opacity: .75; }
.rooms a[aria-current="page"] .online::before { background: var(--on-accent); }

.rooms a.unread { color: var(--ink-strong); font-weight: 650; }
.unread-badge {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  display: inline-grid; place-items: center;
  background: var(--ink-raised); color: var(--ink-strong); font-size: 11.5px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.unread-badge.mention { background: var(--danger); color: #fff; }
.legal { display: flex; gap: 14px; padding: 0 10px; font-size: 12.5px; }
.legal a { color: var(--ink-muted); text-decoration: none; }
.legal a:hover { color: var(--ink-strong); text-decoration: underline; }

.me {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 8px; border: 0; border-radius: 12px;
  background: none; text-align: left;
}
.me:hover { background: var(--ink-raised); }
.me .avatar { --size: 36px; }
.me-text { display: grid; min-width: 0; }
.me-name { color: var(--ink-strong); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-hint { font-size: 12.5px; color: var(--ink-muted); }

/* ---------- Kopfzeile ---------- */

.chat { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; }

.chat-head {
  display: flex; align-items: center; gap: 16px;
  padding: 14px max(24px, calc((100% - var(--column)) / 2));
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.room-info { flex: 1; min-width: 0; }
.room-title {
  margin: 0;
  font: 700 22px/1.15 var(--font-display);
  letter-spacing: -.025em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.room-title .hash { color: var(--muted); font-weight: 500; margin-right: 1px; }
.room-status {
  display: flex; align-items: center; gap: 7px;
  margin-top: 3px; font-size: 13px; color: var(--muted);
}
.room-desc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.room-desc:not(:empty)::before { content: ""; display: inline-block; width: 1px; height: 11px; background: var(--line); margin: 0 9px 0 2px; vertical-align: -1px; }
.room-status { min-width: 0; }
.dot { flex-shrink: 0; width: 8px; height: 8px; border-radius: 50%; background: #e2a400; }
.dot.ok { background: var(--online); box-shadow: 0 0 0 3px color-mix(in srgb, var(--online) 22%, transparent); }
.dot.err { background: var(--danger); }

.people { display: flex; padding: 4px; border: 0; border-radius: 22px; background: none; }
.people:hover { background: var(--canvas); }
.people .avatar { --size: 30px; border: 2px solid var(--surface); margin-left: -9px; box-sizing: content-box; }
.people .avatar:first-child { margin-left: 0; }
.people .avatar.more { background: var(--canvas); color: var(--muted); font-size: 11.5px; }
.chat-head { position: relative; }
.presence-pop { top: calc(100% - 6px); right: max(16px, calc((100% - var(--column)) / 2)); width: 260px; max-height: 60vh; overflow: auto; padding: 8px; }
.presence-pop .pop-head { padding: 6px 8px 8px; font-size: 13px; font-weight: 650; color: var(--muted); }
.presence-pop ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.presence-pop li { display: flex; align-items: center; gap: 10px; padding: 5px 8px; border-radius: 9px; }
.presence-pop li .avatar { --size: 26px; }
.presence-pop .pname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.presence-pop .you { font-size: 12px; color: var(--muted); }
.presence-pop .pop-foot { padding: 8px 8px 4px; font-size: 13px; color: var(--muted); }
.room-rules { flex-shrink: 0; font-size: 12px; padding: 1px 8px; border-radius: 6px; background: var(--canvas); color: var(--muted); }

.btn-quiet {
  display: inline-flex; align-items: center; gap: 7px;
  height: 36px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); font-size: 14px; font-weight: 550;
}
.btn-quiet svg { width: 16px; height: 16px; color: var(--muted); }
.btn-quiet:hover { border-color: var(--accent); color: var(--accent); }
.btn-quiet:hover svg { color: inherit; }

.icon-btn {
  width: 38px; height: 38px; border: 0; border-radius: 10px; background: none;
  display: grid; place-items: center;
}
.icon-btn:hover { background: var(--canvas); }
.icon-btn svg { width: 20px; height: 20px; }
.menu { display: none; margin-left: -8px; }

/* ---------- Nachrichten ---------- */

.messages {
  flex: 1; overflow-y: auto;
  padding: 12px max(24px, calc((100% - var(--column)) / 2)) 120px;
  display: flex; flex-direction: column;
}

/* Nachrichten im „Zitat-Stil“: eckige Blöcke mit farbiger Kante links statt runder Blasen.
   Alle Nachrichten stehen links; die eigenen erkennt man an Akzentkante und zartem Akzentton. */
.msg {
  --bar: color-mix(in srgb, var(--muted) 38%, var(--line));
  --block: var(--surface);
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  column-gap: 12px;
  margin: 12px -10px 0;
  padding: 4px 10px;
  border-radius: 10px;
}
.msg.cont { margin-top: 0; padding-top: 1px; }
.msg:hover { background: color-mix(in srgb, var(--surface) 55%, transparent); }
.msg .avatar { --size: 34px; grid-row: 1 / 3; align-self: start; margin-top: 2px; }
.msg.cont .avatar { visibility: hidden; height: 0; margin: 0; }
.msg .body { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; }

.meta { display: flex; align-items: baseline; gap: 8px; margin: 0 0 3px; font-size: 13.5px; }
.meta b { font-weight: 650; }
.bot-badge {
  display: inline-flex; align-items: center; height: 17px; padding: 0 6px; border-radius: 5px;
  background: var(--accent-soft); color: var(--accent-text); font-size: 10.5px; font-weight: 700;
  letter-spacing: .02em; align-self: center;
}
.avatar.bot { border-radius: 9px; }
.meta time { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.msg.cont .meta { display: none; }
.you-tag { font-size: 11.5px; font-weight: 600; color: var(--accent-text); }

.bubble {
  max-width: min(680px, 100%);
  padding: 7px 12px 7px 12px;
  border-left: 3px solid var(--bar);
  border-radius: 4px 10px 10px 4px;
  background: var(--block);
  white-space: pre-wrap; overflow-wrap: anywhere;
  line-height: 1.5;
}
.bubble a { color: var(--accent-text); text-underline-offset: 2px; }
/* aufeinanderfolgende Nachrichten derselben Person bilden eine durchgehende Kante */
.msg.cont { padding-top: 2px; }

.msg.own { --bar: var(--accent); --block: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.msg.mentioned { --bar: #e2a400; --block: var(--warn-bg); }
.msg.mentioned .bubble { color: var(--text); }

.msg.new .bubble { animation: pop .18s ease-out; }

/* Gelöschte Nachricht */
.bubble.deleted {
  background: transparent; color: var(--muted); border-left-style: dashed;
  font-style: italic; font-size: 14px;
}

/* Nachricht einer blockierten Person (eingeklappt) */
.bubble.blocked-msg {
  background: transparent; color: var(--muted); border-left-style: dashed;
  font-size: 13.5px;
}
.bubble.blocked-msg .text-btn { font-size: 13px; }

/* Blockierte Personen (Profil) */
.blocked-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.blocked-list li { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.blocked-list .avatar { --size: 26px; font-size: 11px; }
.blocked-list .blocked-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.blocked-list .blocked-empty { color: var(--muted); font-size: 13.5px; }
.readonly-note .text-btn { font-size: 13.5px; }

/* Aktionen an einer Nachricht (beim Überfahren) */
.msg .body { position: static; }
.msg-actions {
  position: absolute; top: -12px; right: 10px; z-index: 2;
  display: flex; gap: 2px; padding: 3px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 11px;
  box-shadow: var(--shadow-float);
  opacity: 0; pointer-events: none; transition: opacity .12s;
}
.msg-actions:empty { display: none; }
.msg:hover .msg-actions, .msg:focus-within .msg-actions { opacity: 1; pointer-events: auto; }
.msg-actions .act {
  width: 30px; height: 28px; border: 0; border-radius: 8px; background: none; color: var(--muted);
  display: grid; place-items: center;
}
.msg-actions .act:hover { background: var(--canvas); color: var(--text); }
.msg-actions .act.danger:hover { color: var(--danger); }
.msg-actions .act svg { width: 16px; height: 16px; }
/* Touch: Aktionen erscheinen nach Antippen der Nachricht */
@media (hover: none) {
  .msg-actions { position: static; display: none; opacity: 1; pointer-events: auto; box-shadow: none; padding: 2px; margin-top: 4px; }
  .msg.tapped .msg-actions:not(:empty) { display: flex; }
  .msg-actions .act { width: 38px; height: 34px; }
}

.badge {
  display: inline-flex; align-items: center; height: 17px; padding: 0 6px; border-radius: 5px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .02em; align-self: center; vertical-align: 2px;
}
.team-badge { background: color-mix(in srgb, var(--online) 16%, var(--surface)); color: var(--ok-text); }

.edited { margin-left: 6px; font-size: 11.5px; opacity: .7; font-style: normal; white-space: nowrap; }

/* Formatierung */
.bubble code, .search-results code {
  font: .88em/1.4 ui-monospace, Menlo, Consolas, monospace;
  padding: 1px 5px; border-radius: 5px; background: var(--canvas);
}
.bubble pre {
  margin: 4px 0; padding: 10px 12px; border-radius: 10px; background: var(--canvas);
  font: 13px/1.5 ui-monospace, Menlo, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere;
}
.bubble pre code { padding: 0; background: none; font-size: 1em; }
.msg.own .bubble code, .msg.own .bubble pre, .msg.mentioned .bubble code { background: color-mix(in srgb, var(--text) 7%, transparent); }
.mention { font-weight: 650; color: var(--accent-text); }
.mention-me { background: var(--accent-soft); border-radius: 5px; padding: 0 3px; }

/* Antwort-Zitat */
.reply-quote {
  display: grid; max-width: min(520px, 100%); margin: 0 0 4px; padding: 4px 10px 4px 10px;
  border: 0; border-left: 3px solid var(--accent); border-radius: 4px 10px 10px 4px;
  background: var(--accent-soft); text-align: left; font-size: 12.5px; line-height: 1.35;
}
.reply-quote b { font-weight: 650; color: var(--accent-text); }
.reply-quote span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 420px; }
.reply-quote.gone span { font-style: italic; }

/* Reaktionen */
.reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.reactions:empty { display: none; }
.reaction {
  display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 8px;
  border: 1px solid var(--line); border-radius: 13px; background: var(--surface); font-size: 13px;
}
.reaction .count { font-size: 12px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.reaction.mine { border-color: var(--accent); background: var(--accent-soft); }
.reaction.mine .count { color: var(--accent-text); }
.reaction:hover { border-color: var(--accent); }
.react-picker {
  position: fixed; z-index: 30; display: flex; gap: 2px; padding: 4px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-float);
}
.react-picker { flex-direction: column; max-width: calc(100vw - 16px); }
.react-quick { display: flex; flex-wrap: wrap; gap: 2px; }
.react-picker button { width: 36px; height: 36px; border: 0; border-radius: 10px; background: none; font-size: 20px; line-height: 1; display: grid; place-items: center; padding: 0; }
.react-picker button:hover, .react-picker button:focus-visible { background: var(--accent-soft); transform: scale(1.1); }
.react-picker button img { display: block; object-fit: contain; }
.react-picker .react-more { color: var(--muted); border: 1px dashed var(--line); }
.react-picker .react-more svg { width: 16px; height: 16px; }
.react-picker.expanded .react-more { color: var(--accent); border-color: var(--accent); }
.react-picker.expanded { min-width: min(232px, calc(100vw - 16px)); }
.react-emotes {
  display: grid; grid-template-columns: repeat(auto-fill, 36px); gap: 2px; justify-content: start;
  width: 0; min-width: 100%; max-height: 200px; overflow-y: auto; padding-top: 4px; margin-top: 2px; border-top: 1px solid var(--line);
}
.react-search {
  width: 0; min-width: calc(100% - 4px); margin: 6px 2px 2px; height: 32px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--canvas); color: var(--text); font-size: 13.5px; outline: none;
}
.react-search:focus { border-color: var(--accent); }
.reaction .emote-react { display: block; object-fit: contain; }
.reaction .emote-gone { font-size: 11.5px; color: var(--muted); }

.new-divider { display: flex; align-items: center; gap: 10px; margin: 18px 0 2px; color: var(--danger); font-size: 12px; font-weight: 650; }
.new-divider::before, .new-divider::after { content: ""; flex: 1; height: 1px; background: color-mix(in srgb, var(--danger) 45%, transparent); }
.new-divider::before { flex: 0 0 0; }
.new-divider span { order: 2; }
.msg.flash .bubble { animation: flash 1.6s ease-out; }
@keyframes flash { 0%, 30% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 45%, transparent); } }

/* Suche */
.search-panel {
  position: absolute; z-index: 12; top: 78px; left: 0; right: 0; margin: 0 auto;
  width: min(var(--column), calc(100% - 32px)); max-height: min(70vh, 560px);
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-float);
}
.search-row { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 16px; border-bottom: 1px solid var(--line); }
.search-row > svg { width: 18px; height: 18px; color: var(--muted); flex-shrink: 0; }
.search-row input { flex: 1; min-width: 0; border: 0; outline: none; background: none; height: 38px; font-size: 15.5px; }
.search-info { margin: 0; padding: 10px 16px 4px; font-size: 13px; color: var(--muted); }
.search-results { overflow-y: auto; padding: 4px 8px 10px; display: grid; gap: 2px; }
.hit { display: grid; gap: 3px; text-align: left; padding: 9px 10px; border: 0; border-radius: 12px; background: none; }
.hit:hover, .hit:focus-visible { background: var(--canvas); }
.hit-head { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.hit-head .avatar { --size: 22px; }
.hit-head time { color: var(--muted); font-size: 12px; margin-left: auto; }
.hit p { margin: 0; font-size: 14px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.hit mark { background: color-mix(in srgb, var(--accent) 22%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }

@keyframes pop { from { transform: translateY(6px) scale(.98); opacity: 0; } }

.load-older {
  align-self: center; margin: 4px 0 8px;
  height: 32px; padding: 0 14px; border-radius: 16px;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  font-size: 13px; font-weight: 550;
}
.load-older:hover { color: var(--accent); border-color: var(--accent); }

.day {
  align-self: center;
  margin: 28px 0 6px;
  font-size: 12.5px; font-weight: 550; color: var(--muted);
}

.empty {
  margin: auto; max-width: 320px; text-align: center; color: var(--muted);
  display: grid; justify-items: center; gap: 6px;
}
.empty svg { width: 48px; height: 48px; color: var(--accent); margin-bottom: 8px; }
.empty strong { color: var(--text); font: 650 17px/1.3 var(--font-display); letter-spacing: -.01em; }

/* ---------- Eingabe ---------- */

.composer {
  position: absolute; left: 0; right: 0; bottom: 0;
  margin: 0 auto;
  width: min(var(--column), calc(100% - 48px));
  margin-bottom: max(20px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow-float);
}
.composer-row { display: flex; align-items: flex-end; gap: 6px; padding: 6px 6px 6px 20px; }
.composer:focus-within { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }
.composer textarea {
  flex: 1; resize: none; border: 0; outline: none; background: none;
  padding: 9px 0; max-height: 180px; line-height: 1.45; min-width: 0;
}
.composer textarea::placeholder { color: var(--muted); }
.composer textarea:disabled { cursor: not-allowed; }
.send {
  width: 40px; height: 40px; flex-shrink: 0; border: 0; border-radius: 50%;
  background: var(--accent); color: var(--on-accent);
  display: grid; place-items: center;
  transition: background .15s, opacity .15s;
}
.send:hover { background: var(--accent-hover); }
.send svg { width: 20px; height: 20px; }
.composer:has(textarea:placeholder-shown) .send { opacity: .35; pointer-events: none; }
.send:disabled { opacity: .35; }
.format-btn {
  width: 34px; height: 34px; margin-bottom: 3px; flex-shrink: 0; border: 0; border-radius: 9px;
  background: none; color: var(--muted); font-weight: 700; font-size: 13.5px; letter-spacing: -.02em;
}
.format-btn:hover { background: var(--canvas); color: var(--text); }
.composer.blocked { background: var(--canvas); }

.compose-bar {
  display: flex; align-items: center; gap: 10px;
  margin: 6px 6px 0; padding: 6px 4px 6px 14px;
  border-radius: 16px 16px 8px 8px; background: var(--accent-soft);
}
.compose-bar.edit { background: var(--warn-bg); }
.compose-info { flex: 1; min-width: 0; display: grid; font-size: 13px; line-height: 1.35; }
.compose-info b { color: var(--accent-text); font-weight: 650; }
.compose-bar.edit .compose-info b { color: var(--warn-text); }
.compose-info span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compose-bar .icon-btn { width: 30px; height: 30px; color: var(--muted); }
.compose-bar .icon-btn svg { width: 16px; height: 16px; }
.sanction-note {
  margin: 6px 6px 0; padding: 9px 14px; border-radius: 16px 16px 8px 8px;
  background: color-mix(in srgb, var(--danger) 12%, var(--surface)); color: var(--danger);
  font-size: 13.5px; font-weight: 550;
}

.popover {
  position: absolute; z-index: 15;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow-float);
}
.format-help { bottom: calc(100% + 8px); right: 12px; padding: 14px 16px; width: 250px; font-size: 13px; }
.format-help dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 8px 0 10px; }
.format-help dt { font-family: ui-monospace, Menlo, Consolas, monospace; color: var(--muted); }
.format-help dd { margin: 0; }
.format-help small { color: var(--muted); }

.mention-box {
  position: absolute; bottom: calc(100% + 8px); left: 12px; z-index: 15;
  min-width: 220px; max-width: calc(100% - 24px); padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow-float); display: grid;
}
.mention-box button {
  display: flex; align-items: center; gap: 10px; text-align: left;
  padding: 6px 10px; border: 0; border-radius: 9px; background: none;
}
.mention-box button.active, .mention-box button:hover { background: var(--accent-soft); }
.mention-box .avatar { --size: 24px; }

.toasts {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 40;
  display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none;
  width: max-content; max-width: calc(100vw - 32px);
}
.toast {
  background: var(--text); color: var(--canvas); text-align: center;
  padding: 10px 16px; border-radius: 12px; font-size: 14px;
  box-shadow: var(--shadow-float); animation: rise .2s ease-out;
}


/* ---------- Emotes und GIFs ---------- */

.emote { display: inline-block; vertical-align: -0.35em; object-fit: contain; margin: 0 1px; }
.emote-line { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.emote-jumbo { vertical-align: bottom; }
.bubble:has(> .emote-line) { background: transparent; border-left-color: transparent; padding-left: 0; }
.msg-gif { display: block; max-width: 100%; height: auto; border-radius: 8px; margin-top: 6px; background: var(--canvas); }
.bubble.media-only { padding: 6px; }
.bubble.media-only .msg-gif { margin-top: 0; }
.gif-source { display: block; margin-top: 3px; font-size: 11px; color: var(--muted); }
.format-btn svg { width: 19px; height: 19px; margin: auto; }
.gif-btn { font-size: 11.5px; letter-spacing: .04em; }
.sugg-emote { width: 24px; height: 24px; object-fit: contain; }
.sugg-cmd { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); font-weight: 700; }
.mention-box button { align-items: center; }
.sugg-label { font-weight: 600; }
.sugg-hint { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

.media-panel {
  bottom: calc(100% + 8px); right: 12px; width: min(400px, calc(100vw - 32px));
  display: flex; flex-direction: column; max-height: min(460px, 60vh);
}
.media-head { display: grid; gap: 8px; padding: 10px 10px 8px; border-bottom: 1px solid var(--line); }
.media-tabs { display: flex; gap: 4px; }
.media-tabs button {
  height: 30px; padding: 0 12px; border: 0; border-radius: 8px; background: none;
  color: var(--muted); font-size: 13px; font-weight: 650;
}
.media-tabs button[aria-selected="true"] { background: var(--accent-soft); color: var(--accent-text); }
#mediaSearch {
  height: 36px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--canvas); color: var(--text); outline: none; font-size: 14px;
}
#mediaSearch:focus { border-color: var(--accent); }
.media-grid { overflow-y: auto; padding: 8px; }
.media-grid.emotes { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 4px; }
.media-grid.gifs { columns: 2; column-gap: 6px; }
.emote-pick { aspect-ratio: 1; border: 0; border-radius: 10px; background: none; display: grid; place-items: center; }
.emote-pick:hover, .emote-pick:focus-visible { background: var(--accent-soft); }
.emote-pick img { width: 32px; height: 32px; object-fit: contain; }
.gif-pick {
  display: block; width: 100%; margin: 0 0 6px; padding: 0; border: 0; border-radius: 8px;
  background: var(--canvas); overflow: hidden; break-inside: avoid; cursor: pointer;
}
.gif-pick img { display: block; width: 100%; height: auto; }
.gif-pick:hover, .gif-pick:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; }
.gif-pick.sending { opacity: .5; pointer-events: none; }
.media-empty { margin: 16px 8px; color: var(--muted); font-size: 13.5px; text-align: center; column-span: all; }
.media-note { margin: 0; padding: 6px 12px 8px; font-size: 11.5px; color: var(--muted); border-top: 1px solid var(--line); }
@media (max-width: 760px) { .media-panel { right: 6px; left: 6px; width: auto; } }

/* ---------- Dialoge ---------- */

dialog {
  border: 0; border-radius: 22px; overflow-x: hidden;
  background: var(--surface); color: var(--text);
  padding: 28px; width: min(480px, calc(100vw - 32px));
  box-shadow: 0 24px 60px -12px rgba(10, 12, 30, .45);
}
dialog[open] { animation: rise .2s ease-out; }
@keyframes rise { from { transform: translateY(10px); opacity: 0; } }
dialog::backdrop { background: rgba(13, 15, 28, .5); backdrop-filter: blur(4px); }
dialog h2 { margin: 0 0 8px; font: 700 21px/1.25 var(--font-display); letter-spacing: -.02em; }
dialog p { color: var(--muted); margin: 0 0 18px; }
/* Nur Textfelder – Checkboxen, Radios und Farbwähler behalten ihre normale Größe */
dialog input:not([type=checkbox]):not([type=radio]):not([type=color]):not([type=file]) {
  width: 100%; height: 48px; padding: 0 16px;
  border-radius: 14px; border: 1px solid var(--line); background: var(--canvas);
  font-size: 16px; outline: none;
}
dialog input:not([type=checkbox]):not([type=radio]):focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
dialog pre {
  margin: 0; background: var(--canvas); border-radius: 14px;
  padding: 14px 16px; font-size: 13px; line-height: 1.6;
  white-space: pre-wrap; word-break: break-all;
}
dialog .hint { font-size: 13.5px; margin: 14px 0 0; }
dialog .form-error { color: var(--danger); font-size: 14px; margin: 10px 2px 0; }
dialog .form-error:empty { display: none; }
.actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.btn-primary {
  height: 44px; padding: 0 20px; border: 0; border-radius: 12px;
  background: var(--accent); color: var(--on-accent); font-weight: 600;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: .6; }
.actions .btn-quiet { height: 44px; border-radius: 12px; }
code { font-size: .9em; }

/* ---------- Profil ---------- */

.text-btn {
  background: none; border: 0; padding: 0; font: inherit; font-weight: 600;
  color: var(--accent-text); text-decoration: underline; text-underline-offset: 2px; cursor: pointer;
}
.text-btn.danger { color: var(--danger); }
.alt-action { margin: 20px 0 0; padding-top: 16px; border-top: 1px solid var(--line); font-size: 14px; }

.profile-dialog { width: min(520px, calc(100vw - 32px)); padding: 0; }
.profile-head {
  display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: start;
  padding: 24px 24px 18px; border-bottom: 1px solid var(--line);
}
.profile-head .avatar { --size: 52px; }
.profile-head h2 { margin: 4px 0 2px; overflow-wrap: anywhere; }
.profile-head p { margin: 0; font-size: 13.5px; }
.close-x { margin: -6px -8px 0 0; color: var(--muted); }
.profile-section { padding: 18px 24px; border-bottom: 1px solid var(--line); display: grid; gap: 8px; }
.profile-section p { margin: 0; font-size: 14px; }
.profile-section small { color: var(--muted); font-size: 13px; }
.sec-title { margin: 0; font-size: 15px; font-weight: 650; color: var(--text); }
.inline-row { display: flex; gap: 8px; }
.inline-row input { flex: 1; min-width: 0; }
.inline-row .btn-primary { height: 48px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.btn-row .btn-quiet { height: 40px; }
.secret-note { color: var(--warn-text) !important; background: var(--warn-bg); border-radius: 10px; padding: 8px 12px; font-size: 13px !important; }
.profile-foot { padding: 14px 24px 20px; }
.retention-note { font-size: 13px; margin: 0 0 10px !important; }
.pref-grid { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; align-items: center; font-size: 14px; }
.pref-grid select {
  height: 38px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--canvas); color: var(--text); font: inherit;
}
.profile-dialog .form-error { margin: 0; }

.file-pick { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.file-name { color: var(--muted); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#importCode {
  width: 100%; resize: vertical; padding: 10px 12px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--canvas); color: var(--text);
  font: 13px/1.5 ui-monospace, Menlo, Consolas, monospace; outline: none; word-break: break-all;
}
#importCode:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.warn-box { color: var(--warn-text) !important; background: var(--warn-bg); border-radius: 10px; padding: 10px 12px; font-size: 13.5px; margin: 12px 0 0 !important; }

/* ---------- Mobil ---------- */

.scrim { display: none; }

@media (max-width: 760px) {
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 10; width: min(300px, 86vw);
    transform: translateX(-100%); transition: transform .22s ease;
  }
  .sidebar.open { transform: none; }
  .sidebar.open ~ .scrim { display: block; position: fixed; inset: 0; z-index: 9; background: rgba(13, 15, 28, .45); }
  .menu { display: grid; }
  .chat-head { padding: 10px 16px; gap: 10px; }
  .room-title { font-size: 19px; }
  .btn-quiet span, .people { display: none !important; }
  .room-rules { display: none; }
  .search-panel { top: 62px; }
  .btn-quiet { padding: 0 10px; }
  .messages { padding: 8px 14px 110px; }
  .msg { margin-left: -6px; margin-right: -6px; padding-left: 6px; padding-right: 6px; column-gap: 10px; grid-template-columns: 30px minmax(0, 1fr); }
  .msg .avatar { --size: 30px; }
  .composer { width: calc(100% - 24px); margin-bottom: max(12px, env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
.emote.emote-mini { width: 18px; height: 18px; vertical-align: -4px; margin: 0 1px; }

/* Private Antworten des Befehls-Bots */
.msg.ephemeral .bubble { border-left-style: dashed; background: color-mix(in srgb, var(--accent-soft) 55%, var(--surface)); }
.msg.ephemeral.notice .bubble { color: var(--muted); font-style: italic; }
.msg.ephemeral .eph-quote { cursor: default; }
.eph-tag {
  display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--muted);
}
.eph-tag::before {
  content: ""; width: 13px; height: 13px; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M1.5 10S4.5 4 10 4s8.5 6 8.5 6-3 6-8.5 6S1.5 10 1.5 10Z' fill='none' stroke='black' stroke-width='1.7'/%3E%3Ccircle cx='10' cy='10' r='2.6' fill='black'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M1.5 10S4.5 4 10 4s8.5 6 8.5 6-3 6-8.5 6S1.5 10 1.5 10Z' fill='none' stroke='black' stroke-width='1.7'/%3E%3Ccircle cx='10' cy='10' r='2.6' fill='black'/%3E%3C/svg%3E") center / contain no-repeat;
}
.eph-hide {
  display: block; margin: 3px 0 0; padding: 0; border: 0; background: none; cursor: pointer;
  color: var(--muted); font-size: 12px; text-decoration: underline; text-underline-offset: 2px;
}
.eph-hide:hover { color: var(--accent-text); }

/* Rollen-Abzeichen (Farbe pro Rolle, Kontrast für hell und dunkel gemischt) */
.badge.role-badge {
  background: color-mix(in srgb, var(--role) 16%, var(--surface));
  color: color-mix(in srgb, var(--role) 68%, var(--text));
  max-width: 14em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.meta .role-name, .pname.role-name { color: color-mix(in srgb, var(--role) 75%, var(--text)); }

/* ---------- Community: Profilbilder, Status, Pins, Threads, Umfragen, Bilder, Menüs ---------- */

.avatar.has-img { background: var(--canvas); overflow: hidden; }
.avatar.has-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar { position: relative; }
.avatar.st-away::after, .avatar.st-busy::after {
  content: ""; position: absolute; right: -1px; bottom: -1px;
  width: max(8px, calc(var(--size) * .3)); height: max(8px, calc(var(--size) * .3));
  border-radius: 50%; border: 2px solid var(--surface); box-sizing: border-box;
}
.avatar.st-away::after { background: #e2a400; }
.avatar.st-busy::after { background: var(--danger); }
.avatar.big { --size: 64px; }
.msg .avatar.has-img, .people .avatar.has-img { overflow: visible; }
.msg .avatar.has-img img, .people .avatar.has-img img, .presence-pop .avatar.has-img img { border-radius: 50%; }
.avatar.bot.has-img img { border-radius: 9px; }

.presence-pop .pwho { flex: 1; min-width: 0; display: grid; }
.presence-pop .pstatus { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.presence-pop .pdm {
  width: 30px; height: 30px; border: 0; border-radius: 8px; background: none; color: var(--muted);
  display: grid; place-items: center; flex-shrink: 0;
}
.presence-pop .pdm:hover { background: var(--accent-soft); color: var(--accent-text); }
.presence-pop .pdm svg { width: 16px; height: 16px; }

.rooms .room-flag { font-size: 11px; margin-left: 4px; opacity: .8; }
.rooms.dms a { gap: 9px; }
.rooms.dms .avatar { --size: 22px; font-size: 10px; }
.rooms.dms .avatar.st-away::after, .rooms.dms .avatar.st-busy::after { border-color: var(--ink); }
#dmNav { margin-top: 14px; }

.readonly-note {
  margin: 6px 6px 0; padding: 9px 14px; border-radius: 16px 16px 8px 8px;
  background: var(--canvas); color: var(--muted); font-size: 13.5px;
}

/* Angepinnt */
.pin-bar {
  position: relative; z-index: 6;
  padding: 0 max(24px, calc((100% - var(--column)) / 2));
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
  border-bottom: 1px solid var(--line);
}
.pin-toggle {
  display: flex; align-items: center; gap: 9px; width: 100%; min-width: 0;
  padding: 8px 0; border: 0; background: none; color: var(--text); text-align: left; font-size: 13.5px;
}
.pin-toggle svg { width: 15px; height: 15px; color: var(--accent); flex-shrink: 0; }
.pin-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pin-label b { font-weight: 650; }
.pin-count { font-size: 12px; font-weight: 650; color: var(--accent-text); background: var(--accent-soft); border-radius: 8px; padding: 1px 7px; }
.pin-list {
  position: absolute; left: max(16px, calc((100% - var(--column)) / 2)); right: max(16px, calc((100% - var(--column)) / 2)); top: 100%;
  max-height: 50vh; overflow: auto; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-float);
}
.pin-item { display: flex; align-items: center; gap: 4px; }
.pin-go {
  flex: 1; min-width: 0; display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; align-items: center; gap: 8px;
  padding: 8px; border: 0; border-radius: 10px; background: none; color: var(--text); text-align: left; font-size: 13.5px;
}
.pin-go:hover { background: var(--canvas); }
.pin-go .avatar { --size: 24px; }
.pin-go span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.pin-go time { font-size: 11.5px; color: var(--muted); }
.pin-item .icon-btn.small { width: 30px; height: 30px; }
.pin-item .icon-btn.small svg { width: 14px; height: 14px; }
.pin-tag { font-size: 11px; font-weight: 600; color: var(--accent-text); }
.msg.pinned { --bar: color-mix(in srgb, var(--accent) 65%, var(--line)); }

/* Menü „Mehr“ */
.msg-menu { position: fixed; z-index: 30; min-width: 220px; padding: 5px; }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px;
  border: 0; border-radius: 9px; background: none; color: var(--text); font-size: 14px; text-align: left;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--canvas); outline: none; }
.menu-item svg { width: 17px; height: 17px; color: var(--muted); flex-shrink: 0; }
.menu-item.danger { color: var(--danger); }
.menu-item.danger svg { color: var(--danger); }

/* Umfragen */
.bubble.has-poll { min-width: min(360px, 100%); }
.poll { display: grid; gap: 6px; margin: 2px 0; white-space: normal; }
.poll-q { font-weight: 650; margin-bottom: 2px; }
.poll-opt {
  position: relative; display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  background: var(--surface); color: var(--text); text-align: left; font-size: 14px; isolation: isolate;
}
.poll-opt::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: var(--pct, 0%); z-index: -1;
  background: color-mix(in srgb, var(--accent) 14%, transparent); transition: width .3s ease;
}
.poll-opt:hover:not(:disabled) { border-color: var(--accent); }
.poll-opt.mine { border-color: var(--accent); }
.poll-opt.mine::before { background: color-mix(in srgb, var(--accent) 24%, transparent); }
.poll-opt:disabled { cursor: default; }
.poll-check { width: 16px; color: var(--accent-text); font-weight: 700; }
.poll-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.poll-num { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.poll-foot { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; font-size: 12px; color: var(--muted); }
.poll-foot .text-btn { font-size: 12px; }
.poll.closed .poll-opt { opacity: .85; }

/* Hochgeladene Bilder */
.msg-img-link { display: block; margin-top: 6px; max-width: 100%; }
.msg-img { display: block; max-width: 100%; height: auto; border-radius: 8px; background: var(--canvas); }
.bubble.media-only .msg-img-link { margin-top: 0; }
.upload-btn svg { width: 19px; height: 19px; }
.upload-btn.sending { opacity: .5; pointer-events: none; }
.composer.drop, .thread-composer.drop { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }

/* Threads */
.thread-sum {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 5px; padding: 4px 10px 4px 8px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); font-size: 12.5px;
}
.thread-sum:hover { border-color: var(--accent); }
.thread-sum svg { width: 15px; height: 15px; color: var(--accent); }
.thread-sum b { color: var(--accent-text); font-weight: 650; }
.thread-sum span { color: var(--muted); }
.hit-thread { font-size: 11px; color: var(--accent-text); }

.thread-panel {
  position: absolute; top: 0; right: 0; bottom: 0; z-index: 12;
  width: 400px; max-width: 100%;
  display: flex; flex-direction: column;
  background: var(--canvas); border-left: 1px solid var(--line);
  box-shadow: -12px 0 30px -18px rgba(10, 12, 30, .3);
}
.thread-head {
  display: flex; align-items: center; gap: 10px; padding: 14px 14px 14px 20px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.thread-head b { font: 700 17px/1.2 var(--font-display); }
.thread-sub { flex: 1; color: var(--muted); font-size: 13px; }
.thread-list { flex: 1; overflow-y: auto; padding: 8px 20px 16px; }
.thread-list .msg { margin-left: -8px; margin-right: -8px; padding-left: 8px; padding-right: 8px; }
.thread-sep { display: flex; align-items: center; gap: 10px; margin: 10px 0 2px; color: var(--muted); font-size: 12.5px; }
.thread-sep::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.thread-sep:empty::after { margin-left: -10px; }
.thread-composer {
  display: flex; align-items: flex-end; gap: 6px; margin: 0 12px 12px; padding: 6px 6px 6px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px;
}
.thread-composer:focus-within { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }
.thread-composer textarea {
  flex: 1; resize: none; border: 0; outline: none; background: none; padding: 9px 0; max-height: 140px; line-height: 1.45; min-width: 0;
}
.thread-composer:has(textarea:placeholder-shown) .send { opacity: .35; pointer-events: none; }
@media (min-width: 1100px) {
  .chat.with-thread .chat-head, .chat.with-thread .pin-bar, .chat.with-thread .messages, .chat.with-thread .search-panel { margin-right: 400px; }
  .chat.with-thread .composer { right: 400px; width: min(var(--column), calc(100% - 448px)); }
}
@media (max-width: 1099px) {
  .thread-panel { width: min(520px, 100%); }
}

/* Profil: Bild und Status */
.avatar-row { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; }
.status-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.status-row select, .status-row input {
  height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--canvas); color: var(--text);
  padding: 0 10px; font-size: 14px; min-width: 0;
}
.profile-dialog .status-row input { width: 100%; height: 40px; font-size: 14px; padding: 0 10px; border-radius: 10px; }
.status-row .btn-quiet { height: 40px; }
@media (max-width: 520px) {
  .status-row { grid-template-columns: 1fr; }
}

/* Melden / Stummschalten */
.report-quote {
  margin: 0 0 12px; padding: 8px 12px; border-left: 3px solid var(--line); border-radius: 4px 10px 10px 4px;
  background: var(--canvas); color: var(--text); font-size: 14px; overflow-wrap: anywhere;
}
#reportDialog select, #reportDialog textarea {
  width: 100%; border-radius: 12px; border: 1px solid var(--line); background: var(--canvas); color: var(--text);
  font: inherit; font-size: 15px; padding: 10px 12px; margin-bottom: 8px; outline: none;
}
#reportDialog select { height: 46px; }
#muteDialog .seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; margin-bottom: 12px; border-radius: 12px; background: var(--canvas); }
#muteDialog .seg label { position: relative; display: grid; place-items: center; height: 38px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer; }
#muteDialog .seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
#muteDialog .seg label:has(input:checked) { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.btn-danger {
  height: 44px; padding: 0 20px; border: 0; border-radius: 12px;
  background: var(--danger); color: #fff; font-weight: 600;
}
.btn-danger:hover { filter: brightness(1.08); }
.sugg-role { width: 14px; height: 14px; border-radius: 50%; background: var(--role); margin: 0 5px; flex-shrink: 0; }

/* ---------- Konten (Modus „hosted“) ---------- */

.auth-dialog { width: min(440px, calc(100vw - 32px)); }
.auth-form .field { display: grid; gap: 6px; margin: 0 0 12px; }
.auth-form .field > span { font-size: 13.5px; font-weight: 600; color: var(--text); }
.auth-form .hint { margin: 2px 0 0; }
.auth-form .alt-action { font-size: 13.5px; }
.auth-form pre.codes { columns: 2; column-gap: 24px; font: 15px/1.9 ui-monospace, Menlo, Consolas, monospace; text-align: center; margin-bottom: 12px; }
.check { display: flex; gap: 10px; align-items: center; font-size: 14px; margin: 14px 0 0; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.auth-form .qr { width: 200px; margin: 0 auto 10px; padding: 6px; background: #fff; border-radius: 12px; border: 1px solid var(--line); }
.auth-form .qr svg { display: block; width: 100%; height: auto; }
.auth-form .secret { text-align: center; }
.auth-form .secret code { font-size: 14px; letter-spacing: .04em; user-select: all; overflow-wrap: anywhere; }
.account-dialog .avatar-lock { font-size: 34px; line-height: 1; }
.account-dialog .ok { color: var(--ok-text); font-weight: 600; }
.account-dialog .warn { color: var(--warn-text); font-weight: 600; }
.account-dialog code.fp { font-size: 12.5px; user-select: all; }
.session-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.session-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 14px; }
.session-list li > span { display: grid; }
.session-list small { color: var(--muted); font-size: 12.5px; }

/* Neue Direktnachricht (Name oder name@instanz) */
.nav-title { display: flex; align-items: center; justify-content: space-between; }
.nav-add {
  width: 22px; height: 22px; border: 0; border-radius: 7px; padding: 0;
  background: var(--ink-raised); color: var(--ink-text); font-size: 16px; line-height: 1;
}
.nav-add:hover { background: var(--accent); color: var(--on-accent); }
.dm-add { padding: 4px 6px 6px; }
.dm-add input {
  width: 100%; height: 34px; padding: 0 10px; border-radius: 9px;
  border: 1px solid var(--ink-line); background: var(--ink-raised); color: var(--ink-strong); font-size: 13.5px; outline: none;
}
.dm-add input:focus { border-color: var(--accent); }
.dm-add input::placeholder { color: var(--ink-muted); }

/* Verschlüsselte Nachrichten */
.e2e-note { color: var(--muted); font-style: italic; }
.bubble.e2e-error .text-btn { font-size: 13px; }
.fed-state { display: inline-block; margin-left: 8px; font-size: 11.5px; color: var(--muted); }
.fed-state.failed { color: var(--danger); font-weight: 600; }
.composer.e2e #gifBtn, .composer.e2e #uploadBtn { display: none !important; }
.safety-btn { font-size: 12.5px; font-weight: 600; }
.safety-number { font: 600 19px/1.7 ui-monospace, Menlo, Consolas, monospace !important; text-align: center; letter-spacing: .06em; }
.e2e-warn { display: inline-block; margin-right: 6px; font-size: 11.5px; font-weight: 700; color: var(--danger); cursor: help; }

/* ---------- Kanal-Gruppen, Angepinnt, Threads in der Seitenleiste ---------- */

.room-row { position: relative; display: flex; align-items: center; }
.room-row > a { flex: 1; min-width: 0; }
.pin-btn {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 24px; height: 24px; padding: 3px; border: 0; border-radius: 7px;
  background: var(--ink-raised); color: var(--ink-text); display: none;
}
.pin-btn svg { width: 16px; height: 16px; }
.room-row:hover .pin-btn, .pin-btn:focus-visible { display: grid; place-items: center; }
.pin-btn:hover { color: var(--ink-strong); background: var(--ink-line); }
.pin-btn.on { color: var(--accent); }
.room-row:has(a[aria-current="page"]) .pin-btn { background: color-mix(in srgb, var(--on-accent) 22%, var(--accent)); color: var(--on-accent); }
.group-label { padding: 2px 10px 2px; font-size: 11.5px; font-weight: 650; letter-spacing: .02em; text-transform: uppercase; color: var(--ink-muted); }
.group-label:not(:first-child) { margin-top: 6px; }

.room-group { margin-top: 6px; }
.group-head {
  width: 100%; display: flex; align-items: center; gap: 6px;
  padding: 4px 8px; border: 0; border-radius: 8px; background: none;
  color: var(--ink-muted); font-size: 12px; font-weight: 650; letter-spacing: .02em; text-transform: uppercase; text-align: left;
}
.group-head:hover { color: var(--ink-strong); }
.group-head svg { width: 13px; height: 13px; flex-shrink: 0; transform: rotate(90deg); transition: transform .15s; }
.room-group.closed .group-head svg { transform: none; }
.group-head .group-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group-head .unread-badge { text-transform: none; letter-spacing: 0; }
.group-rooms { margin-top: 1px; }

.room-threads { list-style: none; margin: 0 0 2px 22px; padding: 0 0 0 8px; border-left: 1px solid var(--ink-line); display: grid; gap: 1px; }
.thread-link {
  width: 100%; display: flex; align-items: center; gap: 8px;
  padding: 4px 8px; border: 0; border-radius: 8px; background: none; text-align: left;
  color: var(--ink-text); font-size: 13px;
}
.thread-link:hover { background: var(--ink-raised); color: var(--ink-strong); }
.thread-link[aria-current="true"] { background: var(--ink-raised); color: var(--ink-strong); font-weight: 600; }
.thread-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-count { font-size: 11px; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.nav-sort svg { width: 14px; height: 14px; }
.nav-sort { display: grid; place-items: center; }
@media (hover: none) {
  .pin-btn { display: grid; place-items: center; background: none; opacity: .55; }
  .pin-btn.on { opacity: 1; }
  .room-row > a { padding-right: 34px; }
}
.group-sep { height: 1px; margin: 6px 10px; background: var(--ink-line); }

/* Sprachauswahl */
.side-lang { position: relative; display: inline-flex; align-items: center; gap: 6px; margin: 6px 10px 0; color: var(--ink-muted, var(--muted)); font-size: 12.5px; }
.side-lang[hidden] { display: none; }
.side-lang svg { width: 15px; height: 15px; flex: none; }
.side-lang select {
  appearance: none; -webkit-appearance: none; border: 0; background: transparent; color: inherit; font: inherit;
  padding: 3px 16px 3px 0; cursor: pointer; border-radius: 6px;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: right 5px center, right 1px center; background-size: 4px 4px, 4px 4px; background-repeat: no-repeat;
}
.side-lang select:hover { color: var(--ink-strong, var(--text)); }
.side-lang select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.side-lang option { color: var(--text); background: var(--surface); }
.dialog-lang { display: flex; width: fit-content; margin: -6px 0 6px auto; }
.dialog-lang[hidden] { display: none; }
#prefLangSlot:not([hidden]) { display: contents; }
.login-lang { display: flex; justify-content: center; margin: 14px auto 0; }
.login-lang[hidden] { display: none; }
.admin-foot .side-lang { margin: 0 0 4px; }

/* ---------- Sprachkanäle ---------- */

.rooms .hash.voice-icon { width: 16px; height: 16px; margin: 0 -2px; display: grid; place-items: center; }
.rooms .hash.voice-icon svg { width: 16px; height: 16px; }
.voice-join {
  position: absolute; right: 34px; top: 50%; transform: translateY(-50%);
  width: 24px; height: 24px; padding: 4px; border: 0; border-radius: 7px;
  background: var(--ink-raised); color: var(--ink-text); display: none;
}
.voice-join svg { width: 16px; height: 16px; }
.room-row:hover .voice-join, .voice-join:focus-visible, .voice-join.on { display: grid; place-items: center; }
.voice-join:hover { color: var(--ink-strong); background: var(--ink-line); }
.voice-join.on { background: color-mix(in srgb, var(--danger) 80%, transparent); color: #fff; }
.room-row:has(a[aria-current="page"]) .voice-join:not(.on) { background: color-mix(in srgb, var(--on-accent) 22%, var(--accent)); color: var(--on-accent); }
.voice-room .room-row > a { padding-right: 62px; }
@media (hover: none) { .voice-join { display: grid; place-items: center; background: none; } }

.voice-peers { list-style: none; margin: 1px 0 4px 22px; padding: 0 0 0 6px; border-left: 1px solid var(--ink-line); display: grid; gap: 1px; }
.voice-peer-btn {
  width: 100%; display: flex; align-items: center; gap: 8px;
  padding: 3px 6px; border: 0; border-radius: 8px; background: none; text-align: left;
  color: var(--ink-text); font-size: 13px;
}
.voice-peer-btn:hover { background: var(--ink-raised); color: var(--ink-strong); }
.voice-av { --size: 22px; box-shadow: 0 0 0 2px transparent; transition: box-shadow .12s; }
.voice-peer.speaking .voice-av { box-shadow: 0 0 0 2px var(--ink), 0 0 0 4px var(--online); }
.voice-peer.speaking .voice-name { color: var(--ink-strong); }
.voice-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.voice-flags { display: inline-flex; align-items: center; gap: 3px; color: var(--ink-muted); }
.voice-flag svg { width: 14px; height: 14px; }
.voice-flag.srv, .voice-flag.local { color: var(--danger); }
.voice-flag.hand { color: #f0b429; display: inline-flex; align-items: center; gap: 1px; }
.voice-hand-no { font-size: 10.5px; font-weight: 700; line-height: 1; min-width: 13px; padding: 1px 3px; border-radius: 7px; background: #f0b429; color: #1b1300; text-align: center; }
/* Gemeldet: gelb hinterlegt und pulsierend – auch ohne Animation (reduzierte Bewegung) deutlich */
.voice-peer.hand-up > .voice-peer-btn { background: color-mix(in srgb, #f0b429 20%, transparent); box-shadow: inset 3px 0 0 #f0b429; animation: hand-pulse 1.6s ease-in-out infinite; }
.voice-peer.hand-up .voice-name { color: var(--ink-strong); font-weight: 600; }
.voice-hands {
  display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 9px; font-size: 11.5px; font-weight: 700; line-height: 18px;
  background: #f0b429; color: #1b1300; vertical-align: 1px; animation: hand-blink 1.2s ease-in-out infinite;
}
@keyframes hand-pulse { 50% { background: color-mix(in srgb, #f0b429 38%, transparent); } }
@keyframes hand-blink { 50% { opacity: .45; transform: scale(.92); } }
.voice-hands-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 6px 8px 2px; }
.voice-hands-bar .voice-hands { margin-left: 0; }
.voice-hand-chip {
  border: 1px solid #f0b429; border-radius: 12px; padding: 1px 8px; font: inherit; font-size: 12px; cursor: pointer;
  background: color-mix(in srgb, #f0b429 16%, transparent); color: var(--ink-strong); max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.voice-hand-chip:hover { background: color-mix(in srgb, #f0b429 32%, transparent); }
.conf-tile.hand-up { box-shadow: 0 0 0 3px #f0b429; }
.conf-hand {
  position: absolute; top: 8px; left: 8px; padding: 2px 9px; border-radius: 14px; font-size: 22px; font-weight: 700; line-height: 1.3;
  background: #f0b429; color: #1b1300; box-shadow: 0 2px 8px rgba(0, 0, 0, .35); pointer-events: none; animation: hand-wave 1.8s ease-in-out infinite;
  transform-origin: 50% 90%;
}
.conf-strip .conf-tile .conf-hand { font-size: 15px; top: 4px; left: 4px; padding: 1px 6px; }
@keyframes hand-wave { 0%, 60%, 100% { transform: rotate(0); } 15% { transform: rotate(-12deg); } 30% { transform: rotate(10deg); } 45% { transform: rotate(-6deg); } }
.voice-flag.stage { color: var(--online); }
.voice-vol { font-size: 10.5px; font-variant-numeric: tabular-nums; }

.voice-bar {
  margin: -6px 0 -8px; padding: 10px; border-radius: 14px;
  background: var(--ink-raised); color: var(--ink-text); display: grid; gap: 8px;
}
.voice-bar-head { display: grid; gap: 6px; }
.voice-bar-status {
  flex: 1; min-width: 0; display: grid; text-align: left; padding: 2px 4px; border: 0; border-radius: 8px; background: none; color: inherit;
}
.voice-bar-status:hover { background: var(--ink-line); }
.voice-bar-status b { font-size: 13px; color: var(--online); white-space: nowrap; }
.voice-bar-status.connecting b, .voice-bar-status.reconnecting b { color: #f0b429; }
.voice-bar-status span { font-size: 12px; color: var(--ink-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.voice-bar-btns { display: flex; justify-content: space-between; gap: 2px; }
.vb { flex: 1; max-width: 44px; height: 32px; padding: 7px; border: 0; border-radius: 9px; background: none; color: var(--ink-text); display: grid; place-items: center; }
.vb svg { width: 18px; height: 18px; }
.vb:hover:not(:disabled) { background: var(--ink-line); color: var(--ink-strong); }
.vb.off { color: var(--danger); }
.vb.on { color: #f0b429; }
.vb:disabled { opacity: .55; cursor: default; }
.vb.leave:hover { background: var(--danger); color: #fff; }
.voice-ptt {
  height: 34px; border: 1px dashed var(--ink-line); border-radius: 10px; background: none;
  color: var(--ink-text); font-size: 13px; font-weight: 600; touch-action: none; user-select: none;
}
.voice-ptt.on { background: var(--online); border-color: var(--online); color: #fff; }
.voice-bar-note { margin: 0; font-size: 12px; color: var(--ink-muted); }

.voice-head-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); font-size: 14px; font-weight: 600;
}
.voice-head-btn svg { width: 17px; height: 17px; color: var(--accent); }
.voice-head-btn:hover { border-color: var(--accent); color: var(--accent-text); }
.voice-head-btn.on { background: var(--danger); border-color: var(--danger); color: #fff; }
.voice-head-btn.on svg { color: #fff; }
@media (max-width: 760px) { .voice-head-btn span { display: none; } .voice-head-btn { padding: 0 9px; } }

.voice-pop { position: fixed; z-index: 30; width: 260px; padding: 12px; display: grid; gap: 8px; }
.voice-pop-name { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.voice-pop .check { margin: 0; }
.voice-pop-hint { margin: 0; font-size: 12.5px; color: var(--muted); }
.voice-slider { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; font-size: 13px; color: var(--muted); }
.voice-slider input { grid-column: 1 / -1; grid-row: 2; width: 100%; accent-color: var(--accent); }
.voice-slider output { font-variant-numeric: tabular-nums; color: var(--text); }
.voice-pop-actions { display: grid; border-top: 1px solid var(--line); padding-top: 6px; }
.voice-pop-actions .menu-item { padding: 7px 8px; font-size: 13.5px; }

.voice-dialog { max-height: calc(100dvh - 32px); overflow-y: auto; }
.voice-dialog form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.voice-dialog h2 { margin: 0; }
.voice-field { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; min-width: 0; font-size: 13.5px; font-weight: 600; }
.voice-field small { font-weight: 400; color: var(--muted); }
.voice-field output { font-weight: 400; color: var(--muted); font-variant-numeric: tabular-nums; }
.voice-field select { width: 100%; min-width: 0; text-overflow: ellipsis; height: 44px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--canvas); color: var(--text); font: inherit; font-weight: 400; }
#voiceDialog input[type=range] { width: 100%; height: auto; padding: 0; border: 0; background: none; box-shadow: none; accent-color: var(--accent); }
.voice-meter { --lvl: 0%; --sens: 50%; position: relative; height: 8px; border-radius: 4px; background: var(--canvas); overflow: hidden; }
.voice-meter span { position: absolute; inset: 0 auto 0 0; width: var(--lvl); background: var(--muted); transition: width .06s linear; }
.voice-meter.open span { background: var(--online); }
.voice-meter::after { content: ""; position: absolute; top: 0; bottom: 0; left: var(--sens); width: 2px; background: var(--text); opacity: .6; }
.voice-mode { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 12px; background: var(--canvas); }
.voice-mode label { position: relative; display: grid; place-items: center; height: 38px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer; }
.voice-mode input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.voice-mode label:has(input:checked) { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.voice-key { display: flex; align-items: center; gap: 10px; }
.voice-key kbd { min-width: 44px; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--canvas); font: 600 14px/1 ui-monospace, Menlo, Consolas, monospace; text-align: center; }
.voice-key .btn-quiet { height: 36px; }
.voice-dialog .actions { margin-top: 4px; flex-wrap: wrap; }
.voice-dialog .hint { margin: 0; }
.voice-meter { margin-top: 2px; }

/* Bildschirmfreigabe */
/* Gemeinsamer Bereich für Bildschirm und Kameras: Höhe per Trenner verstellbar, der Chat bleibt darunter */
.media-area {
  flex-shrink: 0; display: flex; flex-direction: column; gap: 8px;
  height: clamp(140px, var(--media-h, 55%), calc(100% - 260px));
  margin: 10px max(16px, calc((100% - var(--column) - 240px) / 2)) 0;
}
.media-area:not(:has(> section:not([hidden]))), .media-area:not(:has(> section:not([hidden]))) + .media-split { display: none; }
.media-area.mini-only { height: auto; }
.media-split { flex-shrink: 0; height: 12px; display: grid; place-items: center; cursor: row-resize; touch-action: none; }
.media-split span { width: 48px; height: 4px; border-radius: 2px; background: var(--line); transition: background .12s; }
.media-split:hover span, .media-split.drag span, .media-split:focus-visible span { background: var(--accent); }
.media-area.mini-only + .media-split { display: none; }
.screen-view {
  flex: 1 1 0; min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr);
  background: #0b0c14; border-radius: 16px; overflow: hidden; box-shadow: var(--shadow-float);
}
.screen-view:fullscreen { height: 100vh; margin: 0; border-radius: 0; }
.screen-head { display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 14px; color: #e7e8f2; font-size: 14px; }
.screen-head svg { width: 18px; height: 18px; flex-shrink: 0; }
.screen-head b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.screen-head .icon-btn { color: #e7e8f2; }
.screen-head .icon-btn:hover { background: rgba(255, 255, 255, .1); }
.screen-stage { position: relative; display: grid; place-items: center; min-height: 0; padding: 0 8px 8px; }
.screen-stage canvas { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; border-radius: 6px; background: #000; }
.screen-wait { position: absolute; color: #9a9db5; font-size: 14px; display: none; }
.screen-view.waiting .screen-wait { display: block; }
.screen-view.waiting canvas { visibility: hidden; }
.voice-peer { display: flex; align-items: center; }
.voice-peer .voice-peer-btn { flex: 1; min-width: 0; }
.voice-watch {
  width: 26px; height: 24px; padding: 3px; margin-left: 2px; border: 0; border-radius: 7px; flex-shrink: 0;
  background: color-mix(in srgb, var(--accent) 30%, transparent); color: var(--ink-strong); display: grid; place-items: center;
}
.voice-watch svg { width: 16px; height: 16px; }
.voice-watch:hover:not(:disabled) { background: var(--accent); }
.voice-watch.on { background: var(--accent); }
.voice-watch:disabled { opacity: .5; cursor: default; }
.vb.sharing { color: #fff; background: var(--online); }
.voice-bar-note.sharing { color: var(--online); font-weight: 600; }
@media (max-width: 760px) { .media-area { margin: 8px 8px 0; height: clamp(120px, var(--media-h, 42%), calc(100% - 220px)); } }

/* Konferenz */
.conf-view {
  flex: 1 1 0; min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto auto; gap: 8px; padding: 8px;
  background: #0b0c14; border-radius: 16px; overflow: hidden; box-shadow: var(--shadow-float);
}
/* Läuft eine Bildschirmfreigabe, bekommt sie die Bühne – die Kameras stehen als Leiste darunter */
.conf-view.mini { order: 2; flex: 0 0 auto; grid-template-rows: auto; padding: 6px; }
.conf-view.mini .conf-stage, .conf-view.mini .conf-bar { display: none; }
.conf-view.mini .conf-tile { width: 128px; }
.conf-view:fullscreen { height: 100vh; margin: 0; border-radius: 0; }
.conf-stage { display: grid; gap: 8px; min-height: 0; grid-template-columns: 1fr; }
.conf-stage[data-n="2"] { grid-template-columns: 1fr 1fr; }
.conf-stage[data-n="3"], .conf-stage[data-n="4"] { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.conf-stage[data-n="5"], .conf-stage[data-n="6"] { grid-template-columns: repeat(3, 1fr); grid-template-rows: 1fr 1fr; }
.conf-stage[data-n="7"], .conf-stage[data-n="8"], .conf-stage[data-n="9"] { grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); }
.conf-strip { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: thin; min-height: 0; }
.conf-strip:empty { display: none; }
.conf-tile {
  position: relative; display: grid; place-items: center; min-width: 0; min-height: 0;
  background: #000; border-radius: 10px; overflow: hidden; box-shadow: 0 0 0 2px transparent; transition: box-shadow .12s;
}
.conf-strip .conf-tile { flex: 0 0 auto; width: 160px; aspect-ratio: 16 / 9; }
.conf-tile canvas, .conf-tile video { width: 100%; height: 100%; object-fit: contain; display: block; }
.conf-tile.self video { transform: scaleX(-1); object-fit: cover; }
.conf-tile.soft canvas { filter: blur(.4px); }
.conf-tile.speaking { box-shadow: 0 0 0 3px var(--online); }
.conf-name {
  position: absolute; left: 8px; bottom: 6px; max-width: calc(100% - 16px);
  padding: 2px 8px; border-radius: 6px; background: rgba(0, 0, 0, .55); color: #fff;
  font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.conf-bar { display: flex; align-items: center; gap: 8px; color: #b8bbcf; font-size: 12.5px; }
.conf-note { flex: 1; }
.conf-bar .icon-btn { color: #e7e8f2; }
#confToggle.on { color: var(--accent-text); background: var(--accent-soft); }
@media (max-width: 760px) { .conf-strip .conf-tile, .conf-view.mini .conf-tile { width: 104px; } }

/* Drag-and-Drop in andere Sprachkanäle */
.voice-peer[draggable="true"] { cursor: grab; }
.voice-dragging .voice-room .room-row > a { outline: 1px dashed var(--ink-line); outline-offset: -1px; }
.voice-room.drop-target .room-row > a { background: color-mix(in srgb, var(--online) 30%, var(--ink-raised)); color: var(--ink-strong); outline: 2px solid var(--online); }
.voice-flag.music { color: #c58af9; }
.voice-flag.cam { color: var(--online); }

/* Passwort, Kanal-Einstellungen */
.locked-btn { margin-top: 14px; }
.room-settings form { display: grid; gap: 12px; }
.room-settings h2 { margin: 0; }
.rs-field { display: grid; gap: 6px; font-size: 13.5px; font-weight: 600; }
.rs-field select { height: 44px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--canvas); color: var(--text); font: inherit; font-weight: 400; }
.rs-voice { border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px 12px; margin: 0; display: grid; gap: 8px; }
.rs-voice legend { padding: 0 6px; font-size: 13.5px; font-weight: 650; }
.rs-voice .check { margin: 2px 0 0; }
.room-settings .hint { margin: 0; }

/* ---------- Bedienung wie bei Discord ---------- */

/* Nutzerleiste unten in der Seitenleiste */
.user-panel { display: flex; align-items: center; gap: 2px; margin: 0 -6px; padding: 6px; border-radius: 12px; background: color-mix(in srgb, var(--ink-raised) 70%, var(--ink)); }
.user-panel .me { flex: 1; min-width: 0; }
.up-btns { display: flex; gap: 2px; flex-shrink: 0; }
.up-btn { width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 8px; background: none; color: var(--ink-text); }
.up-btn svg { width: 19px; height: 19px; }
.up-btn:hover { background: var(--ink-raised); color: var(--ink-strong); }
.up-btn.off { color: var(--danger); }

/* Mitgliederliste rechts */
.members { width: 240px; flex-shrink: 0; background: var(--surface); border-left: 1px solid var(--line); display: flex; flex-direction: column; }
.members-scroll { overflow-y: auto; padding: 14px 8px 20px; }
.members-head { margin: 14px 8px 4px; font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.members-head:first-child { margin-top: 0; }
.member { width: 100%; display: flex; align-items: center; gap: 10px; padding: 5px 8px; border: 0; border-radius: 8px; background: none; text-align: left; }
.member:hover { background: var(--canvas); }
.member .avatar { --size: 32px; }
.member-text { display: grid; min-width: 0; line-height: 1.25; }
.member-name { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-name.role-name { color: var(--role); }
.member-status { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member.self .member-name::after { content: " •"; color: var(--online); }
.members-foot { margin: 14px 8px 0; font-size: 12.5px; color: var(--muted); }
.people.on { background: var(--accent-soft); }

/* Profilkarte */
.profile-card { position: fixed; z-index: 31; width: 300px; overflow: hidden; padding: 0; }
.pc-head { height: 60px; background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 45%, var(--ink))); position: relative; }
.pc-avatar { --size: 72px !important; position: absolute; left: 16px; bottom: -36px; border: 5px solid var(--surface); box-sizing: content-box; }
.pc-body { padding: 44px 16px 16px; display: grid; gap: 6px; }
.pc-name { font: 700 19px/1.2 var(--font-display); }
.pc-status { font-size: 13.5px; color: var(--muted); }
.pc-label { margin-top: 6px; font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.pc-roles { display: flex; flex-wrap: wrap; gap: 5px; }
.pc-actions { display: flex; gap: 6px; margin-top: 8px; }
.pc-actions .btn-primary { flex: 1; }
.pc-more { width: 38px; padding: 0 !important; display: grid; place-items: center; }

/* Tastenkürzel */
.keys-list { display: grid; grid-template-columns: auto 1fr; gap: 8px 18px; margin: 4px 0 18px; font-size: 14px; }
.keys-list dt { white-space: nowrap; color: var(--muted); }
.keys-list dd { margin: 0; }
kbd { display: inline-block; min-width: 22px; padding: 1px 6px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; background: var(--canvas); font: 600 12px/1.5 var(--font); text-align: center; color: var(--text); }

/* Kompakter Nachrichtenstil: keine Blasen, Zeit vorne, dichte Zeilen */
body.compact .msg { margin-top: 6px; padding-top: 2px; padding-bottom: 2px; grid-template-columns: 24px minmax(0, 1fr); column-gap: 8px; }
body.compact .msg.cont { margin-top: 0; padding-top: 0; padding-bottom: 0; }
body.compact .msg .avatar { --size: 24px; }
body.compact .msg .meta { margin-bottom: 0; font-size: 13px; }
body.compact .bubble { padding: 0 0 0 0; border-left: 0; background: none; border-radius: 0; max-width: 100%; line-height: 1.42; }
body.compact .msg.own { --block: transparent; }
body.compact .msg.mentioned { background: var(--warn-bg); box-shadow: inset 3px 0 0 #e2a400; }
body.compact .msg:hover { background: color-mix(in srgb, var(--surface) 80%, var(--canvas)); }

@media (max-width: 1100px) {
  .members { position: fixed; z-index: 12; inset: 0 0 0 auto; width: min(280px, 86vw); box-shadow: var(--shadow-float); }
}
@media (max-width: 760px) {
  .profile-card { width: min(300px, calc(100vw - 16px)); }
}

/* ---------- Konferenz: Ansichten, Reaktionen, Leitung, Untertitel, Statistik, Mobil ---------- */

/* Galerie: alle gleich groß */
.conf-view.gallery { grid-template-rows: minmax(0, 1fr) auto; }
.conf-view.gallery .conf-stage { grid-template-rows: none; grid-auto-rows: minmax(0, 1fr); }
.conf-view.gallery .conf-stage[data-n="2"] { grid-template-columns: 1fr 1fr; }
.conf-view.gallery .conf-stage[data-n="3"], .conf-view.gallery .conf-stage[data-n="4"] { grid-template-columns: 1fr 1fr; }
.conf-view.gallery .conf-stage[data-n="5"], .conf-view.gallery .conf-stage[data-n="6"],
.conf-view.gallery .conf-stage[data-n="7"], .conf-view.gallery .conf-stage[data-n="8"], .conf-view.gallery .conf-stage[data-n="9"] { grid-template-columns: repeat(3, 1fr); }
.conf-view.gallery .conf-stage[data-n="10"], .conf-view.gallery .conf-stage[data-n="11"], .conf-view.gallery .conf-stage[data-n="12"],
.conf-view.gallery .conf-stage[data-n="13"], .conf-view.gallery .conf-stage[data-n="14"], .conf-view.gallery .conf-stage[data-n="15"], .conf-view.gallery .conf-stage[data-n="16"] { grid-template-columns: repeat(4, 1fr); }
.conf-view.mini .conf-tile.lead { width: 220px; box-shadow: 0 0 0 2px var(--accent); }
.conf-tile.pinned { box-shadow: 0 0 0 3px var(--accent); }
.conf-pin {
  position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; border: 0; border-radius: 8px;
  background: rgba(0, 0, 0, .55); font-size: 15px; line-height: 1; opacity: 0; transition: opacity .12s;
}
.conf-tile:hover .conf-pin, .conf-tile.pinned .conf-pin, .conf-pin:focus-visible { opacity: 1; }
.conf-tile:fullscreen { border-radius: 0; }
#confLayout.on { color: var(--accent-text); }

/* Reaktionen */
@keyframes float-up { from { transform: translateY(0) scale(.6); opacity: 0; } 15% { opacity: 1; transform: translateY(-6px) scale(1.15); } to { transform: translateY(-46px) scale(1); opacity: 0; } }
.voice-peer { position: relative; }
.voice-react { position: absolute; right: 36px; top: -4px; font-size: 20px; pointer-events: none; animation: float-up 2.5s ease-out forwards; }
.conf-react { position: absolute; left: 50%; bottom: 30%; font-size: 44px; pointer-events: none; animation: float-up 2.5s ease-out forwards; text-shadow: 0 2px 8px rgba(0, 0, 0, .4); }
.msg-menu.react-menu { display: grid; grid-template-columns: repeat(4, 44px); min-width: 0; gap: 2px; }
.msg-menu.react-menu .menu-item { justify-content: center; padding: 6px; font-size: 22px; }

/* Teilnehmer: Qualität, Aufnahme, moderiert */
.voice-flag.quality.q1 { color: var(--danger); }
.voice-flag.quality.q2 { color: #e2a400; }
.voice-flag.rec { color: var(--danger); }
.voice-flag.mod { color: var(--ink-muted); }

/* Hinweise in der Sprachleiste */
.voice-bar-note.rec { color: #ff6b75; font-weight: 600; }
button.voice-bar-note { border: 0; background: none; padding: 0; text-align: left; font: inherit; cursor: pointer; }
.voice-bar-note.e2ee { font-variant-numeric: tabular-nums; }
.voice-bar-note.e2ee.ok { color: var(--online); }
.voice-ask, .voice-breakout {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; padding: 8px 10px; border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 22%, var(--ink-raised)); color: var(--ink-strong); font-size: 13px;
}
.voice-ask span, .voice-breakout span { flex: 1 1 140px; }
.voice-ask button, .voice-breakout button { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.voice-breakout .btn-quiet { color: var(--ink-strong); border-color: color-mix(in srgb, var(--ink-strong) 30%, transparent); }

/* Untertitel */
.caption-box {
  position: absolute; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 6;
  width: min(760px, calc(100% - 32px)); padding: 8px 14px; border-radius: 12px;
  background: rgba(10, 11, 20, .82); color: #fff; font-size: 15px; line-height: 1.45; pointer-events: none;
}
.caption-box p { margin: 2px 0; }
.caption-box b { color: #b9b4ff; font-weight: 650; }

/* Ton der Bildschirmfreigabe */
.screen-tone { display: flex; align-items: center; gap: 6px; color: #e7e8f2; }
.screen-tone svg { width: 18px; height: 18px; }
.screen-tone input { width: 90px; accent-color: var(--accent); }

/* Statistik */
.voice-stats {
  position: fixed; right: 16px; bottom: 16px; z-index: 40; width: min(420px, calc(100vw - 32px)); max-height: 70vh; overflow: auto;
  padding: 12px 14px; border-radius: 14px; background: var(--surface); color: var(--text); border: 1px solid var(--line);
  box-shadow: var(--shadow-float); font-size: 12.5px;
}
.voice-stats h3 { margin: 0 0 8px; font-size: 14px; }
.vs-row { display: grid; grid-template-columns: minmax(110px, auto) 1fr; gap: 10px; padding: 3px 0; border-bottom: 1px solid var(--line); }
.vs-row span { color: var(--muted); }
.vs-row b { font-weight: 550; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.voice-stats .btn-quiet { margin-top: 10px; height: 32px; }

/* Anrufleiste auf dem Handy */
.mobile-call {
  position: fixed; left: 8px; right: 8px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 8;
  display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 16px;
  background: var(--ink); color: var(--ink-text); box-shadow: var(--shadow-float);
}
.mc-room { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-strong); font-weight: 600; font-size: 14px; }
.mc-btn { width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 12px; background: var(--ink-raised); color: var(--ink-strong); }
.mc-btn svg { width: 22px; height: 22px; }
.mc-btn.off { color: var(--danger); }
.mc-btn.on { background: var(--online); color: #fff; }
.mc-btn.leave { background: var(--danger); color: #fff; }

/* Touch: größere Ziele */
@media (pointer: coarse) {
  .vb, .up-btn { min-width: 40px; min-height: 40px; }
  .voice-peer-btn { min-height: 40px; }
  .conf-pin { opacity: 1; }
  .menu-item { min-height: 44px; }
}

/* Live-Transkription */
.tr-btn { position: relative; }
.tr-btn .tr-dot { display: none; position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 2px var(--surface); }
.tr-btn.live .tr-dot { display: block; animation: hand-blink 1.4s ease-in-out infinite; }
.tr-btn.live { color: var(--danger); }
.tr-bar {
  position: relative; z-index: 6; display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 7px max(24px, calc((100% - var(--column)) / 2));
  background: color-mix(in srgb, var(--danger) 12%, var(--surface)); border-bottom: 1px solid color-mix(in srgb, var(--danger) 30%, var(--line));
  font-size: 13.5px; color: var(--text);
}
.tr-bar-text { flex: 1; min-width: 200px; }
.tr-bar-text b { color: var(--danger); margin-right: 4px; }
.tr-bar-text b::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: var(--danger); vertical-align: 1px; animation: hand-blink 1.4s ease-in-out infinite; }
.tr-bar-btn { height: 30px; padding: 0 12px; font-size: 13px; }
.btn-quiet.danger { color: var(--danger); }
.tr-panel {
  position: relative; z-index: 6; display: flex; flex-direction: column; gap: 8px; max-height: min(45vh, 420px);
  margin: 10px auto 0; width: min(var(--column), calc(100% - 32px)); padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-float);
}
.tr-head { display: flex; align-items: center; gap: 8px; }
.tr-head b { flex: 1; font-size: 14.5px; }
.tr-actions { display: flex; gap: 6px; }
.tr-actions button { height: 32px; padding: 0 12px; font-size: 13px; }
.tr-note { margin: 0; font-size: 13px; color: var(--muted); }
.tr-lines { overflow-y: auto; min-height: 60px; padding-right: 4px; font-size: 14px; line-height: 1.5; }
.tr-line { margin: 0; padding: 2px 0; display: grid; grid-template-columns: 64px minmax(0, 1fr); column-gap: 8px; }
.tr-line:not(.same) { margin-top: 6px; }
.tr-time { grid-row: span 2; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; padding-top: 2px; }
.tr-who { font-weight: 650; }
.tr-line.same .tr-time { grid-row: auto; }
.tr-text { overflow-wrap: anywhere; }
.tr-empty { margin: 8px 0; color: var(--muted); font-size: 13px; }
.tr-past { font-size: 13px; }
.tr-past summary { cursor: pointer; color: var(--muted); }
.tr-past ul { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 4px; max-height: 160px; overflow-y: auto; }
.tr-past-item { display: flex; align-items: center; gap: 6px; }
.tr-past-item span { flex: 1; min-width: 0; }
.tr-past-item button { height: 26px; padding: 0 8px; font-size: 12px; }
.voice-bar-note.tr-live { color: #ff6b75; font-weight: 600; }
@media (max-width: 760px) { .tr-panel { width: calc(100% - 16px); max-height: 50vh; } .tr-line { grid-template-columns: 52px minmax(0, 1fr); } }

/* ---------- Kanal-Föderation ---------- */
.meta .fed-from { color: var(--muted); font-size: 12px; font-weight: 500; margin-left: -2px; }
.room-flag.fed { font-size: 11px; opacity: .8; }
.room-flag.fed.ended { filter: grayscale(1); opacity: .5; }
.chan-sub { width: min(560px, calc(100vw - 32px)); }
.chan-sub-find { display: flex; gap: 8px; margin: 12px 0 0; flex-wrap: wrap; }
.chan-sub-find input { flex: 1 1 180px; min-width: 0; }
.chan-sub-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; max-height: min(320px, 45vh); overflow: auto; }
.chan-sub-list li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; }
.chan-sub-list .cs-info { display: grid; gap: 2px; min-width: 0; flex: 1; }
.chan-sub-list strong { overflow-wrap: anywhere; font-size: 14px; }
.chan-sub-list small { color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; }
.chan-sub-list .cs-empty { border: 0; color: var(--muted); font-size: 13.5px; }
.chan-sub-list a.btn-quiet { text-decoration: none; color: inherit; }
