@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/fonts/nunito-500.ttf") format("truetype");
}
@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/fonts/nunito-600.ttf") format("truetype");
}
@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/fonts/nunito-700.ttf") format("truetype");
}
@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("/fonts/nunito-800.ttf") format("truetype");
}

:root {
  --bg: #0a1620;
  --bg-warm: #12202c;
  --panel: #142433;
  --panel-2: #1a3040;
  --text: #f0f6fa;
  --muted: #8fa9b8;
  --accent: #1a8fa8;
  --accent-hot: #e11d2e;
  --accent-deep: #002d50;
  --accent-2: #0b4f6c;
  --mine: #0b4f6c;
  --theirs: #243848;
  --theirs-2: #2c4558;
  --danger: #e11d2e;
  --border: #2a4558;
  --focus: #1a8fa8;
  --radius: 12px;
  --radius-sm: 10px;
  --shadow: 0 10px 28px #0006;
  --sidebar-width: 340px;
  --layout-gap: 0.55rem;
  --topbar-height: 4.75rem;
  --bottombar-height: 4.25rem;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  font-family: "Nunito", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  height: 100dvh;
  max-width: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
}
html, body, .app, .thread, .sidebar, .modal-card {
  min-width: 0;
}

[hidden] {
  display: none !important;
}

.muted { color: var(--muted); font-size: 0.85rem; }
.error { color: var(--danger); font-size: 0.9rem; margin: 0.35rem 0 0; }
.grow { flex: 1; min-width: 0; }

button {
  font-family: inherit;
  background: linear-gradient(135deg, #002d50 0%, #0b6f8f 48%, #1a8fa8 120%);
  color: #fff;
  border: 0;
  border-radius: 999px;
  padding: 0.65rem 1.15rem;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 4px 14px #002d5044;
  transition: transform 0.12s ease, filter 0.12s ease, box-shadow 0.12s ease;
}
button:hover {
  filter: brightness(1.06);
  box-shadow: 0 6px 18px #002d5055;
}
button:active { transform: translateY(1px); }
button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
.ghost {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text);
  box-shadow: none;
  border-radius: 999px;
  font-weight: 600;
}
.ghost:hover {
  filter: none;
  background: var(--panel-2);
  border-color: var(--accent);
  color: #fff;
  box-shadow: none;
}

input, textarea, select {
  font-family: inherit;
  background: var(--panel-2);
  border: 1.5px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 0.7rem 0.85rem;
  width: 100%;
  font-size: 16px; /* keep ≥16px — smaller fonts cause iOS focus zoom / clipped viewport */
  max-width: 100%;
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
input::placeholder,
textarea::placeholder {
  color: #7e93a1;
}
input:hover,
textarea:hover,
select:hover {
  border-color: #3d5a6a;
}
input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px #2a9bb540;
  background: #203a48;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #c5d4dc;
  margin: 0 0 0.85rem;
}

.pw-row {
  display: flex;
  gap: 0.45rem;
  align-items: stretch;
}
.pw-row input { flex: 1; width: auto; margin: 0; }
.pw-toggle-btn,
.cam-scan-btn {
  flex: 0 0 auto;
  min-width: 48px;
  padding: 0 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--bg-warm);
  color: var(--text);
  border: 1.5px solid var(--border);
  font-size: 0.78rem;
  font-weight: 700;
  box-shadow: none;
}
.pw-toggle-btn {
  width: 48px;
  padding: 0;
  position: relative;
}
.pw-toggle-btn::before {
  content: "";
  display: block;
  width: 22px;
  height: 22px;
  margin: 0 auto;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 12s4-7 11-7 11 7 11 7-4 7-11 7S1 12 1 12z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 12s4-7 11-7 11 7 11 7-4 7-11 7S1 12 1 12z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E") center / contain no-repeat;
}
.pw-toggle-btn.is-shown::before {
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17.94 17.94A10.94 10.94 0 0 1 12 19c-7 0-11-7-11-7a21.8 21.8 0 0 1 5.06-5.94'/%3E%3Cpath d='M9.9 4.24A10.94 10.94 0 0 1 12 5c7 0 11 7 11 7a21.85 21.85 0 0 1-2.16 3.19'/%3E%3Cpath d='M14.12 14.12a3 3 0 1 1-4.24-4.24'/%3E%3Cline x1='1' y1='1' x2='23' y2='23'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17.94 17.94A10.94 10.94 0 0 1 12 19c-7 0-11-7-11-7a21.8 21.8 0 0 1 5.06-5.94'/%3E%3Cpath d='M9.9 4.24A10.94 10.94 0 0 1 12 5c7 0 11 7 11 7a21.85 21.85 0 0 1-2.16 3.19'/%3E%3Cpath d='M14.12 14.12a3 3 0 1 1-4.24-4.24'/%3E%3Cline x1='1' y1='1' x2='23' y2='23'/%3E%3C/svg%3E") center / contain no-repeat;
}
.cam-scan-btn {
  width: 48px;
  padding: 0;
  position: relative;
}
.cam-scan-btn::before {
  content: "";
  display: block;
  width: 22px;
  height: 22px;
  margin: 0 auto;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z'/%3E%3Ccircle cx='12' cy='13' r='4'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z'/%3E%3Ccircle cx='12' cy='13' r='4'/%3E%3C/svg%3E") center / contain no-repeat;
}
.pw-toggle-btn:hover,
.cam-scan-btn:hover {
  filter: none;
  border-color: var(--accent);
  background: var(--panel-2);
  box-shadow: none;
}

.scan-overlay {
  position: fixed;
  inset: 0;
  background: #000c;
  display: none;
  place-items: center;
  z-index: 40;
  padding: 1rem;
}
.scan-overlay.is-open { display: grid; }
.scan-box { width: min(480px, 100%); text-align: center; }
.scan-view {
  position: relative;
  margin: 0.8rem 0;
  border-radius: 16px;
  overflow: hidden;
  background: #000;
}
#scan-video { width: 100%; max-height: 55dvh; display: block; }

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: max(1rem, env(safe-area-inset-top)) 1rem max(1.5rem, env(safe-area-inset-bottom));
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background:
    radial-gradient(ellipse 80% 50% at 20% -10%, #2a8fad33, transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 30%, #0b4f6c28, transparent 50%),
    radial-gradient(ellipse 50% 35% at 0% 80%, #5eb8d418, transparent 45%),
    var(--bg);
}
.auth-shell {
  width: min(980px, 100%);
  margin: 0.5rem auto 1.5rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  align-items: stretch;
}
.auth-hero {
  display: none;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid #35474b;
  box-shadow: var(--shadow);
  background: linear-gradient(135deg, #e8b4a4 0%, #7aa8a0 100%);
  min-height: 0;
  align-self: stretch;
}
.auth-hero-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
  background: linear-gradient(145deg, #e8b4a4 0%, #8bb5ad 55%, #5a9088 100%);
}
.auth-card {
  width: min(420px, 100%);
  justify-self: center;
  background: linear-gradient(180deg, #24363a 0%, var(--panel) 40%);
  padding: 1.35rem 1.35rem 1.5rem;
  border-radius: 20px;
  margin: 0;
  flex: 0 0 auto;
  border: 1px solid #35474b;
  box-shadow: var(--shadow);
}
.auth-card form button[type="submit"] {
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.8rem 1rem;
  font-size: 1rem;
}
.auth-card label {
  font-size: 0.92rem;
  font-weight: 700;
  color: #e8eef0;
  margin-bottom: 0.55rem;
}
.auth-card input,
.auth-card textarea,
.auth-card select {
  background: #f7f3ef;
  border: 1.5px solid #d5cdc4;
  color: #1a2224;
  font-weight: 600;
}
.auth-card input::placeholder,
.auth-card textarea::placeholder {
  color: #5c6a6e;
  opacity: 1;
  font-weight: 600;
  text-transform: capitalize;
}
.auth-card input:hover,
.auth-card textarea:hover,
.auth-card select:hover {
  border-color: #b8aea3;
  background: #fffaf6;
}
.auth-card input:focus,
.auth-card textarea:focus,
.auth-card select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px #58999155;
  background: #fff;
  color: #121a1c;
}
.auth-card input:-webkit-autofill,
.auth-card input:-webkit-autofill:hover,
.auth-card input:-webkit-autofill:focus {
  -webkit-text-fill-color: #1a2224;
  box-shadow: 0 0 0 1000px #f7f3ef inset;
  transition: background-color 99999s ease-out;
}
.auth-card .pw-toggle-btn,
.auth-card .cam-scan-btn {
  border-color: #c9c0b6;
  color: #3a4548;
  background: #fff;
}
.auth-card .muted {
  color: #c5d0d3;
  font-size: 0.92rem;
  line-height: 1.45;
}
.brand-mark {
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #5eb8d4;
  margin: 0 0 0.15rem;
  font-size: 0.85rem;
}
.brand-lockup {
  display: block;
  width: min(280px, 78%);
  height: auto;
  margin: 0.15rem auto 0.55rem;
  border-radius: 14px;
  background: transparent;
  padding: 0;
  box-shadow: none;
}
.brand-lockup-sm {
  width: min(200px, 55%);
  padding: 0;
  margin-bottom: 0.85rem;
}
.brand-tagline {
  text-align: center;
  margin: 0 0 1.1rem;
  line-height: 1.45;
  font-size: 1rem;
  font-weight: 600;
  color: #d7e2e5;
}
.brand-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  flex: 1;
  max-height: 100%;
}
.brand-row > div {
  min-width: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.05rem;
}
#me-name,
#me-email,
.brand-mark {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  line-height: 1.2;
}
.brand-mark {
  font-size: 0.72rem;
  margin: 0;
}
#me-name {
  font-size: 0.95rem;
}
#me-email {
  font-size: 0.75rem;
}
.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  flex-shrink: 0;
  object-fit: cover;
  background: #f4f1ec;
  box-shadow: 0 2px 8px #0005;
  display: block;
}
.me-avatar-btn {
  padding: 2px;
  border: 0;
  background: transparent;
  border-radius: 14px;
  cursor: pointer;
  flex-shrink: 0;
  line-height: 0;
}
.me-avatar-btn.has-status-glow {
  background: transparent;
  box-shadow: none;
  position: relative;
}
.me-avatar-btn.has-status-glow::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 14px;
  padding: 2px;
  background: linear-gradient(135deg, #ff1744 0%, #ff9100 50%, #ff1744 100%);
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  mask-composite: exclude;
  pointer-events: none;
}
.me-avatar-btn:not(.has-status-glow):hover .brand-icon,
.me-avatar-btn:not(.has-status-glow):focus-visible .brand-icon {
  box-shadow: 0 0 0 2px #7ed4e888, 0 2px 8px #0005;
}
.me-avatar-btn:focus-visible {
  outline: none;
}
.me-avatar-btn.has-status-glow .brand-icon {
  box-shadow: none;
  position: relative;
  z-index: 1;
}
.thread-empty-inner {
  display: grid;
  place-items: center;
  height: 100%;
  padding: 1.5rem;
  text-align: center;
}
@media (min-height: 700px) {
  .auth-screen {
    justify-content: center;
  }
}
@media (min-width: 900px) {
  .auth-shell {
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    align-items: stretch;
    width: min(1040px, 100%);
    height: min(780px, calc(100dvh - 2.5rem));
    min-height: min(780px, calc(100dvh - 2.5rem));
    max-height: calc(100dvh - 2.5rem);
    margin: 0 auto;
  }
  .auth-hero,
  .auth-card {
    height: 100%;
    min-height: 0;
    max-height: none;
    margin: 0;
    align-self: stretch;
    border-radius: 22px;
    border: 1px solid #35474b;
    box-shadow: var(--shadow);
    overflow: hidden;
  }
  .auth-hero {
    display: block;
    position: relative;
  }
  .auth-hero-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-height: none;
    object-fit: cover;
    object-position: center top;
  }
  .auth-card {
    width: 100%;
    justify-self: stretch;
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-sizing: border-box;
    padding: 1.75rem 1.85rem 1.9rem;
  }
  .auth-card .brand-lockup {
    margin-top: 0;
    margin-bottom: 0.55rem;
  }
  .auth-card .brand-tagline {
    margin-bottom: 1.15rem;
  }
  .auth-card form {
    display: flex;
    flex-direction: column;
    flex: 0 1 auto;
  }
  .auth-card form[hidden] {
    display: none !important;
  }
  .brand-lockup {
    width: min(300px, 72%);
  }
}
.tabs {
  display: flex;
  gap: 0.35rem;
  margin: 1.1rem 0 1.15rem;
  padding: 0.3rem;
  background: var(--bg-warm);
  border-radius: 999px;
  border: 1px solid var(--border);
}
.tab {
  flex: 1;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  border-radius: 999px;
  padding: 0.55rem 0.7rem;
  font-weight: 700;
  font-size: 0.88rem;
}
.tab:hover {
  filter: none;
  background: #243844;
  color: var(--text);
  box-shadow: none;
}
.tab.active {
  background: linear-gradient(135deg, var(--accent-hot), #ff5e8a 70%);
  color: #fff;
  box-shadow: 0 3px 10px #ff7a4533;
}
.auth-tabs {
  background: #152226;
  border-color: #3d5256;
}
.auth-tabs .tab {
  min-height: 2.55rem;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  color: #b8c6ca;
  background: transparent;
  border: 1.5px solid transparent;
}
.auth-tabs .tab:hover {
  background: #2a3c40;
  color: #f3f7f8;
}
.auth-tabs .tab.active {
  background: linear-gradient(135deg, #0b6f8f 0%, #2a8fad 55%, #5eb8d4 140%);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 3px 12px #0b6f8f44;
}
.auth-tabs .tab:not(.active) {
  background: #24363a;
  border-color: #3f5559;
  color: #e2ebed;
}

.app {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
  height: 100%;
  height: 100dvh;
  max-height: 100dvh;
  max-width: 100%;
  overflow: hidden;
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}
.sidebar {
  grid-column: 1;
  grid-row: 1;
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}
.thread {
  grid-column: 2;
  grid-row: 1 / -1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  overflow: hidden;
  background: #0e1a22;
}
.sidebar-tools {
  grid-column: 1;
  grid-row: 2;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
  flex-shrink: 0;
  flex-wrap: nowrap;
  box-sizing: border-box;
  height: calc(var(--bottombar-height) + var(--safe-bottom));
  min-height: calc(var(--bottombar-height) + var(--safe-bottom));
  max-height: calc(var(--bottombar-height) + var(--safe-bottom));
  padding: 0 0.85rem;
  padding-bottom: var(--safe-bottom);
  border-top: 1px solid var(--border);
  border-right: 1px solid var(--border);
  background: var(--panel-2);
  z-index: 6;
  min-width: 0;
  overflow: hidden;
}
.sidebar-head,
.thread-head {
  display: flex;
  align-items: center;
  gap: var(--layout-gap);
  height: var(--topbar-height);
  min-height: var(--topbar-height);
  max-height: var(--topbar-height);
  padding: 0 0.85rem;
  background: var(--panel-2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  min-width: 0;
  box-sizing: border-box;
  overflow: hidden;
}
.thread-head {
  flex-wrap: nowrap;
}
.thread-heading {
  min-width: 0;
  overflow: hidden;
}
.thread-heading strong,
.thread-heading .thread-title-btn,
.thread-heading .muted {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.25;
}
.thread-heading strong,
.thread-heading .thread-title-btn {
  font-size: 0.98rem;
}
.thread-title-btn {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 800;
  letter-spacing: normal;
  text-align: left;
  cursor: pointer;
  max-width: 100%;
  box-shadow: none;
  filter: none;
}
.thread-title-btn:hover,
.thread-title-btn:focus-visible {
  color: #7ed4e8;
  outline: none;
  background: transparent;
  box-shadow: none;
  filter: none;
}
.thread-title-btn:disabled {
  cursor: default;
  color: inherit;
  box-shadow: none;
  filter: none;
}
.thread-heading .muted {
  font-size: 0.78rem;
}
.presence-label.is-offline.has-last-seen {
  cursor: help;
  border-bottom: 1px dotted currentColor;
}
.presence-label.is-busy {
  color: var(--accent-hot);
}
.thread-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
  flex-wrap: nowrap;
  max-width: min(58%, 440px);
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}
.sidebar-head .ghost:not(.icon-btn),
.thread-head .ghost:not(.icon-btn),
.thread-actions .ghost:not(.icon-btn) {
  padding: 0.4rem 0.7rem;
  font-size: 0.8rem;
  white-space: nowrap;
  height: 2.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.thread-actions .icon-btn {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
}
.icon-btn {
  width: 40px;
  height: 40px;
  padding: 0 !important;
  display: grid;
  place-items: center;
  border-radius: 999px;
}
.icon-btn::before {
  content: "";
  display: block;
  width: 20px;
  height: 20px;
  background: currentColor;
  -webkit-mask: center / contain no-repeat;
  mask: center / contain no-repeat;
}
.logout-icon-btn::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4'/%3E%3Cpolyline points='16 17 21 12 16 7'/%3E%3Cline x1='21' y1='12' x2='9' y2='12'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4'/%3E%3Cpolyline points='16 17 21 12 16 7'/%3E%3Cline x1='21' y1='12' x2='9' y2='12'/%3E%3C/svg%3E");
}
.invites-icon-btn::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='9' cy='7' r='4'/%3E%3Cline x1='19' y1='8' x2='19' y2='14'/%3E%3Cline x1='22' y1='11' x2='16' y2='11'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='9' cy='7' r='4'/%3E%3Cline x1='19' y1='8' x2='19' y2='14'/%3E%3Cline x1='22' y1='11' x2='16' y2='11'/%3E%3C/svg%3E");
}
.add-member-icon-btn::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='9' cy='7' r='4'/%3E%3Cline x1='19' y1='8' x2='19' y2='14'/%3E%3Cline x1='22' y1='11' x2='16' y2='11'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='9' cy='7' r='4'/%3E%3Cline x1='19' y1='8' x2='19' y2='14'/%3E%3Cline x1='22' y1='11' x2='16' y2='11'/%3E%3C/svg%3E");
}
.profile-icon-btn::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='12' cy='7' r='4'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='12' cy='7' r='4'/%3E%3C/svg%3E");
}
.status-icon-btn::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 8v4l2.5 1.5'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 8v4l2.5 1.5'/%3E%3C/svg%3E");
}
.support-icon-btn::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='10' r='3'/%3E%3Cpath d='M5 20v-1a7 7 0 0 1 14 0v1'/%3E%3Cpath d='M4 10a8 8 0 0 1 16 0'/%3E%3Cpath d='M2 10v3a2 2 0 0 0 2 2h1'/%3E%3Cpath d='M22 10v3a2 2 0 0 1-2 2h-1'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='10' r='3'/%3E%3Cpath d='M5 20v-1a7 7 0 0 1 14 0v1'/%3E%3Cpath d='M4 10a8 8 0 0 1 16 0'/%3E%3Cpath d='M2 10v3a2 2 0 0 0 2 2h1'/%3E%3Cpath d='M22 10v3a2 2 0 0 1-2 2h-1'/%3E%3C/svg%3E");
}
.voice-icon-btn::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z'/%3E%3Cpath d='M19 10v2a7 7 0 0 1-14 0v-2'/%3E%3Cline x1='12' y1='19' x2='12' y2='23'/%3E%3Cline x1='8' y1='23' x2='16' y2='23'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z'/%3E%3Cpath d='M19 10v2a7 7 0 0 1-14 0v-2'/%3E%3Cline x1='12' y1='19' x2='12' y2='23'/%3E%3Cline x1='8' y1='23' x2='16' y2='23'/%3E%3C/svg%3E");
}
.voice-icon-btn.is-recording {
  color: var(--danger, #e85d6f) !important;
  border-color: #e85d6f66 !important;
  background: #e85d6f22 !important;
}
.voice-icon-btn.is-recording::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Crect x='6' y='6' width='12' height='12' rx='2'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Crect x='6' y='6' width='12' height='12' rx='2'/%3E%3C/svg%3E");
}
.camera-icon-btn::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z'/%3E%3Ccircle cx='12' cy='13' r='4'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z'/%3E%3Ccircle cx='12' cy='13' r='4'/%3E%3C/svg%3E");
}
.attach-icon-btn::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48'/%3E%3C/svg%3E");
}
.mute-icon-btn::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M11 5L6 9H2v6h4l5 4V5z'/%3E%3Cpath d='M19.07 4.93a10 10 0 0 1 0 14.14'/%3E%3Cpath d='M15.54 8.46a5 5 0 0 1 0 7.07'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M11 5L6 9H2v6h4l5 4V5z'/%3E%3Cpath d='M19.07 4.93a10 10 0 0 1 0 14.14'/%3E%3Cpath d='M15.54 8.46a5 5 0 0 1 0 7.07'/%3E%3C/svg%3E");
}
.mute-icon-btn.is-on::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M11 5L6 9H2v6h4l5 4V5z'/%3E%3Cline x1='23' y1='9' x2='17' y2='15'/%3E%3Cline x1='17' y1='9' x2='23' y2='15'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M11 5L6 9H2v6h4l5 4V5z'/%3E%3Cline x1='23' y1='9' x2='17' y2='15'/%3E%3Cline x1='17' y1='9' x2='23' y2='15'/%3E%3C/svg%3E");
}
.archive-icon-btn::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='21 8 21 21 3 21 3 8'/%3E%3Crect x='1' y='3' width='22' height='5'/%3E%3Cline x1='10' y1='12' x2='14' y2='12'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='21 8 21 21 3 21 3 8'/%3E%3Crect x='1' y='3' width='22' height='5'/%3E%3Cline x1='10' y1='12' x2='14' y2='12'/%3E%3C/svg%3E");
}
.block-icon-btn::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cline x1='4.93' y1='4.93' x2='19.07' y2='19.07'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cline x1='4.93' y1='4.93' x2='19.07' y2='19.07'/%3E%3C/svg%3E");
}
.mute-icon-btn.is-on,
.archive-icon-btn.is-on,
.block-icon-btn.is-on {
  color: var(--accent-hot);
  border-color: #e85d6f66;
}
.emoji-icon-btn::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M8 14s1.5 2 4 2 4-2 4-2'/%3E%3Cline x1='9' y1='9' x2='9.01' y2='9'/%3E%3Cline x1='15' y1='9' x2='15.01' y2='9'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M8 14s1.5 2 4 2 4-2 4-2'/%3E%3Cline x1='9' y1='9' x2='9.01' y2='9'/%3E%3Cline x1='15' y1='9' x2='15.01' y2='9'/%3E%3C/svg%3E");
}
.giphy-icon-btn::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='18' height='18' rx='2'/%3E%3Cpath d='M8 8h3v8H9.5v-2.5H8.2a2 2 0 0 1 0-4H8zm5.5 0H16a2 2 0 0 1 0 4h-1.25V16H13.5z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='18' height='18' rx='2'/%3E%3Cpath d='M8 8h3v8H9.5v-2.5H8.2a2 2 0 0 1 0-4H8zm5.5 0H16a2 2 0 0 1 0 4h-1.25V16H13.5z'/%3E%3C/svg%3E");
}
.camera-overlay {
  position: fixed;
  inset: 0;
  background: #000c;
  display: none;
  place-items: center;
  z-index: 35;
  padding: max(0.75rem, var(--safe-top)) 0.75rem max(0.75rem, var(--safe-bottom));
  overflow: auto;
}
.camera-overlay.is-open { display: grid; }
.camera-box {
  width: min(640px, 100%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1rem;
  box-shadow: var(--shadow);
  min-width: 0;
}
.camera-view {
  position: relative;
  margin: 0.75rem 0;
  border-radius: 14px;
  overflow: hidden;
  background: #000;
  aspect-ratio: 4 / 3;
  max-height: min(60dvh, 520px);
}
#camera-video,
#camera-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #000;
}
.camera-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: flex-end;
}
.camera-actions button {
  flex: 1 1 auto;
  min-width: 6.5rem;
}
.voice-overlay {
  position: fixed;
  inset: 0;
  background: #000c;
  display: none;
  place-items: center;
  z-index: 35;
  padding: max(0.75rem, var(--safe-top)) 0.75rem max(0.75rem, var(--safe-bottom));
  overflow: auto;
}
.voice-overlay.is-open { display: grid; }
.voice-box {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.15rem;
  box-shadow: var(--shadow);
  min-width: 0;
  display: grid;
  gap: 0.85rem;
}
#voice-preview {
  width: 100%;
  max-width: 100%;
}
.voice-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: flex-end;
}
.voice-actions button {
  flex: 1 1 auto;
  min-width: 6.5rem;
}

.status-overlay {
  position: fixed;
  inset: 0;
  background: #05080ccc;
  display: none;
  z-index: 40;
  padding: max(0.65rem, var(--safe-top)) 0.65rem max(0.85rem, var(--safe-bottom));
}
.status-overlay.is-open {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}
.status-top {
  display: grid;
  gap: 0.55rem;
  z-index: 2;
  min-width: 0;
}
.status-progress {
  display: flex;
  gap: 0.28rem;
}
.status-progress span {
  flex: 1;
  height: 3px;
  border-radius: 999px;
  background: #ffffff33;
  overflow: hidden;
}
.status-progress span i {
  display: block;
  height: 100%;
  width: 0;
  background: #fff;
  border-radius: inherit;
}
.status-progress span.is-done i {
  width: 100%;
}
.status-progress span.is-active i {
  width: var(--status-progress, 0%);
  transition: width 0.05s linear;
}
.status-meta {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  min-width: 0;
  padding: 0 0.15rem;
}
.status-meta strong {
  color: #fff;
  font-size: 0.98rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.status-meta .muted {
  color: #c5d4dc;
  font-size: 0.82rem;
  flex-shrink: 0;
}
.status-top {
  grid-template-columns: 1fr auto auto;
  align-items: start;
}
.status-progress {
  grid-column: 1 / -1;
}
.status-meta {
  grid-column: 1;
}
.status-delete-btn {
  padding: 0.35rem 0.7rem !important;
  font-size: 0.82rem !important;
  min-height: 0;
}
.status-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
  overflow: hidden;
}
#status-image {
  max-width: min(100%, 720px);
  max-height: min(78dvh, 900px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 14px;
  background: #000;
}
#status-caption {
  position: absolute;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%);
  width: min(90%, 560px);
  margin: 0;
  padding: 0.55rem 0.75rem;
  border-radius: 12px;
  background: #000a;
  color: #fff;
  text-align: center;
  font-weight: 600;
  z-index: 1;
}
.status-stage:has(#status-viewers:not([hidden])) #status-caption {
  bottom: calc(0.75rem + min(38%, 220px) + 0.45rem);
}
#status-caption:empty {
  display: none;
}
.status-viewers {
  position: absolute;
  left: 50%;
  bottom: 0.75rem;
  transform: translateX(-50%);
  width: min(92%, 420px);
  max-height: min(38%, 220px);
  overflow: auto;
  padding: 0.55rem 0.7rem;
  border-radius: 12px;
  background: #0a1218ee;
  border: 1px solid #ffffff22;
  color: #fff;
  z-index: 2;
}
.status-viewers-title {
  margin: 0 0 0.35rem;
  font-size: 0.82rem;
  font-weight: 800;
}
.status-viewers-empty {
  margin: 0;
  color: #c5d4dc !important;
  font-size: 0.82rem;
}
.status-viewer-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.3rem;
}
.status-viewer-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.86rem;
}
.status-viewer-name {
  font-weight: 700;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.status-viewer-time {
  flex-shrink: 0;
  color: #c5d4dc !important;
  font-size: 0.75rem;
}
.status-hub-views {
  display: grid;
  gap: 0.55rem;
  margin: 0.15rem 0 0.35rem;
}
.status-hub-view-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel-2);
  padding: 0.45rem 0.55rem 0.55rem;
}
.status-hub-view-open {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  margin: 0;
  padding: 0.2rem;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  box-shadow: none;
  text-align: left;
  font: inherit;
  letter-spacing: normal;
  cursor: pointer;
}
.status-hub-view-open:hover,
.status-hub-view-open:focus-visible {
  background: #243844;
  filter: none;
  box-shadow: none;
  outline: none;
}
.status-hub-view-open img {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  background: #111;
}
.status-hub-view-copy {
  display: grid;
  gap: 0.1rem;
  min-width: 0;
}
.status-hub-view-copy strong {
  font-size: 0.92rem;
}
.status-hub-view-names {
  margin: 0.35rem 0 0 0.2rem;
  font-size: 0.82rem;
  line-height: 1.35;
}
.status-nav {
  position: absolute;
  top: 20%;
  bottom: 12%;
  width: 42%;
  border: 0;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  padding: 0;
  cursor: pointer;
}
.status-nav:hover,
.status-nav:active {
  filter: none;
  box-shadow: none;
  transform: none;
}
.status-prev { left: 0; }
.status-next { right: 0; }

.status-hub {
  display: grid;
  gap: 1rem;
}
.status-hub-mine,
.status-hub-list {
  display: grid;
  gap: 0.55rem;
}
.status-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  text-align: left;
  background: var(--panel-2);
  border: 1.5px solid var(--border);
  color: var(--text);
  box-shadow: none;
  border-radius: 14px;
  padding: 0.65rem 0.75rem;
  font-weight: 600;
}
.status-row:hover {
  filter: none;
  border-color: var(--accent);
  background: #243844;
  box-shadow: none;
}
.status-ring {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  padding: 2px;
  background: linear-gradient(135deg, var(--accent-hot), #2a9bb5);
  flex-shrink: 0;
}
.status-ring.is-empty {
  background: var(--border);
}
.status-ring img,
.status-ring-fallback {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--panel-2);
  background: #1e5a6e;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #7ed4e8;
}
.status-row-copy {
  min-width: 0;
  flex: 1;
  display: grid;
  gap: 0.1rem;
}
.status-row-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.status-compose {
  display: grid;
  gap: 0.75rem;
}
.status-compose-preview {
  width: 100%;
  max-height: 240px;
  object-fit: contain;
  border-radius: 12px;
  background: #000;
  border: 1px solid var(--border);
}
.status-compose-preview:not([src]),
.status-compose-preview[hidden] {
  display: none;
}

.mfa-setup-box {
  display: grid;
  gap: 0.65rem;
  margin: 0.75rem 0;
  justify-items: start;
}
.mfa-qr {
  border-radius: 12px;
  background: #fff;
  padding: 0.5rem;
  max-width: 100%;
  height: auto;
}
.mfa-secret {
  display: block;
  word-break: break-all;
  font-size: 0.85rem;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  background: var(--panel);
  border: 1px solid var(--border);
}
.mfa-recovery-box {
  position: relative;
  margin-top: 0.65rem;
}
.mfa-recovery {
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.95rem;
  line-height: 1.6;
  padding: 0.75rem 3rem 0.75rem 0.85rem;
  margin: 0;
  border-radius: 10px;
  background: var(--panel);
  border: 1px solid var(--border);
}
.mfa-recovery-copy {
  position: absolute;
  top: 0.45rem;
  right: 0.45rem;
  width: 36px;
  height: 36px;
}
.copy-icon-btn::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='9' y='9' width='13' height='13' rx='2' ry='2'/%3E%3Cpath d='M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='9' y='9' width='13' height='13' rx='2' ry='2'/%3E%3Cpath d='M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1'/%3E%3C/svg%3E");
}
.copy-icon-btn.is-copied::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
}
.copy-icon-btn.is-copied {
  color: #7ed4e8;
  border-color: var(--accent);
}
.mfa-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}
.profile-panel {
  display: grid;
  gap: 0;
}
.profile-hero {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.15rem 0 1rem;
  margin-bottom: 0.15rem;
  border-bottom: 1px solid var(--border);
}
.profile-hero-copy {
  display: grid;
  gap: 0.55rem;
  min-width: 0;
  flex: 1;
}
.profile-email {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  word-break: break-word;
}
.profile-section {
  padding: 0.95rem 0 0.15rem;
  border-bottom: 1px solid var(--border);
}
.profile-section:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}
.profile-section-title {
  margin: 0 0 0.45rem;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.profile-avatar-preview {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--panel-2);
  border: 2px solid var(--border);
  flex-shrink: 0;
}
.profile-photo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  min-width: 0;
}
.profile-photo-actions button {
  min-height: 2.35rem;
}
.profile-hint {
  margin: 0.35rem 0 0;
  line-height: 1.45;
}
.profile-section .check-row {
  margin: 0.4rem 0 0;
  gap: 0.45rem;
  align-items: flex-start;
}
.profile-status {
  margin: 0.55rem 0 0;
  font-weight: 700;
}
.profile-section .mfa-actions {
  margin-top: 0.85rem;
}
.chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--panel-2);
  display: block;
}
.chat-avatar-ring {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  padding: 0;
  box-sizing: border-box;
  background: transparent;
  position: relative;
  isolation: isolate;
}
button.chat-avatar-btn {
  margin: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  box-shadow: none;
  color: inherit;
  font: inherit;
  letter-spacing: normal;
  cursor: pointer;
  line-height: 0;
}
button.chat-avatar-btn:hover,
button.chat-avatar-btn:focus-visible,
button.chat-avatar-btn:active {
  filter: none;
  box-shadow: none;
  transform: none;
  outline: none;
}
button.chat-avatar-btn:focus-visible {
  box-shadow: 0 0 0 2px #7ed4e888;
}
.chat-avatar-ring .chat-avatar {
  width: 40px;
  height: 40px;
  position: relative;
  z-index: 1;
}
.chat-avatar-ring.has-status-glow::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  padding: 2px;
  background: linear-gradient(135deg, #ff1744 0%, #ff9100 50%, #ff1744 100%);
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  mask-composite: exclude;
  pointer-events: none;
  z-index: 0;
}
.chat-avatar-ring.has-status-glow .chat-avatar {
  border: none;
  box-sizing: border-box;
}
.chat-avatar-fallback {
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #7ed4e8;
  background: #1e5a6e;
  font-size: 1rem;
}
.thread-avatar.is-clickable {
  cursor: pointer;
}
.thread-avatar.is-clickable:hover {
  outline: 2px solid #7ed4e866;
  outline-offset: 2px;
}
.chat-row .preview {
  /* unused */
}
.chat-list li .preview {
  margin-left: calc(44px + 0.55rem);
}
.thread-head .thread-avatar {
  order: 0;
}
.sidebar-actions {
  display: flex;
  gap: 0.45rem;
  padding: 0.7rem 0.85rem;
}
.sidebar-actions button {
  flex: 1;
  padding: 0.6rem 0.75rem;
  font-size: 0.88rem;
}
.search {
  margin: 0 0.85rem 0.7rem;
  width: calc(100% - 1.7rem);
  border-radius: 999px;
  padding-left: 1rem;
}
.chat-filters {
  display: flex;
  gap: 0.35rem;
  padding: 0 0.85rem 0.65rem;
}
.chat-filter {
  flex: 1;
  padding: 0.4rem 0.5rem;
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.chat-filter.active {
  background: #243844;
  color: #e8f4f8;
  border-color: #3d6575;
}
.chat-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow: auto;
  flex: 1;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}
.chat-list-empty {
  padding: 1.25rem 0.95rem;
  color: var(--muted);
  font-size: 0.88rem;
  cursor: default;
  border-bottom: none;
}
.chat-list-empty:hover {
  background: transparent;
}
.chat-mute-mark {
  flex: 0 0 auto;
  width: 13px;
  height: 13px;
  background: var(--muted);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M11 5L6 9H2v6h4l5 4V5z'/%3E%3Cline x1='23' y1='9' x2='17' y2='15'/%3E%3Cline x1='17' y1='9' x2='23' y2='15'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M11 5L6 9H2v6h4l5 4V5z'/%3E%3Cline x1='23' y1='9' x2='17' y2='15'/%3E%3Cline x1='17' y1='9' x2='23' y2='15'/%3E%3C/svg%3E") center / contain no-repeat;
}
.chat-birthday-mark {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  background: #ffb454;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 21v-8a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8'/%3E%3Cpath d='M4 16s.5-1 2-1 2.5 2 4 2 2.5-2 4-2 2.5 2 4 2 2-1 2-1'/%3E%3Cpath d='M2 21h20'/%3E%3Cpath d='M7 8v3'/%3E%3Cpath d='M12 8v3'/%3E%3Cpath d='M17 8v3'/%3E%3Cpath d='M7 4h.01'/%3E%3Cpath d='M12 4h.01'/%3E%3Cpath d='M17 4h.01'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 21v-8a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8'/%3E%3Cpath d='M4 16s.5-1 2-1 2.5 2 4 2 2.5-2 4-2 2.5 2 4 2 2-1 2-1'/%3E%3Cpath d='M2 21h20'/%3E%3Cpath d='M7 8v3'/%3E%3Cpath d='M12 8v3'/%3E%3Cpath d='M17 8v3'/%3E%3Cpath d='M7 4h.01'/%3E%3Cpath d='M12 4h.01'/%3E%3Cpath d='M17 4h.01'/%3E%3C/svg%3E") center / contain no-repeat;
}
.chat-birthday-badge {
  position: absolute;
  right: -1px;
  bottom: -1px;
  z-index: 3;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #16364a;
  border: 1.5px solid #ffb454;
  box-shadow: 0 1px 3px #0008;
  pointer-events: none;
}
.chat-birthday-badge::before {
  content: "";
  display: block;
  width: 11px;
  height: 11px;
  margin: 2.5px auto 0;
  background: #ffb454;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 21v-8a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8'/%3E%3Cpath d='M4 16s.5-1 2-1 2.5 2 4 2 2.5-2 4-2 2.5 2 4 2 2-1 2-1'/%3E%3Cpath d='M2 21h20'/%3E%3Cpath d='M7 8v3'/%3E%3Cpath d='M12 8v3'/%3E%3Cpath d='M17 8v3'/%3E%3Cpath d='M7 4h.01'/%3E%3Cpath d='M12 4h.01'/%3E%3Cpath d='M17 4h.01'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 21v-8a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8'/%3E%3Cpath d='M4 16s.5-1 2-1 2.5 2 4 2 2.5-2 4-2 2.5 2 4 2 2-1 2-1'/%3E%3Cpath d='M2 21h20'/%3E%3Cpath d='M7 8v3'/%3E%3Cpath d='M12 8v3'/%3E%3Cpath d='M17 8v3'/%3E%3Cpath d='M7 4h.01'/%3E%3Cpath d='M12 4h.01'/%3E%3Cpath d='M17 4h.01'/%3E%3C/svg%3E") center / contain no-repeat;
}
.chat-list li.is-birthday .chat-avatar-fallback {
  box-shadow: 0 0 0 2px #ffb45488;
}
.chat-list li.active .chat-birthday-mark,
.chat-list li:hover .chat-birthday-mark {
  background: #ffc878;
}
.profile-birthday-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}
.profile-birthday-row input[type="date"] {
  flex: 1 1 12rem;
  min-width: 0;
}
.profile-saved {
  font-size: 0.82rem;
  font-weight: 700;
  color: #6ecf9a;
  white-space: nowrap;
}
.profile-autosave {
  margin: 0 0 0.75rem;
  padding: 0.45rem 0.7rem;
  border-radius: 10px;
  background: #1e4a3a;
  color: #6ecf9a;
  font-size: 0.85rem;
  font-weight: 700;
  text-align: center;
}
.profile-text-input {
  width: 100%;
}
.profile-display-name {
  margin: 0.15rem 0 0.35rem;
  font-weight: 800;
  font-size: 1.05rem;
}
.profile-name-grid {
  display: grid;
  gap: 0.65rem;
}
.profile-name-grid label {
  margin: 0;
}
@media (min-width: 560px) {
  .profile-name-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
  }
}
.peer-profile-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.peer-profile-hero {
  display: flex;
  gap: 1rem;
  align-items: center;
}
.peer-profile-avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--panel-2);
  flex-shrink: 0;
}
.peer-profile-avatar-fallback {
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 2rem;
  color: #7ed4e8;
  background: #1e5a6e;
}
.peer-profile-name {
  margin: 0;
  font-size: 1.2rem;
}
.peer-profile-age {
  margin: 0.2rem 0 0;
  font-weight: 700;
  color: #7ed4e8;
}
.peer-profile-meta {
  margin: 0.25rem 0 0;
}
.peer-profile-field {
  margin: 0;
}
.peer-profile-field strong {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.85rem;
}
.peer-member-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.peer-member-list button {
  width: 100%;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.7rem;
}
.peer-member-list img,
.peer-member-fallback {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.peer-member-fallback {
  display: grid;
  place-items: center;
  background: #1e5a6e;
  color: #7ed4e8;
  font-weight: 800;
}
.chat-block-banner {
  padding: 0.55rem 0.85rem;
  background: #3a1f28;
  color: #ffb4be;
  font-size: 0.82rem;
  border-bottom: 1px solid #e85d6f44;
  flex-shrink: 0;
}
.composer.is-disabled {
  opacity: 0.55;
  pointer-events: none;
}
.chat-list li {
  padding: 0.8rem 0.95rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.12s ease;
}
.chat-row {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
}
.chat-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.3rem 0.4rem;
}
.chat-main strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-group-mark {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  background: var(--muted);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='9' cy='7' r='4'/%3E%3Cpath d='M23 21v-2a4 4 0 0 0-3-3.87'/%3E%3Cpath d='M16 3.13a4 4 0 0 1 0 7.75'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='9' cy='7' r='4'/%3E%3Cpath d='M23 21v-2a4 4 0 0 0-3-3.87'/%3E%3Cpath d='M16 3.13a4 4 0 0 1 0 7.75'/%3E%3C/svg%3E") center / contain no-repeat;
}
.chat-list li.is-group .chat-avatar-fallback {
  background: #1a4a5c;
}
.chat-list li.active .chat-group-mark,
.chat-list li:hover .chat-group-mark {
  background: #9ec9d6;
}
.chat-del {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  padding: 0 !important;
  display: grid;
  place-items: center;
  border-radius: 999px;
}
.chat-del::before {
  width: 16px;
  height: 16px;
}
.danger-btn {
  border-color: #e85d6f66 !important;
  color: #ff8a98 !important;
}
.danger-btn:hover {
  background: #e85d6f22 !important;
  border-color: var(--danger) !important;
  color: #fff !important;
}
.chat-list li.active,
.chat-list li:hover { background: #243844; }
.chat-list .preview {
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.badge {
  background: linear-gradient(135deg, var(--accent-hot), #ff5e8a);
  color: #fff;
  border-radius: 999px;
  padding: 0.05rem 0.45rem;
  font-size: 0.72rem;
  font-weight: 800;
  margin-left: 0.4rem;
}

.thread#thread-empty { display: grid; place-items: center; }
.messages-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.messages {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  background-color: #0e1a22;
  background-repeat: repeat;
  background-size: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}
.msg-jump {
  display: none;
  position: absolute;
  right: 0.55rem;
  bottom: 0.7rem;
  z-index: 7;
  flex-direction: column;
  gap: 0.4rem;
  pointer-events: none;
}
.msg-jump-btn {
  pointer-events: auto;
  width: 40px;
  height: 40px;
  margin: 0;
  padding: 0;
  border-radius: 12px;
  border: 1px solid #2f4a5a;
  background: #1a3140e8;
  color: #e8f4f8;
  box-shadow: 0 4px 14px #0007;
  display: grid;
  place-items: center;
  letter-spacing: normal;
  opacity: 0.92;
}
.msg-jump-btn:hover,
.msg-jump-btn:focus-visible {
  filter: none;
  opacity: 1;
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 4px 14px #0007, 0 0 0 2px #2a9bb540;
}
.msg-jump-btn::before {
  content: "";
  display: block;
  width: 18px;
  height: 18px;
  background: currentColor;
  -webkit-mask: center / contain no-repeat;
  mask: center / contain no-repeat;
}
.msg-jump-top-btn::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='17 11 12 6 7 11'/%3E%3Cpolyline points='17 18 12 13 7 18'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='17 11 12 6 7 11'/%3E%3Cpolyline points='17 18 12 13 7 18'/%3E%3C/svg%3E");
}
.msg-jump-bottom-btn::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='7 13 12 18 17 13'/%3E%3Cpolyline points='7 6 12 11 17 6'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='7 13 12 18 17 13'/%3E%3Cpolyline points='7 6 12 11 17 6'/%3E%3C/svg%3E");
}
.msg-jump-btn[hidden] {
  display: none !important;
}

.ptr-indicator {
  position: fixed;
  top: calc(var(--safe-top) + 10px);
  left: 50%;
  z-index: 80;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.8rem;
  border-radius: 12px;
  background: #1a3140f2;
  border: 1px solid #2f4a5a;
  box-shadow: var(--shadow);
  color: #e8f4f8;
  font-size: 0.82rem;
  font-weight: 700;
  pointer-events: none;
  opacity: 0;
  --ptr-progress: 0;
  transform: translate(-50%, -12px);
  transition: opacity 0.15s ease;
}
.ptr-indicator.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}
.ptr-indicator.is-refreshing {
  transform: translate(-50%, 0);
}
.ptr-indicator.is-armed .ptr-label {
  color: #7ed4e8;
}
.ptr-ring {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  transform: rotate(-90deg);
}
.ptr-ring-track,
.ptr-ring-fill {
  stroke-width: 3;
  stroke-linecap: round;
}
.ptr-ring-track {
  stroke: #7ed4e833;
}
.ptr-ring-fill {
  stroke: #7ed4e8;
  transition: stroke 0.15s ease;
}
.ptr-indicator.is-armed .ptr-ring-fill {
  stroke: var(--accent-hot);
}
.ptr-indicator.is-refreshing .ptr-ring {
  animation: ptr-spin 1.6s linear infinite;
}
.ptr-indicator.is-refreshing .ptr-ring-fill {
  stroke-dashoffset: 22 !important;
  stroke: #7ed4e8;
}
@keyframes ptr-spin {
  to {
    transform: rotate(270deg);
  }
}
.messages[data-chat-bg="midnight"],
.chat-bg-swatch[data-chat-bg="midnight"] {
  background-image:
    radial-gradient(ellipse 55% 35% at 78% 8%, #ff7a4514, transparent 55%),
    radial-gradient(ellipse 40% 28% at 12% 90%, #2a9bb518, transparent 50%),
    linear-gradient(180deg, #122029 0%, #0e1a22 55%, #0c171e 100%);
  background-size: auto, auto, auto;
  background-repeat: no-repeat;
}
.messages[data-chat-bg="lagoon"],
.chat-bg-swatch[data-chat-bg="lagoon"] {
  background-color: #0d2430;
  background-image:
    radial-gradient(circle at 20% 20%, #2a9bb522 0 2px, transparent 3px),
    radial-gradient(circle at 70% 40%, #7ed4e818 0 1.5px, transparent 2.5px),
    radial-gradient(ellipse 80% 50% at 50% 100%, #1e5a6e33, transparent 60%),
    repeating-linear-gradient(115deg, #2a9bb50c 0 2px, transparent 2px 14px);
  background-size: 48px 48px, 36px 36px, auto, auto;
}
.messages[data-chat-bg="coral-mist"],
.chat-bg-swatch[data-chat-bg="coral-mist"] {
  background-color: #1a1514;
  background-image:
    radial-gradient(ellipse 60% 40% at 85% 15%, #ff7a4528, transparent 55%),
    radial-gradient(ellipse 50% 35% at 10% 80%, #ff5e8a18, transparent 50%),
    radial-gradient(circle at 30% 40%, #ffb08a14 0 1.5px, transparent 2.5px),
    linear-gradient(165deg, #221816, #14101a 70%);
  background-size: auto, auto, 28px 28px, auto;
}
.messages[data-chat-bg="dunes"],
.chat-bg-swatch[data-chat-bg="dunes"] {
  background-color: #1a1712;
  background-image:
    repeating-linear-gradient(185deg, transparent 0 18px, #c4a57412 18px 19px, transparent 19px 36px),
    repeating-linear-gradient(12deg, transparent 0 22px, #ff7a450d 22px 23px, transparent 23px 44px),
    linear-gradient(180deg, #241e16, #15120f 60%, #1c1812);
}
.messages[data-chat-bg="rain"],
.chat-bg-swatch[data-chat-bg="rain"] {
  background-color: #101820;
  background-image:
    repeating-linear-gradient(122deg, transparent 0 10px, #8fa3b014 10px 11px, transparent 11px 22px),
    repeating-linear-gradient(122deg, transparent 0 16px, #2a9bb510 16px 17px, transparent 17px 32px),
    linear-gradient(180deg, #152430, #0e1a22);
}
.messages[data-chat-bg="stars"],
.chat-bg-swatch[data-chat-bg="stars"] {
  background-color: #0a1218;
  background-image:
    radial-gradient(circle at 12% 18%, #fff8 0 1px, transparent 1.5px),
    radial-gradient(circle at 68% 28%, #7ed4e866 0 1px, transparent 1.5px),
    radial-gradient(circle at 42% 72%, #ffb08a55 0 1px, transparent 1.5px),
    radial-gradient(circle at 88% 64%, #fff6 0 1.2px, transparent 2px),
    radial-gradient(circle at 24% 48%, #fff5 0 0.8px, transparent 1.4px),
    radial-gradient(ellipse 50% 40% at 70% 10%, #2a9bb515, transparent 55%),
    linear-gradient(180deg, #0c1520, #080e14);
  background-size: 90px 90px, 110px 110px, 70px 70px, 130px 130px, 50px 50px, auto, auto;
}
.messages[data-chat-bg="weave"],
.chat-bg-swatch[data-chat-bg="weave"] {
  background-color: #132028;
  background-image:
    repeating-linear-gradient(0deg, transparent 0 11px, #2f465422 11px 12px),
    repeating-linear-gradient(90deg, transparent 0 11px, #2f465422 11px 12px),
    linear-gradient(160deg, #182833, #101a22);
}
.messages[data-chat-bg="paper"],
.chat-bg-swatch[data-chat-bg="paper"] {
  background-color: #152430;
  background-image:
    radial-gradient(#ffffff0a 0.7px, transparent 0.8px),
    radial-gradient(#00000018 0.7px, transparent 0.8px),
    linear-gradient(180deg, #1a2c38, #121f28);
  background-size: 6px 6px, 6px 6px, auto;
  background-position: 0 0, 3px 3px, 0 0;
}
.chat-bg-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}
.chat-bg-option {
  display: grid;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  text-align: left;
  cursor: pointer;
  color: var(--text);
  font-weight: 700;
}
.chat-bg-option:hover {
  filter: none;
  box-shadow: none;
}
.chat-bg-swatch {
  height: 72px;
  border-radius: 12px;
  border: 2px solid var(--border);
  background-color: #0e1a22;
}
.chat-bg-option.is-selected .chat-bg-swatch {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px #2a9bb540;
}
.chat-bg-option span {
  font-size: 0.88rem;
}
.chat-bg-option .muted {
  font-size: 0.78rem;
  font-weight: 600;
}
@media (min-width: 801px) {
  .chat-bg-picker {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .chat-bg-swatch {
    height: 88px;
  }
}
.bubble {
  max-width: min(72%, 560px);
  padding: 0.5rem 0.75rem;
  border-radius: 14px;
  line-height: 1.35;
  font-size: 0.95rem;
  position: relative;
}
.bubble.mine {
  align-self: flex-end;
  background: linear-gradient(160deg, #1e5a6e, #184a5c);
  border: 1px solid #2a7a8e55;
  border-bottom-right-radius: 5px;
}
.bubble.theirs {
  align-self: flex-start;
  background: linear-gradient(160deg, var(--theirs-2), var(--theirs));
  border: 1px solid #ff7a4533;
  color: #fff4ee;
  border-bottom-left-radius: 5px;
}
.bubble.theirs .meta {
  color: #d2b8a8;
}
.bubble.system { align-self: center; background: transparent; color: var(--muted); font-size: 0.8rem; }
.bubble.kind-voice {
  width: min(520px, 92%);
  max-width: min(520px, 92%);
  min-width: min(280px, 85%);
  padding: 0.45rem 0.65rem 0.35rem;
}
.voice-msg {
  width: 100%;
  max-width: none;
  min-width: 0;
  line-height: 0;
}
.voice-msg audio {
  width: 100%;
  min-width: 100%;
  max-width: 100%;
  height: 40px;
  display: block;
  vertical-align: top;
}
.msg-del-btn {
  position: static;
  width: 26px !important;
  height: 26px !important;
  padding: 0 !important;
  margin-left: 0.25rem;
  font-size: 1.05rem !important;
  line-height: 1;
  border-radius: 999px;
  opacity: 0.75;
  color: #ffb4bc !important;
  border-color: transparent !important;
  background: transparent !important;
  flex-shrink: 0;
  vertical-align: middle;
}
.bubble.mine:hover .msg-del-btn,
.msg-del-btn:focus-visible {
  opacity: 1;
}
.msg-del-btn::before {
  width: 14px;
  height: 14px;
}
.trash-icon-btn::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='3 6 5 6 21 6'/%3E%3Cpath d='M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2'/%3E%3Cline x1='10' y1='11' x2='10' y2='17'/%3E%3Cline x1='14' y1='11' x2='14' y2='17'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='3 6 5 6 21 6'/%3E%3Cpath d='M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2'/%3E%3Cline x1='10' y1='11' x2='10' y2='17'/%3E%3Cline x1='14' y1='11' x2='14' y2='17'/%3E%3C/svg%3E");
}
.leave-icon-btn::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4'/%3E%3Cpolyline points='16 17 21 12 16 7'/%3E%3Cline x1='21' y1='12' x2='9' y2='12'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4'/%3E%3Cpolyline points='16 17 21 12 16 7'/%3E%3Cline x1='21' y1='12' x2='9' y2='12'/%3E%3C/svg%3E");
}
.call-audio-icon-btn::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72c.127.96.361 1.903.7 2.81a2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45c.907.339 1.85.573 2.81.7A2 2 0 0 1 22 16.92z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72c.127.96.361 1.903.7 2.81a2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45c.907.339 1.85.573 2.81.7A2 2 0 0 1 22 16.92z'/%3E%3C/svg%3E");
}
.wallpaper-icon-btn::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='18' height='18' rx='2'/%3E%3Ccircle cx='8.5' cy='8.5' r='1.5'/%3E%3Cpath d='M21 15l-5-5L5 21'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='18' height='18' rx='2'/%3E%3Ccircle cx='8.5' cy='8.5' r='1.5'/%3E%3Cpath d='M21 15l-5-5L5 21'/%3E%3C/svg%3E");
}
.call-video-icon-btn::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolygon points='23 7 16 12 23 17 23 7'/%3E%3Crect x='1' y='5' width='15' height='14' rx='2' ry='2'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolygon points='23 7 16 12 23 17 23 7'/%3E%3Crect x='1' y='5' width='15' height='14' rx='2' ry='2'/%3E%3C/svg%3E");
}
.reply-icon-btn::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='9 17 4 12 9 7'/%3E%3Cpath d='M20 18v-2a4 4 0 0 0-4-4H4'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='9 17 4 12 9 7'/%3E%3Cpath d='M20 18v-2a4 4 0 0 0-4-4H4'/%3E%3C/svg%3E");
}
.forward-icon-btn::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='15 17 20 12 15 7'/%3E%3Cpath d='M4 18v-2a4 4 0 0 1 4-4h12'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='15 17 20 12 15 7'/%3E%3Cpath d='M4 18v-2a4 4 0 0 1 4-4h12'/%3E%3C/svg%3E");
}
.reply-cancel-icon-btn::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='18' y1='6' x2='6' y2='18'/%3E%3Cline x1='6' y1='6' x2='18' y2='18'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='18' y1='6' x2='6' y2='18'/%3E%3Cline x1='6' y1='6' x2='18' y2='18'/%3E%3C/svg%3E");
}
.msg-reply-btn {
  width: 26px !important;
  height: 26px !important;
  padding: 0 !important;
  margin-left: 0.15rem;
  opacity: 0.7;
  border-color: transparent !important;
  background: transparent !important;
  color: inherit !important;
  flex-shrink: 0;
}
.msg-reply-btn::before {
  width: 14px;
  height: 14px;
}
.bubble:hover .msg-reply-btn,
.msg-reply-btn:focus-visible {
  opacity: 1;
}
.msg-forward-btn {
  width: 26px !important;
  height: 26px !important;
  padding: 0 !important;
  margin-left: 0.05rem;
  opacity: 0.7;
  border-color: transparent !important;
  background: transparent !important;
  color: inherit !important;
  flex-shrink: 0;
}
.msg-forward-btn::before {
  width: 14px;
  height: 14px;
}
.bubble:hover .msg-forward-btn,
.msg-forward-btn:focus-visible {
  opacity: 1;
}
.forwarded-mark {
  font-size: 0.72rem;
  font-style: italic;
  opacity: 0.75;
  margin: 0 0 0.25rem;
}
.msg-edit-btn {
  width: 26px !important;
  height: 26px !important;
  padding: 0 !important;
  margin-left: 0.05rem;
  opacity: 0.7;
  border-color: transparent !important;
  background: transparent !important;
  color: inherit !important;
  flex-shrink: 0;
}
.msg-edit-btn::before {
  width: 14px;
  height: 14px;
}
.bubble:hover .msg-edit-btn,
.msg-edit-btn:focus-visible {
  opacity: 1;
}
.edit-icon-btn::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 20h9'/%3E%3Cpath d='M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4 12.5-12.5z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 20h9'/%3E%3Cpath d='M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4 12.5-12.5z'/%3E%3C/svg%3E");
}
.edit-bar .reply-bar-main {
  border-left-color: var(--accent);
}
.edit-bar .reply-bar-main strong {
  color: #7ed4e8;
}
.meta-edited {
  font-style: italic;
  opacity: 0.85;
  margin-right: 0.2rem;
}
.reply-quote {
  display: grid;
  gap: 0.1rem;
  width: 100%;
  text-align: left;
  margin: 0 0 0.4rem;
  padding: 0.35rem 0.5rem;
  border: 0;
  border-left: 3px solid var(--accent-hot);
  border-radius: 8px;
  background: #0004;
  color: inherit;
  box-shadow: none;
  cursor: pointer;
  font: inherit;
}
.reply-quote strong {
  font-size: 0.75rem;
  color: #ffb08a;
}
.reply-quote span {
  font-size: 0.8rem;
  opacity: 0.9;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bubble.reply-flash {
  outline: 2px solid var(--accent-hot);
  outline-offset: 2px;
}
.reply-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.75rem;
  background: var(--panel);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  min-width: 0;
}
.reply-bar[hidden] {
  display: none !important;
}
.reply-bar-main {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 0.1rem;
  border-left: 3px solid var(--accent-hot);
  padding-left: 0.55rem;
}
.reply-bar-main strong {
  font-size: 0.8rem;
  color: #ffb08a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.reply-bar-main span {
  font-size: 0.82rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.check-row {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 0.5rem;
  margin: 0.55rem 0;
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--text);
  cursor: pointer;
  width: 100%;
}
.check-row input[type="checkbox"] {
  width: 1.15rem;
  height: 1.15rem;
  min-width: 1.15rem;
  max-width: 1.15rem;
  margin: 0.2rem 0 0;
  padding: 0;
  flex: 0 0 1.15rem;
  border-radius: 4px;
  accent-color: var(--accent, #2a9d8f);
}
.modal-card .check-row input[type="checkbox"],
.profile-section .check-row input[type="checkbox"] {
  width: 1.15rem !important;
  height: 1.15rem !important;
  min-width: 1.15rem !important;
  max-width: 1.15rem !important;
  padding: 0 !important;
  margin: 0.2rem 0 0 !important;
  flex: 0 0 1.15rem;
  box-shadow: none;
}
.meta {
  font-size: 0.7rem;
  color: #aebac1;
  text-align: right;
  margin-top: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.15rem;
  flex-wrap: wrap;
  min-width: 0;
}
.ticks { margin-left: 0.25rem; cursor: help; }
.ticks.read { color: #7ed4e8; }
.typing { padding: 0 1rem 0.3rem; color: var(--muted); font-size: 0.8rem; }
.composer-menu-backdrop {
  position: absolute;
  inset: 0;
  z-index: 8;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #0008;
  box-shadow: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.composer-menu-backdrop:hover,
.composer-menu-backdrop:active {
  filter: none;
  transform: none;
  box-shadow: none;
  background: #0008;
}
.emoji-panel {
  display: none;
  grid-template-columns: repeat(auto-fill, minmax(2.4rem, 1fr));
  gap: 0.2rem;
  padding: 0.55rem;
  margin: 0 0.6rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  max-height: min(180px, 28dvh);
  overflow: auto;
  flex-shrink: 0;
  min-width: 0;
  position: relative;
  z-index: 9;
}
.emoji-panel:not([hidden]),
.emoji-panel.is-open {
  display: grid;
}
.emoji-panel button {
  background: transparent;
  color: var(--text);
  border: 0;
  border-radius: 10px;
  padding: 0.35rem 0;
  font-size: 1.35rem;
  line-height: 1;
  min-height: 40px;
  box-shadow: none;
}
.emoji-panel button:hover {
  background: var(--panel-2);
  filter: none;
  box-shadow: none;
}
.giphy-panel {
  display: none;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.55rem 0.65rem 0.65rem;
  margin: 0 0.6rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  max-height: min(280px, 40dvh);
  flex-shrink: 0;
  min-width: 0;
  overflow: hidden;
  position: relative;
  z-index: 9;
}
.giphy-panel:not([hidden]) {
  display: flex;
}
.giphy-toolbar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.35rem;
  min-width: 0;
}
.giphy-toolbar input {
  width: 100%;
  flex: none;
  min-width: 0;
  margin: 0;
  padding: 0.55rem 0.75rem;
  font-size: 16px;
}
.giphy-powered {
  align-self: flex-end;
  flex-shrink: 0;
  font-size: 0.7rem;
  line-height: 1.2;
  text-decoration: none;
  color: var(--muted);
  white-space: nowrap;
}
.giphy-powered:hover {
  color: #7ed4e8;
}
.giphy-results {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.4rem;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
  flex: 1 1 auto;
  align-content: start;
  width: 100%;
}
.giphy-results button {
  position: relative;
  display: block;
  width: 100%;
  max-width: 100%;
  height: 0 !important;
  padding: 0 0 100% !important;
  margin: 0;
  border-radius: 10px !important;
  overflow: hidden;
  background: #0a1218 !important;
  border: 1px solid var(--border) !important;
  box-shadow: none !important;
  color: inherit;
  font-size: 0;
  line-height: 0;
  letter-spacing: 0;
  transform: none !important;
  filter: none !important;
  min-height: 0;
  max-height: none;
  align-self: start;
}
.giphy-results button:hover,
.giphy-results button:active {
  filter: none !important;
  transform: none !important;
  border-color: var(--accent) !important;
  box-shadow: none !important;
  background: #0a1218 !important;
}
.giphy-results img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}
.giphy-empty,
.giphy-status {
  margin: 0.35rem 0 0;
  text-align: center;
  grid-column: 1 / -1;
}
@media (min-width: 801px) {
  .giphy-toolbar {
    flex-direction: row;
    align-items: center;
    gap: 0.55rem;
  }
  .giphy-toolbar input {
    flex: 1;
    font-size: 0.95rem;
  }
  .giphy-powered {
    align-self: center;
  }
  .giphy-results {
    grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  }
}
@media (max-width: 800px) {
  .giphy-panel {
    margin: 0;
    border-radius: 16px 16px 0 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    max-height: min(42dvh, 320px);
    padding: 0.65rem 0.7rem calc(0.55rem + var(--safe-bottom));
  }
  .giphy-results {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 0.45rem;
  }
  .giphy-results button {
    border-radius: 12px !important;
  }
}
.composer {
  display: flex;
  gap: 0.45rem;
  box-sizing: border-box;
  height: calc(var(--bottombar-height) + var(--safe-bottom));
  min-height: calc(var(--bottombar-height) + var(--safe-bottom));
  max-height: calc(var(--bottombar-height) + var(--safe-bottom));
  padding: 0 0.7rem;
  padding-bottom: var(--safe-bottom);
  border-top: 1px solid var(--border);
  background: var(--panel-2);
  align-items: center;
  flex-shrink: 0;
  min-width: 0;
  position: relative;
  z-index: 9;
  max-width: 100%;
  overflow: hidden;
}
.composer .ghost {
  width: 40px;
  height: 40px;
  padding: 0;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 1.15rem;
}
.composer textarea {
  resize: none;
  height: 2.5rem;
  min-height: 2.5rem;
  max-height: 2.5rem;
  border-radius: 18px;
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  overflow-y: auto;
  padding-top: 0.55rem;
  padding-bottom: 0.55rem;
  line-height: 1.3;
}
.composer button[type="submit"] {
  border-radius: 999px;
  padding: 0 1.1rem;
  height: 2.5rem;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.bubble img, .bubble video { max-width: 100%; border-radius: 10px; display: block; }
.bubble audio { width: 100%; max-width: 100%; height: 40px; }

.modal {
  position: fixed;
  inset: 0;
  background: #0008;
  display: none;
  place-items: center;
  z-index: 20;
  padding:
    max(0.5rem, var(--safe-top))
    max(0.5rem, var(--safe-right))
    max(0.5rem, var(--safe-bottom))
    max(0.5rem, var(--safe-left));
  overflow: hidden;
  overscroll-behavior: contain;
  box-sizing: border-box;
  width: 100%;
  max-width: 100vw;
  height: 100%;
  max-height: 100dvh;
}
.ctx-menu {
  position: fixed;
  z-index: 45;
  min-width: 11rem;
  max-width: min(18rem, calc(100vw - 1rem));
  padding: 0.3rem;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 10px 28px #000a;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}
.chat-list li,
.bubble,
.bubble-text,
.chat-main,
.chat-list .preview {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}
.sidebar,
.sidebar-tools,
.chat-filters,
.thread-head,
.thread-actions {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}
.ctx-menu[hidden] {
  display: none !important;
}
.ctx-menu-item {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0.55rem 0.75rem;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  text-align: left;
  letter-spacing: normal;
  box-shadow: none;
  cursor: pointer;
}
.ctx-menu-item:hover,
.ctx-menu-item:focus-visible {
  background: #243844;
  filter: none;
  box-shadow: none;
  outline: none;
}
.ctx-menu-item:disabled {
  opacity: 0.45;
  cursor: default;
}
.ctx-menu-item.is-danger {
  color: #f0a0a8;
}
.ctx-menu-item.is-danger:hover,
.ctx-menu-item.is-danger:focus-visible {
  background: #3a2228;
}
.modal.is-open {
  display: grid;
  align-items: center;
  justify-items: center;
}
.modal-card {
  background: var(--panel);
  padding: 1rem 1rem 0.85rem;
  border-radius: 18px;
  width: min(420px, 100%);
  max-width: 100%;
  max-height: calc(100dvh - var(--safe-top) - var(--safe-bottom) - 1rem);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  margin: 0;
  min-width: 0;
  min-height: 0;
  box-sizing: border-box;
}
.modal-body,
#modal-body {
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.modal-card h2 {
  margin: 0 0 0.75rem;
  font-size: 1.15rem;
  flex: 0 0 auto;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding: 0.65rem 0 0;
  flex: 0 0 auto;
  position: static;
  background: transparent;
  z-index: 1;
}
.confirm-message {
  margin: 0;
  line-height: 1.45;
  color: var(--text);
}
.support-form {
  display: grid;
  gap: 0.65rem;
  min-width: 0;
}
.support-form label {
  display: grid;
  gap: 0.3rem;
  font-weight: 600;
  font-size: 0.88rem;
  min-width: 0;
}
.support-form input,
.support-form select,
.support-form textarea,
.modal-card input,
.modal-card select,
.modal-card textarea {
  font-family: inherit;
  font-weight: 500;
  font-size: 16px !important;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.support-form textarea {
  resize: vertical;
  min-height: 5rem;
  max-height: min(28dvh, 220px);
}
.support-intro,
.support-hint {
  margin: 0;
}
.support-done-msg {
  margin: 0 0 0.5rem;
  line-height: 1.45;
  font-weight: 600;
}
.support-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
#modal-ok.is-danger-action {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
  box-shadow: none;
}
#modal-ok.is-danger-action:hover,
#modal-ok.is-danger-action:focus-visible {
  filter: brightness(1.06);
}
.modal-card-wide {
  width: min(640px, 100%);
}
.modal-card-profile {
  width: min(520px, 100%);
}
.new-group-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  gap: 0.85rem 1rem;
  align-items: start;
  min-width: 0;
}
.new-group-name label,
.new-group-members-label {
  display: block;
  margin: 0 0 0.45rem;
}
.new-group-name input {
  width: 100%;
  margin-top: 0.35rem;
}
.new-group-members {
  min-width: 0;
}
.new-group-members .user-pick {
  max-height: min(280px, 45dvh);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.35rem 0.45rem;
  background: var(--panel-2);
}
.user-pick-check {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.35rem;
  border-radius: 8px;
  cursor: pointer;
  min-width: 0;
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--text);
}
.user-pick-check:hover {
  background: #243844;
}
.user-pick-check input {
  width: auto;
  margin: 0;
  flex-shrink: 0;
}
.user-pick-check span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
@media (max-width: 800px) {
  .new-group-form {
    grid-template-columns: 1fr;
  }
}
.user-pick { max-height: 240px; overflow: auto; }
.user-pick button {
  display: block;
  width: 100%;
  text-align: left;
  margin: 0.3rem 0;
  background: var(--panel-2);
  color: var(--text);
  box-shadow: none;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
}
.user-pick button:hover {
  filter: none;
  border-color: var(--accent);
  background: #243844;
}
.invite-panel {
  display: grid;
  gap: 0.85rem;
}
.invite-block {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem 1.05rem 1.1rem;
  min-width: 0;
}
.invite-block-head {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}
.invite-block-num {
  flex-shrink: 0;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 0.85rem;
  font-weight: 800;
  color: #7ed4e8;
  background: #1e5a6e;
  margin-top: 0.1rem;
}
.invite-block-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: 0;
  text-transform: none;
}
.invite-block-hint {
  margin: 0.25rem 0 0;
  line-height: 1.45;
  font-size: 0.88rem;
}
.invite-or {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0.85rem 0 0.65rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.invite-or::before,
.invite-or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}
.invite-email-box {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.invite-email-box label {
  margin: 0;
}
.invite-email-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.85rem;
  flex-wrap: wrap;
}
.invite-email-actions button {
  flex: 1;
  min-width: 140px;
  min-height: 2.45rem;
}
.invite-pick-btn {
  width: 100%;
  margin: 0;
  padding: 0.85rem 1rem;
  font-size: 0.98rem;
  min-height: 2.55rem;
}
.invite-pick-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  filter: none;
  box-shadow: none;
}
.invite-picked {
  margin: 0.65rem 0 0;
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
}
.invite-picked strong {
  display: block;
  margin-bottom: 0.15rem;
}
.invite-code-fields {
  display: grid;
  gap: 0.55rem;
}
.invite-code-fields label {
  margin: 0;
}
.invite-token {
  margin: 0.85rem 0 0;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92rem;
  word-break: break-all;
  color: #7ed4e8;
}
.invite-list {
  display: grid;
  gap: 0.5rem;
  max-height: min(220px, 30dvh);
  overflow: auto;
}
.invite-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.7rem 0.8rem;
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  min-width: 0;
}
.invite-row-main {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 0.15rem;
}
.invite-row-main strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.invite-row button {
  flex-shrink: 0;
  min-height: 2.2rem;
  padding-inline: 0.85rem;
}
.invite-mail-status {
  margin-top: 0.85rem;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
}
.invite-mail-status > p:first-child {
  margin: 0 0 0.35rem;
  font-weight: 700;
}
.invite-mail-ways {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0.55rem 0;
}
.invite-mail-ways button {
  flex: 1 1 120px;
  font-size: 0.9rem;
  padding: 0.6rem 0.75rem;
  min-height: 2.35rem;
}
.invite-email-choices {
  margin-top: 0.55rem;
}

.call-overlay {
  position: fixed;
  inset: 0;
  background: #000c;
  display: none;
  place-items: center;
  z-index: 30;
  overflow: hidden;
}
.call-overlay.is-open {
  display: grid;
}
.call-overlay.is-open.minimized {
  background: transparent;
  place-items: end stretch;
  padding: 0 0.75rem max(0.75rem, env(safe-area-inset-bottom));
  pointer-events: none;
  overflow: visible;
}
.call-overlay.is-open.minimized .call-box {
  pointer-events: auto;
  width: min(520px, 100%);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-align: left;
  background: #152833ee;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 0.55rem 0.7rem;
  box-shadow: 0 10px 28px #0008;
  backdrop-filter: blur(8px);
}
.call-overlay.is-open.minimized #call-status {
  flex: 1;
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.call-overlay.is-open.minimized .video-stage {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  border-radius: 12px;
  overflow: hidden;
}
.call-overlay.is-open.minimized .video-stage.solo-local #local-video,
.call-overlay.is-open.minimized #remote-video {
  width: 64px;
  height: 64px;
  min-height: 0;
  max-height: none;
  border-radius: 0;
  object-fit: cover;
}
.call-overlay.is-open.minimized #local-video {
  width: 22px;
  height: 28px;
  right: 4px;
  bottom: 4px;
  border-width: 1px;
  border-radius: 5px;
}
.call-overlay.is-open.minimized .video-stage.solo-local #local-video {
  position: static;
  width: 64px;
  height: 64px;
}
.call-overlay.is-open.minimized #video-fs-btn {
  display: none !important;
}
.call-overlay.is-open.minimized .call-actions {
  margin: 0;
  gap: 0.4rem;
}
.call-overlay.is-open.minimized #hangup-btn {
  margin: 0;
  padding: 0.5rem 0.85rem;
  font-size: 0.82rem;
}
.call-box { text-align: center; position: relative; max-width: 100%; width: min(720px, 92vw); }
.call-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.65rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}
.call-icon-btn {
  width: 48px;
  height: 48px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 999px;
}
.call-icon-btn::before {
  content: "";
  display: block;
  width: 22px;
  height: 22px;
  background: currentColor;
  -webkit-mask: center / contain no-repeat;
  mask: center / contain no-repeat;
}
#call-chat-btn::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z'/%3E%3C/svg%3E");
}
#call-share-btn::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='2' y='3' width='20' height='14' rx='2'/%3E%3Cpath d='M8 21h8'/%3E%3Cpath d='M12 17v4'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='2' y='3' width='20' height='14' rx='2'/%3E%3Cpath d='M8 21h8'/%3E%3Cpath d='M12 17v4'/%3E%3C/svg%3E");
}
#call-share-btn.is-active {
  border-color: var(--accent-hot);
  color: var(--accent-hot);
  background: #ff7a4522;
}
#local-video.no-mirror {
  transform: none;
}
#call-expand-btn::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 3h6v6'/%3E%3Cpath d='M9 21H3v-6'/%3E%3Cpath d='M21 3l-7 7'/%3E%3Cpath d='M3 21l7-7'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 3h6v6'/%3E%3Cpath d='M9 21H3v-6'/%3E%3Cpath d='M21 3l-7 7'/%3E%3Cpath d='M3 21l7-7'/%3E%3C/svg%3E");
}
#hangup-btn {
  background: var(--danger);
  background-image: none;
  color: white;
  box-shadow: 0 4px 14px #e85d6f44;
}
#accept-call-btn {
  margin-right: 0.4rem;
}
.video-stage {
  position: relative;
  display: inline-block;
  max-width: 100%;
  background: #000;
  border-radius: 14px;
  overflow: hidden;
}
#local-video {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: min(132px, 28vw);
  height: min(176px, 36vw);
  object-fit: cover;
  border-radius: 12px;
  background: #111;
  border: 2px solid #ffffffaa;
  box-shadow: 0 2px 10px #000a;
  transform: scaleX(-1);
  z-index: 3;
}
.video-stage.solo-local #remote-video {
  display: none !important;
}
.video-stage.solo-local #local-video {
  position: static;
  right: auto;
  bottom: auto;
  width: min(720px, 90vw);
  height: auto;
  min-height: 220px;
  max-height: 50dvh;
  border-radius: 14px;
  border: none;
  box-shadow: none;
  display: block;
  object-fit: cover;
}
.video-stage.max {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  border-radius: 0;
  max-width: none;
}
.video-stage.max.solo-local #local-video {
  width: 100vw;
  height: 100dvh;
  max-height: none;
  min-height: 0;
  border-radius: 0;
  object-fit: cover;
}
.video-stage.max #remote-video {
  width: 100vw;
  height: 100dvh;
  max-height: none;
  object-fit: contain;
  border-radius: 0;
}
.video-stage.max:not(.solo-local) #local-video {
  right: 16px;
  bottom: 16px;
  width: min(160px, 30vw);
  height: min(214px, 40vw);
}
#remote-video {
  width: min(720px, 90vw);
  min-height: 220px;
  max-height: 50dvh;
  background: #000;
  border-radius: 14px;
  display: block;
  object-fit: contain;
}
.video-fs-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 12px;
  background: #111b21cc;
  color: #e9edef;
  border: 1px solid #ffffff33;
  box-shadow: 0 1px 4px #0008;
  z-index: 2;
}
.video-fs-btn::before {
  content: "";
  display: block;
  width: 16px;
  height: 16px;
  margin: 11px auto;
  border: 2px solid currentColor;
  border-radius: 3px;
}
.video-fs-btn.is-max::before {
  width: 12px;
  height: 12px;
  margin: 13px auto;
  box-shadow: 3px 3px 0 -1px #111b21cc, 3px 3px 0 0 currentColor;
  border-radius: 2px;
}
.video-fs-btn:hover { filter: brightness(1.15); }

.mobile-only { display: none !important; }
.desktop-only { display: initial; }

.back-icon-btn::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='15 18 9 12 15 6'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='15 18 9 12 15 6'/%3E%3C/svg%3E");
}

/* —— Desktop layout (≥801px) —— */
@media (min-width: 801px) {
  html[data-layout="desktop"] .desktop-only,
  .desktop-only { display: initial; }

  .sidebar-head,
  .thread-head {
    height: var(--topbar-height);
    min-height: var(--topbar-height);
    max-height: var(--topbar-height);
    padding: 0 0.85rem;
  }

  .thread-actions .ghost {
    max-width: 9rem;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .composer {
    flex-wrap: nowrap;
    height: calc(var(--bottombar-height) + var(--safe-bottom));
    min-height: calc(var(--bottombar-height) + var(--safe-bottom));
    max-height: calc(var(--bottombar-height) + var(--safe-bottom));
  }

  .sidebar-tools {
    height: calc(var(--bottombar-height) + var(--safe-bottom));
    min-height: calc(var(--bottombar-height) + var(--safe-bottom));
    max-height: calc(var(--bottombar-height) + var(--safe-bottom));
  }

  .modal {
    padding: 1.5rem;
  }
  .modal-card {
    width: min(480px, 100%);
    padding: 1.75rem 1.9rem 1.5rem;
    border-radius: 22px;
    max-height: min(88dvh, 900px);
  }
  .modal-card h2 {
    margin-bottom: 1rem;
    font-size: 1.4rem;
    font-weight: 800;
  }
  .modal-card-wide {
    width: min(680px, 100%);
  }
  .modal-card-profile {
    width: min(560px, 100%);
  }
  .modal-actions {
    margin-top: 1.25rem;
    gap: 0.65rem;
  }
  .modal-actions button {
    min-height: 2.55rem;
    padding-inline: 1.1rem;
    font-size: 0.98rem;
  }
  .profile-hero {
    gap: 1.35rem;
    padding-bottom: 1.25rem;
    margin-bottom: 0.25rem;
  }
  .profile-avatar-preview {
    width: 120px;
    height: 120px;
  }
  .profile-email {
    font-size: 1.12rem;
  }
  .profile-section {
    padding: 1.15rem 0 0.25rem;
  }
  .profile-section-title {
    font-size: 0.82rem;
    margin-bottom: 0.55rem;
  }
  .profile-section .check-row {
    font-size: 1rem;
    gap: 0.5rem;
  }
  .profile-hint {
    font-size: 0.9rem;
  }
  .profile-photo-actions button,
  .mfa-actions button {
    min-height: 2.55rem;
    padding-inline: 1rem;
    font-size: 0.95rem;
  }
  .invite-panel {
    gap: 1rem;
  }
  .invite-block {
    padding: 1.15rem 1.2rem 1.25rem;
    border-radius: 18px;
  }
  .invite-block-title {
    font-size: 1.12rem;
  }
  .invite-block-hint {
    font-size: 0.92rem;
  }
  .invite-code-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem 1rem;
  }
  .invite-note-field {
    grid-column: 1 / -1;
  }
  .invite-pick-btn,
  .invite-email-actions button,
  .invite-mail-ways button {
    min-height: 2.55rem;
    font-size: 0.95rem;
  }
  .invite-row {
    padding: 0.85rem 1rem;
  }
  .invite-list {
    max-height: min(260px, 34dvh);
  }
}

/* —— Mobile layout (≤800px) —— */
@media (max-width: 800px) {
  .mobile-only { display: grid !important; }
  .desktop-only { display: none !important; }

  .modal-card,
  .modal-card-wide,
  .modal-card-profile {
    width: 100%;
    max-width: 100%;
    max-height: calc(100dvh - var(--safe-top) - var(--safe-bottom) - 1rem);
    border-radius: 16px;
  }
  .modal-actions button {
    min-height: 2.6rem;
  }
  .new-group-form {
    grid-template-columns: 1fr;
  }

  .app {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
    padding-left: var(--safe-left);
    padding-right: var(--safe-right);
  }
  .sidebar {
    grid-column: 1;
    grid-row: 1;
    border-right: 0;
  }
  .thread {
    grid-column: 1;
    grid-row: 1 / -1;
  }
  .sidebar-tools {
    grid-column: 1;
    grid-row: 2;
    border-right: 0;
    justify-content: space-evenly;
    height: calc(var(--bottombar-height) + var(--safe-bottom));
    min-height: calc(var(--bottombar-height) + var(--safe-bottom));
    max-height: calc(var(--bottombar-height) + var(--safe-bottom));
    padding: 0 0.55rem;
    padding-bottom: var(--safe-bottom);
  }

  .app.chat-open .sidebar,
  .app.chat-open .sidebar-tools {
    display: none !important;
  }
  .app:not(.chat-open) #thread,
  .app:not(.chat-open) #thread-empty {
    display: none !important;
  }

  .thread-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.45rem;
    height: auto;
    min-height: var(--topbar-height);
    max-height: none;
    padding: max(0.5rem, var(--safe-top)) 0.65rem 0.5rem;
    overflow: visible;
  }
  #back-btn {
    flex: 0 0 auto;
    order: 0;
  }
  .thread-head .thread-avatar {
    flex: 0 0 auto;
    order: 1;
    width: 36px;
    height: 36px;
    align-self: center;
  }
  .thread-heading {
    flex: 1 1 0;
    order: 2;
    min-width: 0;
  }
  .thread-actions {
    order: 3;
    flex: 1 0 100%;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(40px, 1fr));
    gap: 0.3rem 0.2rem;
    width: 100%;
    max-width: none;
    overflow: visible;
    justify-items: center;
    align-items: center;
    padding-top: 0.4rem;
    margin-top: 0.15rem;
    border-top: 1px solid var(--border);
  }
  .thread-actions .ghost:not(.icon-btn) {
    grid-column: 1 / -1;
    width: 100%;
    justify-content: center;
    text-align: center;
  }
  .thread-actions .icon-btn {
    flex: none;
    width: 40px;
    height: 40px;
    min-width: 40px;
    margin: 0;
    justify-self: center;
  }
  .thread-actions .icon-btn[hidden] {
    display: none !important;
  }
  .msg-jump {
    display: flex;
  }
  .sidebar-head {
    height: var(--topbar-height);
    min-height: var(--topbar-height);
    max-height: var(--topbar-height);
    padding: 0 0.85rem;
  }

  .composer {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr)) auto;
    grid-template-areas:
      "text text text text text text"
      "attach camera giphy emoji voice send";
    align-items: center;
    column-gap: 0.3rem;
    row-gap: 0.4rem;
    height: auto;
    min-height: calc(var(--bottombar-height) + var(--safe-bottom));
    max-height: none;
    padding: 0.45rem 0.55rem;
    padding-bottom: max(0.45rem, var(--safe-bottom));
    overflow: visible;
  }
  .composer textarea {
    grid-area: text;
    width: 100%;
    max-width: 100%;
    height: 2.5rem;
    min-height: 2.5rem;
    max-height: 2.5rem;
  }
  #attach-btn,
  #camera-btn,
  #giphy-btn,
  #emoji-btn,
  #voice-btn {
    justify-self: center;
  }
  #attach-btn { grid-area: attach; }
  #camera-btn { grid-area: camera; }
  #giphy-btn { grid-area: giphy; }
  #emoji-btn { grid-area: emoji; }
  #voice-btn { grid-area: voice; }
  .composer button[type="submit"] {
    grid-area: send;
    justify-self: stretch;
    padding: 0 0.85rem;
    height: 2.5rem;
    min-width: 4.25rem;
  }

  .sidebar-actions {
    flex-wrap: wrap;
  }
  .sidebar-actions button {
    min-width: calc(50% - 0.25rem);
  }

  .chat-list .preview,
  .chat-main strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
    max-width: 100%;
  }

  .bubble {
    max-width: min(88%, 560px);
  }
  .bubble.kind-voice {
    width: min(92vw, 100%);
    max-width: min(92%, 480px);
    min-width: min(260px, 88%);
  }
  .voice-msg,
  .voice-msg audio {
    width: 100%;
    max-width: none;
    min-width: 100%;
  }

  .auth-card {
    width: min(420px, calc(100% - 0.5rem));
    padding: 1.1rem;
  }
  .brand-lockup {
    width: min(220px, 72vw);
  }
}
