:root {
  /* True black (OLED) with Apple-like neutral grays; blue from the deldown chat logos (#1B43E2, star #BED1E6). */
  --bg: #000;
  --bg-2: #000;              /* list / sidebar */
  --bg-3: #000;              /* chat */
  --bg-4: #1c1c1f;           /* raised: inputs, other people's bubbles */
  --bg-5: #2c2c31;           /* hover, pressed, secondary buttons */
  --line: #1f1f23;           /* hairlines between areas */
  --text: #f5f5f7;
  --text-2: #d1d1d6;
  --muted: #8e8e93;          /* 6.3:1 on black */
  --hover: #121215;
  --brand: #1b43e2;          /* fills: buttons, active states (white text on it: ~6:1) */
  --brand-hover: #2b55f5;
  --accent: #1b43e2;
  --accent-fg: #7b97ff;      /* brand blue lightened for text/icons on dark backgrounds (~6:1) */
  --star: #bed1e6;
  --on-accent: #ffffff;
  --ok: #3ddc97;             /* status only: online, speaking, voice connected */
  --danger: #ef5350;
  --warn: #f2b84b;
  --radius: 10px;
  --r-sm: 8px; --r-md: 14px; --r-lg: 20px; /* radius scale: controls, cards/sheets, bubbles */
  --font: -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", Roboto, Cantarell, "Noto Sans", Ubuntu, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "JetBrains Mono", "DejaVu Sans Mono", monospace;
  color-scheme: dark;
}
/* Themes (Einstellungen → Darstellung). OLED above is the default. */
:root[data-theme="gray"] {
  --bg: #1c1c1e; --bg-2: #1c1c1e; --bg-3: #1c1c1e; --bg-4: #2c2c2e; --bg-5: #3a3a3c; --line: #2c2c2e; --hover: #252527;
  --muted: #98989f;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #ffffff; --bg-2: #ffffff; --bg-3: #ffffff; --bg-4: #eeeef1; --bg-5: #e2e2e7; --line: #e5e5ea; --hover: #f4f4f6;
  --text: #1d1d1f; --text-2: #3a3a3c; --muted: #6e6e73;  /* 5.1:1 on white */
  --accent-fg: #1b43e2; --star: #1b43e2; --ok: #1f9d68;
}

* { box-sizing: border-box; }
html, body, #app { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: var(--accent-fg); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 22px; }
h2 { font-size: 16px; }
h3 { font-size: 15px; }
p { margin: 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 8px 0; width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent-fg); outline-offset: 2px; }
.icon { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* scrollbars: Chromium + Firefox */
.scroll, .sb-list, .popover, .modal, .members { overflow-y: auto; }
.scroll::-webkit-scrollbar, .sb-list::-webkit-scrollbar, .popover::-webkit-scrollbar, .modal::-webkit-scrollbar, .members::-webkit-scrollbar { width: 10px; }
.scroll::-webkit-scrollbar-thumb, .sb-list::-webkit-scrollbar-thumb, .popover::-webkit-scrollbar-thumb, .modal::-webkit-scrollbar-thumb, .members::-webkit-scrollbar-thumb {
  background: var(--bg-5); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box;
}
@supports not selector(::-webkit-scrollbar) {
  .scroll, .sb-list, .popover, .modal, .members { scrollbar-width: thin; scrollbar-color: var(--bg-5) transparent; }
}

/* ------------------------------------------------ onboarding */
.center-screen {
  min-height: 100%; display: grid; place-items: center; padding: 16px;
  background: var(--bg);
}
.card {
  width: min(420px, 100%); background: var(--bg-3); border: 1px solid var(--line); border-radius: 16px;
  padding: 28px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 24px 60px rgb(0 0 0 / 0.4);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; }
.brand-mark { width: 28px; height: 28px; object-fit: contain; flex: none; }
.brand-logo { height: 96px; width: auto; display: block; align-self: center; object-fit: contain; }
.hero-icon { width: 52px; height: 52px; border-radius: 14px; background: var(--bg-4); color: var(--star); display: grid; place-items: center; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.fine { color: var(--muted); font-size: 12.5px; }
.error-text { color: var(--danger); }
.warn-text { color: var(--warn); font-size: 14px; }
.danger-text { color: var(--danger); }
.loading { color: var(--muted); padding: 24px; text-align: center; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--muted); }
.field small { color: var(--muted); font-size: 12.5px; }
.input {
  width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; outline: none;
}
.input:focus { border-color: var(--accent-fg); }
select.input { appearance: auto; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: 8px;
  background: var(--bg-5); color: var(--text); font-weight: 600; transition: background 0.12s, filter 0.12s;
}
.btn:hover { filter: brightness(1.15); }
.btn:disabled { opacity: 0.6; cursor: default; }
.btn.primary { background: var(--brand); color: var(--on-accent); }
.btn.primary:hover { background: var(--brand-hover); filter: none; }
.btn.ok { background: #1f9d68; color: #fff; }
.btn.danger { background: var(--danger); color: #fff; }
.btn.ghost { background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--bg-4); }
.btn.block { width: 100%; }
.btn.small { padding: 6px 12px; font-size: 13.5px; }

.icon-btn {
  width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; color: var(--muted); flex: none;
  transition: background 0.12s, color 0.12s;
}
.icon-btn:hover { background: var(--bg-4); color: var(--text); }
.icon-btn.tiny { width: 24px; height: 24px; }
.icon-btn.tiny .icon { width: 16px; height: 16px; }
.icon-btn.off { color: var(--danger); }
.icon-btn.on { color: var(--on-accent); background: var(--accent); }
.icon-btn.danger { color: #fff; background: var(--danger); }
.icon-btn.danger:hover { filter: brightness(1.1); }
.icon-btn.round { border-radius: 50%; width: 38px; height: 38px; background: var(--bg-4); }
.icon-btn.round.ok { color: var(--ok); }
.icon-btn.danger-hover:hover { color: var(--danger); }
.icon-btn.send { color: var(--accent-fg); }

.row { display: flex; align-items: center; gap: 10px; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 14px; }

/* ------------------------------------------------ layout */
.layout { display: grid; grid-template-columns: 72px 260px minmax(0, 1fr) auto; height: 100vh; height: 100dvh; }
.sidebar { background: var(--bg-2); display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); }
.main { background: var(--bg-3); display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; }
.members { background: var(--bg-2); width: 240px; border-left: 1px solid var(--line); padding: 14px 10px; display: flex; flex-direction: column; gap: 4px; }

.sb-head { height: 56px; padding: 0 8px 0 16px; display: flex; align-items: center; gap: 2px; flex: none; }
.sb-title { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; margin-right: auto; }
.sb-head .icon-btn { position: relative; }
.sb-head .icon-btn.active { background: var(--bg-5); color: var(--text); }
.dot-badge { position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; }
.search-wrap { padding: 0 12px 8px; flex: none; }
.search { width: 100%; height: 36px; border: 0; border-radius: 10px; background: var(--bg-4); padding: 0 12px; color: var(--text); outline: none; }
.search::placeholder { color: var(--muted); }
.search:focus-visible { outline: 2px solid var(--accent-fg); outline-offset: 0; }
.conv-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 10px; border-radius: 12px; text-align: left; color: var(--text); transition: background 0.18s var(--ease, ease); }
.conv-row:hover { background: var(--hover); }
.conv-row.active { background: var(--bg-4); }
.conv-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.conv-line { display: flex; align-items: center; gap: 8px; min-width: 0; }
.conv-name { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-time { flex: none; font-size: 12px; color: var(--muted); }
.conv-preview { flex: 1; min-width: 0; font-size: 13.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-row.unread .conv-preview { color: var(--text-2); }
.conv-row.unread .conv-time { color: var(--accent-fg); font-weight: 600; }
.tabbar { display: none; }
.sb-nav { padding: 8px 8px 0; }
.sb-section {
  display: flex; align-items: center; justify-content: space-between; padding: 16px 10px 4px 16px;
  font-size: 13px; font-weight: 600; color: var(--muted);
}
.sb-list { flex: 1; padding: 4px 8px; display: flex; flex-direction: column; gap: 2px; min-height: 0; }
.sb-empty { color: var(--muted); font-size: 13.5px; padding: 8px 10px; }
.sb-empty.welcome { display: flex; flex-direction: column; gap: 10px; padding: 16px 10px; }
.sb-empty.welcome > b { color: var(--text); font-size: 15px; }
.sb-empty.welcome p { margin: 0; line-height: 1.45; }
.sb-empty.welcome .btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.invite-row.dead { opacity: 0.55; }
.sb-item {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px; color: var(--muted);
  text-align: left; transition: background 0.1s, color 0.1s;
}
.sb-item:hover { background: var(--bg-4); color: var(--text-2); }
.sb-item.active { background: var(--bg-5); color: var(--text); }
.sb-item.unread { color: var(--text); }
.sb-item.unread .sb-name { font-weight: 650; }
.sb-text { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.25; }
.sb-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-text small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge {
  background: var(--danger); color: #fff; border-radius: 10px; min-width: 18px; height: 18px; padding: 0 5px;
  font-size: 11.5px; font-weight: 700; display: inline-grid; place-items: center; margin-left: auto;
}
.in-call { color: var(--ok); display: inline-flex; align-items: center; gap: 4px; }

.voice-box {
  margin: 8px; padding: 8px 8px 8px 12px; background: var(--bg-3); border: 1px solid var(--line); border-radius: 10px;
  display: flex; align-items: center; gap: 4px;
}
.voice-info { flex: 1; min-width: 0; cursor: pointer; display: flex; flex-direction: column; line-height: 1.25; }
.voice-state { color: var(--ok); font-weight: 650; font-size: 13.5px; }
.voice-info small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.update-notes { margin-top: 4px; font-size: 12.5px; color: var(--text-2); }
.update-notes summary { cursor: pointer; color: var(--text); }
.update-notes ul { margin: 4px 0 0; padding-left: 16px; }
.update-box { margin: 8px; padding: 10px 10px 10px 12px; border-radius: 10px; display: flex; align-items: center; gap: 10px; background: rgb(27 67 226 / 0.14); border: 1px solid rgb(27 67 226 / 0.45); }
.user-panel { display: flex; align-items: center; gap: 2px; padding: 8px; background: var(--bg); border-top: 1px solid var(--line); flex: none; }
.me { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; padding: 4px 6px; border-radius: 8px; text-align: left; }
.me:hover { background: var(--bg-4); }

.avatar { border-radius: 50%; object-fit: cover; flex: none; display: block; background: var(--bg-5); }
.avatar.initials { display: grid; place-items: center; color: #fff; font-weight: 650; user-select: none; }
.status-wrap { position: relative; flex: none; }
.status-dot { position: absolute; right: -2px; bottom: -2px; width: 12px; height: 12px; border-radius: 50%; border: 3px solid var(--bg-2); }
.status-dot.on { background: var(--ok); }
.status-dot.off { background: #5b5e66; }
.group-avatar { position: relative; flex: none; }
.group-avatar > :first-child { position: absolute; left: 0; top: 0; }
.group-avatar > :nth-child(2) { position: absolute; right: 0; bottom: 0; box-shadow: 0 0 0 2px var(--bg-2); }

/* ------------------------------------------------ main header */
.top {
  height: 60px; flex: none; display: flex; align-items: center; gap: 10px; padding: 0 12px 0 16px;
  border-bottom: 1px solid var(--line); color: var(--muted);
}
.top h2 { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top h2.clickable { cursor: pointer; }
.top h2.clickable:hover { text-decoration: underline; }
.top .status-dot { border-color: var(--bg-3); }
.handle { color: var(--muted); font-size: 13.5px; font-weight: 400; }
.spacer { flex: 1; }
.e2e-pill {
  display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 700; color: var(--star);
  background: rgb(27 67 226 / 0.25); padding: 2px 8px; border-radius: 20px; letter-spacing: 0.03em;
}
.tabs { display: flex; gap: 4px; margin-left: 12px; border-left: 1px solid var(--line); padding-left: 12px; overflow-x: auto; }
.tab { padding: 4px 10px; border-radius: 6px; color: var(--muted); font-weight: 550; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.tab:hover { background: var(--bg-4); color: var(--text-2); }
.tab.active { background: var(--bg-5); color: var(--text); }
.tab.add { background: var(--accent); color: var(--on-accent); }
.tab.add.active { background: transparent; color: var(--accent-fg); }

.pad { padding: 16px 20px; flex: 1; }
.list-title { font-size: 13px; font-weight: 600; color: var(--muted); padding: 4px 8px 10px; }
.friend-row { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 12px; }
.friend-row:hover { background: var(--hover); }
.page-title { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.segmented { display: flex; gap: 2px; margin: 10px 16px 4px; padding: 3px; background: var(--bg-4); border-radius: 10px; flex: none; max-width: 420px; }
.seg { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 10px; border-radius: 8px; font-size: 13.5px; font-weight: 600; color: var(--muted); transition: background 0.2s var(--ease, ease), color 0.2s; }
.seg.on { background: var(--bg-5); color: var(--text); }
.icon-btn.active { background: var(--bg-5); color: var(--text); }
.row-actions { display: flex; gap: 8px; }
.empty { display: flex; flex-direction: column; align-items: center; gap: 14px; color: var(--muted); padding: 60px 20px; text-align: center; }
.add-friend { display: flex; flex-direction: column; gap: 8px; max-width: 640px; }
.add-row { display: flex; gap: 10px; margin-top: 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 6px; }
.add-row .input { border: 0; background: transparent; }
.add-row .btn { flex: none; white-space: nowrap; }
.add-row:focus-within { border-color: var(--accent-fg); }

/* ------------------------------------------------ chat */
.messages { flex: 1; padding: 8px 0 12px; min-height: 0; }
.intro { padding: 24px 20px 12px; display: flex; flex-direction: column; gap: 8px; }
.intro h1 { font-size: 26px; margin-top: 6px; }
.e2e-note { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.e2e-note .icon { color: var(--star); }
.day { display: flex; justify-content: center; margin: 18px 16px 8px; color: var(--muted); font-size: 12px; font-weight: 600; }
/* messages: bubbles (own right in brand blue, others left in gray); clusters get tighter corners */
.msg { display: flex; align-items: flex-end; gap: 8px; padding: 0 16px; margin-top: 2px; }
.msg.first { margin-top: 10px; }
.msg.mine { flex-direction: row-reverse; }
.msg-avatar { width: 28px; flex: none; margin-bottom: 20px; }
.bubble-col { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; max-width: min(75%, 580px); min-width: 0; }
.msg.mine .bubble-col { align-items: flex-end; }
.msg-author { font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 0 12px 2px; }
.bubble {
  padding: 8px 13px; border-radius: var(--r-lg); background: var(--bg-4); color: var(--text); line-height: 1.38;
  white-space: pre-wrap; overflow-wrap: anywhere; max-width: 100%;
}
.msg.mine .bubble { background: var(--brand); color: #fff; }
.msg.mine .bubble a { color: #fff; text-decoration: underline; }
.msg.theirs:not(.first) .bubble-col > :first-child, .msg.theirs .bubble-col > :not(:first-child):not(.msg-meta) { border-top-left-radius: 6px; }
.msg.theirs:not(.last) .bubble-col > :last-child, .msg.theirs .bubble-col > :not(:last-child) { border-bottom-left-radius: 6px; }
.msg.mine:not(.first) .bubble-col > :first-child, .msg.mine .bubble-col > :not(:first-child):not(.msg-meta) { border-top-right-radius: 6px; }
.msg.mine:not(.last) .bubble-col > :last-child, .msg.mine .bubble-col > :not(:last-child) { border-bottom-right-radius: 6px; }
.bubble.jumbo { background: none !important; padding: 0 2px; font-size: 44px; line-height: 1.15; }
.bubble.undecryptable { display: flex; align-items: center; gap: 6px; color: var(--muted); font-style: italic; }
.msg-meta { font-size: 11.5px; color: var(--muted); padding: 2px 8px 0; }
/* desktop: rows (avatar, name, time; follow-ups indented), bubbles are phone-only */
.mrow { display: flex; gap: 14px; padding: 2px 20px 2px 16px; margin-top: 14px; }
.mrow.cont { margin-top: 0; }
.mrow:hover { background: var(--hover); }
.row-avatar { width: 40px; flex: none; padding-top: 2px; }
.row-side { width: 40px; flex: none; font-size: 11px; color: transparent; text-align: right; padding-top: 3px; }
.mrow:hover .row-side { color: var(--muted); }
.row-main { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.row-head { display: flex; align-items: baseline; gap: 8px; }
.row-author { font-weight: 650; color: var(--text); }
.row-author.mine { color: var(--accent-fg); }
.row-text { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text-2); line-height: 1.45; }
.row-text.jumbo { font-size: 42px; line-height: 1.2; }
.mrow .attachment { border-radius: var(--r-md); }
.sys-msg { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 14px 16px 4px; }
.sys-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--bg-4); color: var(--text-2); font-size: 13px; white-space: nowrap; }
.sys-chip .icon { color: var(--muted); }
.sys-chip.live { background: rgb(61 220 151 / 0.12); color: var(--ok); }
.sys-chip.live .icon { color: var(--ok); }
.sys-time { color: var(--muted); margin-left: 4px; }
.undecryptable { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-style: italic; font-size: 14px; }
.attachment { position: relative; width: fit-content; max-width: min(420px, 100%); border-radius: var(--r-lg); overflow: hidden; }
.img-att { max-width: 100%; max-height: 340px; display: block; cursor: zoom-in; }
.msg-time { font-size: 12px; color: var(--muted); }
.img-skeleton { width: 240px; height: 160px; border-radius: 8px; background: var(--bg-4); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.5; } }
.attachment .fav { position: absolute; top: 6px; right: 6px; background: rgb(0 0 0 / 0.6); color: #fff; opacity: 0; }
.attachment:hover .fav { opacity: 1; }
.file-card { display: flex; align-items: center; gap: 10px; background: var(--bg-4); padding: 10px 12px; min-width: min(260px, 70vw); }
.file-card > .icon { color: var(--accent-fg); }

.banner { display: flex; align-items: center; gap: 10px; margin: 8px 16px 0; padding: 10px 12px; border-radius: 10px; font-size: 13.5px; }
.banner.warn { background: rgb(242 184 75 / 0.12); color: var(--warn); border: 1px solid rgb(242 184 75 / 0.3); }
.banner span { flex: 1; color: var(--text-2); }

.composer-wrap { padding: 0 16px 6px; flex: none; }
.composer { display: flex; align-items: flex-end; gap: 4px; background: var(--bg-4); border-radius: 12px; padding: 6px; }
.composer-input {
  flex: 1; background: transparent; border: 0; outline: none; resize: none; padding: 7px 4px; max-height: 240px; min-height: 34px; line-height: 1.4;
}
.gif-btn { height: 34px; padding: 0 8px; border-radius: 8px; font-size: 12px; font-weight: 800; color: var(--muted); letter-spacing: 0.04em; }
.gif-btn:hover { background: var(--bg-5); color: var(--text); }
.typing { height: 20px; font-size: 12.5px; color: var(--muted); padding: 2px 4px; display: flex; align-items: center; }
.typing b { color: var(--text-2); font-weight: 650; }
.dots { display: inline-flex; gap: 3px; margin-right: 6px; }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: 0.2s; }
.dots i:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 60%, 100% { opacity: 0.3; } 30% { opacity: 1; } }
.pending { display: flex; gap: 8px; flex-wrap: wrap; }
.pending:not(:empty) { padding: 8px 0; }
.chip { display: flex; align-items: center; gap: 8px; background: var(--bg-4); border-radius: 10px; padding: 6px 6px 6px 8px; max-width: 240px; font-size: 13px; }
.chip img { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; }
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.main.drop::after {
  content: "Datei loslassen zum Anhängen"; position: absolute; inset: 12px; border: 2px dashed var(--accent-fg); border-radius: 14px;
  display: grid; place-items: center; background: rgb(0 0 0 / 0.85); color: var(--accent-fg); font-weight: 650; font-size: 18px; pointer-events: none;
}

.member { display: flex; align-items: center; gap: 10px; padding: 5px 8px; border-radius: 8px; color: var(--text-2); }
.member:hover { background: var(--bg-4); }
.member .sb-name { flex: 1; }
.member-actions { margin-top: auto; display: flex; flex-direction: column; gap: 6px; padding-top: 12px; }

/* ------------------------------------------------ calls */
.call-banner { display: flex; align-items: center; gap: 12px; margin: 10px 16px 0; padding: 10px 12px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; }
.call-banner span { flex: 1; color: var(--text-2); font-weight: 550; }
.call-banner .avatars { display: flex; }
.call-banner .avatars > * { margin-right: -8px; box-shadow: 0 0 0 2px var(--bg-2); }
.call-stage { background: var(--bg); padding: 16px; display: flex; flex-direction: column; gap: 14px; flex: none; max-height: 62vh; border-bottom: 1px solid var(--line); }
.tiles { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; min-height: 0; overflow: auto; padding: 5px; } /* room for the speaking ring */
.tile {
  position: relative; background: var(--bg-3); border-radius: 12px; display: grid; place-items: center; overflow: hidden;
  width: 200px; aspect-ratio: 16 / 10; transition: box-shadow 0.1s;
}
.tiles.has-video .tile.video { width: min(640px, 100%); flex: 1 1 420px; }
/* absolute + contain: the whole picture always fits (letterboxed), never cropped – whatever the window size */
.tile.video video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.tile.video video.mirror { transform: scaleX(-1); }
.tile.person.speaking { box-shadow: 0 0 0 3px var(--ok); }
.tile.person.connecting { opacity: 0.7; }
.tile-label small { color: #cfd2d8; }
.tile-label .conn-fail { color: #ff8a80; }
.tile-label {
  position: absolute; left: 8px; bottom: 8px; background: rgb(0 0 0 / 0.6); color: #fff; border-radius: 6px; padding: 2px 8px;
  font-size: 12.5px; display: flex; align-items: center; gap: 4px; max-width: calc(100% - 16px); overflow: hidden; white-space: nowrap;
}
.tile-fs { position: absolute; top: 6px; right: 6px; background: rgb(0 0 0 / 0.5); color: #fff; opacity: 0; }
.tile:hover .tile-fs { opacity: 1; }
.call-controls { display: flex; justify-content: center; gap: 10px; }
.call-controls .icon-btn.round { width: 46px; height: 46px; color: var(--text); background: var(--bg-5); }
/* call bar: labelled buttons (icon + word), mic with a device/filter menu; labels go when space runs out */
.call-stage { container-type: inline-size; }
.cbtn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 16px; border: 0; border-radius: 10px;
  background: var(--bg-4); color: var(--text); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; transition: background 0.15s; }
.cbtn:hover { background: var(--bg-5); }
.cbtn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cbtn.off { color: var(--danger); }
.cbtn.on { background: var(--accent); color: var(--on-accent); }
.cbtn.danger { background: var(--danger); color: #fff; }
.cbtn.danger:hover { filter: brightness(1.08); }
.cbtn-group { display: inline-flex; }
.cbtn-group .cbtn:first-child { border-radius: 10px 0 0 10px; }
.cbtn-group .cbtn.chev { border-radius: 0 10px 10px 0; padding: 0 10px; margin-left: 1px; }
@container (max-width: 860px) { .cbtn-label { display: none; } .cbtn { padding: 0 14px; } }
.mic-menu { min-width: 260px; }
.mic-menu .menu-item.active { color: var(--accent); }
.call-controls .icon-btn.round.off { color: var(--danger); }
.call-controls .icon-btn.round.on { background: var(--accent); color: var(--on-accent); }
.call-controls .icon-btn.round.danger { background: var(--danger); color: #fff; }
.source-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.source { background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px; display: flex; flex-direction: column; gap: 6px; text-align: left; }
.source:hover { border-color: var(--accent-fg); }
.source img { width: 100%; aspect-ratio: 16 / 10; object-fit: contain; background: #000; border-radius: 6px; }
.source span { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ------------------------------------------------ overlays */
.modal-back { position: fixed; inset: 0; background: rgb(0 0 0 / 0.65); display: grid; place-items: center; padding: 16px; z-index: 50; animation: fade 0.2s ease-out; }
.modal {
  background: var(--bg-3); border: 1px solid var(--line); border-radius: 14px; width: min(440px, 100%); max-height: calc(100vh - 32px);
  padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 30px 80px rgb(0 0 0 / 0.5);
}
.modal.wide { width: min(760px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; }
@keyframes fade { from { opacity: 0; } }
.lightbox img { max-width: 100%; max-height: 70vh; display: block; margin: 0 auto 12px; border-radius: 8px; }

.popover {
  position: fixed; z-index: 40; background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 40px rgb(0 0 0 / 0.5);
  width: 360px; max-height: 420px; padding: 10px;
}
.emoji-cat { font-size: 13px; font-weight: 600; color: var(--muted); padding: 8px 4px 4px; }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); }
.emoji { font-size: 24px; height: 40px; border-radius: 8px; }
.emoji:hover { background: var(--bg-4); }
.gif-picker { display: flex; flex-direction: column; gap: 10px; }
.gif-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.gif-consent { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; font-size: 13px; line-height: 1.5; }
.gif-consent p, .gif-consent > span { width: 100%; margin: 0; }
.gifbox-message { display: inline-flex; flex-direction: column; gap: 5px; max-width: 100%; }
.gifbox-message img, .gifbox-message video { display: block; width: auto; max-width: min(360px, 100%); max-height: 280px; border-radius: 8px; }
.gif-cell { position: relative; }
.gif-cell img { width: 100%; height: 140px; object-fit: contain; border-radius: 8px; cursor: pointer; display: block; }
.gif-cell .icon-btn { position: absolute; top: 4px; right: 4px; background: rgb(0 0 0 / 0.6); color: #fff; opacity: 0; }
.gif-cell:hover .icon-btn { opacity: 1; }

.toasts { position: fixed; left: 50%; bottom: 92px; /* above the composer */ transform: translateX(-50%); z-index: 100;
  display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast {
  background: var(--bg-5); color: var(--text); padding: 10px 16px; text-align: center; overflow-wrap: anywhere;
  border-radius: 10px; box-shadow: 0 10px 30px rgb(0 0 0 / 0.4); transition: opacity 0.4s; max-width: 100%; pointer-events: auto;
}
.toast.error { background: var(--danger); color: #fff; }
.toast.ok { background: var(--accent); color: var(--on-accent); }
.toast.gone { opacity: 0; }
/* no connection: a strip at the very top, on phones too (they have no user panel) */
body.offline::before {
  content: "Keine Verbindung · wird wiederhergestellt…"; position: fixed; top: 0; left: 0; right: 0; background: var(--warn); color: #231800;
  text-align: center; font-size: 13px; font-weight: 600; padding: 3px; padding-top: max(3px, env(safe-area-inset-top)); z-index: 90;
  animation: fade 0.3s ease-out 1.2s both; /* a blip during a normal reconnect doesn't flash it */
}

.check-list { display: flex; flex-direction: column; gap: 2px; max-height: 320px; overflow-y: auto; }
.check-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.check-row:hover { background: var(--bg-4); }
.check-row input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.check-row.big { align-items: flex-start; padding: 10px; background: var(--bg-2); border: 1px solid var(--line); }
.check-row.big small { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.safety { background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.safety.focus { border-color: var(--warn); }
.safety pre { margin: 0; font-family: var(--mono); font-size: 14px; letter-spacing: 0.06em; color: var(--text-2); white-space: pre-wrap; }
.tag { font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 20px; margin-left: auto; }
.tag.ok { background: rgb(61 220 151 / 0.12); color: var(--ok); }
.tag.warn { background: rgb(242 184 75 / 0.15); color: var(--warn); }
.facts { margin: 0; padding-left: 18px; color: var(--text-2); font-size: 13.5px; display: flex; flex-direction: column; gap: 6px; }

.settings { display: grid; grid-template-columns: 170px 1fr; gap: 20px; min-height: 380px; }
.settings-nav { display: flex; flex-direction: column; gap: 2px; }
.settings-body { min-width: 0; }
.avatar-edit { position: relative; cursor: pointer; border-radius: 50%; flex: none; }
.avatar-edit span {
  position: absolute; inset: 0; border-radius: 50%; background: rgb(0 0 0 / 0.55); color: #fff; font-size: 12px; font-weight: 700;
  display: grid; place-items: center; opacity: 0; transition: opacity 0.12s;
}
.avatar-edit:hover span { opacity: 1; }

/* ------------------------------------------------ narrow screens (web on phones) */
.m-back { display: none; }
@media (max-width: 760px) {
  /* phone: list and chat are two screens (see showPane in app.js) */
  .layout { grid-template-columns: minmax(0, 1fr); overflow: clip; } /* the chat slides in from the right: never a sideways scroll */
  .layout[data-pane="list"] .main, .layout[data-pane="main"] .sidebar { display: none; }
  .rail { display: none; }
  .sidebar { border-right: 0; }
  .m-back { display: grid; margin-left: -6px; }
  .desk-only, .user-panel { display: none; }
  .conv-row { padding: 10px 12px; }
  .conv-name { font-size: 16.5px; }
  .conv-preview { font-size: 15px; }
  .sb-title { font-size: 30px; }
  .sb-head { height: 64px; }
  /* bottom tab bar: 3 items, 56px tall, respects the gesture bar */
  .tabbar { display: flex; flex: none; border-top: 1px solid var(--line); padding: 4px 8px calc(4px + env(safe-area-inset-bottom)); background: var(--bg); }
  .tabbar-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; font-size: 11px; font-weight: 600; color: var(--muted); position: relative; min-height: 48px; }
  .tabbar-item.on { color: var(--text); }
  .sidebar:has(.search:focus) .tabbar { display: none; } /* typing in search: keyboard up, bar out of the way */
  .tabbar-item .icon { width: 24px; height: 24px; }
  .tabbar-item .dot-badge { top: 0; right: calc(50% - 22px); }
  .members { display: none; }
  .top h2 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .tabs { margin-left: 0; overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: none; }
  .top > .icon:first-child, .handle { display: none; }
  .settings { grid-template-columns: 1fr; grid-template-rows: max-content 1fr; } /* the tab row scrolls sideways: its row must keep its height */
  .settings-nav { flex-direction: row; overflow-x: auto; scrollbar-width: none; gap: 4px; }
  .settings-nav > * { white-space: nowrap; flex: none; width: auto; padding: 7px 12px; border-radius: 999px; }
  .settings-nav { margin: 0 -4px 6px; padding: 2px 4px; flex: none; } /* scrolls sideways, so it may not shrink in the column */
  .popover { width: calc(100vw - 32px); right: 16px !important; }
  .msg { padding: 0 10px; }
  .bubble-col { max-width: 82%; }
  body { font-size: 16px; }
  .tile { width: 140px; }
  .call-stage:not(.expanded):not(.voice-full) { max-height: 40vh; padding: 10px; gap: 10px; }
  .call-stage:not(.expanded):not(.voice-full) .tile { width: 110px; }
  .call-controls { gap: 8px; flex-wrap: wrap; }
}

.dl { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-radius: 10px; background: var(--accent); color: var(--on-accent); font-weight: 650; }
.dl:hover { text-decoration: none; filter: brightness(1.08); }
.dl small { font-weight: 500; opacity: 0.75; }

/* ------------------------------------------------ legal pages */
.legal-body { overflow: auto; }
.legal { max-width: 860px; margin: 0 auto; padding: 40px 16px 80px; line-height: 1.65; }
.legal h1 { font-size: 28px; margin: 8px 0 6px; }
.legal h2 { font-size: 19px; margin: 36px 0 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.legal p, .legal li { color: var(--text-2); margin: 0 0 10px; }
.legal ul { padding-left: 20px; }
.legal-top { font-size: 14px; }
.legal .legal-draft { background: var(--warn); color: #231800; font-weight: 700; padding: 8px 12px; border-radius: 8px; }
.legal-table { overflow-x: auto; }
.legal table { width: 100%; border-collapse: collapse; font-size: 14px; }
.legal th, .legal td { text-align: left; vertical-align: top; padding: 9px 10px; border-bottom: 1px solid var(--line); }
.legal th { color: var(--muted); font-weight: 650; }

/* ------------------------------------------------ call: focus layout */
.main.stage-full #messages, .main.stage-full #banner, .main.stage-full .composer-wrap { display: none; }
.call-stage.voice-full { flex: 1 1 auto; max-height: none; min-height: 0; border-bottom: 0; justify-content: center; }
.call-stage.voice-full .tiles { flex: 1 1 auto; align-content: center; }
.call-stage.focus-mode { max-height: 58vh; }
.call-stage.focus-mode.expanded { flex: 1 1 auto; max-height: none; min-height: 0; border-bottom: 0; }
.stage-focus { flex: 1 1 auto; min-height: 0; display: flex; justify-content: center; }
.stage-focus .tile.video { flex: 1 1 auto; width: auto; height: auto; min-width: 0; align-self: stretch; aspect-ratio: auto; border-radius: 12px; background: #000; }
/* Watch Together */
.watch-box { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; border-radius: 12px; overflow: hidden; background: #000; }
.watch-bar { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 12px; background: var(--bg-3); color: var(--text-2); font-size: 13px; }
.watch-bar .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.watch-warn { color: var(--warn, #e0a200); }
.watch-body { position: relative; flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.watch-body > .video-card, .watch-body > .undecryptable { margin: auto; }
.watch-stage { position: relative; flex: 1 1 auto; min-height: 0; }
.watch-stage > .watch-video { position: absolute; inset: 0; object-fit: contain; }
.watch-controls { flex: none; display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--bg-3); color: var(--text); font-size: 13px; }
.wc-btn { display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 8px; background: transparent; color: inherit; cursor: pointer; }
.wc-btn:hover { background: var(--bg-5); }
.wc-time { font-variant-numeric: tabular-nums; color: var(--text-2); white-space: nowrap; }
.wc-seek { flex: 1 1 auto; min-width: 60px; accent-color: var(--accent); cursor: pointer; }
.wc-vol { width: 80px; accent-color: var(--accent); }
@container (max-width: 520px) { .wc-vol, .watch-controls > .icon { display: none; } }
.watch-body > .video-card { width: min(360px, 80%); }
.watch-video { width: 100%; height: 100%; border: 0; display: block; background: #000; }
.watch-tap { position: absolute; inset: auto auto 16px 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; padding: 10px 16px; border: 0; border-radius: 999px; background: var(--brand); color: #fff; font: inherit; cursor: pointer; }
.stage-strip { display: flex; gap: 10px; justify-content: center; overflow-x: auto; flex: none; padding: 5px; }
.stage-strip .tile { width: 168px; flex: none; }
.stage-strip .tile.video { cursor: pointer; }
.stage-strip .tile.video:hover { box-shadow: 0 0 0 2px var(--bg-5); }
.stage-strip .tile-label { font-size: 11.5px; left: 6px; bottom: 6px; }
.live-badge { position: absolute; top: 8px; left: 8px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 800; letter-spacing: 0.04em; padding: 1px 6px; border-radius: 4px; }
.guide-layer { position: absolute; z-index: 2; pointer-events: none; overflow: hidden; }
.guide-layer.interactive { pointer-events: auto; touch-action: none; cursor: crosshair; }
.guide-tools[hidden] { display: none; }
.guide-tools { position: absolute; z-index: 3; left: 50%; top: 8px; transform: translateX(-50%); display: flex; gap: 3px; max-width: calc(100% - 120px); flex-wrap: wrap; justify-content: center; padding: 4px; border: 1px solid rgb(255 255 255 / .18); border-radius: 8px; background: rgb(14 14 18 / .94); }
.guide-btn { border: 0; border-radius: 5px; padding: 5px 8px; background: transparent; color: #eee; font: inherit; font-size: 12px; white-space: nowrap; }
.guide-btn:hover:enabled { background: #32323b; }
.guide-btn[aria-pressed=true] { background: #343445; color: #fff; box-shadow: inset 0 -2px var(--accent); }
.guide-btn:disabled { opacity: .45; cursor: default; }
.guide-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tile.video:fullscreen { width: 100vw; height: 100vh; max-width: none; border-radius: 0; background: #000; }
@media (max-width: 620px) { .guide-tools { top: 36px; max-width: calc(100% - 16px); width: max-content; } .guide-btn { padding: 7px 6px; } }
.tile-audio { position: absolute; top: 6px; right: 6px; background: rgb(0 0 0 / 0.55); color: #fff; }
.tile.focus .tile-audio { right: 46px; }
.tile-audio.off { color: #ff8a80; }

/* ------------------------------------------------ mic meter */
.meter { position: relative; height: 10px; border-radius: 6px; background: var(--bg); border: 1px solid var(--line); overflow: hidden; margin: 4px 0; }
.meter-fill { height: 100%; width: 0; background: var(--muted); transition: width 60ms linear; }
.meter.open .meter-fill { background: var(--ok); }
.meter-mark { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--warn); }
.range { width: 100%; accent-color: var(--accent); }
.range:disabled { opacity: 0.4; }

.tile.paused { background: repeating-linear-gradient(135deg, var(--bg-3) 0 14px, var(--bg-2) 14px 28px); }
.paused-info { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--text-2); text-align: center; padding: 12px; }
.paused-info b { color: var(--text); }
.paused-info small { color: var(--muted); font-size: 12.5px; }
.stage-strip .paused-info small, .stage-strip .paused-info .icon { display: none; }

/* ------------------------------------------------ volume */
.tile.person.adjustable { cursor: pointer; }
.tile.person.adjustable:hover { box-shadow: 0 0 0 2px var(--bg-5); }
.tile.person.adjustable.speaking:hover { box-shadow: 0 0 0 3px var(--ok); }
.vol-badge { color: var(--warn); }
.vol-pop { display: flex; flex-direction: column; gap: 10px; width: 260px; }
.vol-val { font-variant-numeric: tabular-nums; }
.popover:has(.vol-pop) { width: auto; max-height: none; }

/* ------------------------------------------------ motion
   Apple-like: quick start, long soft settle (no bounce). Only transform/opacity, so it stays on the GPU. */
:root { --ease: cubic-bezier(0.32, 0.72, 0, 1); }
.btn, .icon-btn, .sb-item, .tab, .dl { transition: background 0.18s var(--ease), color 0.18s var(--ease), filter 0.18s var(--ease), transform 0.25s var(--ease); }
.btn:active, .icon-btn:active, .sb-item:active, .tab:active, .dl:active { transform: scale(0.96); transition-duration: 0.08s; }
.modal { animation: pop 0.36s var(--ease); }
.popover { animation: pop 0.28s var(--ease); }
.toast { animation: toast-in 0.42s var(--ease); }
.card { animation: rise 0.5s var(--ease); }
@keyframes pop { from { opacity: 0; transform: scale(0.95) translateY(6px); } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(0.97); } }
@media (max-width: 760px) { .toasts { bottom: calc(env(safe-area-inset-bottom) + 84px); } } /* above tab bar / composer */
/* phone: chat pushes in from the right, the list slides back under it (like iOS navigation) */
@media (max-width: 760px) {
  .layout.nav[data-pane="main"] .main { animation: push-in 0.45s var(--ease); }
  .layout.nav[data-pane="list"] .sidebar { animation: back-in 0.45s var(--ease); }
}
@keyframes push-in { from { transform: translateX(100%); box-shadow: -20px 0 40px rgb(0 0 0 / 0.35); } }
@keyframes back-in { from { transform: translateX(-28%); opacity: 0.6; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ------------------------------------------------ chat header */
.head-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.head-text h2 { font-size: 16px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.head-text small { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.head-text small.on { color: var(--ok); }
.head-text.clickable { cursor: pointer; }

/* ------------------------------------------------ message menu */
.menu { display: flex; flex-direction: column; }
.menu-item { display: flex; align-items: center; gap: 12px; padding: 13px 8px; border-radius: 10px; text-align: left; font-size: 15.5px; }
.menu-item:hover { background: var(--bg-4); }
.msg.picked .bubble { filter: brightness(1.25); }
.mrow.picked { background: var(--bg-4); }

/* ------------------------------------------------ phone: sheets instead of floating dialogs */
@media (max-width: 760px) {
  .modal-back { padding: 0; place-items: end stretch; }
  .modal { width: 100%; max-height: 92dvh; border-radius: 20px 20px 0 0; border-width: 1px 0 0; padding: 10px 18px calc(18px + env(safe-area-inset-bottom)); animation: sheet-up 0.42s var(--ease); }
  .modal::before { content: ""; align-self: center; width: 36px; height: 5px; border-radius: 3px; background: var(--bg-5); margin-bottom: 2px; }
  .modal.wide { height: 100dvh; max-height: none; border-radius: 0; border: 0; }
  .modal.wide::before { display: none; }
  .popover { left: 0 !important; right: 0 !important; bottom: 0 !important; top: auto !important; width: auto; max-height: 55dvh;
    border-radius: 20px 20px 0 0; border-width: 1px 0 0; padding-bottom: calc(10px + env(safe-area-inset-bottom)); animation: sheet-up 0.42s var(--ease); }
  .emoji-grid { grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); }
  .bubble { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; } /* long-press opens our menu */
}
@keyframes sheet-up { from { transform: translateY(100%); } }

/* ------------------------------------------------ group picture default, theme picker */
.avatar.group-default { display: grid; place-items: center; color: #fff; border-radius: 50%; flex: none; }
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.theme-opt { display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: var(--r-md); border: 2px solid var(--line); text-align: left; font-weight: 600; }
.theme-opt.on { border-color: var(--brand); }
.theme-swatch { height: 56px; border-radius: 8px; display: flex; align-items: flex-end; gap: 4px; padding: 8px; border: 1px solid rgb(128 128 128 / 0.25); }
.theme-swatch i { height: 10px; border-radius: 5px; }
.theme-swatch i:first-child { width: 40%; }
.theme-swatch i:last-child { width: 30%; margin-left: auto; background: var(--brand); }
.group-pic { display: flex; align-items: center; gap: 14px; }

/* ------------------------------------------------ profile card + editor */
.pc { border-radius: var(--r-md); overflow: hidden; background: var(--bg-4); }
.pc-banner { display: block; width: 100%; aspect-ratio: 5 / 2; max-height: 160px; object-fit: cover; }
.pc-head { padding: 0 16px; margin-top: -46px; }
.pc-head .avatar { box-shadow: 0 0 0 5px var(--bg-4); }
.pc-head .status-dot { width: 20px; height: 20px; border-width: 4px; border-color: var(--bg-4); right: 0; bottom: 0; }
.pc-body { padding: 10px 16px 16px; display: flex; flex-direction: column; gap: 6px; }
.pc-body h2 { font-size: 21px; font-weight: 700; }
.pc-handle { color: var(--muted); font-size: 14px; }
.pc-status { color: var(--text-2); }
.pc-game { display: flex; align-items: center; gap: 6px; color: var(--ok); font-size: 14px; }
.pc-hint { color: var(--muted); font-size: 12.5px; margin: 4px 0 0; }
.pc-section { margin-top: 6px; padding-top: 10px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.pc-section > span { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.pc-bio { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text-2); }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; color: var(--muted); background: var(--bg-4); }
.swatch.on { outline: 2px solid var(--text); outline-offset: 2px; }
.row.wrap { flex-wrap: wrap; }
.profile-form textarea.input { resize: vertical; min-height: 80px; }
.clickable-user { cursor: pointer; }
.friend-row small.playing, .head-text small.playing { color: var(--ok); }
.pc-head .status-wrap { width: fit-content; }

/* ------------------------------------------------ messages: enter, pending, edited, edit bar, context menu */
.msg.enter, .mrow.enter { animation: msg-in 0.24s ease-out; }
/* on its way to the server: slightly faded until confirmed (usually a few 100 ms, so only visible on slow lines) */
.mrow.sending .row-main, .msg.sending .bubble-col { opacity: 0.55; transition: opacity 0.2s 0.3s; }
@keyframes msg-in { from { opacity: 0; transform: translateY(6px); } }
.edited { color: var(--muted); font-size: 12px; }
.edit-bar:empty { display: none; }
.edit-bar { display: flex; align-items: center; gap: 6px; padding: 6px 10px 6px 12px; margin-bottom: 4px; font-size: 13px; color: var(--accent-fg); }
.edit-bar .icon-btn { margin-left: auto; }
.composer-wrap.editing .composer { box-shadow: 0 0 0 2px var(--brand); }
.ctx-menu { position: fixed; z-index: 60; min-width: 200px; padding: 5px; background: var(--bg-4); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 12px 32px rgb(0 0 0 / 0.35); animation: pop 0.18s var(--ease); display: flex; flex-direction: column; }
.ctx-menu .menu-item { padding: 8px 10px; font-size: 14px; border-radius: 8px; }
.ctx-menu .menu-item:hover { background: var(--bg-5); }

/* ------------------------------------------------ image viewer */
.viewer { position: fixed; inset: 0; z-index: 80; background: rgb(0 0 0 / 0.92); display: flex; flex-direction: column; animation: fade 0.18s ease-out; color: #fff; }
.viewer-bar { display: flex; align-items: center; gap: 4px; padding: 10px 12px calc(10px) 16px; padding-top: max(10px, env(safe-area-inset-top)); }
.viewer-bar .icon-btn { color: #fff; }
.viewer-bar .icon-btn:hover { background: rgb(255 255 255 / 0.12); }
.viewer-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: 14px; }
.viewer-stage { flex: 1; min-height: 0; display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr); place-items: center; overflow: hidden; touch-action: none; cursor: zoom-in; padding: 0 12px 16px; }
.viewer-stage.zoomed { cursor: grab; }
.viewer-stage.zoomed:active { cursor: grabbing; }
.viewer-img { max-width: 100%; max-height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; will-change: transform; animation: pop 0.24s var(--ease); }

/* ------------------------------------------------ servers: rail, channels, members, settings */
/* Server rail: frosted glass over our own colour field (bg-glass.webp, generated, 10 KB, shipped with the app).
   Only the rail shows it; everything else stays solid and calm. */
.layout { background: var(--bg) url("bg-glass.webp") left top / cover no-repeat fixed; }
.rail { background: color-mix(in srgb, var(--bg) 58%, transparent); backdrop-filter: blur(40px) saturate(1.5); -webkit-backdrop-filter: blur(40px) saturate(1.5);
  border-right: 1px solid color-mix(in srgb, var(--line) 60%, transparent); display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 10px 0; overflow-y: auto; scrollbar-width: none; }
:root[data-theme="light"] .rail { background: color-mix(in srgb, var(--bg) 82%, transparent); }
@media (prefers-reduced-transparency: reduce) { .rail { background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none; } }
.rail::-webkit-scrollbar { display: none; }
.rail-btn { position: relative; width: 48px; height: 48px; border-radius: 16px; display: grid; place-items: center; flex: none; background: var(--bg-4); color: var(--text-2); transition: border-radius 0.2s var(--ease), background 0.2s; overflow: visible; }
.rail-btn img, .rail-btn .srv-icon { border-radius: inherit; }
.rail-btn:hover, .rail-btn.on { border-radius: 14px; }
.rail-btn.home img { width: 30px; height: 30px; }
.rail-btn.add { color: var(--ok); background: var(--bg-4); }
.rail-btn.add:hover { background: var(--ok); color: #fff; }
.rail-btn::before { content: ""; position: absolute; left: -12px; top: 50%; width: 4px; height: 0; border-radius: 0 4px 4px 0; background: var(--text); transform: translateY(-50%); transition: height 0.2s var(--ease); }
.rail-btn.unread::before { height: 8px; }
.rail-btn:hover::before { height: 20px; }
.rail-btn.on::before { height: 36px; }
.rail-sep { width: 32px; height: 2px; border-radius: 1px; background: var(--line); flex: none; }
.srv-icon { border-radius: 16px; object-fit: cover; display: grid; place-items: center; color: #fff; font-weight: 700; flex: none; }
.conv-row .srv-icon { border-radius: 14px; }
.srv-head { border-bottom: 1px solid var(--line); gap: 4px; padding-left: 8px; }
.srv-title { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; padding: 8px; border-radius: 10px; font-weight: 700; font-size: 16px; text-align: left; }
.srv-title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srv-title:hover { background: var(--hover); }
.ch-section { margin-top: 12px; }
.ch-head { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 4px 10px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.ch-row { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px; border-radius: 8px; color: var(--muted); text-align: left; }
.ch-row:hover { background: var(--hover); color: var(--text-2); }
.ch-row.active { background: var(--bg-4); color: var(--text); }
.ch-row.unread { color: var(--text); font-weight: 600; }
.ch-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member.off { opacity: 0.55; }
.member small.playing { color: var(--ok); }
.e2e-note.warn { color: var(--warn); }
.composer.disabled { opacity: 0.6; }
.invite-preview:empty { display: none; }
.invite-preview { display: flex; align-items: center; gap: 10px; }
.invite-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--bg-4); }
.invite-row code { font-family: var(--mono); font-size: 13px; }
.invite-row small { flex: 1; }
.grow { flex: 1; min-width: 0; }
.role-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.roles-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 16px; }
.role-list { display: flex; flex-direction: column; gap: 2px; }
.role-item { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 8px; text-align: left; }
.role-item:hover { background: var(--hover); }
.role-move { margin-left: auto; }
.perm-grid { display: flex; flex-direction: column; gap: 4px; }
.perm-grid .check-row:has(select) { justify-content: space-between; }
.input.tri { width: auto; padding: 4px 8px; }
@media (max-width: 760px) {
  .rail { display: none; }
  .roles-layout { grid-template-columns: 1fr; }
  .role-list { flex-direction: row; flex-wrap: wrap; }
}
.vc-user { display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 34px; font-size: 13.5px; color: var(--text-2); }
.vc-user .avatar { transition: box-shadow 0.15s; }
.vc-user .vc-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vc-flags { margin-left: auto; display: inline-flex; gap: 3px; color: var(--danger); flex: none; }
.tile-label .vc-flags { margin-left: 4px; }
.encoder-diag { display: block; margin-top: 4px; color: var(--muted); }
.stream-own { display: flex; flex-direction: column; gap: 8px; min-width: 240px; }
.stream-own-title { display: flex; align-items: center; gap: 8px; }
.vc-user.speaking .avatar { box-shadow: 0 0 0 2px var(--ok); }
.voice-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; }
.main.stage-full #call-stage { flex: 1; display: flex; flex-direction: column; min-height: 0; }

/* ------------------------------------------------ image crop */
.crop { align-items: center; }
.crop .row { width: 100%; max-width: 340px; align-items: center; color: var(--muted); }
.crop .range { flex: 1; }
.crop-view { position: relative; overflow: hidden; border-radius: 14px; background: #000; touch-action: none; cursor: grab; flex: none; }
.crop-view:active { cursor: grabbing; }
.crop-img { position: absolute; max-width: none; user-select: none; pointer-events: none; }
.crop-mask { position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 0 2px rgb(255 255 255 / 0.6); border-radius: inherit; }
.crop-view.round .crop-mask { border-radius: 50%; box-shadow: 0 0 0 9999px rgb(0 0 0 / 0.55), inset 0 0 0 2px rgb(255 255 255 / 0.6); }

/* ------------------------------------------------ server settings (redesign) */
.modal.wide:has(.ss) { width: min(980px, 100%); height: min(760px, calc(100vh - 32px)); }
.modal:has(.ss) { padding: 0; gap: 0; overflow: hidden; }
.modal:has(.ss) > .modal-head { padding: 14px 18px; border-bottom: 1px solid var(--line); }
.ss { display: grid; grid-template-columns: 220px minmax(0, 1fr); flex: 1; min-height: 0; }
.ss-nav { border-right: 1px solid var(--line); padding: 14px 10px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.ss-server { display: flex; align-items: center; gap: 10px; padding: 0 6px; }
.ss-server b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ss-group { display: flex; flex-direction: column; gap: 2px; }
.ss-group > span { font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 0 10px 4px; }
.ss-link { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--text-2); text-align: left; }
.ss-link:hover { background: var(--hover); }
.ss-link.on { background: var(--bg-4); color: var(--text); font-weight: 600; }
.ss-body { overflow-y: auto; min-height: 0; position: relative; }
.ss-pane { padding: 20px 24px 90px; display: flex; flex-direction: column; gap: 14px; }
.ss-pane > h2 { font-size: 20px; font-weight: 700; }
.ss-card { display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: var(--r-md); background: var(--bg-4); }
.ss-card.danger { box-shadow: inset 0 0 0 1px rgb(239 83 80 / 0.4); background: rgb(239 83 80 / 0.06); }
.ss-icon { flex-direction: row; align-items: flex-start; gap: 18px; }
.icon-pick { position: relative; border-radius: 20px; flex: none; }
.icon-pick span { position: absolute; inset: 0; display: grid; place-items: center; background: rgb(0 0 0 / 0.55); color: #fff; font-size: 12px; font-weight: 600; border-radius: 20px; opacity: 0; transition: opacity 0.15s; }
.icon-pick:hover span { opacity: 1; }
.self-start { align-self: flex-start; }
.ss-roles-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 18px; align-items: start; }
.ss-roles { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; }
.ss-role { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.ss-role:hover { background: var(--hover); }
.ss-role.on { background: var(--bg-4); font-weight: 600; }
.ss-role-editor { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.ss-role-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ss-role-editor .segmented { margin: 0; max-width: none; }
.perm-group h4 { margin: 6px 0 4px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.perm-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.perm-row > div:first-child { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.perm-row small { color: var(--muted); font-size: 12.5px; }
.perm-row.warn b { color: var(--warn); }
.switch { position: relative; width: 42px; height: 24px; flex: none; cursor: pointer; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: inherit; }
.switch-track { position: absolute; inset: 0; border-radius: 12px; background: var(--bg-5); transition: background 0.2s var(--ease); }
.switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform 0.22s var(--ease); box-shadow: 0 1px 3px rgb(0 0 0 / 0.3); }
.switch input:checked + .switch-track { background: var(--ok); }
.switch input:checked + .switch-track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent-fg); outline-offset: 2px; }
.switch.disabled { opacity: 0.45; cursor: not-allowed; }
.tri-switch { display: flex; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); flex: none; }
.tri-switch button { width: 34px; height: 28px; display: grid; place-items: center; color: var(--muted); font-weight: 700; }
.tri-switch button + button { border-left: 1px solid var(--line); }
.tri-switch .deny.on { background: var(--danger); color: #fff; }
.tri-switch .inherit.on { background: var(--bg-5); color: var(--text); }
.tri-switch .allow.on { background: var(--ok); color: #fff; }
.role-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-btn { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--bg-4); font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.chip-btn.on { background: var(--bg-5); color: var(--text); box-shadow: inset 0 0 0 1px var(--accent-fg); }
.chip-btn.static { cursor: default; background: var(--bg-5); }
.chip-btn.add { width: 26px; justify-content: center; padding: 4px 0; }
.chip-x { color: var(--muted); font-size: 15px; line-height: 1; padding: 0 0 0 2px; }
.chip-x:hover { color: var(--danger); }
.ss-member { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 10px; }
.ss-member:hover { background: var(--hover); }
.stack-tight { display: flex; flex-direction: column; gap: 6px; }
.save-bar { position: sticky; bottom: 12px; margin-top: 8px; display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 16px; border-radius: 12px;
  background: var(--bg-5); box-shadow: 0 10px 30px rgb(0 0 0 / 0.35); animation: rise 0.3s var(--ease); }
.save-bar span { flex: 1; font-weight: 600; }
@media (max-width: 760px) {
  .ss { grid-template-columns: 1fr; grid-template-rows: max-content minmax(0, 1fr); }
  .ss-nav { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px; gap: 4px; scrollbar-width: none; }
  .ss-server, .ss-group > span { display: none; }
  .ss-group { flex-direction: row; }
  .ss-link { white-space: nowrap; }
  .ss-pane { padding: 16px 16px 90px; }
  .ss-roles-layout { grid-template-columns: 1fr; }
  .ss-roles { position: static; flex-direction: row; overflow-x: auto; scrollbar-width: none; }
  .ss-role { flex: none; }
  .modal.wide:has(.ss) { height: 100dvh; }
}
.btn.danger-text, .btn.ghost.danger-text { color: var(--danger); }

/* ------------------------------------------------ reactions */
.rx-row { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.msg.mine .rx-row { justify-content: flex-end; }
.rx-chip { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 8px; border-radius: 13px; background: var(--bg-4); box-shadow: inset 0 0 0 1px transparent; font-size: 13px; transition: transform 0.15s var(--ease), background 0.15s; }
.rx-chip:hover { background: var(--bg-5); }
.rx-chip:active { transform: scale(0.92); }
.rx-chip.mine { background: rgb(27 67 226 / 0.22); box-shadow: inset 0 0 0 1px var(--accent-fg); }
.rx-emoji { font-size: 15px; line-height: 1; }
.rx-count { font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums; }
.rx-quick { display: flex; align-items: center; gap: 2px; padding: 2px 2px 6px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.rx-q { width: 38px; height: 38px; border-radius: 10px; font-size: 22px; display: grid; place-items: center; transition: transform 0.15s var(--ease); }
.rx-q:hover { background: var(--bg-5); transform: scale(1.12); }
.rx-q.more { color: var(--muted); font-size: 16px; }
.phone-only { display: none !important; }
@media (max-width: 760px) { .phone-only { display: grid !important; } }

/* ------------------------------------------------ mentions */
.mn { background: rgb(27 67 226 / 0.2); color: var(--accent-fg); border-radius: 4px; padding: 0 2px; font-weight: 600; cursor: pointer; }
.msg.mine .bubble .mn { background: rgb(255 255 255 / 0.2); color: #fff; }
.mrow.mentioned { background: rgb(242 184 75 / 0.08); box-shadow: inset 3px 0 0 var(--warn); }
.mrow.mentioned:hover { background: rgb(242 184 75 / 0.12); }
.msg.mentioned .bubble { box-shadow: inset 0 0 0 1.5px var(--warn); }
.rail-btn .dot-badge { top: auto; bottom: -2px; right: -2px; box-shadow: 0 0 0 3px var(--bg); }
.mn-pop { position: absolute; left: 0; right: 0; bottom: 100%; margin-bottom: 6px; background: var(--bg-4); border: 1px solid var(--line); border-radius: 12px; padding: 4px; box-shadow: 0 12px 32px rgb(0 0 0 / 0.35); max-height: 260px; overflow-y: auto; z-index: 30; animation: pop 0.16s var(--ease); }
.mn-opt { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 8px; border-radius: 8px; text-align: left; }
.mn-opt.on, .mn-opt:hover { background: var(--bg-5); }
.mn-opt small { color: var(--muted); }
.composer-wrap { position: relative; }
.hero-icon.small { width: 24px; height: 24px; border-radius: 50%; font-size: 13px; font-weight: 700; }

/* ------------------------------------------------ search */
.srch-results { display: flex; flex-direction: column; gap: 2px; max-height: 55vh; overflow-y: auto; }
.srch-row { display: flex; gap: 10px; align-items: flex-start; width: 100%; padding: 8px; border-radius: 10px; text-align: left; }
.srch-row:hover { background: var(--hover); }
.srch-text { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; font-size: 14px; color: var(--text-2); overflow-wrap: anywhere; }
.srch-meta { display: flex; gap: 8px; align-items: baseline; }
.srch-meta span { color: var(--accent-fg); font-size: 12.5px; }
.srch-meta small { color: var(--muted); }
.srch-text mark { background: rgb(242 184 75 / 0.35); color: inherit; border-radius: 3px; }
.flash { animation: flash 1.8s ease-out; }
@keyframes flash { 0%, 30% { background: rgb(242 184 75 / 0.25); } }

/* ------------------------------------------------ video attachments */
.video-card { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; width: min(360px, 70vw); aspect-ratio: 16 / 9; background: var(--bg-4); color: var(--text-2); border-radius: inherit; }
.video-card .play { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--brand); color: #fff; transition: transform 0.2s var(--ease); }
.video-card:hover .play { transform: scale(1.08); }
.video-card .play .icon { fill: currentColor; margin-left: 3px; }
.video-name { max-width: 90%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 600; }
.video-card small { color: var(--muted); }
.video-att { display: block; max-width: min(480px, 100%); max-height: 360px; background: #000; }
.audio-card { display: flex; align-items: center; gap: 12px; padding: 16px; width: min(360px, 70vw); background: var(--bg-4); color: var(--text); text-align: left; min-height: 64px; }
.audio-card > .icon { flex: none; color: var(--accent-fg); }
.audio-card .sb-text { min-width: 0; }
.audio-card .sb-name, .audio-name { overflow-wrap: anywhere; }
.audio-card[disabled] { cursor: wait; opacity: .65; }
.audio-player { width: min(360px, 70vw); padding: 12px; background: var(--bg-4); }
.audio-name { margin: 0 4px 10px; font-size: 14px; }
.audio-att { display: block; width: 100%; height: 54px; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--bg-5); border-top-color: var(--accent-fg); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- categories (sidebar) ---------- */
.ch-cat { padding-left: 2px; }
.ch-cat-btn { display: flex; align-items: center; gap: 4px; min-width: 0; flex: 1; padding: 4px 4px; color: var(--muted); font: inherit; text-transform: uppercase; letter-spacing: .02em; text-align: left; }
.ch-cat-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-cat-btn:hover { color: var(--text-2); }
.ch-cat-btn svg { flex: none; transition: transform .18s ease; }
.ch-cat.closed .ch-cat-btn svg { transform: rotate(-90deg); }
.ch-row[draggable="true"], .ch-cat[draggable="true"] { cursor: grab; }
.drop-before { box-shadow: inset 0 2px 0 var(--accent-fg); }
.ss-role.sub { padding-left: 28px; }

/* ---------- replies ---------- */
.reply-line { display: flex; align-items: center; gap: 6px; max-width: 100%; min-width: 0; margin: 0 0 3px; padding: 0; color: var(--muted); font-size: 13px; text-align: left; }
.reply-line b { flex: none; color: var(--text-2); font-weight: 600; }
.reply-line .avatar { flex: none; }
.reply-line svg { flex: none; }
.reply-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
button.reply-line:hover .reply-text, button.reply-line:hover b { color: var(--text); }
.reply-line.missing { font-style: italic; }
.reply-older { flex: none; font-style: italic; }
.msg.mine .reply-line { align-self: flex-end; }
.reply-snip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* ---------- forum ---------- */
.forum-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line); }
.forum-bar .btn { display: inline-flex; align-items: center; gap: 6px; flex: none; }
.forum-list { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 20px 24px; display: flex; flex-direction: column; gap: 8px; }
.post-card { display: flex; flex-direction: column; gap: 6px; width: 100%; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-3); text-align: left; color: var(--text); }
.post-card:hover { background: var(--hover); }
.post-title { font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
.post-preview { color: var(--text-2); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.post-meta { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12.5px; flex-wrap: wrap; }
.post-dot { opacity: .6; }
@media (max-width: 760px) {
  .forum-bar { padding: 10px 16px; }
  .forum-list { padding: 10px 16px 20px; }
}
@media (prefers-reduced-motion: reduce) { .ch-cat-btn svg { transition: none; } }
.mrow.has-reply .row-avatar { padding-top: 24px; }
.mn.mn-me { background: rgb(242 184 75 / 0.2); color: var(--warn); }
.reply-to { flex: none; white-space: nowrap; }

/* someone is in one of this server's voice channels: small speaker on the rail icon (mentions keep the other corner) */
.voice-card { position: fixed; z-index: 60; min-width: 180px; max-width: 260px; padding: 10px 12px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line); box-shadow: 0 6px 24px rgb(0 0 0 / 0.35); pointer-events: none; font-size: 13px; }
.voice-card-name { display: block; margin-bottom: 6px; }
.voice-card-chan + .voice-card-chan { margin-top: 8px; }
.voice-card-title { display: flex; align-items: center; gap: 6px; color: var(--text-2); margin-bottom: 4px; }
.voice-card-user { display: flex; align-items: center; gap: 8px; padding: 2px 0 2px 20px; }
.voice-card-user span:not(.live-tag) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.voice-badge { position: absolute; bottom: -2px; left: -2px; width: 20px; height: 20px; border-radius: 10px; display: grid; place-items: center;
  background: var(--ok); color: #04210f; box-shadow: 0 0 0 3px var(--bg); }
/* screen share: red LIVE next to the name (voice channel list, call tiles) */
.live-tag { flex: none; margin-left: 6px; padding: 0 5px; border-radius: 4px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 800; letter-spacing: 0.04em; line-height: 16px; }

/* stream right-click menu + technical info overlay */
.stream-menu { display: flex; flex-direction: column; gap: 4px; min-width: 240px; }
.stream-menu .menu-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; font-size: 14px; text-align: left; }
.stream-menu .menu-item:hover { background: var(--bg-5); }
.stream-stats { position: absolute; top: 8px; left: 56px; right: 48px; font-size: 11.5px; font-weight: 600; color: #fff;
  background: rgb(0 0 0 / 0.6); padding: 3px 8px; border-radius: 6px; width: fit-content; max-width: calc(100% - 110px); pointer-events: none; font-variant-numeric: tabular-nums; }

/* Named profile themes; custom CSS and external resources are never accepted. */
.custom-emoji { width: 1.5em; height: 1.5em; vertical-align: middle; object-fit: contain; }
.emoji .custom-emoji { width: 28px; height: 28px; }
.emoji-upload-list { display: grid; gap: 8px; }
.emoji-upload-row { display: flex; align-items: center; gap: 12px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; }
.emoji-upload-row img { width: 40px; height: 40px; object-fit: contain; }
.gif-cell button.gif-send { border: 0; padding: 0; width: 100%; background: transparent; }

.bot-badge { display:inline-block; margin-left:8px; padding:2px 6px; border:1px solid var(--line); border-radius:4px; font-size:11px; vertical-align:middle; color:var(--text-2); }

.spoiler-reveal { font: inherit; color: var(--text); background: var(--fill, #343942); border: 1px solid var(--sep, #667080); border-radius: 6px; padding: 2px 8px; cursor: pointer; }
.spoiler-reveal:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.spoiler-shown { background: var(--tint, #2f6fb01a); border-radius: 4px; padding: 1px 3px; overflow-wrap: anywhere; }

.gif-send video { display: block; width: 100%; height: 140px; object-fit: contain; border-radius: inherit; }

.gif-popover { width: min(560px, calc(100vw - 16px)); box-sizing: border-box; }
.gif-send { width: 100%; }

.voice-duration { margin-left: auto; flex-shrink: 0; color: var(--ok); font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; }
