/* ==========================================================================
   aecho — mobile-first messenger UI
   ========================================================================== */

:root {
  --bg: #ffffff;
  --bg-2: #f4f6f8;
  --bg-3: #edf1f4;
  --text: #0e1621;
  --muted: #78838d;
  --muted-2: #a5adb5;
  --line: #e8edf2;
  --accent: #a94fd0;
  --accent-strong: #963fc0;
  --accent-soft: #f6ecfd;
  --accent-rgb: 169, 79, 208;
  --on-accent: #ffffff;
  --header-bg: rgba(255, 255, 255, 0.92);
  --search-bg: #f1eef5;
  --bubble-in: #ffffff;
  --bubble-out: #e5ffd8;
  --bubble-in-text: #0e1621;
  --bubble-out-text: #0e1621;
  --bubble-time-in: #8a959f;
  --bubble-time-out: #6b8c5d;
  --tick: #a94fd0;
  --online: #31c48d;
  --danger: #e5484d;
  --sheet: #ffffff;
  --shadow-sm: 0 1px 2px rgba(13, 35, 55, 0.08);
  --shadow-md: 0 10px 30px rgba(13, 35, 55, 0.15);
  --shadow-lg: 0 30px 90px rgba(13, 35, 55, 0.28);
  /* Один набор радиусов, размеров текста и разделителей для всех экранов. */
  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 18px;
  --r-2xl: 22px;
  --r-pill: 999px;
  --fs-2xs: 11px;
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-md: 14px;
  --fs-base: 15px;
  --fs-lg: 16px;
  --fs-xl: 20px;
  --fs-2xl: 22px;
  --fs-3xl: 26px;
  --fs-4xl: 36px;
  --fs-5xl: 44px;
  --fs-hero: 32px;
  --divider: rgba(128, 128, 128, 0.22);
  --danger-soft: rgba(229, 72, 77, 0.1);
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --wallpaper:
    radial-gradient(1100px 620px at 88% -8%, rgba(var(--accent-rgb), 0.18), transparent 58%),
    radial-gradient(900px 520px at -5% 108%, rgba(130, 80, 180, 0.14), transparent 55%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cg fill='none' stroke='%238a5aa8' stroke-opacity='.10' stroke-width='1.4'%3E%3Ccircle cx='28' cy='30' r='7'/%3E%3Cpath d='M100 22l7 7-7 7-7-7z'/%3E%3Cpath d='M142 74c7 0 7 11 0 11s-7-11 0-11z'/%3E%3Cpath d='M54 112l4 8 9 1-6.5 6 2 9-8.5-4.5-8.5 4.5 2-9-6.5-6 9-1z'/%3E%3Cpath d='M24 150c9-9 18 5 9 9'/%3E%3Cpath d='M105 140h12M111 134v12'/%3E%3Cpath d='M150 120c0-5 8-5 8 0s-8 5-8 0z'/%3E%3C/g%3E%3C/svg%3E");
  --wallpaper-color: #f4edfa;
}

html[data-theme="dark"] {
  --bg: #000000;
  --bg-2: #161618;
  --bg-3: #26262a;
  --text: #ffffff;
  --muted: #9a9aa2;
  --muted-2: #6d6d75;
  --line: #26262b;
  --accent: #d79bf5;
  --accent-strong: #c77cf0;
  --accent-soft: rgba(215, 155, 245, 0.16);
  --accent-rgb: 215, 155, 245;
  --on-accent: #1a1020;
  --header-bg: rgba(0, 0, 0, 0.88);
  --search-bg: #1b1b1e;
  --bubble-in: #1b1b1e;
  --bubble-out: #4a2a5f;
  --bubble-in-text: #f5f2f8;
  --bubble-out-text: #ffffff;
  --bubble-time-in: #8d8d97;
  --bubble-time-out: #d9bce9;
  --tick: #e0b7f7;
  --online: #4cd7a0;
  --danger: #ff6b70;
  --sheet: #17171a;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 30px 90px rgba(0, 0, 0, 0.75);
  --divider: rgba(255, 255, 255, 0.12);
  --danger-soft: rgba(255, 107, 112, 0.14);
  --wallpaper: none;
  --wallpaper-color: #000000;
}

/* Accent colors. Purple is the default and lives in :root and html[data-theme="dark"]. */
html[data-accent="blue"] { --accent: #2a9fe0; --accent-strong: #1f86c2; --accent-rgb: 42, 159, 224; --accent-soft: #e8f5fd; --tick: #2a9fe0; --bubble-out: #dcefff; }
html[data-accent="green"] { --accent: #31a866; --accent-strong: #2a8f57; --accent-rgb: 49, 168, 102; --accent-soft: #e6f7ee; --tick: #31a866; --bubble-out: #dcf5e6; }
html[data-accent="orange"] { --accent: #f08a24; --accent-strong: #d9731a; --accent-rgb: 240, 138, 36; --accent-soft: #fdf1e4; --tick: #f08a24; --bubble-out: #fde9d0; }
html[data-accent="red"] { --accent: #e5484d; --accent-strong: #cc3338; --accent-rgb: 229, 72, 77; --accent-soft: #fdeaea; --tick: #e5484d; --bubble-out: #fde0e1; }
html[data-accent="pink"] { --accent: #e0589c; --accent-strong: #c94487; --accent-rgb: 224, 88, 156; --accent-soft: #fcebf4; --tick: #e0589c; --bubble-out: #fde3f0; }
html[data-accent="teal"] { --accent: #14a3a3; --accent-strong: #0e8686; --accent-rgb: 20, 163, 163; --accent-soft: #e5f6f6; --tick: #14a3a3; --bubble-out: #d7f3f1; }
html[data-accent="blue"][data-theme="dark"] { --accent: #6cc0f5; --accent-strong: #4fb0ee; --accent-rgb: 108, 192, 245; --accent-soft: rgba(108, 192, 245, 0.16); --tick: #9fd8f8; --bubble-out: #1d3a52; }
html[data-accent="green"][data-theme="dark"] { --accent: #6fd39a; --accent-strong: #55c485; --accent-rgb: 111, 211, 154; --accent-soft: rgba(111, 211, 154, 0.16); --tick: #9be6bd; --bubble-out: #1f4232; }
html[data-accent="orange"][data-theme="dark"] { --accent: #f5a95c; --accent-strong: #e8914a; --accent-rgb: 245, 169, 92; --accent-soft: rgba(245, 169, 92, 0.16); --tick: #f9c48e; --bubble-out: #4d3420; }
html[data-accent="red"][data-theme="dark"] { --accent: #ff7a7e; --accent-strong: #f25c61; --accent-rgb: 255, 122, 126; --accent-soft: rgba(255, 122, 126, 0.16); --tick: #ffa3a6; --bubble-out: #4d2224; }
html[data-accent="pink"][data-theme="dark"] { --accent: #f080bb; --accent-strong: #e0649f; --accent-rgb: 240, 128, 187; --accent-soft: rgba(240, 128, 187, 0.16); --tick: #f7acd3; --bubble-out: #4d2440; }
html[data-accent="teal"][data-theme="dark"] { --accent: #5fd0d0; --accent-strong: #3fbcbc; --accent-rgb: 95, 208, 208; --accent-soft: rgba(95, 208, 208, 0.16); --tick: #9de6e6; --bubble-out: #173f40; }


* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}

/* Standalone documents (admin, terms, privacy, invites) are ordinary pages and
   must scroll: the app shell rule above keeps the messenger fixed. */
html.doc-scroll {
  height: auto;
  min-height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
html.doc-scroll body {
  height: auto;
  min-height: 100%;
  overflow-y: visible;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: var(--fs-base);
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input, textarea {
  font: inherit;
  color: inherit;
}

button { cursor: pointer; border: 0; background: none; padding: 0; }

input, textarea { outline: none; }

svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

a { color: var(--accent); }

[hidden] { display: none !important; }

::selection { background: rgba(var(--accent-rgb), 0.28); }

/* ------------------------------- App shell ------------------------------- */
#app {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background: var(--bg);
  isolation: isolate;
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.chats-screen { z-index: 1; }

.chat-screen {
  z-index: 20;
  transform: translateX(100%);
  visibility: hidden;
  transition: transform 0.32s var(--ease), visibility 0.32s;
  box-shadow: -12px 0 40px rgba(12, 30, 48, 0.13);
}

.chat-screen.open {
  transform: translateX(0);
  visibility: visible;
}

.profile-screen {
  z-index: 30;
  transform: translateX(100%);
  visibility: hidden;
  transition: transform 0.32s var(--ease), visibility 0.32s;
}

.profile-screen.open {
  transform: translateX(0);
  visibility: visible;
}

.group-screen {
  z-index: 30;
  transform: translateX(100%);
  visibility: hidden;
  transition: transform 0.32s var(--ease), visibility 0.32s;
}

.group-screen.open {
  transform: translateX(0);
  visibility: visible;
}

.group-body {
  flex: 1;
  overflow-y: auto;
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
}

/* Group info: use the same rounded cards as privacy and notifications. */
#groupScreen .group-body { padding: 0 16px calc(24px + env(safe-area-inset-bottom)); }
#groupScreen .group-head { padding: 20px 4px 16px; }
#groupScreen .group-section { padding: 18px 4px 8px; }
#groupScreen .group-list {
  border: 0;
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
#groupScreen .group-row {
  padding: 11px 14px;
  border: 1.5px solid transparent;
  border-radius: var(--r-xl);
  background: var(--bg-2);
  transition: background 0.15s, border-color 0.15s;
}
#groupScreen .group-row:hover { background: var(--bg-3); }
#groupScreen .group-row.action { color: var(--accent); }
#groupScreen .group-row.action.danger { color: var(--danger); }
#groupScreen .group-row-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--r-lg);
  background: var(--accent-soft);
  color: var(--accent);
}
#groupScreen .group-row-icon svg { width: 20px; height: 20px; }
#groupScreen .group-list-hint { padding: 12px 14px; }
#groupScreen .group-desc-card { margin: 8px 4px 12px; }
#groupScreen .group-edit { padding: 8px 4px 12px; }

/* Group permissions use the same switch shape as notification settings. */
#groupScreen .perm-row input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 44px;
  height: 26px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--bg-3);
  position: relative;
  flex: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
#groupScreen .perm-row input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s;
}
#groupScreen .perm-row input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}
#groupScreen .perm-row input[type="checkbox"]:checked::after { transform: translateX(18px); }
#groupScreen .perm-row input[type="checkbox"]:disabled { opacity: 0.5; cursor: default; }

.group-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 24px 20px 16px;
  text-align: center;
}

.group-title {
  font-size: var(--fs-xl);
  font-weight: 600;
  word-break: break-word;
}

.group-sub {
  color: var(--muted);
  font-size: var(--fs-md);
}

.group-rename {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.group-rename input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line, var(--muted));
  border-radius: var(--r-md);
  background: var(--bg-2);
  color: inherit;
  font: inherit;
  text-align: center;
}

.group-picker-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.group-picker-actions .group-submit {
  width: auto;
  padding: 0 18px;
}

.group-picker-list {
  max-height: 320px;
  overflow-y: auto;
}

.group-section {
  padding: 16px 20px 6px;
  color: var(--muted);
  font-size: var(--fs-sm);
}

.group-list {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin-bottom: 8px;
}

.group-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: none;
  border: 0;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.group-row:hover { background: var(--bg-2); }

.group-row.action {
  padding: 14px 16px;
  color: var(--accent);
}

.group-row.action.danger { color: var(--danger); }

.group-row-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-2);
  font-size: var(--fs-2xl);
  flex: none;
}

.group-row.member .user-meta { flex: 1; min-width: 0; }

/* Channel subscriber list is visible to admins only. */
.group-list-hint {
  padding: 12px 16px;
  font-size: var(--fs-sm);
  line-height: 1.45;
  color: var(--muted);
}

.group-you {
  color: var(--muted);
  font-weight: 400;
}

.group-remove {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: none;
}

.group-remove:hover { color: var(--danger); background: var(--bg-2); }

.group-remove svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

/* Notification settings: cards matching the privacy screen */
#notifyScreen .privacy-body {
  padding: 12px 16px calc(30px + env(safe-area-inset-bottom));
}
#notifyScreen .group-section {
  padding: 18px 4px 8px;
}
#notifyScreen .group-section:first-of-type { padding-top: 6px; }
#notifyScreen .group-list {
  border: 0;
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
#notifyScreen .group-row {
  padding: 11px 14px;
  border: 1.5px solid transparent;
  border-radius: var(--r-xl);
  background: var(--bg-2);
  transition: background 0.15s, border-color 0.15s;
}
#notifyScreen .group-row:hover { background: var(--bg-3); }
#notifyScreen .group-row.action {
  padding: 11px 14px;
  color: var(--accent);
}
#notifyScreen .group-row-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--r-lg);
  background: var(--accent-soft);
  color: var(--accent);
}
#notifyScreen .group-row-icon svg { width: 20px; height: 20px; }
#notifyScreen .group-hint {
  margin: 0;
  padding: 8px 4px 14px;
  color: var(--muted);
  font-size: var(--fs-sm);
  line-height: 1.45;
}
#notifyScreen .group-remove { margin-left: auto; }

.privacy-screen {
  z-index: 31;
  transform: translateX(100%);
  visibility: hidden;
  transition: transform 0.32s var(--ease), visibility 0.32s;
}

.privacy-screen.open {
  transform: translateX(0);
  visibility: visible;
}

/* --------------------------------- Icons --------------------------------- */
.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: background 0.16s, color 0.16s, transform 0.12s;
  flex: none;
}

.icon-btn:hover { background: var(--bg-3); color: var(--text); }
.icon-btn:active { transform: scale(0.92); }
.icon-btn svg { width: 24px; height: 24px; }

.text-btn {
  color: var(--accent);
  font-size: var(--fs-base);
  font-weight: 600;
  padding: 8px 10px;
  border-radius: var(--r-md);
  margin-right: -6px;
}

.text-btn:active { background: var(--accent-soft); }

/* -------------------------------- Avatars -------------------------------- */
.avatar {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  color: #fff;
  font-size: var(--fs-2xl);
  font-weight: 600;
  letter-spacing: 0.01em;
  user-select: none;
  flex: none;
  text-transform: uppercase;
  background: linear-gradient(135deg, #5bc8ff, #1688d4);
}

.avatar.sm { width: 40px; height: 40px; font-size: var(--fs-lg); }
.avatar.lg { width: 64px; height: 64px; font-size: var(--fs-3xl); }
.avatar.xl { width: 112px; height: 112px; font-size: var(--fs-5xl); box-shadow: 0 8px 24px rgba(13, 60, 100, 0.22); }

.avatar.c0 { background: linear-gradient(135deg, #5bc8ff, #1688d4); }
.avatar.c1 { background: linear-gradient(135deg, #b18aff, #7b4dff); }
.avatar.c2 { background: linear-gradient(135deg, #ffbe6b, #f2712d); }
.avatar.c3 { background: linear-gradient(135deg, #65ddaa, #1fa06b); }
.avatar.c4 { background: linear-gradient(135deg, #ff9cc0, #e14c85); }
.avatar.c5 { background: linear-gradient(135deg, #ff9382, #df4b4b); }
.avatar.c6 { background: linear-gradient(135deg, #6cd9dc, #1d9da6); }
.avatar.c7 { background: linear-gradient(135deg, #99a6ff, #5b61e8); }

.avatar.no-photo {
  background: linear-gradient(135deg, #9aa7b4, #6b7a8a);
  color: rgba(255, 255, 255, 0.92);
}

.avatar.no-photo svg {
  width: 56%;
  height: 56%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.avatar-fallback { line-height: 1; }

.avatar-img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.avatar-wrap { position: relative; display: inline-flex; flex: none; }

.online-dot {
  position: absolute;
  right: 0;
  bottom: 1px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--online);
  border: 2.5px solid var(--bg);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.03);
}

/* ==========================================================================
   CHATS LIST
   ========================================================================== */
.chats-header {
  flex: none;
  padding: calc(8px + env(safe-area-inset-top)) 12px 10px;
  background: var(--header-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
  z-index: 2;
}

.chats-header-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
}

.chats-title {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding-left: 2px;
  font-size: var(--fs-2xl);
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.title-badge {
  min-width: 21px;
  height: 21px;
  padding: 0 6px;
  border-radius: var(--r-md);
  background: var(--accent);
  color: var(--on-accent);
  font-size: var(--fs-xs);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  animation: badgePop 0.25s ease;
}

.own-avatar-btn {
  border-radius: 50%;
  padding: 2px;
  transition: transform 0.15s;
  flex: none;
}

.own-avatar-btn:active { transform: scale(0.9); }
.own-avatar-btn .avatar { width: 36px; height: 36px; font-size: var(--fs-md); }

.search-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  margin-top: 10px;
  padding: 0 10px 0 12px;
  border-radius: var(--r-lg);
  background: var(--search-bg);
  color: var(--muted);
  transition: box-shadow 0.18s, background 0.18s;
}

.search-pill:focus-within {
  box-shadow: 0 0 0 2px var(--accent) inset;
  background: var(--bg);
}

.search-icon { width: 19px; height: 19px; stroke-width: 2.1; flex: none; }
.own-avatar-btn .avatar { box-shadow: 0 2px 6px rgba(13, 60, 100, 0.18); }

.search-pill input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  /* 16px+ prevents mobile Safari from zooming the page on focus. */
  font-size: var(--fs-lg);
  height: 100%;
}

.search-pill input::placeholder { color: var(--muted); }

.clear-search {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  background: var(--bg-3);
}

.clear-search svg { width: 15px; height: 15px; }

.chat-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 16px 2px;
}
.chat-filter {
  flex: none;
  max-width: 150px;
  padding: 6px 11px;
  border-radius: var(--r-pill);
  background: var(--bg-2);
  color: var(--muted);
  font-size: var(--fs-sm);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.15s, color 0.15s;
}
.chat-filter:hover { background: var(--bg-3); }
.chat-filter.active { background: var(--accent); color: var(--on-accent); }
.chat-filter.active:hover { background: var(--accent-strong); }

.chat-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  padding: 4px 0 90px;
  scrollbar-width: thin;
  scrollbar-color: var(--muted-2) transparent;
}

.chat-list::-webkit-scrollbar { width: 5px; }
.chat-list::-webkit-scrollbar-thumb { background: var(--muted-2); border-radius: 4px; }

.chat-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 9px 14px;
  text-align: left;
  transition: background 0.14s;
}

.chat-item:hover { background: var(--bg-2); }
.chat-item:active { background: var(--bg-3); }

.chat-item .avatar { width: 54px; height: 54px; }

.chat-item-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 4px 0;
}

.chat-item-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-name {
  flex: 1;
  min-width: 0;
  font-size: var(--fs-lg);
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.012em;
}

.chat-time {
  font-size: var(--fs-xs);
  color: var(--muted);
  flex: none;
  margin-top: 1px;
}

.chat-item-bottom {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 19px;
}

.chat-preview {
  flex: 1;
  min-width: 0;
  color: var(--muted);
  font-size: var(--fs-md);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 4px;
}

.chat-preview .preview-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.chat-preview .you { color: var(--muted); }
.chat-preview.typing-preview { color: var(--accent); font-style: italic; }

.unread-badge {
  min-width: 21px;
  height: 21px;
  padding: 0 6px;
  border-radius: var(--r-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: var(--on-accent);
  font-size: var(--fs-xs);
  font-weight: 600;
  flex: none;
  box-shadow: 0 2px 6px rgba(var(--accent-rgb), 0.28);
}

.unread-badge.muted-badge {
  background: var(--muted-2);
  box-shadow: none;
}

.ticks {
  display: inline-flex;
  align-items: center;
  color: var(--muted-2);
  flex: none;
}

.ticks svg { width: 16px; height: 16px; stroke-width: 2.3; }
.ticks.read { color: var(--accent); }
.ticks.stack svg + svg { margin-left: -7px; }

.chat-search-hit {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 13px 16px;
  text-align: left;
  color: var(--accent);
  font-weight: 600;
  border-bottom: 1px solid var(--line);
}

.chat-search-hit svg { width: 21px; height: 21px; }

.no-chat-results {
  padding: 48px 32px;
  text-align: center;
  color: var(--muted);
  font-size: var(--fs-md);
}

/* skeletons */
.skeleton-chat {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
}

.sk-avatar {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  flex: none;
  background: var(--bg-2);
  position: relative;
  overflow: hidden;
}

.sk-lines { flex: 1; display: flex; flex-direction: column; gap: 9px; }
.sk-lines i {
  display: block;
  height: 11px;
  border-radius: var(--r-xs);
  background: var(--bg-2);
  position: relative;
  overflow: hidden;
}
.sk-lines i:last-child { width: 62%; height: 9px; }

.sk-avatar::after, .sk-lines i::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  animation: shimmer 1.3s infinite;
}

html[data-theme="dark"] .sk-avatar::after,
html[data-theme="dark"] .sk-lines i::after {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06), transparent);
}

/* empty state */
.empty-chats {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px 40px 90px;
  color: var(--muted);
}

.empty-illustration { width: 120px; height: 120px; color: var(--accent); margin-bottom: 14px; }
.empty-illustration svg { width: 100%; height: 100%; stroke-width: 1; }
.empty-chats h2 { margin: 0 0 6px; font-size: var(--fs-xl); color: var(--text); letter-spacing: -0.01em; }
.empty-chats p { margin: 0 0 18px; font-size: var(--fs-md); max-width: 260px; }

.empty-action {
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  font-size: var(--fs-md);
  padding: 10px 20px;
  border-radius: var(--r-lg);
  box-shadow: 0 6px 16px rgba(var(--accent-rgb), 0.3);
}

.fab {
  position: absolute;
  right: 18px;
  bottom: calc(22px + env(safe-area-inset-bottom));
  width: 56px;
  height: 56px;
  border-radius: var(--r-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--on-accent);
  background: linear-gradient(140deg, var(--accent), var(--accent-strong));
  box-shadow: 0 10px 24px rgba(199, 124, 240, 0.4), 0 2px 6px rgba(199, 124, 240, 0.3);
  transition: transform 0.16s, box-shadow 0.16s;
  z-index: 5;
}

.fab svg { width: 25px; height: 25px; stroke-width: 2.1; }
.fab:hover { transform: translateY(-1px) scale(1.02); box-shadow: 0 14px 30px rgba(199, 124, 240, 0.46); }
.fab:active { transform: scale(0.94); }

/* ==========================================================================
   CHAT
   ========================================================================== */
.chat-screen { background: var(--wallpaper-color); }

.chat-header {
  flex: none;
  display: flex;
  align-items: center;
  gap: 2px;
  height: calc(56px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 6px 0 4px;
  background: var(--header-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
  z-index: 3;
}

.back-btn { color: var(--accent); }
.back-btn svg { stroke-width: 2.3; }

.chat-peer {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 4px;
  text-align: left;
  border-radius: var(--r-lg);
}

.chat-peer:active { background: var(--bg-2); }

.peer-meta { display: flex; flex-direction: column; min-width: 0; gap: 1px; }

.peer-name {
  font-size: var(--fs-lg);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.012em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.peer-status {
  font-size: var(--fs-xs);
  color: var(--muted);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.peer-status.online { color: var(--accent); }
.peer-status.typing { color: var(--accent); font-style: italic; }

.chat-body {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
}

.messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  padding: 10px 0 10px;
  background-color: var(--wallpaper-color);
  background-image: var(--wallpaper);
  background-size: auto, auto, 180px 180px;
  scrollbar-width: thin;
  scrollbar-color: rgba(100, 120, 140, 0.35) transparent;
  -webkit-overflow-scrolling: touch;
}

.scroll-down {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 6;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--sheet);
  color: var(--muted);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px) scale(0.92);
  transition: opacity 0.16s, transform 0.16s, visibility 0.16s, color 0.15s;
  pointer-events: none;
}

.scroll-down.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.scroll-down:hover { color: var(--accent); }
.scroll-down svg { width: 22px; height: 22px; }

.messages::-webkit-scrollbar { width: 5px; }
.messages::-webkit-scrollbar-thumb { background: rgba(100, 120, 140, 0.35); border-radius: 4px; }

.messages-inner { min-height: 100%; display: flex; flex-direction: column; justify-content: flex-end; }

.msg {
  display: flex;
  padding: 0 10px;
  margin-top: 2px;
  animation: msgIn 0.18s ease-out both;
}

.msg.group-start { margin-top: 10px; }
.msg.out { justify-content: flex-end; }
.msg.shredding { pointer-events: none; }

/* Android Chrome treats a horizontal drag on a scrollable list as a pan and
   cancels the pointer events, so swipe-to-reply used to die after a few pixels.
   pan-y keeps vertical scrolling and hands horizontal gestures to the message
   handler; pinch-zoom stays available where supported. */
.msg,
.bubble {
  touch-action: pan-y;
}

@supports (touch-action: pinch-zoom) {
  .msg,
  .bubble {
    touch-action: pan-y pinch-zoom;
  }
}

.msg.swiping { position: relative; z-index: 2; }

.msg.swiping .bubble {
  transform: translateX(var(--swipe-x, 0px));
  transition: none;
}

.msg.swipe-release .bubble {
  transform: translateX(0);
  transition: transform 0.18s cubic-bezier(0.2, 0.7, 0.3, 1);
}

.msg.swiping::after {
        content: "↩";
  position: absolute;
  left: 12px;
  top: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--bg);
  color: var(--accent);
  font-size: var(--fs-lg);
  line-height: 1;
  box-shadow: var(--shadow-sm);
  pointer-events: none;
  opacity: var(--swipe-progress, 0);
  transform: translateY(-50%);
}

.msg.swiping.swipe-left::after {
        content: "↪";
  left: auto;
  right: 12px;
}

.msg.flash .bubble { animation: replyFlash 0.9s ease; }

@keyframes replyFlash {
  0%, 100% { box-shadow: var(--shadow-sm); }
  35% { box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.62); }
}

.shred-overlay {
  position: fixed;
  z-index: 70;
  pointer-events: none;
  perspective: 900px;
}

.shred-slice {
  position: absolute;
  left: 0;
  width: 100%;
  overflow: hidden;
  transform-origin: 50% 50%;
  will-change: transform, opacity;
  backface-visibility: hidden;
}

.shred-slice .shred-clone {
  box-shadow: none;
  pointer-events: none;
}

.bubble {
  position: relative;
  max-width: min(80%, 430px);
  min-width: 64px;
  padding: 5px 10px 4px;
  border-radius: var(--r-xl);
  background: var(--bubble-in);
  color: var(--bubble-in-text);
  box-shadow: var(--shadow-sm);
  font-size: var(--fs-base);
  line-height: 1.34;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

.msg.in .bubble { border-bottom-left-radius: 6px; background: var(--bubble-in); }
.msg.out .bubble { border-bottom-right-radius: 6px; background: var(--bubble-out); color: var(--bubble-out-text); }

html[data-theme="dark"] .msg.in .bubble {
  border: 1px solid rgba(255, 255, 255, 0.04);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.28);
}

.msg:not(.group-start).in .bubble { border-top-left-radius: 8px; }
.msg:not(.group-start).out .bubble { border-top-right-radius: 8px; }

.bubble .text {
  display: block;
  white-space: pre-wrap;
  padding-bottom: 15px;
  padding-right: 4px;
}

.bubble .text a { text-decoration: none; border-bottom: 1px solid rgba(var(--accent-rgb), 0.35); }
.bubble .text a:hover { border-bottom-color: var(--accent); }

.bubble .text.caption { padding-top: 4px; }

.reply-quote {
  display: flex;
  align-items: stretch;
  gap: 7px;
  width: 100%;
  min-width: 0;
  margin: 1px 0 5px;
  padding: 4px 8px 4px 0;
  border-radius: var(--r-sm);
  background: rgba(var(--accent-rgb), 0.1);
  color: inherit;
  text-align: left;
  overflow: hidden;
}

.reply-quote-accent {
  width: 3px;
  flex: none;
  border-radius: 2px;
  background: var(--accent);
}

.reply-quote-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.reply-quote-author {
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--accent);
}

.reply-quote-text {
  max-width: min(62vw, 300px);
  font-size: var(--fs-xs);
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.msg.out .reply-quote { background: rgba(31, 86, 40, 0.08); }
.msg.out .reply-quote-author { color: #2c7a3d; }
.msg.out .reply-quote-text { color: #4d6b4d; }

html[data-theme="dark"] .msg.out .reply-quote { background: rgba(255, 255, 255, 0.13); }
html[data-theme="dark"] .msg.out .reply-quote-accent { background: rgba(255, 255, 255, 0.85); }
html[data-theme="dark"] .msg.out .reply-quote-author { color: #ffffff; }
html[data-theme="dark"] .msg.out .reply-quote-text { color: rgba(255, 255, 255, 0.82); }
html[data-theme="dark"] .msg.in .reply-quote { background: rgba(255, 255, 255, 0.06); }

.forward-label {
  display: flex;
  align-items: flex-start;
  gap: 5px;
  margin: 1px 0 4px;
  font-size: var(--fs-xs);
  font-weight: 700;
  line-height: 1.35;
  color: var(--accent);
}

.forward-label svg {
  flex: none;
  width: 14px;
  height: 14px;
  margin-top: 1px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.forward-label span { overflow-wrap: anywhere; }

.msg.out .forward-label { color: #2c7a3d; }
html[data-theme="dark"] .msg.out .forward-label { color: rgba(255, 255, 255, 0.85); }

.bubble.has-image {
  width: min(78%, 340px);
  padding: 4px;
}

.msg-image-wrap {
  display: block;
  position: relative;
  border-radius: var(--r-lg);
  overflow: hidden;
}

.msg-image-wrap.is-loading,
.msg-image-wrap.is-uploading,
.msg-image-wrap.cancelled {
  min-height: 180px;
  background: var(--bg-3);
}

.msg-image-wrap.cancelled .msg-image { display: none; }

.bubble .msg-image {
  display: block;
  border-radius: var(--r-lg);
  overflow: hidden;
  text-decoration: none;
}

.bubble .msg-image img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 380px;
  object-fit: cover;
  border-radius: var(--r-lg);
  background: var(--bg-3);
}

.media-loader {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: inherit;
  background: rgba(7, 18, 29, 0.26);
  color: #fff;
}

.media-loader.is-uploading { background: rgba(7, 18, 29, 0.34); }
.media-loader.failed { background: rgba(7, 18, 29, 0.3); }

.progress-ring {
  position: absolute;
  width: 46px;
  height: 46px;
  overflow: visible;
  transform-origin: 50% 50%;
  animation: mediaSpin 1.5s linear infinite;
}

.ring-track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.32);
  stroke-width: 3;
}

.ring-bar {
  fill: none;
  stroke: #fff;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 125.6;
  stroke-dashoffset: calc(125.6 - 125.6 * var(--p, 0.3));
}

.progress-ring.indeterminate .ring-bar {
  stroke-dasharray: 34 92;
  stroke-dashoffset: 0;
}

.media-action {
  position: relative;
  z-index: 1;
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #fff;
  transition: background 0.15s;
}

.media-action:hover { background: rgba(255, 255, 255, 0.14); }
.media-action svg { width: 18px; height: 18px; stroke-width: 2.4; }

.media-retry { display: none; }

.media-loader.cancelled .progress-ring,
.media-loader.cancelled .media-action[data-media-cancel],
.media-loader.failed .progress-ring,
.media-loader.failed .media-action[data-media-cancel] {
  display: none;
}

.media-loader.cancelled .media-retry,
.media-loader.failed .media-retry { display: flex; }

@keyframes mediaSpin {
  to { transform: rotate(360deg); }
}

.bubble.has-image .text.caption {
  padding: 5px 6px 15px;
}

.bubble .msg-file {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 4px 3px;
  border-radius: var(--r-lg);
  color: inherit;
  text-decoration: none;
}

.bubble .msg-file:hover .msg-file-name { color: var(--accent); }

.msg-file-icon {
  width: 40px;
  height: 40px;
  flex: none;
  position: relative;
  border-radius: var(--r-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  background: rgba(var(--accent-rgb), 0.13);
}

.msg-file-icon > svg { width: 22px; height: 22px; }

.msg-file-icon .media-loader {
  border-radius: var(--r-lg);
  background: rgba(7, 18, 29, 0.42);
}

.msg-file-icon .progress-ring {
  width: 38px;
  height: 38px;
}

.msg-file-icon .media-action {
  width: 36px;
  height: 36px;
}

.msg-file-icon .media-action svg {
  width: 16px;
  height: 16px;
}

.msg-file.uploading { cursor: default; }
.msg-file.uploading:hover .msg-file-name { color: inherit; }

.msg-file-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.msg-file-name {
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--fs-sm);
  font-weight: 600;
}

.msg-file-size {
  font-size: var(--fs-2xs);
  color: var(--muted);
}

.bubble.has-file { min-width: 210px; }
.bubble.file-only { padding-bottom: 16px; }

.bubble.has-voice { min-width: 230px; }

.msg-voice {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.msg-voice.is-uploading { opacity: 0.6; }

.voice-play {
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  background: rgba(var(--accent-rgb), 0.13);
}

.voice-play:disabled { cursor: default; }
.voice-play svg { width: 18px; height: 18px; }
.msg-voice .voice-icon-pause { display: none; }
.msg-voice.is-playing .voice-icon-pause { display: block; }
.msg-voice.is-playing .voice-icon-play { display: none; }

.voice-track {
  flex: 1;
  min-width: 90px;
  height: 4px;
  border-radius: 2px;
  overflow: hidden;
  background: rgba(var(--accent-rgb), 0.22);
}

.voice-fill {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
}

.voice-time {
  min-width: 34px;
  text-align: right;
  font-size: var(--fs-2xs);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.bubble.has-image .meta {
  right: 7px;
  bottom: 7px;
  padding: 2px 5px;
  border-radius: var(--r-sm);
  background: rgba(0, 0, 0, 0.48);
  color: #fff;
}

.bubble.has-image .meta .ticks { color: rgba(255, 255, 255, 0.85); }
.bubble.has-image .meta .ticks.read { color: #a9d8ff; }

.bubble.has-image.with-caption .meta {
  right: 9px;
  bottom: 4px;
  padding: 0;
  background: none;
  color: var(--bubble-time-in);
}

.msg.out .bubble.has-image.with-caption .meta { color: var(--bubble-time-out); }
.bubble.has-image.with-caption .meta .ticks { color: rgba(70, 100, 55, 0.65); }
.bubble.has-image.with-caption .meta .ticks.read { color: var(--tick); }

.bubble .meta {
  position: absolute;
  right: 9px;
  bottom: 4px;
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: var(--fs-2xs);
  line-height: 1;
  color: var(--bubble-time-in);
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
  flex-wrap: nowrap;
}

.bubble .meta > * { flex: none; }

.msg.out .bubble { min-width: 78px; }

.msg.out .bubble .meta { color: var(--bubble-time-out); }

.bubble .meta .ticks { color: rgba(70, 100, 55, 0.65); }
.bubble .meta .ticks svg { width: 15px; height: 15px; stroke-width: 2.4; }
.bubble .meta .ticks.read { color: var(--tick); }

/* Реакции: время и «изм.» уходят в поток под чипы, чтобы не наезжать на них
   в коротких сообщениях и на картинках с подписью. */
.bubble.has-reactions .text,
.bubble.has-reactions.has-image .text.caption {
  padding-bottom: 0;
}

.bubble.has-reactions.file-only { padding-bottom: 4px; }

.bubble.has-reactions .reactions { margin: 4px 0 0; }

.bubble.has-reactions .meta,
.bubble.has-reactions.has-image .meta,
.bubble.has-reactions.has-image.with-caption .meta {
  position: static;
  justify-content: flex-end;
  margin-top: 2px;
  padding: 0;
  background: none;
  color: var(--bubble-time-in);
}

.msg.out .bubble.has-reactions .meta,
.msg.out .bubble.has-reactions.has-image .meta,
.msg.out .bubble.has-reactions.has-image.with-caption .meta {
  color: var(--bubble-time-out);
}

.bubble.has-reactions .meta .ticks,
.bubble.has-reactions.has-image .meta .ticks,
.bubble.has-reactions.has-image.with-caption .meta .ticks {
  color: rgba(70, 100, 55, 0.65);
}

.bubble.has-reactions .meta .ticks.read,
.bubble.has-reactions.has-image .meta .ticks.read,
.bubble.has-reactions.has-image.with-caption .meta .ticks.read {
  color: var(--tick);
}

.msg.deleted .bubble .text { font-style: italic; color: var(--muted); }

.msg .bubble {
  transition: box-shadow 0.15s;
}

.msg .bubble:active { box-shadow: 0 2px 6px rgba(13, 35, 55, 0.12); }

.date-sep {
  width: fit-content;
  margin: 12px auto 8px;
  padding: 3px 10px;
  border-radius: var(--r-lg);
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--bubble-in-text);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 1px 2px rgba(13, 35, 55, 0.06);
  user-select: none;
}

html[data-theme="dark"] .date-sep { background: rgba(23, 33, 43, 0.72); color: var(--text); }

.load-older {
  width: fit-content;
  align-self: center;
  margin-bottom: 8px;
  padding: 5px 12px;
  border-radius: var(--r-lg);
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: var(--fs-xs);
  backdrop-filter: blur(10px);
}

html[data-theme="dark"] .load-older { background: rgba(23, 33, 43, 0.72); }

.chat-loading {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: var(--fs-sm);
}

.chat-empty {
  margin: auto;
  padding: 12px 18px;
  border-radius: var(--r-xl);
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: var(--fs-sm);
  text-align: center;
  backdrop-filter: blur(10px);
  max-width: 230px;
}

html[data-theme="dark"] .chat-empty { background: rgba(23, 33, 43, 0.72); }

/* composer */
.composer {
  flex: none;
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 8px 9px calc(8px + env(safe-area-inset-bottom));
  background: var(--bg);
  border-top: 1px solid var(--line);
  position: relative;
  z-index: 4;
}

.composer-btn {
  width: 40px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  border-radius: var(--r-lg);
  transition: color 0.15s, background 0.15s;
}

.composer-btn:hover { color: var(--accent); background: var(--bg-2); }
.composer-btn svg { width: 24px; height: 24px; }

.voice-btn[hidden] { display: none; }
.voice-btn .icon-stop { display: none; }
.voice-btn.is-recording { color: var(--danger); }
.voice-btn.is-recording .icon-mic { display: none; }
.voice-btn.is-recording .icon-stop { display: block; }

.rec-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--danger);
  animation: rec-pulse 1.2s ease-in-out infinite;
}

@keyframes rec-pulse {
  50% { opacity: 0.3; }
}

.attach-preview {
  flex: none;
  padding: 8px 12px 0;
  background: var(--bg);
  position: relative;
  z-index: 4;
}

.attach-preview-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-lg);
  background: var(--bg-2);
}

.attach-preview-thumb {
  width: 44px;
  height: 44px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: var(--r-md);
  background: var(--bg-3);
  color: var(--accent);
}

.attach-preview-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.attach-preview-thumb svg { width: 24px; height: 24px; color: var(--accent); }

.attach-preview-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.attach-preview-name {
  font-size: var(--fs-sm);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attach-preview-size { font-size: var(--fs-2xs); color: var(--muted); }

.attach-cancel {
  width: 34px;
  height: 34px;
  flex: none;
}

.attach-cancel svg { width: 18px; height: 18px; }

.attach-preview.sending { opacity: 0.55; pointer-events: none; }

.reply-bar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  background: var(--bg);
  border-top: 1px solid var(--line);
  position: relative;
  z-index: 4;
  animation: replyBarIn 0.16s ease both;
}

.reply-bar-accent {
  width: 3px;
  align-self: stretch;
  min-height: 32px;
  flex: none;
  border-radius: 2px;
  background: var(--accent);
}

.reply-bar-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.reply-bar-title {
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--accent);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reply-bar-text {
  font-size: var(--fs-sm);
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reply-bar-cancel {
  width: 34px;
  height: 34px;
  flex: none;
}

.reply-bar-cancel svg { width: 18px; height: 18px; }

@keyframes replyBarIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Pinned message bar: sits right under the chat header (as in Telegram), so
   it stays in view at the top of the conversation instead of above the
   composer. */
.pin-bar {
  border-top: 0;
  border-bottom: 1px solid var(--line);
  box-shadow: 0 6px 14px rgba(12, 30, 48, 0.06);
  animation: pinBarIn 0.18s ease both;
}

.pin-bar-icon {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  color: var(--accent);
}

.pin-bar-icon svg { width: 18px; height: 18px; stroke-width: 2.1; }

.pin-bar .reply-bar-body { cursor: pointer; }

/* The bar sits above the messages: keep the text readable over the wallpaper. */
.pin-bar .reply-bar-text { color: var(--text); }

@keyframes pinBarIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.input-wrap {
  flex: 1;
  min-width: 0;
  background: var(--search-bg);
  border-radius: var(--r-2xl);
  min-height: 44px;
  display: flex;
  align-items: flex-end;
  transition: box-shadow 0.16s;
}

.input-wrap:focus-within { box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.32); }

.input-wrap textarea {
  width: 100%;
  border: 0;
  background: transparent;
  resize: none;
  padding: 10px 14px;
  font-size: var(--fs-lg);
  line-height: 23px;
  max-height: 128px;
  min-height: 44px;
  border-radius: var(--r-2xl);
  overflow-y: auto;
  scrollbar-width: none;
}

.input-wrap textarea::-webkit-scrollbar { display: none; }
.input-wrap textarea::placeholder { color: var(--muted); }

.send-btn {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--on-accent);
  background: linear-gradient(140deg, var(--accent), var(--accent-strong));
  box-shadow: 0 6px 16px rgba(199, 124, 240, 0.34);
  transition: transform 0.16s, opacity 0.16s, box-shadow 0.16s;
}

.send-btn svg { width: 23px; height: 23px; transform: translateX(-1px); }
.send-btn:hover { transform: translateY(-1px); }
.send-btn:active { transform: scale(0.92); }

.send-btn:disabled {
  background: var(--bg-3);
  color: var(--muted-2);
  box-shadow: none;
  opacity: 0.85;
  transform: none;
  cursor: default;
}

.emoji-panel {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: calc(68px + env(safe-area-inset-bottom));
  max-height: 238px;
  overflow-y: auto;
  background: var(--sheet);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--line);
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  z-index: 15;
  animation: sheetUp 0.18s ease both;
  scrollbar-width: thin;
}

.emoji-item {
  aspect-ratio: 1;
  border-radius: var(--r-md);
  font-size: var(--fs-2xl);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s, transform 0.12s;
}

.emoji-item:hover { background: var(--bg-3); transform: scale(1.08); }
.emoji-item:active { transform: scale(0.9); }

/* ==========================================================================
   PROFILE
   ========================================================================== */
.sub-header {
  flex: none;
  display: flex;
  align-items: center;
  gap: 4px;
  height: calc(56px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 10px 0 4px;
  border-bottom: 1px solid var(--line);
  background: var(--header-bg);
  backdrop-filter: blur(18px);
}

.sub-header h1 {
  flex: 1;
  font-size: var(--fs-xl);
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
}

.profile-body {
  flex: 1;
  overflow-y: auto;
  padding: 26px 20px calc(30px + env(safe-area-inset-bottom));
}

.profile-avatar-block {
  position: relative;
  width: 112px;
  height: 112px;
  margin: 0 auto 16px;
}

.avatar.xl { width: 112px; height: 112px; font-size: var(--fs-5xl); }

.profile-avatar-ring {
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  opacity: 0.18;
  pointer-events: none;
}

.profile-avatar-btn {
  padding: 0;
  border: 0;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.profile-avatar-btn:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 5px;
}

.profile-avatar-badge {
  position: absolute;
  right: -2px;
  bottom: -2px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid var(--bg);
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: var(--shadow-md);
  pointer-events: none;
}

.profile-avatar-badge svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.avatar-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 14px 0 4px;
}

.avatar-action {
  padding: 7px 11px;
  border-radius: var(--r-md);
  color: var(--accent);
  font-size: var(--fs-sm);
  font-weight: 600;
  transition: background 0.15s, opacity 0.15s;
}

.avatar-action:hover { background: var(--accent-soft); }
.avatar-action:disabled { opacity: 0.55; cursor: default; }
.avatar-action.danger { color: var(--danger); }
.avatar-action.danger:hover { background: var(--danger-soft); }

.color-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 0 auto 26px;
  flex-wrap: wrap;
}

.color-swatch {
  width: 27px;
  height: 27px;
  border-radius: 50%;
  position: relative;
  transition: transform 0.15s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.16);
}

.color-swatch:hover { transform: scale(1.12); }
.color-swatch.selected::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--accent);
}

.color-swatch.c0 { background: linear-gradient(135deg, #5bc8ff, #1688d4); }
.color-swatch.c1 { background: linear-gradient(135deg, #b18aff, #7b4dff); }
.color-swatch.c2 { background: linear-gradient(135deg, #ffbe6b, #f2712d); }
.color-swatch.c3 { background: linear-gradient(135deg, #65ddaa, #1fa06b); }
.color-swatch.c4 { background: linear-gradient(135deg, #ff9cc0, #e14c85); }
.color-swatch.c5 { background: linear-gradient(135deg, #ff9382, #df4b4b); }
.color-swatch.c6 { background: linear-gradient(135deg, #6cd9dc, #1d9da6); }
.color-swatch.c7 { background: linear-gradient(135deg, #99a6ff, #5b61e8); }

.field {
  display: block;
  position: relative;
  background: var(--bg-2);
  border-radius: var(--r-lg);
  padding: 9px 14px 10px;
  margin-bottom: 12px;
  border: 1px solid transparent;
  transition: border-color 0.15s, background 0.15s;
}

.field:focus-within { border-color: rgba(var(--accent-rgb), 0.55); background: var(--bg); }

.field-label {
  display: block;
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 1px;
}

.field input, .field textarea {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  font-size: var(--fs-lg);
  line-height: 1.45;
  padding: 2px 0;
  resize: none;
}

.field-static { background: var(--bg-2); }
.static-value { font-size: var(--fs-lg); padding: 2px 0; color: var(--accent); font-weight: 500; }
.field-note { display: block; font-size: var(--fs-xs); color: var(--muted); margin-top: 3px; }

.field-counter {
  position: absolute;
  right: 12px;
  bottom: 8px;
  font-size: var(--fs-2xs);
  color: var(--muted-2);
  background: var(--bg-2);
  padding-left: 6px;
}

.field:focus-within .field-counter { background: var(--bg); }

.profile-tip {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 22px;
  padding: 12px 14px;
  border-radius: var(--r-lg);
  background: var(--accent-soft);
  color: var(--muted);
  font-size: var(--fs-xs);
  line-height: 1.45;
}

.profile-tip svg { width: 19px; height: 19px; color: var(--accent); margin-top: 1px; }

/* ==========================================================================
   PRIVACY
   ========================================================================== */
.privacy-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px 20px calc(30px + env(safe-area-inset-bottom));
}

.privacy-body[hidden] { display: none; }

.privacy-intro { margin-bottom: 14px; }

.privacy-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.privacy-section-title {
  margin: 18px 2px 6px;
  color: var(--accent);
  font-size: var(--fs-sm);
  font-weight: 700;
  letter-spacing: 0.01em;
}

.privacy-list > .privacy-section-title:first-child { margin-top: 0; }

.privacy-menu { display: flex; flex-direction: column; }

.privacy-menu-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 46px;
  padding: 10px 4px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.privacy-menu-row:last-child { border-bottom: 0; }
.privacy-menu-row:hover { background: var(--bg-2); }

.privacy-menu-icon {
  width: 24px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
}

.privacy-menu-icon svg { width: 21px; height: 21px; }

.privacy-menu-title {
  flex: 1;
  min-width: 0;
  font-size: var(--fs-base);
  color: var(--text);
}

.privacy-menu-row.plain .privacy-menu-title { padding-left: 2px; }

.privacy-menu-value {
  flex: none;
  max-width: 52%;
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--accent);
  font-size: var(--fs-sm);
}

.privacy-menu-note {
  display: block;
  width: 100%;
  margin: 8px 0 0;
  padding: 12px 14px;
  border-radius: var(--r-lg);
  background: var(--bg-2);
  color: var(--muted);
  text-align: left;
  font-size: var(--fs-sm);
  line-height: 1.4;
}

.privacy-account-title { margin-top: 20px; }

.privacy-account-options {
  display: flex;
  gap: 8px;
  margin: 4px 0 0;
}

.privacy-account-option {
  flex: 1;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--bg-2);
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: 600;
}

.privacy-account-option.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.privacy-account-note {
  margin: 8px 2px 12px;
  color: var(--muted-2);
  font-size: var(--fs-xs);
  line-height: 1.45;
}

.privacy-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  text-align: left;
  background: var(--bg-2);
  border: 1.5px solid transparent;
  border-radius: var(--r-xl);
  transition: background 0.15s, border-color 0.15s;
}

.privacy-row:hover { background: var(--bg-3); }
.privacy-row:active { border-color: var(--accent); }

.privacy-row-icon {
  width: 38px;
  height: 38px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-lg);
  background: var(--accent-soft);
  color: var(--accent);
}

.privacy-row-icon svg { width: 20px; height: 20px; }

.privacy-row-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.privacy-row-title {
  font-size: var(--fs-base);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.privacy-row-value {
  font-size: var(--fs-xs);
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.privacy-row-chevron {
  width: 18px;
  height: 18px;
  flex: none;
  color: var(--muted-2);
}

.privacy-row-chevron svg { width: 18px; height: 18px; }

.privacy-title {
  margin: 0 0 6px;
  font-size: var(--fs-xl);
  font-weight: 650;
  letter-spacing: -0.01em;
}

.privacy-hint {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: var(--fs-sm);
  line-height: 1.45;
}

.privacy-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.privacy-option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 13px 14px;
  text-align: left;
  background: var(--bg-2);
  border: 1.5px solid transparent;
  border-radius: var(--r-xl);
  transition: background 0.15s, border-color 0.15s;
}

.privacy-option:hover { background: var(--bg-3); }

.privacy-option.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.privacy-option-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.privacy-option-title {
  font-size: var(--fs-base);
  font-weight: 600;
}

.privacy-option-sub {
  font-size: var(--fs-xs);
  line-height: 1.35;
  color: var(--muted);
}

.privacy-radio {
  width: 22px;
  height: 22px;
  flex: none;
  border-radius: 50%;
  border: 1.5px solid var(--muted-2);
  position: relative;
  transition: border-color 0.15s, background 0.15s;
}

.privacy-option.selected .privacy-radio {
  border-color: var(--accent);
  background: var(--accent);
}

.privacy-option.selected .privacy-radio::after {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: var(--on-accent);
}

.privacy-exceptions { margin-top: 20px; }

.privacy-exceptions-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.privacy-exceptions-title {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--muted);
}

.privacy-count {
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: var(--r-md);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: var(--fs-xs);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.privacy-users {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.privacy-user {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 9px 12px;
  text-align: left;
  background: var(--bg-2);
  border: 1.5px solid transparent;
  border-radius: var(--r-lg);
  transition: background 0.15s, border-color 0.15s;
}

.privacy-user:hover { background: var(--bg-3); }

.privacy-user.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.privacy-user-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.privacy-user-name {
  font-size: var(--fs-md);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.privacy-user-sub {
  font-size: var(--fs-xs);
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.privacy-check {
  width: 22px;
  height: 22px;
  flex: none;
  border-radius: 50%;
  border: 1.5px solid var(--muted-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--on-accent);
  transition: background 0.15s, border-color 0.15s;
}

.privacy-check svg { width: 14px; height: 14px; stroke-width: 3; }

.privacy-user.selected .privacy-check {
  border-color: var(--accent);
  background: var(--accent);
}

/* ==========================================================================
   DRAWER
   ========================================================================== */
.backdrop {
  position: absolute;
  inset: 0;
  z-index: 60;
  background: rgba(9, 20, 32, 0.42);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.24s, visibility 0.24s;
  backdrop-filter: blur(1.5px);
}

.backdrop.open { opacity: 1; visibility: visible; }

.drawer {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 61;
  width: min(312px, 84%);
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  transform: translateX(-102%);
  visibility: hidden;
  transition: transform 0.3s var(--ease), visibility 0.3s;
  box-shadow: 16px 0 48px rgba(9, 20, 32, 0.22);
  border-radius: 0 var(--r-2xl) var(--r-2xl) 0;
  overflow: hidden;
}

.drawer.open { transform: translateX(0); visibility: visible; }

.drawer-head {
  padding: calc(22px + env(safe-area-inset-top)) 18px 20px;
  background:
    radial-gradient(360px 220px at 100% 0%, rgba(255, 255, 255, 0.22), transparent 60%),
    linear-gradient(150deg, #a94fd0, #7f2fa8 60%, #5f217f);
  color: #fff;
}

.drawer-profile {
  display: flex;
  align-items: center;
  gap: 13px;
  cursor: pointer;
  border-radius: var(--r-lg);
  margin: -6px;
  padding: 6px;
  transition: background 0.15s;
}

.drawer-profile:hover { background: rgba(255, 255, 255, 0.1); }
.drawer-profile .avatar { border: 2px solid rgba(255, 255, 255, 0.45); }

.drawer-id { min-width: 0; }
.drawer-name {
  font-size: var(--fs-lg);
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.drawer-username {
  font-size: var(--fs-sm);
  opacity: 0.78;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.drawer-nav { flex: 1; overflow-y: auto; padding: 10px 8px; }

.drawer-item {
  display: flex;
  align-items: center;
  gap: 15px;
  width: 100%;
  min-height: 50px;
  padding: 0 12px;
  border-radius: var(--r-lg);
  color: var(--text);
  font-size: var(--fs-base);
  font-weight: 500;
  text-align: left;
  transition: background 0.15s;
}

.drawer-item:hover { background: var(--bg-2); }
.drawer-item svg { width: 22px; height: 22px; color: var(--muted); stroke-width: 1.9; }
.drawer-item.danger { color: var(--danger); }
.drawer-item.danger svg { color: var(--danger); }
.drawer-item-label { display: flex; align-items: center; gap: 15px; flex: 1; }

.theme-row { justify-content: space-between; cursor: pointer; }

.switch { position: relative; display: inline-flex; flex: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }

.switch-track {
  width: 42px;
  height: 25px;
  border-radius: var(--r-lg);
  background: var(--bg-3);
  position: relative;
  display: inline-block;
  transition: background 0.2s;
  border: 1px solid var(--line);
}

.switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s var(--ease);
}

.switch input:checked + .switch-track { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(17px); }

.drawer-footer {
  padding: 14px 20px calc(18px + env(safe-area-inset-bottom));
  font-size: var(--fs-xs);
  line-height: 1.6;
  color: var(--muted-2);
  border-top: 1px solid var(--line);
}

.drawer-footer span { opacity: 0.7; }
.drawer-version { font-size: var(--fs-2xs); }

/* ==========================================================================
   NEW CHAT SHEET
   ========================================================================== */
.sheet-backdrop {
  position: absolute;
  inset: 0;
  z-index: 70;
  background: rgba(9, 20, 32, 0.4);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.24s, visibility 0.24s;
}

.sheet-backdrop.open { opacity: 1; visibility: visible; }

.sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 71;
  max-height: 82%;
  display: flex;
  flex-direction: column;
  background: var(--sheet);
  border-radius: var(--r-2xl) var(--r-2xl) 0 0;
  box-shadow: 0 -12px 50px rgba(9, 20, 32, 0.25);
  transform: translateY(104%);
  visibility: hidden;
  transition: transform 0.32s var(--ease), visibility 0.32s;
  padding-bottom: env(safe-area-inset-bottom);
}

.sheet.open { transform: translateY(0); visibility: visible; }

.sheet.fullscreen {
  position: fixed;
  inset: 0;
  height: 100%;
  max-height: none;
  border-radius: 0;
  padding-top: env(safe-area-inset-top);
}

.sheet.fullscreen .sheet-handle { display: none; }

.sheet.fullscreen .user-results { flex: 1; min-height: 0; max-height: none; }

.sheet-handle {
  width: 38px;
  height: 4px;
  border-radius: 3px;
  background: var(--bg-3);
  margin: 8px auto 2px;
  flex: none;
}

.sheet-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 18px;
  flex: none;
}

.sheet-header h2 {
  flex: 1;
  margin: 0;
  font-size: var(--fs-xl);
  font-weight: 700;
  letter-spacing: -0.015em;
}

.sheet-search {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 6px 14px 9px;
  padding: 0 13px;
  height: 42px;
  border-radius: var(--r-lg);
  background: var(--bg-2);
  color: var(--muted);
  flex: none;
}

.sheet-search svg { width: 19px; height: 19px; }
.sheet-search input { flex: 1; border: 0; background: transparent; font-size: var(--fs-lg); height: 100%; }
.sheet-search input::placeholder { color: var(--muted); }

.sheet-label {
  padding: 3px 20px 6px;
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.045em;
  text-transform: uppercase;
  color: var(--muted);
  flex: none;
}

.user-results {
  flex: 1;
  overflow-y: auto;
  min-height: 180px;
  padding: 0 0 12px;
  overscroll-behavior: contain;
}

.user-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 8px 16px;
  text-align: left;
  transition: background 0.14s;
}

.user-item:hover { background: var(--bg-2); }
.user-item .avatar { width: 48px; height: 48px; font-size: var(--fs-xl); }

.user-meta { flex: 1; min-width: 0; }
.user-name {
  display: block;
  font-size: var(--fs-lg);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-sub {
  display: block;
  font-size: var(--fs-sm);
  color: var(--muted);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-sub.online { color: var(--accent); }

.sheet-action {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 2px 14px 8px;
  padding: 9px 12px;
  border-radius: var(--r-lg);
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: var(--fs-lg);
  font-weight: 600;
  text-align: left;
  flex: none;
}

.sheet-action[hidden] { display: none; }

.sheet-action-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  flex: none;
}

.sheet-action-icon svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sheet-search[hidden], .sheet-label[hidden], .user-results[hidden] { display: none; }

.group-form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.group-form[hidden] { display: none; }

.group-form .user-results { min-height: 0; }

.group-back {
  align-self: flex-start;
  margin: 2px 14px 0;
  padding: 6px 4px;
  background: none;
  border: 0;
  color: var(--accent);
  font-size: var(--fs-base);
  font-weight: 600;
}

.group-pick .avatar-wrap { flex: none; }

.group-check {
  width: 22px;
  height: 22px;
  margin-left: auto;
  border-radius: 50%;
  border: 2px solid var(--muted);
  flex: none;
  transition: background 0.14s, border-color 0.14s;
}

.group-pick.selected .group-check {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: inset 0 0 0 4px var(--sheet);
}

.group-footer { padding: 10px 16px calc(12px + env(safe-area-inset-bottom)); flex: none; }

.group-submit {
  width: 100%;
  height: 46px;
  border-radius: var(--r-lg);
  background: var(--accent);
  color: var(--on-accent);
  font-size: var(--fs-lg);
  font-weight: 600;
}

.group-submit:disabled { opacity: 0.45; }

.sender-name {
  margin-bottom: 2px;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--accent-strong);
}

/* -------------------------- Account and chat labels ------------------------- */
.badge {
  display: inline-block;
  margin-left: 6px;
  padding: 0 7px;
  border-radius: var(--r-pill);
  background: var(--bg-3);
  color: var(--muted);
  font-size: var(--fs-2xs);
  font-weight: 600;
  line-height: 17px;
  vertical-align: 1px;
  white-space: nowrap;
}
.badge-check {
  display: inline-flex;
  align-items: center;
  margin-left: 4px;
  color: var(--accent);
  vertical-align: -2px;
}
.badge-check svg {
  width: 15px;
  height: 15px;
  stroke-width: 2.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.badge-row {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--accent);
}
.badge-row svg { width: 15px; height: 15px; stroke-width: 2.6; }
.modal-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 12px;
  margin-top: 10px;
}
.profile-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-top: 6px;
}

.user-loading, .user-empty {
  padding: 36px 30px;
  text-align: center;
  color: var(--muted);
  font-size: var(--fs-sm);
  line-height: 1.5;
}

/* ==========================================================================
   MODAL / INFO
   ========================================================================== */
.modal-backdrop {
  position: absolute;
  inset: 0;
  z-index: 400;
  background: rgba(9, 20, 32, 0.46);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s, visibility 0.22s;
  backdrop-filter: blur(2px);
}

.modal-backdrop.open { opacity: 1; visibility: visible; }

.modal {
  position: absolute;
  inset: 0;
  z-index: 401;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  visibility: hidden;
  pointer-events: none;
}

.modal.open { visibility: visible; pointer-events: auto; }

.modal-card {
  position: relative;
  width: 100%;
  max-width: 330px;
  max-height: 80%;
  overflow-y: auto;
  background: var(--sheet);
  border-radius: var(--r-2xl);
  box-shadow: var(--shadow-lg);
  padding: 24px 22px 18px;
  transform: translateY(14px) scale(0.97);
  opacity: 0;
  transition: transform 0.24s var(--ease), opacity 0.22s;
}

.modal.open .modal-card { transform: none; opacity: 1; }

.modal-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: background 0.15s, color 0.15s, transform 0.12s;
}

.modal-close:hover { background: var(--bg-3); color: var(--text); }
.modal-close:active { transform: scale(0.92); }
.modal-close svg {
  width: 20px;
  height: 20px;
}

.modal-info { text-align: center; }
.modal-info .avatar { margin: 0 auto 13px; }
.modal-title { font-size: var(--fs-xl); font-weight: 700; letter-spacing: -0.015em; }
.modal-sub { color: var(--muted); font-size: var(--fs-md); margin-top: 2px; }
.modal-bio {
  margin: 16px 0 4px;
  padding: 12px;
  border-radius: var(--r-lg);
  background: var(--bg-2);
  color: var(--text);
  font-size: var(--fs-md);
  line-height: 1.5;
  white-space: pre-wrap;
}
.modal-bio.muted { color: var(--muted); font-style: italic; }
.modal-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  font-size: var(--fs-sm);
  color: var(--muted);
}
.modal-status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted-2);
}
.modal-status.online { color: var(--accent); }
.modal-status.online::before { background: var(--online); }
.modal-actions { margin-top: 18px; display: flex; flex-direction: column; gap: 8px; }
.modal-btn {
  height: 44px;
  border-radius: var(--r-lg);
  background: var(--bg-2);
  font-weight: 600;
  font-size: var(--fs-md);
  transition: background 0.15s;
}
.modal-btn:hover { background: var(--bg-3); }
.modal-btn.primary { background: var(--accent); color: var(--on-accent); }
.right-row { margin-top: 14px; }
.right-choice { margin-top: 6px; display: flex; gap: 6px; }
.right-choice .modal-btn { flex: 1; padding: 8px 4px; font-size: var(--fs-sm); }
.member-right-row { flex-wrap: wrap; }
.member-right-row .right-choice { width: 100%; margin-top: 8px; }
.member-page-hint { padding: 8px 16px 16px; font-size: var(--fs-sm); line-height: 1.4; color: var(--muted); }
.member-title.role-creator { background: var(--accent-soft); color: var(--accent); }
.member-title.role-admin { background: var(--bg-3); color: var(--online); }
.member-title.role-member { background: var(--bg-3); color: var(--muted); }
.member-title {
  display: inline-block;
  max-width: 120px;
  margin-left: 4px;
  padding: 0 6px;
  border-radius: var(--r-xs);
  font-size: var(--fs-2xs);
  font-weight: 500;
  line-height: 16px;
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.modal-btn.primary:hover { background: var(--accent-strong); }
.modal-btn.danger { background: rgba(229, 72, 77, 0.12); color: var(--danger); }
.modal-btn.danger:hover { background: rgba(229, 72, 77, 0.18); }

.forward-modal { text-align: left; }

.forward-preview {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 14px 0 4px;
  padding: 10px 12px;
  border-radius: var(--r-lg);
  background: var(--bg-2);
  color: var(--muted);
  font-size: var(--fs-sm);
  line-height: 1.4;
}

.forward-preview svg {
  flex: none;
  width: 16px;
  height: 16px;
  margin-top: 1px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.forward-preview span {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.forward-list {
  max-height: 288px;
  margin: 10px -8px 0;
  padding: 0 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.forward-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 8px;
  border-radius: var(--r-lg);
  text-align: left;
  transition: background 0.14s;
}

.forward-item:hover { background: var(--bg-2); }
.forward-item .avatar { width: 44px; height: 44px; font-size: var(--fs-lg); }
.forward-item-body { flex: 1; min-width: 0; }

.forward-item-arrow {
  flex: none;
  display: flex;
  color: var(--muted-2);
}

.forward-item-arrow svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.forward-empty {
  padding: 24px 12px;
  text-align: center;
  color: var(--muted);
  font-size: var(--fs-sm);
  line-height: 1.5;
}

.about-icon {
  width: 76px;
  height: 76px;
  margin: 0 auto 14px;
  filter: drop-shadow(0 12px 26px rgba(32, 76, 170, 0.32));
}
.about-icon img { display: block; width: 100%; height: 100%; }
.about-list { text-align: left; margin: 16px 0 4px; }
.about-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 2px;
  border-bottom: 1px solid var(--line);
  font-size: var(--fs-sm);
}
.about-row:last-child { border-bottom: 0; }
.about-row span:first-child { color: var(--muted); }

/* ==========================================================================
   CONTEXT MENU / TOAST
   ========================================================================== */
.ctx-menu {
  position: fixed;
  z-index: 110;
  min-width: 190px;
  padding: 6px;
  background: var(--sheet);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--line);
  animation: ctxIn 0.13s ease both;
}

.ctx-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  height: 42px;
  padding: 0 11px;
  border-radius: var(--r-md);
  font-size: var(--fs-md);
  text-align: left;
  transition: background 0.12s;
}

.ctx-item:hover { background: var(--bg-2); }
.ctx-item svg { width: 19px; height: 19px; color: var(--muted); }
.ctx-item.danger { color: var(--danger); }
.ctx-item.danger svg { color: var(--danger); }

.offline-banner {
  position: absolute;
  top: calc(9px + env(safe-area-inset-top));
  left: 50%;
  z-index: 132;
  display: flex;
  align-items: center;
  gap: 7px;
  max-width: calc(100% - 32px);
  padding: 7px 14px;
  border-radius: var(--r-pill);
  background: var(--danger);
  color: #fff;
  font-size: var(--fs-xs);
  font-weight: 600;
  box-shadow: 0 8px 22px rgba(9, 20, 32, 0.24);
  transform: translateX(-50%);
}

.offline-banner[hidden] { display: none; }
.offline-banner svg { width: 16px; height: 16px; stroke-width: 2.2; }
body.is-offline .notif-banner { top: calc(54px + env(safe-area-inset-top)); }
.ticks.pending { opacity: 0.6; }

.update-banner {
  position: absolute;
  left: 50%;
  bottom: calc(84px + env(safe-area-inset-bottom));
  z-index: 140;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 8px 14px;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: var(--on-accent);
  font-size: var(--fs-sm);
  font-weight: 600;
  box-shadow: var(--shadow-md);
  transform: translateX(-50%);
  white-space: nowrap;
}
.update-banner[hidden] { display: none; }
.update-banner button {
  padding: 6px 12px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.22);
  color: inherit;
  font: inherit;
  font-weight: 700;
}
.update-banner button:hover { background: rgba(255, 255, 255, 0.32); }

.notif-banner {
  position: absolute;
  top: calc(10px + env(safe-area-inset-top));
  left: 50%;
  z-index: 125;
  display: flex;
  align-items: center;
  gap: 10px;
  width: calc(100% - 24px);
  max-width: 400px;
  padding: 10px 8px 10px 12px;
  border-radius: var(--r-xl);
  background: var(--sheet);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, -16px);
  transition: opacity 0.2s, transform 0.24s, visibility 0.2s;
  cursor: pointer;
}

.notif-banner.open {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

.notif-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.notif-name {
  font-size: var(--fs-sm);
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notif-text {
  font-size: var(--fs-xs);
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notif-close {
  width: 32px;
  height: 32px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--muted);
}

.notif-close:hover { background: var(--bg-2); }
.notif-close svg { width: 17px; height: 17px; }

.toast {
  position: absolute;
  left: 50%;
  bottom: calc(84px + env(safe-area-inset-bottom));
  z-index: 120;
  max-width: 82%;
  padding: 10px 17px;
  border-radius: var(--r-lg);
  background: rgba(15, 27, 40, 0.94);
  color: #fff;
  font-size: var(--fs-sm);
  line-height: 1.35;
  text-align: center;
  box-shadow: 0 10px 28px rgba(9, 20, 32, 0.32);
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 10px);
  transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
  pointer-events: none;
}

.toast.show { opacity: 1; visibility: visible; transform: translate(-50%, 0); }

/* ==========================================================================
   TABS / NEW CHATS HEADER
   ========================================================================== */
.tab-view {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.tab-view[hidden] { display: none !important; }

.chats-header {
  padding: calc(12px + env(safe-area-inset-top)) 12px 10px;
  background: transparent;
  border-bottom: 0;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.chats-header-row {
  position: relative;
  justify-content: center;
  min-height: 46px;
}

.chats-title {
  justify-content: center;
  padding: 0 106px;
  font-size: var(--fs-2xl);
}

.edit-chats-btn {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 40px;
  padding: 0 18px;
  border-radius: var(--r-pill);
  background: var(--bg-2);
  color: var(--text);
  font-size: var(--fs-lg);
  font-weight: 700;
  letter-spacing: -0.01em;
  transition: background 0.15s, color 0.15s, transform 0.15s;
}

.edit-chats-btn:hover { background: var(--bg-3); }
.edit-chats-btn:active { transform: translateY(-50%) scale(0.94); }
.edit-chats-btn[aria-pressed="true"] {
  background: var(--accent-soft);
  color: var(--accent);
}

.header-actions {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-round {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, background 0.15s, box-shadow 0.15s;
}

.header-round svg { width: 21px; height: 21px; stroke-width: 2; }

.quick-chat-btn {
  background: var(--bg-2);
  color: var(--text);
}

.quick-chat-btn:hover { background: var(--bg-3); }

.compose-btn {
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: 0 6px 18px rgba(199, 124, 240, 0.32);
}

.compose-btn:hover {
  background: var(--accent-strong);
  box-shadow: 0 9px 22px rgba(199, 124, 240, 0.42);
}

.compose-btn svg { stroke-linecap: round; stroke-linejoin: round; }

.compose-btn svg {
  transition: transform 0.2s var(--ease);
}

.compose-btn:hover svg { transform: rotate(-10deg); }

.header-round:active { transform: scale(0.92); }

.simple-row {
  justify-content: flex-start;
  min-height: 46px;
}

.simple-title {
  justify-content: flex-start;
  padding: 0 6px;
}

.search-pill {
  height: 44px;
  margin-top: 10px;
  padding: 0 12px 0 14px;
  border-radius: var(--r-pill);
}

.chat-list {
  padding: 6px 0 10px;
}

.chat-item {
  width: calc(100% - 12px);
  margin: 2px 6px;
  border-radius: var(--r-xl);
}

.chat-search-hit {
  width: calc(100% - 12px);
  margin: 4px 6px;
  border-radius: var(--r-lg);
  border-bottom: 0;
}

.no-chat-results { padding: 40px 32px 14px; }

/* edit mode */
.chat-item.edit-item {
  cursor: default;
}

.chat-item.edit-item:hover { background: transparent; }
.chat-item.edit-item:active { background: transparent; }

.chat-pin {
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  flex: none;
}

.chat-pin svg { width: 14px; height: 14px; stroke-width: 2.1; }

.chat-edit-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: none;
}

.edit-order {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.edit-act {
  width: 36px;
  height: 36px;
  border-radius: var(--r-lg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  background: var(--bg-2);
  transition: background 0.14s, color 0.14s, transform 0.14s;
}

.edit-act svg { width: 18px; height: 18px; stroke-width: 2; }
.edit-act.tiny { width: 27px; height: 23px; border-radius: var(--r-sm); background: transparent; }
.edit-act.tiny svg { width: 16px; height: 16px; }
.edit-act:hover { background: var(--bg-3); }
.edit-act:active { transform: scale(0.92); }
.edit-act.active { color: var(--accent); background: var(--accent-soft); }
.edit-act.danger { color: var(--danger); background: transparent; }
.edit-act:disabled { opacity: 0.22; pointer-events: none; }

/* ==========================================================================
   BOTTOM TABS
   ========================================================================== */
.tab-bar {
  flex: none;
  display: flex;
  align-items: stretch;
  gap: 2px;
  margin: 4px 12px calc(10px + env(safe-area-inset-bottom));
  padding: 5px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.35);
  z-index: 5;
}

.tab-item {
  flex: 1;
  min-width: 0;
  height: 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border-radius: var(--r-pill);
  color: var(--muted);
  font-size: var(--fs-2xs);
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: color 0.15s, background 0.15s;
}

.tab-item svg { width: 23px; height: 23px; stroke-width: 2; }
.tab-item:hover { color: var(--text); }
.tab-item.active {
  background: var(--bg-3);
  color: var(--accent);
}
.tab-item.active:hover { color: var(--accent); }

.tab-icon-wrap {
  position: relative;
  display: inline-flex;
}

.tab-badge {
  position: absolute;
  top: -5px;
  right: -9px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: var(--r-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: var(--on-accent);
  font-size: var(--fs-2xs);
  font-weight: 700;
  box-shadow: 0 0 0 2px var(--bg-2);
}

.tab-avatar {
  width: 26px;
  height: 26px;
  font-size: var(--fs-2xs);
  font-weight: 700;
  letter-spacing: 0;
}

/* ==========================================================================
   CALLS / SETTINGS
   ========================================================================== */
.calls-view { background: var(--bg); }

.calls-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px 40px 40px;
  color: var(--muted);
}

.calls-empty .empty-illustration {
  width: 112px;
  height: 112px;
  color: var(--accent);
  margin-bottom: 14px;
}

.calls-empty h2 {
  margin: 0 0 6px;
  font-size: var(--fs-xl);
  color: var(--text);
  letter-spacing: -0.01em;
}

.calls-empty p { margin: 0; font-size: var(--fs-md); max-width: 250px; }

.settings-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 4px 14px calc(20px + env(safe-area-inset-bottom));
  scrollbar-width: thin;
}

.settings-profile {
  position: relative;
  isolation: isolate;
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 20px 14px 16px;
  text-align: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-2xl);
  background-color: var(--bg-2);
  background-image: linear-gradient(150deg, rgba(var(--accent-rgb), 0.22), rgba(var(--accent-rgb), 0.04) 70%);
  background-position: center;
  background-size: cover;
  transition: border-color 0.16s;
}

.settings-profile::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(180deg, rgba(6, 18, 30, 0.04), rgba(6, 18, 30, 0.66));
  transition: opacity 0.2s;
}

.settings-profile.has-cover::after { opacity: 1; }
.settings-profile > * { position: relative; z-index: 1; }
.settings-profile:hover { border-color: var(--accent); }

.settings-profile .avatar {
  width: 96px;
  height: 96px;
  font-size: var(--fs-4xl);
  box-shadow: 0 10px 26px rgba(6, 18, 30, 0.22);
}

.settings-profile.has-cover .settings-name {
  color: #ffffff;
  text-shadow: 0 2px 14px rgba(4, 14, 24, 0.6);
}

.settings-profile.has-cover .settings-username,
.settings-profile.has-cover .settings-bio {
  color: rgba(255, 255, 255, 0.88);
  text-shadow: 0 1px 10px rgba(4, 14, 24, 0.55);
}

.settings-profile-meta {
  flex: 0 1 auto;
  max-width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.settings-name {
  font-size: var(--fs-2xl);
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: -0.015em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings-username {
  font-size: var(--fs-base);
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings-chevron {
  display: none;
  width: 20px;
  height: 20px;
  color: var(--muted-2);
  stroke-width: 2.1;
}

.settings-group {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  border-radius: var(--r-xl);
  background: var(--bg-2);
  overflow: hidden;
}

.settings-group .drawer-item {
  position: relative;
  min-height: 50px;
  padding: 0 14px;
  gap: 14px;
  border-radius: 0;
}

.settings-group .drawer-item:hover { background: var(--bg-3); }

.settings-group .drawer-item + .drawer-item::before {
  content: "";
  position: absolute;
  top: 0;
  left: 58px;
  right: 0;
  height: 1px;
  background: var(--divider);
}

.settings-group .drawer-item-label { gap: 14px; }

.settings-group svg.ic {
  flex: none;
  width: 30px;
  height: 30px;
  padding: 5px;
  border-radius: var(--r-md);
  background: var(--accent-soft);
  color: var(--accent);
  stroke-width: 2;
}

.settings-footer {
  margin-top: auto;
  padding: 10px 0 4px;
  text-align: center;
  color: var(--muted);
  font-size: var(--fs-xs);
  line-height: 1.6;
}

.settings-footer span { color: var(--muted-2); }
.settings-footer .settings-version { color: var(--muted-2); }

/* Desktop placeholder shown in the right pane while no chat is open. It stays
   out of the mobile layout where the chat screen is a full-screen slide-over. */
.desktop-empty {
  display: none;
  flex: 1 1 auto;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 32px;
  text-align: center;
  background: var(--bg);
  color: var(--muted);
}

.desktop-empty-art {
  width: 104px;
  height: 104px;
  margin-bottom: 6px;
  color: var(--accent);
  opacity: 0.9;
}

.desktop-empty-art svg { width: 100%; height: 100%; stroke-width: 1; }

.desktop-empty h2 {
  margin: 0;
  font-size: var(--fs-2xl);
  font-weight: 650;
  color: var(--text);
  letter-spacing: -0.015em;
}

.desktop-empty p {
  margin: 0;
  max-width: 340px;
  font-size: var(--fs-md);
  line-height: 1.5;
}

/* ==========================================================================
   RESPONSIVE / DESKTOP
   ========================================================================== */
@media (min-width: 800px) {
  body {
    display: block;
    padding: 0;
    background: var(--bg-2);
  }

  html[data-theme="dark"]:not([data-wallpaper]) body {
    background: #0b0b0d;
  }

  #app {
    display: flex;
    width: 100%;
    max-width: 1680px;
    height: 100vh;
    height: 100dvh;
    margin: 0 auto;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: var(--bg);
  }

  /* Left column: chats, calls and settings. */
  .chats-screen {
    position: relative;
    inset: auto;
    flex: 0 0 clamp(330px, 27vw, 400px);
    width: clamp(330px, 27vw, 400px);
    height: 100%;
    border-right: 1px solid var(--line);
    box-shadow: none;
    z-index: 3;
  }

  /* Right column: the conversation, permanently docked instead of sliding in. */
  .chat-screen {
    position: relative;
    inset: auto;
    display: none;
    flex: 1 1 auto;
    min-width: 0;
    height: 100%;
    transform: none;
    visibility: visible;
    box-shadow: none;
    z-index: 2;
  }

  .chat-screen.open {
    display: flex;
    transform: none;
  }

  .desktop-empty { display: flex; }
  .chat-screen.open ~ .desktop-empty { display: none; }

  /* Full-screen sheets become a centered dialog on a wide screen. */
  .sheet.fullscreen {
    position: absolute;
    inset: auto;
    top: 50%;
    left: 50%;
    width: min(560px, calc(100% - 48px));
    height: min(720px, calc(100% - 48px));
    max-height: calc(100% - 48px);
    border-radius: var(--r-2xl);
    box-shadow: var(--shadow-lg);
    transform: translate(-50%, calc(-50% + 18px));
    padding-top: 0;
  }

  .sheet.fullscreen.open { transform: translate(-50%, -50%); }

  /* Desktop: profile and group/channel info are floating panels, not pages. */
  #app > .profile-screen,
  #app > .group-screen {
    position: absolute;
    inset: auto;
    top: 50%;
    left: 50%;
    width: min(560px, calc(100% - 48px));
    height: min(780px, calc(100% - 48px));
    max-height: calc(100% - 48px);
    z-index: 40;
    overflow: hidden;
    visibility: hidden;
    opacity: 0;
    border-radius: var(--r-2xl);
    box-shadow:
      0 30px 90px rgba(0, 0, 0, 0.6),
      0 0 0 100vmax rgba(3, 10, 18, 0.42);
    transform: translate(-50%, calc(-50% + 18px));
    transition:
      transform 0.24s var(--ease),
      opacity 0.2s,
      visibility 0.24s;
  }

  #app > .profile-screen.open,
  #app > .group-screen.open {
    transform: translate(-50%, -50%);
    opacity: 1;
    visibility: visible;
  }

  .chats-header { padding-top: 14px; }
  .chat-header { height: 62px; padding-top: 0; }
  .sub-header { height: 62px; padding-top: 0; }
  .drawer-head { padding-top: 26px; }
  .tab-bar { margin: 4px 14px 14px; }
  .chat-body .messages { padding-top: 16px; }

  /* The list is always on screen, so the slide-over back arrow is redundant. */
  .chat-screen .back-btn { display: none; }
}

@media (max-width: 370px) {
  .chats-title { font-size: var(--fs-2xl); }
  .chat-item { padding-left: 10px; padding-right: 10px; }
  .chat-item .avatar { width: 48px; height: 48px; font-size: var(--fs-xl); }
  .composer-btn { width: 34px; }
  .send-btn { width: 44px; height: 44px; }
  .emoji-panel { grid-template-columns: repeat(7, 1fr); }
}

/* ==========================================================================
   ANIMATIONS
   ========================================================================== */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes msgIn {
  from { opacity: 0; transform: translateY(6px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes badgePop {
  0% { transform: scale(0.6); opacity: 0; }
  70% { transform: scale(1.08); }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes shimmer {
  100% { transform: translateX(100%); }
}

@keyframes sheetUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes ctxIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* Group permissions, admins and pinned message */
.perm-row input[type="checkbox"] { accent-color: var(--accent); width: 20px; height: 20px; flex: none; margin: 0; cursor: pointer; }
.group-role-btn { flex: none; margin-left: auto; }
.composer-locked {
  flex: none;
  padding: 14px 16px;
  text-align: center;
  font-size: var(--fs-md);
  color: var(--muted, #6b7785);
  background: var(--bg);
  border-top: 1px solid var(--line);
}

/* Group edit mode: icons, description card and form fields */
.group-row-icon { flex: none; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }
.group-row-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.group-row.action .group-row-icon { color: var(--accent); }
.group-desc-card { margin: 8px 16px 12px; padding: 12px 14px; border-radius: var(--r-lg); background: var(--bg-2); }
.group-desc-title { display: flex; align-items: center; gap: 8px; font-size: var(--fs-sm); color: var(--muted); margin-bottom: 6px; }
.group-desc-title .group-row-icon { width: 18px; height: 18px; }
.group-desc-title .group-row-icon svg { width: 16px; height: 16px; }
.group-desc-text { white-space: pre-wrap; word-break: break-word; font-size: var(--fs-base); line-height: 1.4; }
.group-edit { padding: 8px 16px 12px; display: flex; flex-direction: column; gap: 12px; }
.group-field { display: flex; flex-direction: column; gap: 6px; }
.group-field-label { font-size: var(--fs-sm); color: var(--muted); }
.group-field input,
.group-field textarea { width: 100%; box-sizing: border-box; font: inherit; color: inherit; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 10px 12px; resize: vertical; }
.group-field input:focus,
.group-field textarea:focus { outline: none; border-color: var(--accent); }

/* ------------------------------ Calls ------------------------------ */
.calls-list { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 4px 0 24px; }
.calls-list[hidden] { display: none !important; }
.call-row { display: flex; align-items: center; gap: 12px; padding: 10px 16px; }
.call-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.call-name { font-size: var(--fs-lg); font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.call-name.missed { color: var(--danger); }
.call-sub { font-size: var(--fs-sm); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.call-back { color: var(--accent); }
.call-back svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.call-screen {
  position: fixed; inset: 0; z-index: 300; display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  padding: calc(64px + env(safe-area-inset-top)) 24px calc(56px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, #2b1a3d, #0e0a14); color: #fff;
  visibility: hidden; opacity: 0; transition: opacity 0.2s, visibility 0.2s;
}
.call-screen.open { visibility: visible; opacity: 1; }
.call-screen.minimized { display: none; }
.call-body { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.call-peer-name { margin: 8px 0 0; font-size: var(--fs-3xl); font-weight: 600; }
.call-status { margin: 0; font-size: var(--fs-base); color: rgba(255, 255, 255, 0.7); }
.call-link {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-radius: 999px;
  padding: 7px 14px;
  font-size: var(--fs-sm);
  pointer-events: auto;
}
.call-link:hover { background: rgba(255, 255, 255, 0.2); }
.call-actions { display: flex; gap: 28px; align-items: center; }
.call-screen[data-mode="incoming"] .call-actions-call,
.call-screen:not([data-mode="incoming"]) .call-actions-incoming { display: none; }
.call-btn {
  width: 68px; height: 68px; border-radius: 50%; border: 0; padding: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, 0.14); color: #fff;
}
.call-btn svg { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.call-btn.active { background: #fff; color: #1b1020; }
.call-btn-end,
.call-btn-decline { background: var(--danger); }
.call-remote-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
  z-index: 0;
}
.call-local-video {
  position: absolute;
  top: calc(72px + env(safe-area-inset-top));
  right: 16px;
  width: 104px;
  height: 146px;
  object-fit: cover;
  border-radius: 14px;
  border: 2px solid rgba(255, 255, 255, 0.55);
  background: #000;
  z-index: 3;
}
.call-relay-view {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  z-index: 1;
}
.call-screen.has-video {
  background: #000;
  justify-content: flex-end;
}
.call-screen.has-video .call-body {
  position: absolute;
  top: calc(18px + env(safe-area-inset-top));
  left: 20px;
  right: 20px;
  z-index: 2;
  align-items: flex-start;
  text-align: left;
  pointer-events: none;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.6);
}
.call-screen.has-video #callAvatar { display: none; }
.call-screen.has-video .call-peer-name { font-size: var(--fs-xl); margin: 0; }
.call-screen.has-video .call-status { font-size: var(--fs-sm); }
.call-actions { position: relative; z-index: 4; }
.call-minimize {
  position: absolute;
  top: calc(14px + env(safe-area-inset-top));
  right: 14px;
  z-index: 5;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}
.call-minimize svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Startup failure banner: never leave the app on endless skeletons. */
.boot-error {
  position: fixed;
  left: 50%;
  top: calc(14px + env(safe-area-inset-top));
  transform: translateX(-50%);
  width: min(420px, calc(100% - 24px));
  z-index: 260;
  background: var(--sheet);
  color: var(--text);
  border-radius: 16px;
  padding: 14px 16px;
  box-shadow: var(--shadow-lg);
}
.boot-error[hidden] { display: none; }
.boot-error-title { font-weight: 600; margin-bottom: 4px; }
.boot-error-text {
  font-size: var(--fs-sm);
  color: var(--muted);
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.boot-error-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

/* Collapsed call: a compact bar over the chats. */
.call-mini {
  position: fixed;
  left: 50%;
  bottom: calc(70px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(396px, calc(100% - 24px));
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 8px 7px 10px;
  border-radius: 18px;
  background: rgba(24, 16, 32, 0.96);
  color: #fff;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(8px);
  z-index: 250;
}
.call-mini[hidden] { display: none; }
.call-mini-main {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  padding: 0;
  background: none;
  border: 0;
  color: inherit;
  text-align: left;
}
.call-mini-text { display: flex; flex-direction: column; min-width: 0; }
.call-mini-name {
  font-size: var(--fs-sm);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.call-mini-status { font-size: var(--fs-xs); color: rgba(255, 255, 255, 0.72); }
.call-mini-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}
.call-mini-btn.active { background: #fff; color: #1b1020; }
.call-mini-btn.end { background: var(--danger); }
.call-mini-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
@media (max-width: 430px) {
  .call-actions { gap: 14px; }
  .call-btn { width: 58px; height: 58px; }
  .call-btn svg { width: 26px; height: 26px; }
  .call-local-video { width: 88px; height: 124px; }
}
.call-btn-decline svg { transform: rotate(135deg); }
.call-btn-accept { background: var(--online); }

:root {
  --doodle-sky: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cg fill='none' stroke='%233d8fd1' stroke-opacity='.55' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath transform='translate(123.3 76.5) rotate(12.8) scale(0.95)' d='M-16 6h30a7 7 0 0 0 0-14 10 10 0 0 0-19 3 6 6 0 0 0-11 11z'/%3E%3Cpath transform='translate(168.2 154.7) rotate(-13.6) scale(0.89)' d='M0-7a7 7 0 1 0 0.01 0zM0-11v-5M0 11v5M-11 0h-5M11 0h5M-8-8l-3.5-3.5M8 8l3.5 3.5M8-8l3.5-3.5M-8 8l-3.5 3.5'/%3E%3Cpath transform='translate(39.3 27.4) rotate(-6.3) scale(0.95)' d='M0-14C6-6 9 0 9 5a9 9 0 0 1-18 0C-9 0-6-6 0-14z'/%3E%3Cpath transform='translate(81.7 156.0) rotate(-6.5) scale(0.98)' d='M0-14C6-6 9 0 9 5a9 9 0 0 1-18 0C-9 0-6-6 0-14z'/%3E%3Cpath transform='translate(256.3 221.1) rotate(-10.7) scale(0.91)' d='M-13 0q6.5-7 13 0q6.5-7 13 0'/%3E%3Cpath transform='translate(26.3 205.3) rotate(5.5) scale(1.01)' d='M4-12a12 12 0 1 0 10 18 9 9 0 0 1-10-18z'/%3E%3Cpath transform='translate(222.4 281.2) rotate(-9.0) scale(0.96)' d='M-13 0q6.5-7 13 0q6.5-7 13 0'/%3E%3Cpath transform='translate(28.7 139.6) rotate(6.7) scale(0.92)' d='M0-7a7 7 0 1 0 0.01 0zM0-11v-5M0 11v5M-11 0h-5M11 0h5M-8-8l-3.5-3.5M8 8l3.5 3.5M8-8l3.5-3.5M-8 8l-3.5 3.5'/%3E%3Cpath transform='translate(237.0 109.6) rotate(-9.7) scale(0.98)' d='M0-14C6-6 9 0 9 5a9 9 0 0 1-18 0C-9 0-6-6 0-14z'/%3E%3Cpath transform='translate(274.2 157.1) rotate(-0.6) scale(0.88)' d='M-18-4h20a5 5 0 1 0-5-5M-18 4h27a5 5 0 1 1-5 5M-18 12h12'/%3E%3Cpath transform='translate(207.5 48.2) rotate(-11.1) scale(1.02)' d='M-13 0q6.5-7 13 0q6.5-7 13 0'/%3E%3Cpath transform='translate(201.0 90.9) rotate(12.5) scale(0.96)' d='M4-12a12 12 0 1 0 10 18 9 9 0 0 1-10-18z'/%3E%3Cpath transform='translate(22.6 84.5) rotate(-12.7) scale(1.00)' d='M-16 6h30a7 7 0 0 0 0-14 10 10 0 0 0-19 3 6 6 0 0 0-11 11z'/%3E%3Cpath transform='translate(151.3 281.7) rotate(-10.8) scale(1.02)' d='M0-7a7 7 0 1 0 0.01 0zM0-11v-5M0 11v5M-11 0h-5M11 0h5M-8-8l-3.5-3.5M8 8l3.5 3.5M8-8l3.5-3.5M-8 8l-3.5 3.5'/%3E%3Cpath transform='translate(87.5 16.0) rotate(2.6) scale(1.04)' d='M0-14C6-6 9 0 9 5a9 9 0 0 1-18 0C-9 0-6-6 0-14z'/%3E%3C/g%3E%3C/svg%3E");
  --doodle-sky-dark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cg fill='none' stroke='%239fd0f5' stroke-opacity='.32' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath transform='translate(123.3 76.5) rotate(12.8) scale(0.95)' d='M-16 6h30a7 7 0 0 0 0-14 10 10 0 0 0-19 3 6 6 0 0 0-11 11z'/%3E%3Cpath transform='translate(168.2 154.7) rotate(-13.6) scale(0.89)' d='M0-7a7 7 0 1 0 0.01 0zM0-11v-5M0 11v5M-11 0h-5M11 0h5M-8-8l-3.5-3.5M8 8l3.5 3.5M8-8l3.5-3.5M-8 8l-3.5 3.5'/%3E%3Cpath transform='translate(39.3 27.4) rotate(-6.3) scale(0.95)' d='M0-14C6-6 9 0 9 5a9 9 0 0 1-18 0C-9 0-6-6 0-14z'/%3E%3Cpath transform='translate(81.7 156.0) rotate(-6.5) scale(0.98)' d='M0-14C6-6 9 0 9 5a9 9 0 0 1-18 0C-9 0-6-6 0-14z'/%3E%3Cpath transform='translate(256.3 221.1) rotate(-10.7) scale(0.91)' d='M-13 0q6.5-7 13 0q6.5-7 13 0'/%3E%3Cpath transform='translate(26.3 205.3) rotate(5.5) scale(1.01)' d='M4-12a12 12 0 1 0 10 18 9 9 0 0 1-10-18z'/%3E%3Cpath transform='translate(222.4 281.2) rotate(-9.0) scale(0.96)' d='M-13 0q6.5-7 13 0q6.5-7 13 0'/%3E%3Cpath transform='translate(28.7 139.6) rotate(6.7) scale(0.92)' d='M0-7a7 7 0 1 0 0.01 0zM0-11v-5M0 11v5M-11 0h-5M11 0h5M-8-8l-3.5-3.5M8 8l3.5 3.5M8-8l3.5-3.5M-8 8l-3.5 3.5'/%3E%3Cpath transform='translate(237.0 109.6) rotate(-9.7) scale(0.98)' d='M0-14C6-6 9 0 9 5a9 9 0 0 1-18 0C-9 0-6-6 0-14z'/%3E%3Cpath transform='translate(274.2 157.1) rotate(-0.6) scale(0.88)' d='M-18-4h20a5 5 0 1 0-5-5M-18 4h27a5 5 0 1 1-5 5M-18 12h12'/%3E%3Cpath transform='translate(207.5 48.2) rotate(-11.1) scale(1.02)' d='M-13 0q6.5-7 13 0q6.5-7 13 0'/%3E%3Cpath transform='translate(201.0 90.9) rotate(12.5) scale(0.96)' d='M4-12a12 12 0 1 0 10 18 9 9 0 0 1-10-18z'/%3E%3Cpath transform='translate(22.6 84.5) rotate(-12.7) scale(1.00)' d='M-16 6h30a7 7 0 0 0 0-14 10 10 0 0 0-19 3 6 6 0 0 0-11 11z'/%3E%3Cpath transform='translate(151.3 281.7) rotate(-10.8) scale(1.02)' d='M0-7a7 7 0 1 0 0.01 0zM0-11v-5M0 11v5M-11 0h-5M11 0h5M-8-8l-3.5-3.5M8 8l3.5 3.5M8-8l3.5-3.5M-8 8l-3.5 3.5'/%3E%3Cpath transform='translate(87.5 16.0) rotate(2.6) scale(1.04)' d='M0-14C6-6 9 0 9 5a9 9 0 0 1-18 0C-9 0-6-6 0-14z'/%3E%3C/g%3E%3C/svg%3E");
  --doodle-mint: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cg fill='none' stroke='%232f9e6a' stroke-opacity='.55' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath transform='translate(99.5 264.1) rotate(11.4) scale(0.91)' d='M0-14C6-6 9 0 9 5a9 9 0 0 1-18 0C-9 0-6-6 0-14z'/%3E%3Cpath transform='translate(32.2 125.6) rotate(13.4) scale(0.96)' d='M0 16V-4M0-2C-7-2-10-8-10-12c7 0 10 5 10 10zM0-4c1-6 6-9 10-9 0 5-4 9-10 9z'/%3E%3Cpath transform='translate(262.8 213.4) rotate(9.0) scale(0.93)' d='M0.0 -7.0m-5 0a5 5 0 1 0 10 0a5 5 0 1 0-10 0M6.7 -2.2m-5 0a5 5 0 1 0 10 0a5 5 0 1 0-10 0M4.1 5.7m-5 0a5 5 0 1 0 10 0a5 5 0 1 0-10 0M-4.1 5.7m-5 0a5 5 0 1 0 10 0a5 5 0 1 0-10 0M-6.7 -2.2m-5 0a5 5 0 1 0 10 0a5 5 0 1 0-10 0M0-2.5a2.5 2.5 0 1 0 0.01 0z'/%3E%3Cpath transform='translate(230.2 127.2) rotate(12.9) scale(0.89)' d='M-14 12C-15-4-6-12 14-14c1 16-7 26-28 26zM-14 12L8-6'/%3E%3Cpath transform='translate(124.8 165.0) rotate(13.4) scale(0.86)' d='M0-12L3-3L12 0L3 3L0 12L-3 3L-12 0L-3-3Z'/%3E%3Cpath transform='translate(118.4 72.3) rotate(5.6) scale(0.86)' d='M-14 12C-15-4-6-12 14-14c1 16-7 26-28 26zM-14 12L8-6'/%3E%3Cpath transform='translate(149.2 226.1) rotate(-1.1) scale(0.90)' d='M0-14C6-6 9 0 9 5a9 9 0 0 1-18 0C-9 0-6-6 0-14z'/%3E%3Cpath transform='translate(76.0 212.1) rotate(-10.1) scale(0.97)' d='M0.0 -7.0m-5 0a5 5 0 1 0 10 0a5 5 0 1 0-10 0M6.7 -2.2m-5 0a5 5 0 1 0 10 0a5 5 0 1 0-10 0M4.1 5.7m-5 0a5 5 0 1 0 10 0a5 5 0 1 0-10 0M-4.1 5.7m-5 0a5 5 0 1 0 10 0a5 5 0 1 0-10 0M-6.7 -2.2m-5 0a5 5 0 1 0 10 0a5 5 0 1 0-10 0M0-2.5a2.5 2.5 0 1 0 0.01 0z'/%3E%3Cpath transform='translate(18.8 240.1) rotate(0.6) scale(0.96)' d='M0-14C6-6 9 0 9 5a9 9 0 0 1-18 0C-9 0-6-6 0-14z'/%3E%3Cpath transform='translate(74.2 116.4) rotate(-5.1) scale(0.92)' d='M0-12L3-3L12 0L3 3L0 12L-3 3L-12 0L-3-3Z'/%3E%3Cpath transform='translate(80.9 156.0) rotate(-0.9) scale(1.03)' d='M-14 12C-15-4-6-12 14-14c1 16-7 26-28 26zM-14 12L8-6'/%3E%3Cpath transform='translate(39.7 41.0) rotate(-1.1) scale(1.01)' d='M0 16V-4M0-2C-7-2-10-8-10-12c7 0 10 5 10 10zM0-4c1-6 6-9 10-9 0 5-4 9-10 9z'/%3E%3Cpath transform='translate(247.0 282.1) rotate(10.1) scale(1.04)' d='M0.0 -7.0m-5 0a5 5 0 1 0 10 0a5 5 0 1 0-10 0M6.7 -2.2m-5 0a5 5 0 1 0 10 0a5 5 0 1 0-10 0M4.1 5.7m-5 0a5 5 0 1 0 10 0a5 5 0 1 0-10 0M-4.1 5.7m-5 0a5 5 0 1 0 10 0a5 5 0 1 0-10 0M-6.7 -2.2m-5 0a5 5 0 1 0 10 0a5 5 0 1 0-10 0M0-2.5a2.5 2.5 0 1 0 0.01 0z'/%3E%3Cpath transform='translate(112.8 223.3) rotate(-12.6) scale(0.85)' d='M0-14C6-6 9 0 9 5a9 9 0 0 1-18 0C-9 0-6-6 0-14z'/%3E%3Cpath transform='translate(191.4 196.1) rotate(-3.0) scale(1.03)' d='M0-12L3-3L12 0L3 3L0 12L-3 3L-12 0L-3-3Z'/%3E%3C/g%3E%3C/svg%3E");
  --doodle-mint-dark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cg fill='none' stroke='%236fd39a' stroke-opacity='.32' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath transform='translate(99.5 264.1) rotate(11.4) scale(0.91)' d='M0-14C6-6 9 0 9 5a9 9 0 0 1-18 0C-9 0-6-6 0-14z'/%3E%3Cpath transform='translate(32.2 125.6) rotate(13.4) scale(0.96)' d='M0 16V-4M0-2C-7-2-10-8-10-12c7 0 10 5 10 10zM0-4c1-6 6-9 10-9 0 5-4 9-10 9z'/%3E%3Cpath transform='translate(262.8 213.4) rotate(9.0) scale(0.93)' d='M0.0 -7.0m-5 0a5 5 0 1 0 10 0a5 5 0 1 0-10 0M6.7 -2.2m-5 0a5 5 0 1 0 10 0a5 5 0 1 0-10 0M4.1 5.7m-5 0a5 5 0 1 0 10 0a5 5 0 1 0-10 0M-4.1 5.7m-5 0a5 5 0 1 0 10 0a5 5 0 1 0-10 0M-6.7 -2.2m-5 0a5 5 0 1 0 10 0a5 5 0 1 0-10 0M0-2.5a2.5 2.5 0 1 0 0.01 0z'/%3E%3Cpath transform='translate(230.2 127.2) rotate(12.9) scale(0.89)' d='M-14 12C-15-4-6-12 14-14c1 16-7 26-28 26zM-14 12L8-6'/%3E%3Cpath transform='translate(124.8 165.0) rotate(13.4) scale(0.86)' d='M0-12L3-3L12 0L3 3L0 12L-3 3L-12 0L-3-3Z'/%3E%3Cpath transform='translate(118.4 72.3) rotate(5.6) scale(0.86)' d='M-14 12C-15-4-6-12 14-14c1 16-7 26-28 26zM-14 12L8-6'/%3E%3Cpath transform='translate(149.2 226.1) rotate(-1.1) scale(0.90)' d='M0-14C6-6 9 0 9 5a9 9 0 0 1-18 0C-9 0-6-6 0-14z'/%3E%3Cpath transform='translate(76.0 212.1) rotate(-10.1) scale(0.97)' d='M0.0 -7.0m-5 0a5 5 0 1 0 10 0a5 5 0 1 0-10 0M6.7 -2.2m-5 0a5 5 0 1 0 10 0a5 5 0 1 0-10 0M4.1 5.7m-5 0a5 5 0 1 0 10 0a5 5 0 1 0-10 0M-4.1 5.7m-5 0a5 5 0 1 0 10 0a5 5 0 1 0-10 0M-6.7 -2.2m-5 0a5 5 0 1 0 10 0a5 5 0 1 0-10 0M0-2.5a2.5 2.5 0 1 0 0.01 0z'/%3E%3Cpath transform='translate(18.8 240.1) rotate(0.6) scale(0.96)' d='M0-14C6-6 9 0 9 5a9 9 0 0 1-18 0C-9 0-6-6 0-14z'/%3E%3Cpath transform='translate(74.2 116.4) rotate(-5.1) scale(0.92)' d='M0-12L3-3L12 0L3 3L0 12L-3 3L-12 0L-3-3Z'/%3E%3Cpath transform='translate(80.9 156.0) rotate(-0.9) scale(1.03)' d='M-14 12C-15-4-6-12 14-14c1 16-7 26-28 26zM-14 12L8-6'/%3E%3Cpath transform='translate(39.7 41.0) rotate(-1.1) scale(1.01)' d='M0 16V-4M0-2C-7-2-10-8-10-12c7 0 10 5 10 10zM0-4c1-6 6-9 10-9 0 5-4 9-10 9z'/%3E%3Cpath transform='translate(247.0 282.1) rotate(10.1) scale(1.04)' d='M0.0 -7.0m-5 0a5 5 0 1 0 10 0a5 5 0 1 0-10 0M6.7 -2.2m-5 0a5 5 0 1 0 10 0a5 5 0 1 0-10 0M4.1 5.7m-5 0a5 5 0 1 0 10 0a5 5 0 1 0-10 0M-4.1 5.7m-5 0a5 5 0 1 0 10 0a5 5 0 1 0-10 0M-6.7 -2.2m-5 0a5 5 0 1 0 10 0a5 5 0 1 0-10 0M0-2.5a2.5 2.5 0 1 0 0.01 0z'/%3E%3Cpath transform='translate(112.8 223.3) rotate(-12.6) scale(0.85)' d='M0-14C6-6 9 0 9 5a9 9 0 0 1-18 0C-9 0-6-6 0-14z'/%3E%3Cpath transform='translate(191.4 196.1) rotate(-3.0) scale(1.03)' d='M0-12L3-3L12 0L3 3L0 12L-3 3L-12 0L-3-3Z'/%3E%3C/g%3E%3C/svg%3E");
  --doodle-sunset: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cg fill='none' stroke='%23d9703c' stroke-opacity='.55' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath transform='translate(73.5 188.6) rotate(0.9) scale(0.91)' d='M-19 12L-6-10L4 4L9-3L19 12Z'/%3E%3Cpath transform='translate(141.3 64.0) rotate(9.5) scale(0.85)' d='M-19 12L-6-10L4 4L9-3L19 12Z'/%3E%3Cpath transform='translate(198.2 284.2) rotate(-7.8) scale(0.85)' d='M0 12C-14 3-15-7-8-9c3-1 6 1 8 4 2-3 5-5 8-4 7 2 6 12-8 21z'/%3E%3Cpath transform='translate(66.2 234.8) rotate(4.2) scale(1.02)' d='M-13 0q6.5-7 13 0q6.5-7 13 0'/%3E%3Cpath transform='translate(213.9 52.4) rotate(-11.7) scale(0.88)' d='M0-12L3-3L12 0L3 3L0 12L-3 3L-12 0L-3-3Z'/%3E%3Cpath transform='translate(50.3 43.9) rotate(-6.3) scale(0.96)' d='M-13 4a13 13 0 0 1 26 0M-18 8h36M0-16v4M-12-12l2.5 2.5M12-12l-2.5 2.5'/%3E%3Cpath transform='translate(22.0 78.3) rotate(-6.4) scale(0.98)' d='M0-12L3-3L12 0L3 3L0 12L-3 3L-12 0L-3-3Z'/%3E%3Cpath transform='translate(280.8 240.5) rotate(9.4) scale(0.92)' d='M0 12C-14 3-15-7-8-9c3-1 6 1 8 4 2-3 5-5 8-4 7 2 6 12-8 21z'/%3E%3Cpath transform='translate(129.2 118.7) rotate(-12.6) scale(0.98)' d='M-13 0q6.5-7 13 0q6.5-7 13 0'/%3E%3Cpath transform='translate(141.3 199.3) rotate(-2.2) scale(0.98)' d='M0-12L3-3L12 0L3 3L0 12L-3 3L-12 0L-3-3Z'/%3E%3Cpath transform='translate(85.7 86.0) rotate(2.2) scale(0.95)' d='M-13 0q6.5-7 13 0q6.5-7 13 0'/%3E%3Cpath transform='translate(165.2 257.3) rotate(-1.2) scale(0.92)' d='M-19 12L-6-10L4 4L9-3L19 12Z'/%3E%3Cpath transform='translate(48.4 284.8) rotate(12.2) scale(0.89)' d='M0 12C-14 3-15-7-8-9c3-1 6 1 8 4 2-3 5-5 8-4 7 2 6 12-8 21z'/%3E%3Cpath transform='translate(238.1 222.0) rotate(-8.7) scale(0.99)' d='M-13 0q6.5-7 13 0q6.5-7 13 0'/%3E%3Cpath transform='translate(60.1 141.0) rotate(-2.1) scale(1.01)' d='M-13 0q6.5-7 13 0q6.5-7 13 0'/%3E%3C/g%3E%3C/svg%3E");
  --doodle-sunset-dark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cg fill='none' stroke='%23f2a57f' stroke-opacity='.32' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath transform='translate(73.5 188.6) rotate(0.9) scale(0.91)' d='M-19 12L-6-10L4 4L9-3L19 12Z'/%3E%3Cpath transform='translate(141.3 64.0) rotate(9.5) scale(0.85)' d='M-19 12L-6-10L4 4L9-3L19 12Z'/%3E%3Cpath transform='translate(198.2 284.2) rotate(-7.8) scale(0.85)' d='M0 12C-14 3-15-7-8-9c3-1 6 1 8 4 2-3 5-5 8-4 7 2 6 12-8 21z'/%3E%3Cpath transform='translate(66.2 234.8) rotate(4.2) scale(1.02)' d='M-13 0q6.5-7 13 0q6.5-7 13 0'/%3E%3Cpath transform='translate(213.9 52.4) rotate(-11.7) scale(0.88)' d='M0-12L3-3L12 0L3 3L0 12L-3 3L-12 0L-3-3Z'/%3E%3Cpath transform='translate(50.3 43.9) rotate(-6.3) scale(0.96)' d='M-13 4a13 13 0 0 1 26 0M-18 8h36M0-16v4M-12-12l2.5 2.5M12-12l-2.5 2.5'/%3E%3Cpath transform='translate(22.0 78.3) rotate(-6.4) scale(0.98)' d='M0-12L3-3L12 0L3 3L0 12L-3 3L-12 0L-3-3Z'/%3E%3Cpath transform='translate(280.8 240.5) rotate(9.4) scale(0.92)' d='M0 12C-14 3-15-7-8-9c3-1 6 1 8 4 2-3 5-5 8-4 7 2 6 12-8 21z'/%3E%3Cpath transform='translate(129.2 118.7) rotate(-12.6) scale(0.98)' d='M-13 0q6.5-7 13 0q6.5-7 13 0'/%3E%3Cpath transform='translate(141.3 199.3) rotate(-2.2) scale(0.98)' d='M0-12L3-3L12 0L3 3L0 12L-3 3L-12 0L-3-3Z'/%3E%3Cpath transform='translate(85.7 86.0) rotate(2.2) scale(0.95)' d='M-13 0q6.5-7 13 0q6.5-7 13 0'/%3E%3Cpath transform='translate(165.2 257.3) rotate(-1.2) scale(0.92)' d='M-19 12L-6-10L4 4L9-3L19 12Z'/%3E%3Cpath transform='translate(48.4 284.8) rotate(12.2) scale(0.89)' d='M0 12C-14 3-15-7-8-9c3-1 6 1 8 4 2-3 5-5 8-4 7 2 6 12-8 21z'/%3E%3Cpath transform='translate(238.1 222.0) rotate(-8.7) scale(0.99)' d='M-13 0q6.5-7 13 0q6.5-7 13 0'/%3E%3Cpath transform='translate(60.1 141.0) rotate(-2.1) scale(1.01)' d='M-13 0q6.5-7 13 0q6.5-7 13 0'/%3E%3C/g%3E%3C/svg%3E");
  --doodle-ocean: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cg fill='none' stroke='%232b7fb8' stroke-opacity='.55' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath transform='translate(33.4 239.7) rotate(6.4) scale(0.93)' d='M-14 0C-8-9 6-9 12 0C6 9-8 9-14 0zM12 0l8-6v12zM-9-1.5a1.2 1.2 0 1 0 0.01 0z'/%3E%3Cpath transform='translate(146.5 219.3) rotate(13.2) scale(1.03)' d='M-22 0q5.5-6 11 0t11 0t11 0t11 0'/%3E%3Cpath transform='translate(247.5 216.1) rotate(-5.9) scale(0.89)' d='M0 14L-13-2A15 15 0 0 1 13-2zM0 14L-6-2M0 14L6-2M0 14V-2'/%3E%3Cpath transform='translate(217.3 132.3) rotate(-2.8) scale(0.95)' d='M-4 3a7 7 0 1 0 0.01 0zM7-7a3.5 3.5 0 1 0 0.01 0zM8 6a2 2 0 1 0 0.01 0z'/%3E%3Cpath transform='translate(183.6 86.9) rotate(-3.7) scale(0.95)' d='M0-14L3.5-4.5L13.5-4.5L5.5 1.8L8.5 11.5L0 6L-8.5 11.5L-5.5 1.8L-13.5-4.5L-3.5-4.5Z'/%3E%3Cpath transform='translate(86.7 23.1) rotate(11.2) scale(0.88)' d='M-22 0q5.5-6 11 0t11 0t11 0t11 0'/%3E%3Cpath transform='translate(85.0 183.7) rotate(-10.9) scale(0.93)' d='M-22 0q5.5-6 11 0t11 0t11 0t11 0'/%3E%3Cpath transform='translate(99.2 112.0) rotate(5.1) scale(1.03)' d='M0 14L-13-2A15 15 0 0 1 13-2zM0 14L-6-2M0 14L6-2M0 14V-2'/%3E%3Cpath transform='translate(267.3 284.0) rotate(-6.0) scale(0.98)' d='M-4 3a7 7 0 1 0 0.01 0zM7-7a3.5 3.5 0 1 0 0.01 0zM8 6a2 2 0 1 0 0.01 0z'/%3E%3Cpath transform='translate(141.3 172.2) rotate(-13.4) scale(0.98)' d='M-4 3a7 7 0 1 0 0.01 0zM7-7a3.5 3.5 0 1 0 0.01 0zM8 6a2 2 0 1 0 0.01 0z'/%3E%3Cpath transform='translate(94.6 280.7) rotate(-2.3) scale(0.95)' d='M-14 0C-8-9 6-9 12 0C6 9-8 9-14 0zM12 0l8-6v12zM-9-1.5a1.2 1.2 0 1 0 0.01 0z'/%3E%3Cpath transform='translate(44.1 95.1) rotate(-13.2) scale(1.03)' d='M-22 0q5.5-6 11 0t11 0t11 0t11 0'/%3E%3Cpath transform='translate(279.6 78.6) rotate(10.8) scale(0.97)' d='M0 14L-13-2A15 15 0 0 1 13-2zM0 14L-6-2M0 14L6-2M0 14V-2'/%3E%3Cpath transform='translate(166.5 16.7) rotate(-5.1) scale(1.04)' d='M-4 3a7 7 0 1 0 0.01 0zM7-7a3.5 3.5 0 1 0 0.01 0zM8 6a2 2 0 1 0 0.01 0z'/%3E%3Cpath transform='translate(233.9 62.6) rotate(7.8) scale(0.87)' d='M0-14L3.5-4.5L13.5-4.5L5.5 1.8L8.5 11.5L0 6L-8.5 11.5L-5.5 1.8L-13.5-4.5L-3.5-4.5Z'/%3E%3C/g%3E%3C/svg%3E");
  --doodle-ocean-dark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cg fill='none' stroke='%237fc4ea' stroke-opacity='.32' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath transform='translate(33.4 239.7) rotate(6.4) scale(0.93)' d='M-14 0C-8-9 6-9 12 0C6 9-8 9-14 0zM12 0l8-6v12zM-9-1.5a1.2 1.2 0 1 0 0.01 0z'/%3E%3Cpath transform='translate(146.5 219.3) rotate(13.2) scale(1.03)' d='M-22 0q5.5-6 11 0t11 0t11 0t11 0'/%3E%3Cpath transform='translate(247.5 216.1) rotate(-5.9) scale(0.89)' d='M0 14L-13-2A15 15 0 0 1 13-2zM0 14L-6-2M0 14L6-2M0 14V-2'/%3E%3Cpath transform='translate(217.3 132.3) rotate(-2.8) scale(0.95)' d='M-4 3a7 7 0 1 0 0.01 0zM7-7a3.5 3.5 0 1 0 0.01 0zM8 6a2 2 0 1 0 0.01 0z'/%3E%3Cpath transform='translate(183.6 86.9) rotate(-3.7) scale(0.95)' d='M0-14L3.5-4.5L13.5-4.5L5.5 1.8L8.5 11.5L0 6L-8.5 11.5L-5.5 1.8L-13.5-4.5L-3.5-4.5Z'/%3E%3Cpath transform='translate(86.7 23.1) rotate(11.2) scale(0.88)' d='M-22 0q5.5-6 11 0t11 0t11 0t11 0'/%3E%3Cpath transform='translate(85.0 183.7) rotate(-10.9) scale(0.93)' d='M-22 0q5.5-6 11 0t11 0t11 0t11 0'/%3E%3Cpath transform='translate(99.2 112.0) rotate(5.1) scale(1.03)' d='M0 14L-13-2A15 15 0 0 1 13-2zM0 14L-6-2M0 14L6-2M0 14V-2'/%3E%3Cpath transform='translate(267.3 284.0) rotate(-6.0) scale(0.98)' d='M-4 3a7 7 0 1 0 0.01 0zM7-7a3.5 3.5 0 1 0 0.01 0zM8 6a2 2 0 1 0 0.01 0z'/%3E%3Cpath transform='translate(141.3 172.2) rotate(-13.4) scale(0.98)' d='M-4 3a7 7 0 1 0 0.01 0zM7-7a3.5 3.5 0 1 0 0.01 0zM8 6a2 2 0 1 0 0.01 0z'/%3E%3Cpath transform='translate(94.6 280.7) rotate(-2.3) scale(0.95)' d='M-14 0C-8-9 6-9 12 0C6 9-8 9-14 0zM12 0l8-6v12zM-9-1.5a1.2 1.2 0 1 0 0.01 0z'/%3E%3Cpath transform='translate(44.1 95.1) rotate(-13.2) scale(1.03)' d='M-22 0q5.5-6 11 0t11 0t11 0t11 0'/%3E%3Cpath transform='translate(279.6 78.6) rotate(10.8) scale(0.97)' d='M0 14L-13-2A15 15 0 0 1 13-2zM0 14L-6-2M0 14L6-2M0 14V-2'/%3E%3Cpath transform='translate(166.5 16.7) rotate(-5.1) scale(1.04)' d='M-4 3a7 7 0 1 0 0.01 0zM7-7a3.5 3.5 0 1 0 0.01 0zM8 6a2 2 0 1 0 0.01 0z'/%3E%3Cpath transform='translate(233.9 62.6) rotate(7.8) scale(0.87)' d='M0-14L3.5-4.5L13.5-4.5L5.5 1.8L8.5 11.5L0 6L-8.5 11.5L-5.5 1.8L-13.5-4.5L-3.5-4.5Z'/%3E%3C/g%3E%3C/svg%3E");
}

/* Chat wallpapers: drawn doodle patterns. The default pattern lives in :root. */
html[data-wallpaper="plain"] { --wallpaper: none; --wallpaper-color: #eef2f5; }
html[data-wallpaper="sky"] { --wallpaper: var(--doodle-sky); --wallpaper-color: #d6ebf9; }
html[data-wallpaper="mint"] { --wallpaper: var(--doodle-mint); --wallpaper-color: #d7f2e4; }
html[data-wallpaper="sunset"] { --wallpaper: var(--doodle-sunset); --wallpaper-color: #fbe3d6; }
html[data-wallpaper="ocean"] { --wallpaper: var(--doodle-ocean); --wallpaper-color: #d4e9f5; }
html[data-wallpaper="plain"][data-theme="dark"] { --wallpaper: none; --wallpaper-color: #0b0b0d; }
html[data-wallpaper="sky"][data-theme="dark"] { --wallpaper: var(--doodle-sky-dark); --wallpaper-color: #0f1b26; }
html[data-wallpaper="mint"][data-theme="dark"] { --wallpaper: var(--doodle-mint-dark); --wallpaper-color: #0d1f17; }
html[data-wallpaper="sunset"][data-theme="dark"] { --wallpaper: var(--doodle-sunset-dark); --wallpaper-color: #22151a; }
html[data-wallpaper="ocean"][data-theme="dark"] { --wallpaper: var(--doodle-ocean-dark); --wallpaper-color: #0c1a24; }
/* Appearance settings screen */
#appearanceScreen .privacy-body { padding-bottom: 32px; }
.segmented {
  display: flex;
  gap: 3px;
  margin: 4px 16px 0;
  padding: 3px;
  border-radius: var(--r-lg);
  background: var(--bg-3);
}
.segmented-item {
  flex: 1;
  min-height: 36px;
  border-radius: var(--r-md);
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--muted);
  transition: background 0.16s, color 0.16s;
}
.segmented-item[aria-checked="true"] {
  background: var(--bg);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.accent-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 6px 16px 4px;
}
.accent-swatch {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--swatch);
  transition: transform 0.12s;
}
.accent-swatch:active { transform: scale(0.92); }
.accent-swatch[aria-checked="true"] {
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--swatch);
}
.accent-swatch[data-choice="purple"] { --swatch: #a94fd0; }
.accent-swatch[data-choice="blue"] { --swatch: #2a9fe0; }
.accent-swatch[data-choice="green"] { --swatch: #31a866; }
.accent-swatch[data-choice="orange"] { --swatch: #f08a24; }
.accent-swatch[data-choice="red"] { --swatch: #e5484d; }
.accent-swatch[data-choice="pink"] { --swatch: #e0589c; }
.accent-swatch[data-choice="teal"] { --swatch: #14a3a3; }
.wallpaper-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 6px 16px 4px;
}
.wallpaper-tile {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.wallpaper-preview {
  position: relative;
  display: block;
  height: 84px;
  overflow: hidden;
  border-radius: var(--r-lg);
  border: 2px solid transparent;
  background: var(--preview);
  background-size: 200px 200px;
}
.wallpaper-preview::before,
.wallpaper-preview::after {
  content: "";
  position: absolute;
  height: 14px;
  border-radius: var(--r-xs);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}
.wallpaper-preview::before {
  left: 10px;
  top: 16px;
  width: 46%;
  background: var(--bubble-in);
}
.wallpaper-preview::after {
  right: 10px;
  bottom: 16px;
  width: 36%;
  background: var(--bubble-out);
}
.wallpaper-tile[aria-checked="true"] .wallpaper-preview { border-color: var(--accent); }
.wallpaper-name {
  font-size: var(--fs-sm);
  color: var(--muted);
  text-align: center;
}
.wallpaper-tile[aria-checked="true"] .wallpaper-name {
  color: var(--accent);
  font-weight: 600;
}
.wallpaper-tile[data-choice="default"] .wallpaper-preview { --preview: radial-gradient(circle at 30% 30%, rgba(var(--accent-rgb), 0.22) 0 4px, transparent 5px), #f4edfa; }
.wallpaper-tile[data-choice="plain"] .wallpaper-preview { --preview: #eef2f5; }
.wallpaper-tile[data-choice="sky"] .wallpaper-preview { --preview: #d6ebf9 var(--doodle-sky); }
.wallpaper-tile[data-choice="mint"] .wallpaper-preview { --preview: #d7f2e4 var(--doodle-mint); }
.wallpaper-tile[data-choice="sunset"] .wallpaper-preview { --preview: #fbe3d6 var(--doodle-sunset); }
.wallpaper-tile[data-choice="ocean"] .wallpaper-preview { --preview: #d4e9f5 var(--doodle-ocean); }
html[data-theme="dark"] .wallpaper-tile[data-choice="default"] .wallpaper-preview { --preview: #000000; }
html[data-theme="dark"] .wallpaper-tile[data-choice="plain"] .wallpaper-preview { --preview: #0b0b0d; }
html[data-theme="dark"] .wallpaper-tile[data-choice="sky"] .wallpaper-preview { --preview: #0f1b26 var(--doodle-sky-dark); }
html[data-theme="dark"] .wallpaper-tile[data-choice="mint"] .wallpaper-preview { --preview: #0d1f17 var(--doodle-mint-dark); }
html[data-theme="dark"] .wallpaper-tile[data-choice="sunset"] .wallpaper-preview { --preview: #22151a var(--doodle-sunset-dark); }
html[data-theme="dark"] .wallpaper-tile[data-choice="ocean"] .wallpaper-preview { --preview: #0c1a24 var(--doodle-ocean-dark); }
/* ------------------------------ Reactions ------------------------------ */
.reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
}
.reaction-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 24px;
  padding: 1px 8px;
  border-radius: var(--r-pill);
  background: var(--bg-2);
  color: var(--text);
  font-size: var(--fs-xs);
  font-weight: 600;
  line-height: 1.4;
  transition: background 0.12s, transform 0.12s;
}
.reaction-btn:hover { background: var(--bg-3); }
.reaction-btn.mine { background: var(--accent-soft); color: var(--accent); }
.reaction-emoji { font-size: var(--fs-md); line-height: 1; }
.msg.out .reaction-btn { background: rgba(255, 255, 255, 0.35); }
.msg.out .reaction-btn.mine { background: rgba(255, 255, 255, 0.6); color: var(--text); }
.edited-mark { margin-right: 4px; font-size: var(--fs-2xs); color: var(--bubble-time-in); }
.msg.out .edited-mark { color: var(--bubble-time-out); }

/* -------------------------------- Search -------------------------------- */
.search-kind {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 2px 10px 8px;
}
.search-kind[hidden] { display: none; }
.search-kind-chip {
  flex: none;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--bg-2);
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.search-kind-chip:hover { color: var(--accent); }
.search-kind-chip.active {
  background: var(--accent);
  color: var(--on-accent);
}

.search-results {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 8px calc(16px + env(safe-area-inset-bottom));
}
.search-results[hidden] { display: none; }
.search-result {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border-radius: var(--r-lg);
  text-align: left;
  color: inherit;
}
.search-result:hover { background: var(--bg-2); }
.search-result-body { flex: 1; min-width: 0; }
.search-result-title {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--accent);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-result-text {
  display: block;
  font-size: var(--fs-md);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-result-time { flex: none; font-size: var(--fs-2xs); color: var(--muted); }
.search-empty,
.search-loading {
  padding: 20px 12px;
  color: var(--muted);
  font-size: var(--fs-sm);
  text-align: center;
}

/* -------------------------------- Archive ------------------------------- */
.archive-entry,
.archive-back {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: calc(100% - 20px);
  margin: 6px 10px 0;
  padding: 10px 12px;
  border-radius: var(--r-lg);
  color: var(--text);
  font-size: var(--fs-md);
  font-weight: 600;
  text-align: left;
}
.archive-entry:hover,
.archive-back:hover { background: var(--bg-2); }
.archive-entry-count { color: var(--muted); font-size: var(--fs-sm); font-weight: 400; }
.archive-back { color: var(--accent); margin-bottom: 4px; }

/* ------------------------------- Sessions ------------------------------- */
.session-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 320px;
  margin: 8px 0 14px;
  overflow-y: auto;
}
.session-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-lg);
  background: var(--bg-2);
}
.session-row.current { box-shadow: inset 0 0 0 1.5px var(--accent); }
.session-body { flex: 1; min-width: 0; }
.session-agent {
  font-size: var(--fs-sm);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.session-meta { font-size: var(--fs-2xs); color: var(--muted); }
.session-end { flex: none; color: var(--danger); font-size: var(--fs-sm); font-weight: 600; }

/* ------------------------------ Edit bar -------------------------------- */
.edit-bar .reply-bar-title { color: var(--accent); }
/* --------------------------- Context menu extras ------------------------ */
.ctx-title {
  padding: 8px 12px 6px;
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 600;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ctx-reactions {
  display: flex;
  gap: 2px;
  padding: 4px 6px 6px;
  border-bottom: 1px solid var(--divider);
  margin-bottom: 4px;
}
.ctx-reaction {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 20px;
  line-height: 1;
  transition: background 0.12s, transform 0.12s;
}
.ctx-reaction:hover { background: var(--bg-2); transform: scale(1.08); }
.chat-search-results {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 300px;
  margin: 4px 0 12px;
  overflow-y: auto;
  text-align: left;
}
/* ------------------------------- Legal pages ---------------------------- */
body.legal-page {
  height: auto;
  min-height: 100%;
  overflow-y: auto;
  background: var(--bg);
  color: var(--text);
}
.legal-shell {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 20px calc(48px + env(safe-area-inset-bottom));
}
.legal-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
}
.legal-title { color: var(--muted); font-size: var(--fs-lg); font-weight: 600; }
.legal-body h1 { margin: 0 0 6px; font-size: 28px; line-height: 1.2; letter-spacing: -0.02em; }
.legal-meta { margin: 0 0 22px; color: var(--muted); font-size: var(--fs-sm); }
.legal-body h2 { margin: 26px 0 8px; font-size: var(--fs-xl); }
.legal-body p, .legal-body li { font-size: var(--fs-base); line-height: 1.6; }
.legal-body ul { margin: 8px 0; padding-left: 20px; }
.legal-note {
  margin-top: 28px;
  padding: 12px 14px;
  border-radius: var(--r-lg);
  background: var(--accent-soft);
  color: var(--muted);
  font-size: var(--fs-sm);
  line-height: 1.5;
}

/* ------------------------------ Admin page ------------------------------ */
body.admin-page {
  height: auto;
  min-height: 100%;
  overflow-y: auto;
  background: var(--bg);
  color: var(--text);
}
.admin-shell {
  max-width: 980px;
  margin: 0 auto;
  padding: 24px 20px calc(48px + env(safe-area-inset-bottom));
}
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 18px;
}
.admin-title { margin: 0 0 4px; font-size: var(--fs-2xl); letter-spacing: -0.02em; }
.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 22px;
}
.admin-stat { padding: 12px 14px; border-radius: var(--r-lg); background: var(--bg-2); }
.admin-stat-value { font-size: var(--fs-2xl); font-weight: 700; }
.admin-stat-label { margin-top: 2px; color: var(--muted); font-size: var(--fs-xs); }
.admin-tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.admin-tab {
  padding: 6px 12px;
  border-radius: var(--r-pill);
  background: var(--bg-2);
  color: var(--muted);
  font-size: var(--fs-sm);
  font-weight: 600;
}
.admin-tab.active { background: var(--accent-soft); color: var(--accent); }
.admin-report {
  margin-bottom: 10px;
  padding: 12px 14px;
  border-radius: var(--r-lg);
  background: var(--bg-2);
}
.admin-report-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: var(--fs-sm);
}
.admin-report-target { font-weight: 600; }
.admin-report-reason { color: var(--danger); font-weight: 600; }
.admin-report-meta { margin-top: 4px; color: var(--muted); font-size: var(--fs-2xs); }
.admin-report-text {
  margin: 8px 0;
  padding: 8px 10px;
  border-radius: var(--r-md);
  background: var(--bg);
  font-size: var(--fs-sm);
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}
.admin-report-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.admin-report-actions button {
  padding: 5px 10px;
  border-radius: var(--r-md);
  background: var(--bg-3);
  font-size: var(--fs-xs);
  font-weight: 600;
}
.admin-report-actions button.danger { color: var(--danger); }

/* Admin: ready-made labels */
.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 10px 0 12px;
}
.admin-btn {
  padding: 9px 14px;
  border-radius: var(--r-md);
  background: var(--bg-2);
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: 600;
}
.admin-btn:hover { background: var(--bg-3); }
.admin-btn.primary { background: var(--accent); color: var(--on-accent); }
.admin-btn:disabled { opacity: 0.55; }
.admin-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-xs);
  color: var(--muted);
}
.admin-check input { accent-color: var(--accent); }
.admin-section { margin-bottom: 22px; }
.admin-section-title { margin: 0 0 4px; font-size: var(--fs-lg); letter-spacing: -0.01em; }
.admin-search {
  width: 100%;
  margin: 10px 0 12px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--bg-2);
  font-size: var(--fs-md);
  color: var(--text);
}
.admin-search:focus { outline: none; border-color: var(--accent); }
.admin-result-group {
  margin: 14px 0 6px;
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.admin-result {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  padding: 10px 12px;
  border-radius: var(--r-lg);
  background: var(--bg-2);
}
.admin-result-main { flex: 1; min-width: 170px; }
.admin-result-name { font-weight: 600; }
.admin-result-sub { display: block; margin-top: 2px; color: var(--muted); font-size: var(--fs-2xs); }
.admin-result-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.admin-badge-btn {
  padding: 4px 10px;
  border-radius: var(--r-pill);
  background: var(--bg-3);
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 600;
}
.admin-badge-btn.active { background: var(--accent-soft); color: var(--accent); }
.admin-badge-btn:disabled { opacity: 0.5; }

/* --------------------------- Sessions and 2FA --------------------------- */
.session-new {
  display: inline-block;
  margin-left: 6px;
  padding: 0 7px;
  border-radius: var(--r-pill);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: var(--fs-2xs);
  font-weight: 600;
  vertical-align: 1px;
}
.twofa-codes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin: 10px 0 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.twofa-code {
  padding: 6px 8px;
  border-radius: var(--r-md);
  background: var(--bg-2);
  font-size: var(--fs-sm);
  text-align: center;
  letter-spacing: 0.04em;
}
.twofa-secret {
  margin: 8px 0 12px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  background: var(--bg-2);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: var(--fs-sm);
  word-break: break-all;
  user-select: all;
}
.about-links { display: flex; justify-content: center; gap: 14px; margin-top: 12px; font-size: var(--fs-sm); }
.about-links a { color: var(--accent); font-weight: 600; }

/* ------------------------------ Group links ------------------------------ */
.group-links {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 12px 4px;
  border: 0;
}

.group-link-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  border-radius: var(--r-lg);
  background: var(--bg-2);
}

.group-link-title { font-weight: 600; }

.group-link-note {
  color: var(--muted);
  font-size: var(--fs-xs);
  line-height: 1.45;
}

.group-link-line { display: flex; align-items: center; gap: 6px; }

.group-link-prefix { flex: none; color: var(--muted); font-size: var(--fs-sm); }

.group-link-input {
  flex: 1;
  min-width: 0;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: var(--fs-sm);
}

.group-link-input::placeholder { color: var(--muted); }

.group-link-btn {
  flex: none;
  height: 34px;
  padding: 0 12px;
  border-radius: var(--r-md);
  background: var(--accent);
  color: var(--on-accent);
  font-size: var(--fs-sm);
  font-weight: 600;
}

.group-link-btn.ghost {
  background: none;
  border: 1px solid var(--line);
  color: var(--accent);
}

.group-link-btn.ghost.danger { color: var(--danger); }

.group-link-actions { display: flex; flex-wrap: wrap; gap: 6px; }

/* ------------------------------ Invite page ------------------------------ */
.invite-card {
  max-width: 400px;
  margin: 24px auto 0;
  padding: 26px 22px;
  border-radius: var(--r-xl);
  background: var(--card, var(--bg-2));
  border: 1px solid var(--line);
  text-align: center;
}

.invite-logo {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
}

.invite-logo svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.invite-title { margin: 0 0 6px; font-size: var(--fs-2xl); line-height: 1.2; }

.invite-sub { margin: 0 0 12px; color: var(--muted); font-size: var(--fs-sm); }

.invite-message { margin: 0 0 18px; color: var(--muted); font-size: var(--fs-base); line-height: 1.5; }

.invite-action {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  margin-bottom: 10px;
  border-radius: var(--r-lg);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  text-decoration: none;
}

.invite-link { color: var(--accent); font-size: var(--fs-sm); text-decoration: none; }

/* ----------------------------- Photo viewer ----------------------------- */
.image-viewer {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(6, 12, 20, 0.9);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.18s, visibility 0.18s;
}

.image-viewer.open { opacity: 1; visibility: visible; }

.image-viewer img {
  max-width: min(100%, 900px);
  max-height: calc(100% - 84px);
  border-radius: var(--r-md);
  object-fit: contain;
}

.image-viewer-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(16px + env(safe-area-inset-bottom));
  display: flex;
  justify-content: center;
  gap: 10px;
}

.image-viewer-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 16px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  font-size: var(--fs-sm);
  font-weight: 600;
  text-decoration: none;
}

.image-viewer-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.image-viewer-close {
  position: absolute;
  top: calc(14px + env(safe-area-inset-top));
  right: 14px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-viewer-close svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}
/* ----------------------- Channel preview and comments ---------------------- */
.preview-bar {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--bg);
  border-top: 1px solid var(--line);
  position: relative;
  z-index: 4;
}

.preview-bar-hint {
  color: var(--muted);
  font-size: var(--fs-xs);
  text-align: center;
}

.preview-join {
  height: 44px;
  border-radius: var(--r-lg);
  background: var(--accent);
  color: var(--on-accent);
  font-size: var(--fs-md);
  font-weight: 700;
  transition: background 0.15s, transform 0.12s;
}

.preview-join:hover { background: var(--accent-strong); }
.preview-join:active { transform: scale(0.99); }
.preview-join:disabled { opacity: 0.6; }

.comment-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: 100%;
  margin-top: 3px;
  padding: 4px 0 1px;
  border-top: 1px solid rgba(var(--accent-rgb), 0.14);
  color: var(--accent);
  font-size: var(--fs-xs);
  font-weight: 600;
}

.comment-btn svg {
  width: 14px;
  height: 14px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.msg.out .comment-btn {
  color: #2c7a3d;
  border-top-color: rgba(31, 86, 40, 0.14);
}

html[data-theme="dark"] .msg.out .comment-btn {
  color: #9be6bd;
  border-top-color: rgba(255, 255, 255, 0.14);
}

.modal-card[data-size="wide"] { max-width: 430px; }

/* Desktop profile preview: a compact floating card instead of a full page. */
.modal-card[data-size="panel"] {
  width: min(520px, calc(100vw - 48px));
  max-width: 520px;
  max-height: min(820px, calc(100vh - 48px));
  padding: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  border-radius: var(--r-2xl);
}

.modal-card[data-size="panel"] .peer-card { min-height: 0; }

.modal-card[data-size="panel"] .peer-card-hero {
  padding: 44px 22px 24px;
}

.modal-card[data-size="panel"] .modal-close {
  z-index: 3;
  top: 10px;
  right: 10px;
  color: #ffffff;
  background: rgba(9, 20, 32, 0.42);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.comments-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}

.comments-head { text-align: center; }
.comments-title { font-size: var(--fs-lg); font-weight: 700; }
.comments-subtitle { color: var(--muted); font-size: var(--fs-sm); margin-top: 2px; }

.comments-source {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border-left: 3px solid var(--accent);
  border-radius: var(--r-md);
  background: var(--bg-2);
  font-size: var(--fs-xs);
  color: var(--muted);
}

.comments-source-label { color: var(--accent); font-weight: 700; }

.comments-source-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.comments-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
  max-height: 46vh;
  overflow-y: auto;
  padding: 2px 2px 4px;
}

.comments-empty {
  padding: 14px 6px;
  color: var(--muted);
  font-size: var(--fs-sm);
  text-align: center;
}

.comment-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.comment-row .avatar { flex: none; }

.comment-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.comment-head {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.comment-author { font-size: var(--fs-sm); font-weight: 600; }
.comment-time { color: var(--muted); font-size: var(--fs-xs); }

.comment-text {
  font-size: var(--fs-sm);
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

.comment-form { display: flex; gap: 6px; }

.comment-form input {
  flex: 1;
  min-width: 0;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: var(--fs-sm);
}

.comment-form input::placeholder { color: var(--muted); }

.comment-send {
  flex: none;
  height: 38px;
  padding: 0 14px;
  border-radius: var(--r-lg);
  background: var(--accent);
  color: var(--on-accent);
  font-size: var(--fs-sm);
  font-weight: 600;
}

.comment-send:disabled { opacity: 0.6; }

.comments-locked {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: var(--fs-sm);
  text-align: center;
}

.comment-join {
  height: 38px;
  padding: 0 18px;
  border-radius: var(--r-lg);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
}

.comment-join:hover, .comment-send:hover { background: var(--accent-strong); }
.comment-quote { width: 100%; }

/* --------------------------- Chat loading status ------------------------- */
.chats-title[data-state="connecting"],
.chats-title[data-state="updating"] {
  color: var(--accent);
  font-size: var(--fs-lg);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.chat-status-cube {
  position: relative;
  display: none;
  width: 17px;
  height: 17px;
  flex: none;
}

.chats-title[data-state="connecting"] .chat-status-cube,
.chats-title[data-state="updating"] .chat-status-cube {
  display: block;
}

.chat-status-cube i {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: currentColor;
  animation: chat-cube-gather 1.3s ease-in-out infinite;
}

.chat-status-cube i:nth-child(1) {
  top: 0;
  left: 0;
  --cube-x: 5px;
  --cube-y: 5px;
}

.chat-status-cube i:nth-child(2) {
  top: 0;
  right: 0;
  --cube-x: -5px;
  --cube-y: 5px;
}

.chat-status-cube i:nth-child(3) {
  bottom: 0;
  left: 0;
  --cube-x: 5px;
  --cube-y: -5px;
}

.chat-status-cube i:nth-child(4) {
  right: 0;
  bottom: 0;
  --cube-x: -5px;
  --cube-y: -5px;
}

@keyframes chat-cube-gather {
  0%, 12% { transform: translate(0, 0) scale(1); opacity: 1; }
  42%, 52% { transform: translate(var(--cube-x), var(--cube-y)) scale(0.95); opacity: 1; }
  64%, 76% { transform: translate(var(--cube-x), var(--cube-y)) scale(0.32); opacity: 0.8; }
  100% { transform: translate(0, 0) scale(1); opacity: 1; }
}

/* ------------------------------- Stories --------------------------------- */
.story-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 2px 2px 10px;
  scrollbar-width: none;
}

.story-strip::-webkit-scrollbar { display: none; }
.story-strip:empty { display: none; }
html[data-stories="hidden"] .story-strip { display: none !important; }

.story-item {
  flex: none;
  width: 68px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: none;
  color: inherit;
}

.story-ring {
  position: relative;
  width: 60px;
  height: 60px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.story-ring > svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
  overflow: visible;
}

.story-ring circle { fill: none; stroke-width: 2.6; stroke-linecap: round; }
.story-ring .story-track { stroke: var(--line); }
.story-ring .story-seg { stroke-width: 3; }

.story-ring .avatar {
  width: 50px;
  height: 50px;
  font-size: var(--fs-xl);
  border: 2px solid var(--bg);
}

.story-ring.empty .avatar { opacity: 0.9; }

.story-badge {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  border: 2px solid var(--bg);
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.story-item:active .story-ring { transform: scale(0.96); }

.story-label {
  max-width: 64px;
  font-size: var(--fs-xs);
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Full-screen story viewer */
.story-viewer {
  position: fixed;
  inset: 0;
  z-index: 250;
  display: flex;
  flex-direction: column;
  background: #000000;
  color: #ffffff;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.18s ease;
}

.story-viewer.open { opacity: 1; visibility: visible; }

.story-progress {
  display: flex;
  gap: 3px;
  padding: 10px 12px 0;
  flex: none;
}

.story-bar {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.28);
  overflow: hidden;
}

.story-bar-fill {
  display: block;
  height: 100%;
  width: 0;
  background: #ffffff;
}

.story-bar-fill.done { width: 100%; }

.story-bar-fill.active {
  animation-name: story-progress-fill;
  animation-duration: 5s;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
}

@keyframes story-progress-fill {
  from { width: 0; }
  to { width: 100%; }
}

.story-viewer-top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px 6px;
  flex: none;
}

.story-viewer-avatar .avatar {
  width: 38px;
  height: 38px;
  font-size: var(--fs-md);
  border: 1px solid rgba(255, 255, 255, 0.4);
}

.story-viewer-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.story-viewer-name {
  font-size: var(--fs-md);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.story-viewer-time { font-size: var(--fs-xs); color: rgba(255, 255, 255, 0.7); }

.story-viewer-close {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 50%;
}

.story-viewer-close svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.story-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.story-stage img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

.story-nav {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 38%;
  background: none;
}

.story-nav-prev { left: 0; }
.story-nav-next { right: 0; }

.story-viewer-bottom {
  flex: none;
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 10px 14px calc(16px + env(safe-area-inset-bottom));
}

.story-delete {
  min-height: 38px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #ffffff;
  font-size: var(--fs-sm);
  font-weight: 600;
}

.story-delete:active { background: rgba(255, 255, 255, 0.14); }

.story-like {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 52px;
  min-height: 38px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #ffffff;
  font-size: var(--fs-sm);
  font-weight: 600;
  transition: background 0.15s, color 0.15s, transform 0.12s;
}

.story-like svg {
  width: 21px;
  height: 21px;
  fill: none;
  transition: fill 0.15s, transform 0.12s;
}

.story-like.liked {
  border-color: rgba(255, 110, 140, 0.85);
  background: rgba(255, 70, 110, 0.18);
  color: #ff9fb2;
}

.story-like.liked svg { fill: currentColor; }
.story-like:active { transform: scale(0.94); }
.story-like[hidden] { display: none; }

/* Story upload dialog */
.story-compose {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: center;
}

.story-compose-preview {
  width: 100%;
  max-height: 34vh;
  object-fit: contain;
  border-radius: var(--r-lg);
  background: var(--bg-2);
}

.story-hours { display: flex; gap: 8px; }

.story-hours-btn {
  flex: 1;
  height: 42px;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: 600;
}

.story-hours-btn.selected {
  background: var(--accent);
  border-color: transparent;
  color: var(--on-accent);
}

/* ==========================================================================
   PROFILE COVER (full-width hero with a personal background)
   ========================================================================== */
.profile-hero {
  position: relative;
  margin: -26px -20px 20px;
  padding: 26px 18px 20px;
  overflow: hidden;
  text-align: center;
  border-radius: 0 0 var(--r-2xl) var(--r-2xl);
  background: linear-gradient(150deg, rgba(var(--accent-rgb), 0.22), rgba(var(--accent-rgb), 0.04) 70%);
  border-bottom: 1px solid var(--line);
}

.profile-hero-cover {
  position: absolute;
  inset: 0;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  opacity: 0;
  transition: opacity 0.2s;
}

.profile-hero-cover.has-image { opacity: 1; }

.profile-hero-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(6, 18, 30, 0.05) 20%, rgba(6, 18, 30, 0.68) 100%);
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}

.profile-hero.has-cover .profile-hero-shade { opacity: 1; }

.profile-hero .profile-avatar-block {
  position: relative;
  z-index: 1;
  margin-bottom: 12px;
}

.profile-hero-name {
  position: relative;
  z-index: 1;
  font-size: var(--fs-2xl);
  font-weight: 650;
  letter-spacing: -0.012em;
  word-break: break-word;
}

.profile-hero-username {
  position: relative;
  z-index: 1;
  margin-top: 2px;
  font-size: var(--fs-md);
  color: var(--muted);
}

.profile-hero.has-cover .profile-hero-name {
  color: #ffffff;
  text-shadow: 0 2px 12px rgba(4, 14, 24, 0.55);
}

.profile-hero.has-cover .profile-hero-username {
  color: rgba(255, 255, 255, 0.88);
  text-shadow: 0 1px 10px rgba(4, 14, 24, 0.5);
}

.profile-hero-actions {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
}

.profile-hero-btn {
  padding: 8px 14px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--sheet);
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: 550;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s, opacity 0.15s;
}

.profile-hero-btn:hover { background: var(--accent-soft); color: var(--accent); }
.profile-hero-btn:disabled { opacity: 0.55; cursor: default; }
.profile-hero-btn.danger { color: var(--danger); border-color: rgba(229, 72, 77, 0.35); }

.profile-hero.has-cover .profile-hero-btn {
  border-color: rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.profile-hero.has-cover .profile-hero-btn:hover { background: rgba(255, 255, 255, 0.3); }
.profile-hero.has-cover .profile-hero-btn.danger { color: #ffe1e2; }

/* ==========================================================================
   CHAT PHOTO PULL (the chat photo grows while the list is dragged down)
   ========================================================================== */
.chat-photo-pull {
  position: absolute;
  top: 14px;
  left: 50%;
  z-index: 0;
  width: min(62vw, 260px);
  height: min(62vw, 260px);
  overflow: hidden;
  border-radius: 28px;
  opacity: 0;
  transform: translate(-50%, 0) scale(0.4);
  pointer-events: none;
  box-shadow: 0 18px 44px rgba(12, 30, 48, 0.26);
  will-change: transform, opacity;
}

.chat-photo-pull-img.avatar {
  width: 100%;
  height: 100%;
  border-radius: 0;
  font-size: min(17vw, 76px);
  box-shadow: none;
}

.chat-photo-pull-img .avatar-img { border-radius: 0; }

.messages {
  position: relative;
  z-index: 1;
  will-change: transform;
}

/* ==========================================================================
   PEER PROFILE (full-page card instead of a small dialog)
   ========================================================================== */
.modal.modal-full { padding: 0; align-items: stretch; justify-content: stretch; }

.modal-full .modal-card {
  width: 100%;
  max-width: none;
  max-height: none;
  height: 100%;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
  background: var(--bg);
  transform: translateY(24px);
}

.modal-full .modal-close {
  z-index: 3;
  top: calc(10px + env(safe-area-inset-top));
  right: 12px;
  width: 36px;
  height: 36px;
  color: #ffffff;
  background: rgba(9, 20, 32, 0.42);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.modal-full .modal-close:hover { background: rgba(9, 20, 32, 0.6); color: #ffffff; }

.peer-card {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.peer-card-hero {
  position: relative;
  padding: calc(46px + env(safe-area-inset-top)) 22px 24px;
  text-align: center;
  overflow: hidden;
  background: linear-gradient(150deg, rgba(var(--accent-rgb), 0.3), rgba(var(--accent-rgb), 0.06) 70%);
}

.peer-card-cover {
  position: absolute;
  inset: -30px;
  background-position: center;
  background-size: cover;
  filter: blur(22px) saturate(1.25);
  transform: scale(1.1);
  opacity: 0;
  transition: opacity 0.2s;
}

.peer-card-hero.has-photo .peer-card-cover { opacity: 0.7; }

.peer-card-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(6, 18, 30, 0.25) 0%, rgba(6, 18, 30, 0.55) 100%);
  opacity: 0;
}

.peer-card-hero.has-photo .peer-card-shade { opacity: 1; }

.peer-card-photo {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  margin-bottom: 14px;
}

.peer-card-photo .avatar.xl {
  width: 132px;
  height: 132px;
  font-size: 52px;
  box-shadow: 0 14px 36px rgba(6, 18, 30, 0.3);
}

.peer-card-name {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: var(--fs-2xl);
  font-weight: 700;
  letter-spacing: -0.015em;
  color: #ffffff;
  text-shadow: 0 2px 14px rgba(4, 14, 24, 0.45);
  word-break: break-word;
}

.peer-card-hero:not(.has-photo) .peer-card-name { color: var(--text); text-shadow: none; }

.peer-card-username {
  position: relative;
  z-index: 1;
  margin-top: 3px;
  font-size: var(--fs-md);
  color: rgba(255, 255, 255, 0.86);
  text-shadow: 0 1px 10px rgba(4, 14, 24, 0.4);
}

.peer-card-hero:not(.has-photo) .peer-card-username { color: var(--muted); text-shadow: none; }

.peer-card-hero .modal-status {
  position: relative;
  z-index: 1;
  margin-top: 10px;
  color: rgba(255, 255, 255, 0.9);
}

.peer-card-hero:not(.has-photo) .modal-status { color: var(--muted); }

.peer-card-body {
  flex: 1;
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 20px 22px calc(28px + env(safe-area-inset-bottom));
}

.peer-card-body .modal-bio { margin-top: 0; }

/* The notification toggle and action rows sit on the same card surface as the
   birth/join rows instead of floating on the page background. */
.peer-card .group-list {
  border: 0;
  margin: 0 0 16px;
}
.peer-card .group-row {
  padding: 11px 14px;
  border: 1.5px solid transparent;
  border-radius: var(--r-lg);
  background: var(--bg-2);
}
.peer-card .group-row:hover { background: var(--bg-3); }
.peer-card .group-row-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--r-lg);
  background: var(--accent-soft);
  color: var(--accent);
}
.peer-card .group-row-icon svg { width: 20px; height: 20px; }

/* Birth date row in the peer card: shown only when the privacy scope allows. */
.peer-card-birth {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 12px;
  padding: 11px 14px;
  border-radius: var(--r-lg);
  background: var(--bg-2);
  font-size: var(--fs-md);
  color: var(--text);
}

.peer-card-birth-label {
  flex: none;
  font-size: var(--fs-sm);
  color: var(--muted);
}

.peer-card-birth-value { font-weight: 600; }

.peer-card-birth.muted { color: var(--muted); font-size: var(--fs-sm); }

/* End-to-end encryption: header badge, locked bubbles and the unlock dialog. */
.peer-meta { position: relative; }

.e2ee-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
  color: var(--accent);
  font-size: var(--fs-2xs);
  line-height: 1.1;
  white-space: nowrap;
}

.e2ee-badge svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.e2ee-badge[hidden] { display: none; }

.text.e2ee-locked {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.text.e2ee-locked:hover { color: var(--text); }

.e2ee-locked-open {
  color: var(--accent);
  text-decoration: underline;
}

.e2ee-unlock {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(9, 24, 37, 0.55);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.18s var(--ease, ease);
}

.e2ee-unlock.open { opacity: 1; }

.e2ee-unlock-card {
  width: min(360px, 100%);
  padding: 24px 22px 20px;
  border-radius: var(--r-xl, 20px);
  background: var(--bg, #fff);
  color: var(--text);
  box-shadow: var(--shadow-lg, 0 24px 60px rgba(0, 0, 0, 0.24));
  text-align: center;
}

.e2ee-unlock-icon {
  display: inline-flex;
  width: 46px;
  height: 46px;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent, #229ed9) 14%, transparent);
  color: var(--accent, #229ed9);
}

.e2ee-unlock-icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.e2ee-unlock-title { font-size: var(--fs-lg, 17px); font-weight: 700; }

.e2ee-unlock-sub {
  margin-top: 6px;
  color: var(--muted);
  font-size: var(--fs-sm, 13px);
  line-height: 1.4;
}

.e2ee-unlock-input {
  width: 100%;
  margin-top: 16px;
  padding: 11px 13px;
  border: 1px solid var(--divider, rgba(0, 0, 0, 0.12));
  border-radius: var(--r-md, 12px);
  background: var(--bg-2);
  color: var(--text);
  font: inherit;
  font-size: var(--fs-md, 15px);
}

.e2ee-unlock-input:focus {
  outline: none;
  border-color: var(--accent, #229ed9);
}

.e2ee-unlock-error {
  min-height: 18px;
  margin-top: 8px;
  color: var(--danger, #e5484d);
  font-size: var(--fs-sm, 13px);
}

.e2ee-unlock-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.e2ee-unlock-primary,
.e2ee-unlock-cancel {
  width: 100%;
  padding: 11px 14px;
  border: none;
  border-radius: var(--r-md, 12px);
  font: inherit;
  font-size: var(--fs-md, 15px);
  font-weight: 600;
  cursor: pointer;
}

.e2ee-unlock-primary {
  background: var(--accent, #229ed9);
  color: var(--on-accent);
}

.e2ee-unlock-primary:disabled { opacity: 0.6; cursor: default; }

.e2ee-unlock-cancel {
  background: transparent;
  color: var(--muted);
}

/* ==========================================================================
   Telegram-like polish: profile sections, richer appearance, font scale
   ========================================================================== */

/* --- Text size (appearance -> "Размер текста") ---------------------------- */
html[data-fontsize="small"] {
  --fs-2xs: 10px;
  --fs-xs: 11px;
  --fs-sm: 12px;
  --fs-md: 13px;
  --fs-base: 14px;
  --fs-lg: 15px;
  --fs-xl: 18px;
  --fs-2xl: 20px;
  --fs-3xl: 24px;
  --fs-4xl: 32px;
  --fs-5xl: 40px;
  --fs-hero: 28px;
}
html[data-fontsize="large"] {
  --fs-2xs: 12px;
  --fs-xs: 13px;
  --fs-sm: 14px;
  --fs-md: 15px;
  --fs-base: 17px;
  --fs-lg: 18px;
  --fs-xl: 22px;
  --fs-2xl: 24px;
  --fs-3xl: 28px;
  --fs-4xl: 40px;
  --fs-5xl: 48px;
  --fs-hero: 36px;
}

/* --- Custom chat wallpaper ------------------------------------------------ */
html[data-wallpaper="custom"] .messages,
html[data-wallpaper="custom"] .appearance-preview {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* --- Section titles (profile, settings) ---------------------------------- */
.section-title {
  padding: 0 6px 7px;
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.055em;
  text-transform: uppercase;
  color: var(--muted);
}
.profile-section { margin-top: 18px; }
.profile-hero + .profile-section { margin-top: 4px; }
.profile-section .settings-group { margin: 0; }

/* The profile hero is a compact Telegram-like card: photo, name, one status
   line and two small actions, instead of a tall form header. */
.profile-hero { padding-bottom: 18px; }
.profile-hero-status {
  margin-top: 5px;
  font-size: var(--fs-sm);
  color: var(--muted);
}
.profile-hero.has-cover .profile-hero-status { color: rgba(255, 255, 255, 0.82); }
.profile-hero-actions {
  margin-top: 14px;
  flex-wrap: wrap;
  justify-content: center;
}
.profile-hero-btn {
  min-height: 34px;
  padding: 0 14px;
  border-radius: var(--r-pill);
  font-size: var(--fs-sm);
}

/* Editable profile rows sit inside one rounded card, like Telegram settings. */
.profile-fields { gap: 0; }
.profile-fields .field {
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 11px 14px;
}
.profile-fields .field:focus-within { background: transparent; }
.profile-fields .field + .field { border-top: 1px solid var(--divider); }
.profile-fields .field-label {
  font-size: var(--fs-xs);
  color: var(--muted);
  font-weight: 600;
}
.profile-fields .field input,
.profile-fields .field textarea { font-size: var(--fs-lg); padding: 2px 0; }

/* The native date picker icon looks like a checkbox in dark mode; draw a
   calendar instead and keep the whole indicator clickable. */
.profile-fields input[type="date"] {
  padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a5adb5' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='16' rx='2'/%3E%3Cpath d='M16 3v4M8 3v4M3 11h18'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 2px center;
  background-size: 19px 19px;
}
.profile-fields input[type="date"]::-webkit-calendar-picker-indicator {
  width: 30px;
  height: 30px;
  opacity: 0;
  cursor: pointer;
}
.profile-fields .field-counter { right: 14px; }

/* --- Settings rows with title + subtitle --------------------------------- */
.drawer-item-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.drawer-item-title {
  font-size: var(--fs-base);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.drawer-item-sub {
  min-width: 0;
  font-size: var(--fs-xs);
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.drawer-item-action {
  flex: none;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--accent);
}
.drawer-item.static { cursor: default; }
.drawer-item.static:hover { background: transparent; }
.drawer-item .color-row {
  justify-content: flex-start;
  gap: 8px;
  margin: 6px 0 0;
}
.drawer-item .color-swatch { width: 22px; height: 22px; }
.drawer-item .profile-badges { margin-top: 5px; }
.drawer-item.danger .drawer-item-title { color: inherit; }

/* --- Collapsible security blocks ----------------------------------------- */
.settings-expander { display: block; }
.settings-expander > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
}
.settings-expander > summary::-webkit-details-marker { display: none; }
.settings-expander > summary::marker { content: ""; }
.settings-expander .drawer-chevron {
  flex: none;
  width: 18px;
  height: 18px;
  color: var(--muted-2);
  transition: transform 0.18s var(--ease);
}
.settings-expander[open] .drawer-chevron { transform: rotate(90deg); }
.settings-expander .expander-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 14px 16px;
  border-top: 1px solid var(--divider);
}
.settings-expander .expander-hint {
  margin: 8px 0 0;
  font-size: var(--fs-xs);
  color: var(--muted);
  line-height: 1.45;
}
.settings-expander .field { background: var(--bg); }
.settings-expander .avatar-action { align-self: flex-start; margin: 2px 0 0; }
.settings-expander .drawer-item + .drawer-item::before { display: none; }
.settings-group .settings-expander + .settings-expander { position: relative; }
.settings-group .settings-expander + .settings-expander::before {
  content: "";
  position: absolute;
  top: 0;
  left: 58px;
  right: 0;
  height: 1px;
  background: var(--divider);
}

/* --- Appearance screen ---------------------------------------------------- */
.appearance-preview {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 8px;
  min-height: 148px;
  margin: 4px 16px 20px;
  padding: 16px 14px;
  overflow: hidden;
  border-radius: var(--r-xl);
  border: 1px solid var(--line);
  background-color: var(--wallpaper-color);
  background-image: var(--wallpaper);
  box-shadow: var(--shadow-sm);
}
.ap-bubble {
  max-width: 82%;
  padding: 8px 12px;
  border-radius: 14px;
  font-size: var(--fs-sm);
  line-height: 1.35;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}
.ap-in {
  align-self: flex-start;
  border-bottom-left-radius: 5px;
  background: var(--bubble-in);
  color: var(--bubble-in-text);
}
.ap-out {
  align-self: flex-end;
  border-bottom-right-radius: 5px;
  background: var(--bubble-out);
  color: var(--bubble-out-text);
}
.ap-composer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  pointer-events: none;
}
.ap-field {
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  border-radius: var(--r-pill);
  background: var(--bubble-in);
  color: var(--muted);
  font-size: var(--fs-sm);
  line-height: 1.2;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ap-send {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: 0 3px 8px rgba(var(--accent-rgb), 0.35);
}
.ap-send svg { width: 16px; height: 16px; stroke-width: 1.8; }
.accent-swatch-custom {
  display: flex;
  align-items: center;
  justify-content: center;
  background: conic-gradient(#e5484d, #f08a24, #31a866, #2a9fe0, #7b4dff, #e0589c, #e5484d);
  color: #ffffff;
}
.accent-swatch-custom.has-custom {
  background: var(--custom-swatch, var(--accent));
  color: var(--on-accent);
}
.accent-swatch-custom svg {
  width: 19px;
  height: 19px;
  stroke-width: 1.7;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.35));
}
.accent-swatch-custom[aria-checked="true"] {
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);
}
.wallpaper-tile-custom .wallpaper-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px dashed var(--line);
  background: var(--bg-2);
  color: var(--muted);
}
.wallpaper-tile-custom .wallpaper-preview::before,
.wallpaper-tile-custom .wallpaper-preview::after { display: none; }
.wallpaper-tile-custom.has-image .wallpaper-preview {
  border-style: solid;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
.wallpaper-tile-custom.has-image .wallpaper-preview svg { display: none; }
.wallpaper-tile-custom.has-image .wallpaper-preview::before,
.wallpaper-tile-custom.has-image .wallpaper-preview::after { display: block; }
.wallpaper-tile-custom svg { width: 24px; height: 24px; }
.wallpaper-tile-custom[aria-checked="true"] .wallpaper-preview {
  border-color: var(--accent);
  color: var(--accent);
  background-color: var(--accent-soft);
}
.wallpaper-tile-custom.has-image[aria-checked="true"] .wallpaper-preview { background-color: var(--bg-3); }
.appearance-reset {
  display: block;
  width: calc(100% - 32px);
  margin: 20px 16px 0;
  padding: 12px;
  border-radius: var(--r-lg);
  background: var(--bg-2);
  color: var(--danger);
  font-size: var(--fs-md);
  font-weight: 600;
  text-align: center;
}
.appearance-reset:active { background: var(--danger-soft); }

/* Keyboard focus is visible on the custom controls, which sit on top of a
   rounded surface where the browser ring would be hard to see. */
.accent-swatch:focus-visible,
.segmented-item:focus-visible,
.appearance-reset:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.wallpaper-tile:focus-visible { outline: none; }
.wallpaper-tile:focus-visible .wallpaper-preview {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* --- Peer profile: birth date + join date share one info card ----------- */
.peer-card-info {
  margin: 10px 0 14px;
  border-radius: var(--r-lg);
  background: var(--bg-2);
  overflow: hidden;
}
.peer-card-info > * {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  padding: 11px 14px;
  border-radius: 0;
  background: transparent;
}
.peer-card-info > * + * { border-top: 1px solid var(--divider); }
.peer-card-join {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: var(--fs-md);
}
.peer-card-join-label { flex: none; font-size: var(--fs-sm); color: var(--muted); }
.peer-card-join-value { font-weight: 600; }
.peer-card-preview {
  margin: 16px auto 0;
  max-width: 430px;
  padding: 10px 12px;
  border-radius: var(--r-lg);
  background: var(--bg-2);
  color: var(--muted);
  font-size: var(--fs-sm);
  line-height: 1.45;
  text-align: center;
}

/* Settings card under the avatar: one-line bio, like Telegram. */
.settings-bio {
  max-width: 100%;
  font-size: var(--fs-xs);
  color: var(--muted-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.profile-fields .field { margin-bottom: 0; }

/* The hint under the reset button lines up with the swatches above it. */
#appearanceScreen .group-hint {
  margin: 10px 0 0;
  padding: 0 16px;
  font-size: var(--fs-sm);
  color: var(--muted);
  line-height: 1.45;
}

/* --- Custom chat filters ------------------------------------------------ */
.chat-filter-add {
  width: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-lg);
  line-height: 1;
}

.appearance-link-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: calc(100% - 32px);
  margin: 4px 16px 0;
  padding: 10px 14px;
  border-radius: var(--r-lg);
  background: var(--bg-2);
  text-align: left;
}
.appearance-link-row:hover { background: var(--bg-3); }
.appearance-link-icon {
  width: 38px;
  height: 38px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-lg);
  background: var(--accent-soft);
  color: var(--accent);
}
.appearance-link-icon svg { width: 20px; height: 20px; }
.appearance-link-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.appearance-link-title { font-size: var(--fs-base); font-weight: 600; }
.appearance-link-sub { font-size: var(--fs-xs); color: var(--muted); }
.appearance-link-chevron { width: 18px; height: 18px; color: var(--muted-2); flex: none; }
.filter-manager-list {
  max-height: 280px;
  margin: 8px 0 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
}
.filter-manager-section {
  padding: 14px 2px 6px;
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}
.filter-manager-standard {
  padding: 0 2px 2px;
  color: var(--text);
  font-size: var(--fs-sm);
  line-height: 1.5;
}
.filter-manager-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-lg);
  background: var(--bg-2);
}
.filter-manager-icon {
  width: 34px;
  height: 34px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-md);
  background: var(--accent-soft);
  color: var(--accent);
}
.filter-manager-icon svg { width: 18px; height: 18px; }
.filter-manager-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.filter-manager-name {
  font-size: var(--fs-md);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.filter-manager-count { font-size: var(--fs-xs); color: var(--muted); }
.filter-manager-action {
  width: 32px;
  height: 32px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--muted);
}
.filter-manager-action:hover { background: var(--bg-3); color: var(--text); }
.filter-manager-action.danger:hover { background: var(--danger-soft); color: var(--danger); }
.filter-manager-action svg { width: 17px; height: 17px; }
.filter-manager-empty {
  padding: 14px 4px;
  color: var(--muted);
  font-size: var(--fs-sm);
  text-align: center;
}
.filter-manager .modal-btn.primary {
  width: 100%;
  margin-bottom: 2px;
}
.filter-show-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--divider);
  font-size: var(--fs-md);
}
.filter-chat-list {
  max-height: 200px;
  margin: 10px 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}
.filter-chat-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: var(--r-md);
  cursor: pointer;
}
.filter-chat-row:hover { background: var(--bg-2); }
.filter-chat-row .avatar { width: 36px; height: 36px; font-size: var(--fs-md); }
.filter-chat-name {
  flex: 1;
  min-width: 0;
  font-size: var(--fs-md);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.filter-chat-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
  flex: none;
  accent-color: var(--accent);
}

/* --- Disappearing messages ---------------------------------------------- */
.ttl-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0 16px;
}
.ttl-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1.5px solid transparent;
  border-radius: var(--r-lg);
  background: var(--bg-2);
  text-align: left;
}
.ttl-option:hover { background: var(--bg-3); }
.ttl-option.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.ttl-option-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ttl-option-title { font-size: var(--fs-base); font-weight: 600; }
.ttl-option-hint { font-size: var(--fs-xs); color: var(--muted); }
.ttl-option.selected .privacy-check {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
}
.ttl-row .user-sub { color: var(--muted); }

/* --- Polls --------------------------------------------------------------- */
.poll-bubble .bubble { min-width: 232px; }
.poll {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 210px;
}
.poll-question {
  font-size: var(--fs-sm);
  font-weight: 600;
  line-height: 1.35;
  word-break: break-word;
}
.poll-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-2xs);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.poll-head svg { width: 14px; height: 14px; flex: none; }
.poll-options { display: flex; flex-direction: column; gap: 6px; }
.poll-option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--r-md);
  background: var(--bg-2);
  overflow: hidden;
  text-align: left;
  font-size: var(--fs-sm);
  color: var(--text);
}
.msg.out .poll-option { background: rgba(255, 255, 255, 0.35); }
.poll-bar {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--accent-soft);
  transition: width 0.25s ease;
}
.msg.out .poll-bar { background: rgba(255, 255, 255, 0.5); }
.poll-option.mine .poll-bar { background: var(--accent); opacity: 0.22; }
.poll-option.mine { box-shadow: inset 0 0 0 1.5px var(--accent); }
.poll-option-text {
  position: relative;
  flex: 1;
  min-width: 0;
  word-break: break-word;
}
.poll-option-count {
  position: relative;
  flex: none;
  font-size: var(--fs-xs);
  color: var(--muted);
}
.poll-option-count b { color: var(--text); font-weight: 600; margin-right: 2px; }
.poll-option.closed { opacity: 0.85; }
.poll-option:disabled { cursor: default; }
.poll-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  /* The time/ticks meta sits in the bottom-right corner of the bubble. */
  padding-right: 52px;
  font-size: var(--fs-xs);
  color: var(--muted);
}
.poll-close {
  margin-left: auto;
  color: var(--accent);
  font-size: var(--fs-xs);
  font-weight: 600;
}

/* --- Attach sheet -------------------------------------------------------- */
.attach-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--r-lg);
  text-align: left;
  color: inherit;
}
.attach-row:hover { background: var(--bg-2); }
.attach-row-icon {
  width: 42px;
  height: 42px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-md);
  background: var(--accent-soft);
  color: var(--accent);
}
.attach-row-icon svg { width: 22px; height: 22px; }
.attach-row-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.attach-row-title { font-size: var(--fs-sm); font-weight: 600; }
.attach-row-sub { font-size: var(--fs-xs); color: var(--muted); }

/* --- Poll composer ------------------------------------------------------- */
.poll-options-label { display: block; margin-top: 12px; }
.poll-field-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 6px 0 10px;
}
.poll-field-row { display: flex; align-items: center; gap: 6px; }
.poll-field-row input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border-radius: var(--r-md);
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: var(--fs-sm);
}
.poll-field-row input:focus { border-color: var(--accent); outline: none; }
.poll-option-remove {
  width: 32px;
  height: 32px;
  flex: none;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
}
.poll-option-remove:hover { color: var(--danger); background: var(--bg-3); }
.poll-add-option { width: 100%; margin-bottom: 12px; }

/* --- PWA install --------------------------------------------------------- */
.install-status {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 10px 0;
}
.install-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--r-md);
  background: var(--bg-2);
}
.install-mark {
  width: 20px;
  height: 20px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  background: var(--danger-soft);
  color: var(--danger);
}
.install-row.ok .install-mark {
  background: var(--accent-soft);
  color: var(--accent);
}
.install-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.install-title { font-size: var(--fs-sm); font-weight: 600; }
.install-detail { font-size: var(--fs-xs); color: var(--muted); }
.install-row.ok .install-detail { display: none; }
/* The call diagnostics must show numbers even for healthy rows. */
.call-diag .install-row.ok .install-detail { display: block; }
.call-diag .install-title { font-size: var(--fs-base); }
.install-modal .modal-actions { flex-direction: row; }
.install-modal .modal-actions .modal-btn { flex: 1; }

/* --- Passkeys ------------------------------------------------------------ */
.passkey-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0;
}
.passkey-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-lg);
  background: var(--bg-2);
}
.passkey-icon {
  width: 34px;
  height: 34px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 18px;
}
.passkey-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.passkey-delete {
  width: 30px;
  height: 30px;
  flex: none;
  color: var(--muted);
  font-size: 18px;
}
.passkey-delete:hover { color: var(--danger); background: var(--bg-3); }
.passkey-empty {
  padding: 14px;
  text-align: center;
  color: var(--muted);
  font-size: var(--fs-sm);
}
.passkeys-modal > .modal-btn { width: 100%; margin-top: 4px; }

/* --- Safety numbers ------------------------------------------------------ */
.safety-number {
  margin: 12px 0;
  padding: 14px;
  border-radius: var(--r-lg);
  background: var(--bg-2);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: var(--fs-md);
  line-height: 1.7;
  letter-spacing: 0.08em;
  text-align: center;
  user-select: all;
  word-break: break-word;
}
.safety-fingerprints {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 8px 0 12px;
}
.safety-fingerprints > div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: var(--fs-xs);
  color: var(--muted);
}
.safety-fingerprints code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--text);
  word-break: break-all;
  text-align: right;
}
.safety-members {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0;
  max-height: 46vh;
  overflow: auto;
}
.safety-member {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.safety-member:last-child { border-bottom: none; }
.safety-fingerprint {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: var(--fs-2xs);
  color: var(--muted);
  word-break: break-all;
}

/* --- Quiet hours ---------------------------------------------------------- */
.quiet-hours {
  display: flex;
  gap: 10px;
  padding: 10px 12px 4px;
}
.quiet-hours[hidden] { display: none; }
.quiet-time {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}
.quiet-time span { color: var(--muted); font-size: var(--fs-xs); }
.quiet-time input {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border-radius: var(--r-md);
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: var(--fs-sm);
}
.quiet-time input:focus { border-color: var(--accent); outline: none; }

/* --- Stickers ------------------------------------------------------------ */
.bubble.has-sticker {
  background: transparent;
  box-shadow: none;
  padding: 0;
  max-width: none;
}
.msg.out .bubble.has-sticker { background: transparent; }
.sticker-wrap { display: block; }
.sticker-img {
  display: block;
  width: 160px;
  height: 160px;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}
.bubble.has-sticker .meta {
  align-self: flex-end;
  margin-top: 2px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.36);
  color: #fff;
  font-size: var(--fs-2xs);
}
.bubble.has-sticker .meta .edited-mark { color: #fff; }

.sticker-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 12px 0;
  max-height: 46vh;
  overflow: auto;
}
.sticker-cell { position: relative; }
.sticker-item {
  width: 100%;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-md);
  background: var(--bg-2);
}
.sticker-item:hover { background: var(--bg-3); }
.sticker-item img {
  width: 86%;
  height: 86%;
  object-fit: contain;
  pointer-events: none;
}
.sticker-item.sending { opacity: 0.45; pointer-events: none; }
.sticker-delete {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(17, 24, 39, 0.62);
  color: #fff;
  font-size: 15px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sticker-delete:hover { background: var(--danger); }
.sticker-actions {
  display: flex;
  gap: 8px;
  margin: 8px 0 0;
}
.sticker-actions[hidden] { display: none; }
.sticker-actions .modal-btn { flex: 1; }
.sticker-empty {
  grid-column: 1 / -1;
  padding: 20px;
  text-align: center;
  color: var(--muted);
  font-size: var(--fs-sm);
}

/* --- GIF picker ---------------------------------------------------------- */
.gif-tabs {
  display: flex;
  gap: 6px;
  margin: 10px 0 2px;
}
.gif-tab {
  flex: 1;
  padding: 8px 10px;
  border-radius: var(--r-md);
  background: var(--bg-2);
  color: var(--muted);
  font-size: var(--fs-sm);
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.gif-tab.active {
  background: var(--accent-soft);
  color: var(--accent);
}
.gif-mine-actions {
  display: flex;
  gap: 8px;
  margin: 8px 0 0;
}
.gif-mine-actions[hidden] { display: none; }
.gif-mine-actions .modal-btn { flex: 1; }

.gif-cell { position: relative; }
.gif-cell .gif-item { width: 100%; }
.gif-delete {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(17, 24, 39, 0.62);
  color: #fff;
  font-size: 16px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}
.gif-delete:hover { background: var(--danger); }

.gif-frames-pick {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  margin: 4px 0 6px;
  border: 1.5px dashed var(--line);
  border-radius: var(--r-lg);
  cursor: pointer;
}
.gif-frames-pick:hover { border-color: var(--accent); background: var(--bg-2); }
.gif-frames-pick input[type="file"] { display: none; }
.gif-frames-btn {
  padding: 7px 12px;
  border-radius: var(--r-md);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: var(--fs-sm);
  font-weight: 600;
  flex: none;
}
.gif-frames-count { font-size: var(--fs-xs); color: var(--muted); }

.gif-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 12px 0;
  max-height: 46vh;
  overflow: auto;
}
.gif-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--bg-2);
  text-align: center;
}
.gif-item img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}
.gif-item span {
  padding: 0 6px 6px;
  font-size: var(--fs-2xs);
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gif-item:hover { outline: 2px solid var(--accent); }
.gif-item.sending { opacity: 0.5; pointer-events: none; }
.gif-empty {
  grid-column: 1 / -1;
  padding: 20px;
  text-align: center;
  color: var(--muted);
  font-size: var(--fs-sm);
}

/* --- Scheduled messages -------------------------------------------------- */
.schedule-btn[hidden] { display: none; }

.scheduled-bar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--accent-soft);
  border-top: 1px solid var(--line);
  color: var(--accent);
  font-size: var(--fs-xs);
  position: relative;
  z-index: 4;
}
.scheduled-bar[hidden] { display: none; }
.scheduled-bar svg { width: 16px; height: 16px; flex: none; }
.scheduled-bar-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}
.scheduled-bar-open {
  flex: none;
  padding: 2px 4px;
  color: var(--accent);
  font-size: var(--fs-xs);
  font-weight: 600;
}
.scheduled-bar-open:hover { text-decoration: underline; }

.schedule-preview {
  margin: 10px 0;
  padding: 10px 12px;
  border-left: 3px solid var(--accent);
  border-radius: var(--r-md);
  background: var(--bg-2);
  font-size: var(--fs-sm);
  color: var(--text);
  max-height: 120px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
.schedule-reply {
  margin: -4px 0 10px;
  font-size: var(--fs-xs);
  color: var(--muted);
}
.schedule-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0 4px;
}
.schedule-quick-btn {
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--bg-2);
  color: var(--muted);
  font-size: var(--fs-xs);
}
.schedule-quick-btn:hover { background: var(--bg-3); color: var(--accent); }
.schedule-modal #scheduleWhen { width: 100%; }

.scheduled-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0;
  max-height: 50vh;
  overflow: auto;
}
.scheduled-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-lg);
  background: var(--bg-2);
}
.scheduled-item-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.scheduled-item-time {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-xs);
  color: var(--accent);
  font-weight: 600;
}
.scheduled-item-time svg { width: 14px; height: 14px; flex: none; }
.scheduled-item-text {
  font-size: var(--fs-sm);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.scheduled-item-cancel {
  width: 34px;
  height: 34px;
  flex: none;
  color: var(--muted);
}
.scheduled-item-cancel:hover { color: var(--danger); background: var(--bg-3); }
.scheduled-item-cancel svg { width: 18px; height: 18px; }
.scheduled-empty {
  padding: 18px 6px;
  text-align: center;
  color: var(--muted);
  font-size: var(--fs-sm);
}

/* --- In-app legal document editor (administrators) ----------------------- */
.legal-editor {
  width: 100%;
  max-width: 820px;
  height: 100%;
  min-height: 0;
  margin: 0 auto;
  padding: calc(18px + env(safe-area-inset-top)) 18px calc(16px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}
.legal-editor-head { padding-right: 44px; }
.legal-editor-tabs {
  display: flex;
  gap: 4px;
  margin: 16px 0 10px;
  padding: 4px;
  border-radius: var(--r-lg);
  background: var(--bg-3);
}
.legal-editor-tabs button {
  flex: 1;
  min-height: 38px;
  padding: 0 10px;
  border-radius: var(--r-md);
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--muted);
}
.legal-editor-tabs button[aria-selected="true"] {
  background: var(--bg);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.legal-editor-meta {
  min-height: 18px;
  margin-bottom: 8px;
  font-size: var(--fs-xs);
  color: var(--muted);
}
.legal-editor-textarea {
  flex: 1;
  width: 100%;
  min-height: 160px;
  resize: none;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--bg-2);
  color: var(--text);
  padding: 12px 14px;
  line-height: 1.55;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.legal-editor-textarea:focus { outline: none; border-color: var(--accent); }
.legal-editor-hint {
  margin: 8px 2px 0;
  font-size: var(--fs-xs);
  color: var(--muted);
}
.legal-editor-hint code {
  padding: 1px 4px;
  border-radius: 4px;
  background: var(--bg-3);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.legal-editor-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.legal-editor-actions .modal-btn { flex: 1; }
.legal-editor-loading {
  margin: auto;
  color: var(--muted);
}

/* ==========================================================================
   MUSIC
   ========================================================================== */
.music-upload { margin-bottom: 18px; }

.music-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.music-tabs {
  margin: 8px 0 12px;
}

.music-search {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 12px;
  border-radius: var(--r-lg);
  background: var(--bg-2);
  border: 1px solid var(--line);
}

.music-search svg { width: 18px; height: 18px; flex: none; color: var(--muted); }

.music-search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: var(--fs-lg);
}

.music-stream-btn {
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 42px;
  padding: 0 13px;
  border-radius: var(--r-lg);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: var(--fs-sm);
  font-weight: 600;
}

.music-stream-btn:hover { background: var(--accent); color: var(--on-accent); }
.music-stream-btn svg { width: 19px; height: 19px; }

.music-top {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.music-top-user {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 9px 12px;
  border-radius: var(--r-lg);
  background: var(--bg-2);
  border: 1px solid var(--line);
}

.music-top-user .avatar { width: 36px; height: 36px; flex: none; }

.music-top-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.music-top-name {
  overflow: hidden;
  color: var(--text);
  font-size: var(--fs-base);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.music-top-sub {
  overflow: hidden;
  color: var(--muted);
  font-size: var(--fs-xs);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.music-top-play {
  width: 34px;
  height: 34px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
}

.music-top-play svg { width: 17px; height: 17px; fill: currentColor; }

.music-like {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: none;
  min-width: 30px;
  height: 30px;
  padding: 0 5px;
  border-radius: 999px;
  color: var(--muted);
  font-size: var(--fs-xs);
}

.music-like svg { width: 19px; height: 19px; fill: none; }
.music-like:hover { color: var(--danger); }
.music-like.liked { color: var(--danger); }
.music-like.liked svg { fill: currentColor; }

.music-stream {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.music-stream-track {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: var(--r-lg);
  background: var(--bg-2);
}

.music-stream-icon {
  width: 42px;
  height: 42px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-lg);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 23px;
}

.music-stream-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.music-stream-title {
  overflow: hidden;
  font-size: var(--fs-base);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.music-stream-artist {
  overflow: hidden;
  color: var(--muted);
  font-size: var(--fs-xs);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.music-stream-actions { display: flex; flex-direction: column; gap: 8px; }

.music-add-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  min-height: 48px;
  border-radius: var(--r-lg);
  background: linear-gradient(140deg, var(--accent), var(--accent-strong));
  color: var(--on-accent);
  font-size: var(--fs-base);
  font-weight: 600;
  box-shadow: 0 8px 20px rgba(var(--accent-rgb), 0.24);
  transition: filter 0.15s, transform 0.12s, opacity 0.15s;
}

.music-add-btn:hover { filter: brightness(1.04); }
.music-add-btn:active { transform: scale(0.985); }
.music-add-btn:disabled { opacity: 0.6; cursor: default; }
.music-add-btn svg { width: 22px; height: 22px; }

.music-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.music-track {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 12px 14px;
  border-radius: var(--r-lg);
  background: var(--bg-2);
  border: 1px solid var(--line);
}

.music-track-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.music-track.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.music-track-play {
  width: 38px;
  height: 38px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  transition: background 0.15s, color 0.15s, transform 0.12s;
}

.music-track-play:hover { background: var(--accent); color: var(--on-accent); }
.music-track-play:active { transform: scale(0.94); }
.music-track-play svg { width: 17px; height: 17px; fill: currentColor; stroke: none; }
.music-track-play.playing { background: var(--accent); color: var(--on-accent); }

.music-track-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.music-track-title {
  overflow: hidden;
  color: var(--text);
  font-size: var(--fs-base);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.music-track-sub {
  overflow: hidden;
  color: var(--muted);
  font-size: var(--fs-xs);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.music-track-actions {
  display: flex;
  align-items: center;
  gap: 1px;
  flex: none;
}

.music-edit {
  width: 30px;
  height: 30px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--muted);
}

.music-edit:hover { background: var(--accent-soft); color: var(--accent); }
.music-edit svg { width: 17px; height: 17px; fill: none; }

.music-delete {
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 50%;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
}

.music-delete:hover { background: var(--danger-soft); color: var(--danger); }

.music-form { display: flex; flex-direction: column; }

/* Persistent mini player, docked under the chat list above the tab bar. */
.mini-player {
  position: relative;
  flex: none;
  margin: 2px 12px 0;
  padding: 6px 10px 7px;
  border-radius: var(--r-lg);
  background: var(--bg-2);
  border: 1px solid var(--line);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.22);
  z-index: 6;
}

.mini-player[hidden] { display: none; }

.mini-player-top {
  display: flex;
  align-items: center;
  gap: 9px;
}

.mini-player-seek {
  --seek-played: 0%;
  --seek-buffered: 0%;
  flex: 1;
  min-width: 0;
  height: 18px;
  margin: 0;
  padding: 0;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  cursor: pointer;
}

.mini-player-seek:disabled { cursor: default; opacity: 0.5; }

.mini-player-seek::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(
    to right,
    var(--accent) 0 var(--seek-played),
    rgba(var(--accent-rgb), 0.45) var(--seek-played) var(--seek-buffered),
    var(--bg-3) var(--seek-buffered) 100%
  );
}

.mini-player-seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 11px;
  height: 11px;
  margin-top: -3.5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--bg-2);
}

.mini-player-seek::-moz-range-track {
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(
    to right,
    var(--accent) 0 var(--seek-played),
    rgba(var(--accent-rgb), 0.45) var(--seek-played) var(--seek-buffered),
    var(--bg-3) var(--seek-buffered) 100%
  );
}

.mini-player-seek::-moz-range-thumb {
  width: 11px;
  height: 11px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
}

.mini-player.buffering .mini-player-time { color: var(--accent); }
.mini-player.buffering .mini-player-btn.primary svg { animation: mini-buffer-pulse 1s ease-in-out infinite; }

@keyframes mini-buffer-pulse {
  50% { opacity: 0.35; }
}

.mini-player-time {
  flex: none;
  color: var(--muted);
  font-size: var(--fs-2xs);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.mini-player-main {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.mini-player-info {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  text-align: left;
}

.mini-player-icon {
  width: 36px;
  height: 36px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-md);
  background: linear-gradient(140deg, var(--accent), var(--accent-strong));
  color: var(--on-accent);
  box-shadow: 0 6px 14px rgba(var(--accent-rgb), 0.28);
}

.mini-player-icon svg { width: 19px; height: 19px; }

.mini-player-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.mini-player-title {
  overflow: hidden;
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-player-artist {
  overflow: hidden;
  color: var(--muted);
  font-size: var(--fs-xs);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-player-actions {
  flex: none;
  display: flex;
  align-items: center;
  gap: 2px;
}

.mini-player-btn {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--text);
  transition: background 0.15s, color 0.15s, transform 0.12s;
}

.mini-player-btn:hover { background: var(--bg-3); }
.mini-player-btn:active { transform: scale(0.92); }
.mini-player-btn svg { width: 18px; height: 18px; fill: currentColor; stroke: none; }
.mini-player-btn.primary { background: var(--accent); color: var(--on-accent); }
.mini-player-btn.primary:hover { background: var(--accent-strong); }
.mini-player-btn.close { color: var(--muted); font-size: 22px; line-height: 1; }
.mini-player-btn.close:hover { background: var(--danger-soft); color: var(--danger); }

@media (min-width: 800px) {
  .mini-player { margin: 2px 14px 0; }
}

/* Mobile Safari zooms the whole page when a focused editable field is smaller
   than 16px. The "small" text size scale used to bring the composer and search
   down to 15px, so typing enlarged the screen. Keep every editable control at
   16px or larger regardless of the text size setting; pinch-to-zoom is still
   allowed because the viewport is not locked. */
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]):not([type="button"]):not([type="submit"]):not([type="reset"]),
textarea:not([disabled]):not([readonly]),
select:not([disabled]) {
  font-size: 16px;
  font-size: max(16px, var(--fs-lg));
}

