:root {
  color-scheme: dark light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bg: #f6f7fb;
  --panel: #ffffff;
  --panel-2: #eef2f7;
  --text: #111827;
  --muted: #64748b;
  --line: #d9e0ea;
  --accent: #2563eb;
  --accent-2: #0f766e;
  --danger: #dc2626;
  --bubble-in: #e9eef6;
  --bubble-out: #dbeafe;
  --rail: rgb(15 23 42 / 0.72);
  --glass: rgb(255 255 255 / 0.62);
  --glass-strong: rgb(255 255 255 / 0.78);
  --glass-line: rgb(255 255 255 / 0.42);
  --shadow: 0 18px 55px rgb(31 41 55 / 0.16);
  --inner-glow: inset 0 1px 0 rgb(255 255 255 / 0.62);
  --unread: #ff3b30;
}

:root[data-theme="dark"] {
  --bg: #0b1020;
  --panel: #121a2b;
  --panel-2: #1b2638;
  --text: #eef2ff;
  --muted: #93a4b8;
  --line: #2b3951;
  --accent: #60a5fa;
  --accent-2: #2dd4bf;
  --danger: #f87171;
  --bubble-in: #1f2a3f;
  --bubble-out: #14345d;
  --rail: rgb(8 13 26 / 0.78);
  --glass: rgb(18 26 43 / 0.66);
  --glass-strong: rgb(27 38 56 / 0.78);
  --glass-line: rgb(255 255 255 / 0.13);
  --shadow: 0 20px 65px rgb(0 0 0 / 0.28);
  --inner-glow: inset 0 1px 0 rgb(255 255 255 / 0.12);
  --unread: #ff453a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 280px;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  color: var(--text);
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--bg), var(--accent) 10%), var(--bg) 46%, color-mix(in srgb, var(--bg), var(--accent-2) 10%));
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  border: 0;
  border-radius: 13px;
  padding: 10px 12px;
  color: white;
  background: var(--accent);
  cursor: pointer;
  box-shadow: var(--inner-glow), 0 10px 22px color-mix(in srgb, var(--accent), transparent 78%);
  transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

button:hover {
  transform: none;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

button.secondary {
  color: var(--text);
  background: var(--glass);
  border: 1px solid var(--glass-line);
  box-shadow: var(--inner-glow);
}

button.danger-button,
button.danger,
.danger-button {
  color: white;
  background: var(--danger);
}

.support-form {
  display: grid;
  gap: 10px;
  border: 1px solid var(--glass-line);
  border-radius: 13px;
  padding: 12px;
  background: color-mix(in srgb, var(--panel), white 4%);
  box-shadow: var(--inner-glow);
}

.support-form button {
  min-height: 42px;
  color: white;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent-2), white 14%), var(--accent-2));
  box-shadow: var(--inner-glow), 0 10px 22px color-mix(in srgb, var(--accent-2), transparent 78%);
  font-size: 13px;
  font-weight: 900;
}

.support-form button:hover {
  transform: none;
}

.support-feedback {
  min-height: 18px;
  color: var(--muted);
  font-size: 12px;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--glass-line);
  border-radius: 13px;
  padding: 10px 12px;
  color: var(--text);
  background: var(--glass);
  box-shadow: var(--inner-glow);
  backdrop-filter: blur(20px) saturate(1.35);
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.app-shell {
  display: grid;
  grid-template-columns: 96px minmax(260px, 340px) 1fr;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

.app-shell.call-active {
  padding-top: 58px;
}

.app-shell.call-active .content,
.app-shell.call-active .view,
.app-shell.call-active .chat-view.active-view,
.app-shell.call-active .chat-screen {
  height: 100%;
}

.call-bar {
  position: fixed !important;
  top: 8px;
  left: 8px;
  right: 8px;
  z-index: 44;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 6px 8px;
  border: 1px solid var(--glass-line);
  border-radius: 18px;
  background: linear-gradient(145deg, var(--glass-strong), color-mix(in srgb, var(--panel), transparent 18%));
  box-shadow: var(--shadow), var(--inner-glow);
  backdrop-filter: blur(26px) saturate(1.45);
  contain: layout paint;
}

.call-bar-avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  overflow: hidden;
  border-radius: 50%;
  color: white;
  background: linear-gradient(145deg, var(--accent-2), var(--accent));
  font-size: 14px;
  font-weight: 950;
}

.call-bar-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.call-bar-main {
  display: grid;
  min-width: 0;
  line-height: 1.1;
}

.call-bar-main strong,
.call-bar-main small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.call-bar-main small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.call-bar-button,
.call-options-button {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 900;
}

.call-options-button {
  width: 38px;
  padding-inline: 0;
  letter-spacing: 1px;
}

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    radial-gradient(circle at 18% 12%, color-mix(in srgb, var(--accent), transparent 58%), transparent 34%),
    radial-gradient(circle at 88% 82%, color-mix(in srgb, var(--accent-2), transparent 62%), transparent 38%),
    color-mix(in srgb, var(--bg), black 10%);
  backdrop-filter: blur(28px) saturate(1.35);
}

.auth-card {
  width: min(100%, 520px);
  max-height: calc(100vh - 28px);
  overflow: auto;
  display: grid;
  gap: 14px;
  padding: 20px;
  border: 1px solid var(--glass-line);
  border-radius: 30px;
  background: linear-gradient(145deg, var(--glass-strong), color-mix(in srgb, var(--panel), transparent 18%));
  box-shadow: var(--shadow), var(--inner-glow);
}

.banned-overlay {
  z-index: 80;
  background:
    radial-gradient(circle at 20% 12%, color-mix(in srgb, var(--danger), transparent 54%), transparent 35%),
    radial-gradient(circle at 82% 88%, color-mix(in srgb, var(--accent), transparent 72%), transparent 42%),
    color-mix(in srgb, var(--bg), black 18%);
}

.banned-card {
  text-align: center;
  justify-items: center;
  border-color: color-mix(in srgb, var(--danger), white 18%);
}

.ban-icon {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  border-radius: 22px;
  color: white;
  font-size: 36px;
  font-weight: 1000;
  background: linear-gradient(180deg, color-mix(in srgb, var(--danger), white 12%), var(--danger));
  box-shadow: 0 18px 38px color-mix(in srgb, var(--danger), transparent 65%), var(--inner-glow);
}

.ban-kicker {
  margin: 0 0 4px;
  color: var(--danger);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.banned-card h1 {
  margin: 0;
  font-size: clamp(30px, 8vw, 46px);
  line-height: 1;
}

.banned-card button {
  width: min(100%, 340px);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.auth-brand img {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  box-shadow: 0 16px 30px color-mix(in srgb, var(--accent), transparent 72%);
}

.auth-brand p,
.auth-copy,
.auth-feedback,
.legacy-claim-card p,
.account-profile-row p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.auth-brand h1 {
  margin: 2px 0 0;
  font-size: clamp(26px, 7vw, 42px);
  line-height: 1;
}

.auth-tabs,
.account-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.auth-tabs button {
  color: var(--text);
  background: var(--glass);
}

.auth-tabs button.active {
  color: white;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent), white 18%), var(--accent));
}

.auth-form {
  display: grid;
  gap: 11px;
}

.auth-reset-note {
  margin: 0;
  padding: 12px 13px;
  border: 1px solid color-mix(in srgb, var(--accent), transparent 42%);
  border-radius: 16px;
  color: var(--text);
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--accent), transparent 82%), color-mix(in srgb, var(--panel-2), transparent 16%));
  box-shadow: var(--inner-glow);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.45;
}

.auth-reset-note strong {
  color: white;
  font-weight: 950;
}

.auth-search-results {
  display: grid;
  gap: 8px;
  max-height: min(320px, 42vh);
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--glass-line);
  border-radius: 18px;
  background: color-mix(in srgb, var(--panel), transparent 8%);
  box-shadow: var(--inner-glow), 0 18px 36px color-mix(in srgb, black, transparent 84%);
}

.auth-search-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 66px;
  padding: 9px;
  color: var(--text);
  text-align: left;
  background: linear-gradient(145deg, var(--glass), color-mix(in srgb, var(--panel-2), transparent 18%));
  border: 1px solid var(--glass-line);
  border-radius: 16px;
  box-shadow: var(--inner-glow);
}

.auth-search-avatar {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  overflow: hidden;
  border-radius: 16px;
  color: white;
  font-weight: 950;
  background: linear-gradient(145deg, var(--accent), var(--accent-2));
  box-shadow: var(--inner-glow);
}

.auth-search-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.auth-search-main {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.auth-search-main strong,
.auth-search-main small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-search-main small,
.auth-search-empty {
  color: var(--muted);
  font-size: 12px;
}

.name-with-badge {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  min-width: 0;
  gap: 5px;
}

.name-with-badge strong {
  min-width: 0;
}

.profile-badge {
  display: inline-flex;
  align-items: center;
  width: max-content;
  max-width: 100%;
  min-height: 20px;
  padding: 3px 8px;
  border: 1px solid color-mix(in srgb, #93c5fd, transparent 38%);
  border-radius: 999px;
  color: #dbeafe;
  background:
    linear-gradient(180deg, rgb(96 165 250 / 0.32), rgb(14 165 233 / 0.16)),
    color-mix(in srgb, var(--glass), transparent 12%);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.28),
    0 8px 22px rgb(96 165 250 / 0.18);
  font-size: 10px;
  font-weight: 950;
  line-height: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-badge.compact {
  min-height: 17px;
  padding: 2px 7px;
  font-size: 8px;
}

.auth-search-select {
  padding: 7px 9px;
  border-radius: 999px;
  color: white;
  font-size: 12px;
  font-weight: 900;
  background: var(--accent);
}

.auth-search-empty {
  margin: 0;
  padding: 14px 10px;
  text-align: center;
}

.owner-reset-preview {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 13px;
  border: 1px solid color-mix(in srgb, var(--accent), white 20%);
  border-radius: 22px;
  background:
    radial-gradient(circle at 0% 0%, color-mix(in srgb, var(--accent), transparent 64%), transparent 52%),
    color-mix(in srgb, var(--panel), transparent 8%);
  box-shadow: var(--inner-glow), 0 16px 34px color-mix(in srgb, var(--accent), transparent 80%);
}

.owner-reset-preview img {
  width: 72px;
  height: 72px;
  border-radius: 24px;
  object-fit: cover;
  border: 1px solid var(--glass-line);
  box-shadow: var(--inner-glow);
}

.owner-reset-preview p,
.owner-reset-preview h2 {
  margin: 0;
}

.owner-reset-preview p {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.owner-reset-preview h2 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 24px;
  line-height: 1;
}

.owner-reset-preview strong {
  display: inline-flex;
  margin-top: 6px;
  padding: 5px 9px;
  border-radius: 999px;
  color: white;
  background: color-mix(in srgb, var(--accent), black 8%);
  font-size: 13px;
}

.owner-reset-preview button {
  grid-column: 1 / -1;
}

.password-row,
.auth-picture-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.password-row input {
  min-width: 0;
}

.password-toggle {
  min-width: 74px;
  min-height: 42px;
  padding: 0 12px;
  border-radius: 13px;
  font-size: 12px;
}

.auth-picture-row {
  grid-template-columns: 64px minmax(0, 1fr);
}

.auth-picture-row img {
  width: 64px;
  height: 64px;
  border-radius: 22px;
  object-fit: cover;
  border: 1px solid var(--glass-line);
  box-shadow: var(--inner-glow);
}

.auth-form button {
  min-height: 48px;
  font-size: 15px;
  font-weight: 900;
}

.trusted-device-button {
  color: white;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent-2), white 18%), var(--accent-2));
  border: 1px solid color-mix(in srgb, var(--accent-2), white 24%);
  box-shadow: var(--inner-glow), 0 14px 34px color-mix(in srgb, var(--accent-2), transparent 72%);
}

.auth-create-cta {
  min-height: 54px;
  border-color: color-mix(in srgb, var(--accent), white 18%);
  background: color-mix(in srgb, var(--accent), transparent 76%);
}

.legacy-claim-card,
.account-settings-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--glass-line);
  border-radius: 20px;
  background: color-mix(in srgb, var(--panel), transparent 12%);
  box-shadow: var(--inner-glow);
}

.legacy-claim-card h2,
.account-settings-card h4 {
  margin: 0;
}

.account-profile-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.account-profile-row img {
  width: 58px;
  height: 58px;
  border-radius: 20px;
  object-fit: cover;
  border: 1px solid var(--glass-line);
}

.account-profile-row h4 {
  margin: 0 0 3px;
  font-size: 18px;
}

.account-home-card {
  gap: 14px;
}

.account-primary-actions,
.account-secondary-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 9px;
}

.account-primary-actions button {
  min-height: 48px;
  font-weight: 900;
}

.account-secondary-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.account-secondary-actions button {
  min-height: 42px;
}

.danger-copy {
  margin: 0;
  color: #fecaca;
  font-size: 12px;
  line-height: 1.45;
}

.tutorial-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.tutorial-list strong {
  color: var(--text);
}

.recovery-card {
  max-width: 560px;
}

.recovery-phrase-box {
  padding: 16px;
  border: 1px dashed color-mix(in srgb, var(--accent), white 15%);
  border-radius: 18px;
  color: var(--text);
  background: color-mix(in srgb, var(--accent), transparent 86%);
  font: 800 18px/1.55 ui-monospace, "Cascadia Mono", Consolas, monospace;
  word-spacing: 6px;
}

.known-accounts {
  display: grid;
  gap: 8px;
}

.known-account {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--glass-line);
  border-radius: 16px;
  background: var(--glass);
}

.known-account img {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  object-fit: cover;
}

.known-account strong,
.known-account span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.known-account span {
  color: var(--muted);
  font-size: 12px;
}

.app-shell.sidebar-mode {
  grid-template-columns: 96px minmax(0, 1fr);
}

.app-shell.sidebar-mode .sidebar {
  grid-column: 2;
}

.app-shell.sidebar-mode .content {
  display: none;
}

.app-shell.messages-mode {
  grid-template-columns: 96px 1fr;
}

.app-shell.messages-mode .sidebar {
  display: none;
}

.app-shell.settings-mode {
  grid-template-columns: 96px 1fr;
}

.app-shell.settings-mode .sidebar {
  display: none;
}

.rail {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 10px;
  background: var(--rail);
  border-right: 1px solid var(--glass-line);
  box-shadow: var(--inner-glow);
  backdrop-filter: blur(24px) saturate(1.4);
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.rail-button {
  position: relative;
  flex: 0 0 auto;
  width: 76px;
  height: 38px;
  padding: 0;
  border-radius: 15px;
  border: 1px solid var(--glass-line);
  background: rgb(255 255 255 / 0.11);
  color: color-mix(in srgb, var(--text), white 36%);
  font-size: 12px;
  font-weight: 800;
  box-shadow: var(--inner-glow);
}

.message-button.has-unread::after {
  content: attr(data-unread-count);
  position: absolute;
  top: 7px;
  right: 7px;
  min-width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  padding: 0 5px;
  border: 2px solid color-mix(in srgb, var(--rail), black 18%);
  border-radius: 999px;
  color: white;
  background: var(--unread);
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--unread), transparent 78%), 0 6px 18px color-mix(in srgb, var(--unread), transparent 35%);
}

#discoverButton.has-unseen-stories::after {
  content: attr(data-story-count);
  position: absolute;
  top: 3px;
  right: 4px;
  display: grid;
  place-items: center;
  min-width: 17px;
  height: 17px;
  padding-inline: 4px;
  border: 2px solid var(--rail);
  border-radius: 999px;
  color: white;
  background: var(--unread);
  font-size: 9px;
  line-height: 1;
}

.message-button {
  height: 76px;
  font-size: 14px;
  line-height: 1.1;
}

.rail-button.active {
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent), white 18%), var(--accent));
  color: white;
}

.rail-content-button {
  margin-top: 0;
}

.rail-spacer {
  flex: 1 1 auto;
  min-height: 0;
}

.reel-focus-toggle {
  display: none;
}

.app-shell.discover-mode,
.app-shell.content-mode {
  grid-template-columns: 96px minmax(0, 1fr);
}

.app-shell.discover-mode .sidebar,
.app-shell.content-mode .sidebar {
  display: none;
}

.sidebar,
.content {
  min-width: 0;
  border-left: 1px solid var(--glass-line);
}

.sidebar {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  padding: 16px;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  background: var(--glass);
  box-shadow: var(--inner-glow);
  backdrop-filter: blur(28px) saturate(1.35);
  overflow: hidden;
}

.sidebar-view {
  display: none;
  align-content: start;
  gap: 16px;
  max-height: 100%;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 2px;
}

.active-sidebar-view {
  display: grid;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.brand img {
  width: 44px;
  height: 44px;
}

.brand h1,
.brand p,
.topbar h2,
.topbar p,
.panel-heading h2 {
  margin: 0;
}

.brand h1 {
  font-size: 18px;
}

.brand p,
.topbar p,
.muted {
  color: var(--muted);
  font-size: 13px;
}

.identity-card,
.stack,
.settings-grid {
  display: grid;
  gap: 10px;
}

.sidebar-panel {
  display: grid;
  gap: 10px;
}

.sidebar-view-heading,
.sidebar-panel-heading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  justify-content: center;
  text-align: center;
}

.sidebar-view-heading h2,
.sidebar-panel-heading h2 {
  margin: 0;
  color: var(--text);
  font-size: 16px;
  font-weight: 900;
}

.sidebar-view-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.palette-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.palette-grid input[type="color"] {
  height: 38px;
  padding: 4px;
  cursor: pointer;
}

.sidebar-actions {
  display: grid;
  gap: 8px;
}

.sidebar-actions button {
  width: 100%;
  min-height: 38px;
}

.design-control-group {
  display: grid;
  gap: 9px;
}

.design-control-group h3 {
  margin: 0;
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.theme-presets {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.theme-preset {
  display: grid;
  justify-items: start;
  gap: 6px;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--glass-line);
  border-radius: 8px;
  color: var(--text);
  background: var(--glass);
  font-size: 11px;
  font-weight: 900;
  box-shadow: var(--inner-glow);
}

.theme-preset.selected {
  border-color: var(--accent);
  box-shadow: var(--inner-glow), 0 0 0 2px color-mix(in srgb, var(--accent), transparent 70%);
}

.theme-swatches {
  display: flex;
  gap: 3px;
}

.theme-swatches i {
  width: 17px;
  height: 17px;
  border: 1px solid rgb(0 0 0 / 0.14);
  border-radius: 50%;
  background: var(--swatch);
}

.message-color-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.message-color-presets button {
  width: 34px;
  height: 34px;
  min-width: 34px;
  padding: 0;
  border: 3px solid var(--panel);
  border-radius: 50%;
  background: var(--message-swatch);
  box-shadow: 0 0 0 1px var(--glass-line);
}

.message-color-presets button.selected {
  box-shadow: 0 0 0 3px var(--text);
}

.message-style-preview {
  width: fit-content;
  max-width: 92%;
  justify-self: end;
  padding: 10px 12px;
  border: 1px solid rgb(255 255 255 / 0.28);
  border-radius: 17px;
  line-height: 1.35;
  overflow-wrap: anywhere;
  box-shadow: var(--inner-glow), 0 8px 20px rgb(0 0 0 / 0.12);
}

.copy-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.contacts {
  display: grid;
  grid-auto-rows: max-content;
  align-content: start;
  gap: 6px;
  min-height: 0;
}

.contact-directory-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.contact-directory-tab {
  min-height: 36px;
  padding: 7px 9px;
  color: var(--muted);
  background: var(--glass);
  border: 1px solid var(--glass-line);
  font-size: 12px;
  font-weight: 900;
}

.contact-directory-tab.active {
  color: white;
  background: var(--accent);
}

.contact-directory-panel {
  display: none;
  align-content: start;
  gap: 9px;
  min-height: 0;
}

.active-contact-directory-panel {
  display: grid;
}

.quick-add-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px;
  gap: 7px;
}

.quick-add-note {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.quick-add-visibility {
  padding: 9px 10px;
  border: 1px solid var(--glass-line);
  border-radius: 8px;
  color: var(--text);
  background: var(--glass);
  text-transform: none;
}

.quick-add-list {
  display: grid;
  grid-auto-rows: max-content;
  gap: 7px;
}

.quick-add-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 34px 34px;
  align-items: center;
  gap: 7px;
  padding: 8px;
  border: 1px solid var(--glass-line);
  border-radius: 8px;
  background: var(--glass);
  box-shadow: var(--inner-glow);
}

.quick-add-row .avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.quick-add-row .contact-main {
  min-width: 0;
}

.quick-add-row .contact-main strong,
.quick-add-row .contact-main small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-add-plus,
.quick-add-more {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  min-width: 34px;
  padding: 0;
  border-radius: 50%;
  font-size: 20px;
}

.quick-add-more {
  color: var(--text);
  background: var(--glass-strong);
  border: 1px solid var(--glass-line);
}

.member-picker {
  display: grid;
  grid-auto-rows: max-content;
  gap: 7px;
  max-height: 190px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--glass-line);
  border-radius: 15px;
  background: var(--glass);
}

.dialog-member-picker {
  max-height: 280px;
}

.member-option {
  display: grid;
  grid-template-columns: auto 34px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: 13px;
  color: var(--text);
  background: transparent;
  cursor: pointer;
  text-transform: none;
}

.member-option:hover,
.member-option:has(input:checked) {
  border-color: var(--glass-line);
  background: var(--glass-strong);
}

.member-option input {
  appearance: none;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  min-width: 18px;
  min-height: 18px;
  padding: 0;
  border: 1px solid var(--glass-line);
  border-radius: 6px;
  background: color-mix(in srgb, var(--panel), transparent 12%);
  accent-color: var(--accent);
}

.member-option input::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 3px;
  background: white;
  opacity: 0;
  transform: scale(.55);
}

.member-option input:checked {
  border-color: color-mix(in srgb, var(--accent), white 22%);
  background: var(--accent);
}

.member-option input:checked::after {
  opacity: 1;
  transform: scale(1);
}

.member-option .avatar {
  width: 34px;
  height: 34px;
  border-radius: 12px;
}

.members-dialog-card {
  width: min(460px, calc(100vw - 28px));
}

.group-members-list {
  display: grid;
  grid-auto-rows: max-content;
  gap: 10px;
  max-height: min(420px, 62vh);
  overflow-y: auto;
  padding-right: 2px;
}

.group-member-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 68px;
  padding: 12px;
  border: 1px solid var(--glass-line);
  border-radius: 14px;
  background: var(--glass);
  box-shadow: var(--inner-glow);
}

.group-member-row.blocked-member {
  opacity: 0.72;
}

.group-member-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.group-member-actions button {
  min-height: 34px;
  padding: 8px 10px;
  font-size: 12px;
}

.contact {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  color: var(--text);
  background: transparent;
  border: 1px solid transparent;
  text-align: left;
  box-shadow: none;
}

.contact.selected,
.contact:hover {
  background: var(--glass-strong);
  border-color: var(--glass-line);
  box-shadow: var(--inner-glow);
}

.contact.has-unread strong,
.message-contact.has-unread strong {
  color: var(--text);
}

.avatar-wrap {
  position: relative;
  width: 38px;
  height: 38px;
}

.avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 13px;
  background: linear-gradient(145deg, var(--accent-2), color-mix(in srgb, var(--accent), var(--accent-2) 45%));
  color: white;
  font-weight: 900;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.28), 0 10px 26px color-mix(in srgb, var(--accent-2), transparent 72%);
}

.unread-dot {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 12px;
  height: 12px;
  border: 2px solid var(--panel);
  border-radius: 999px;
  background: var(--unread);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--unread), transparent 78%), 0 4px 14px color-mix(in srgb, var(--unread), transparent 45%);
}

.unread-count {
  min-width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  padding: 0 7px;
  border-radius: 999px;
  color: white;
  background: var(--unread);
  font-size: 11px;
  font-weight: 900;
  box-shadow: 0 8px 20px color-mix(in srgb, var(--unread), transparent 58%);
}

.avatar img,
.profile-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.contact-main {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.contact-main small {
  color: var(--muted);
}

.content {
  background: transparent;
  min-height: 0;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.view {
  display: none;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

.active-view {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 0;
}

.chat-view.active-view {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

.chat-screen {
  display: none;
  grid-row: 1;
  grid-column: 1;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

.app-shell.messages-mode:not(.conversation-open) #contactPickerScreen {
  display: grid;
}

.app-shell.messages-mode:not(.conversation-open) #conversationScreen,
.app-shell.messages-mode.conversation-open #contactPickerScreen {
  display: none !important;
}

.app-shell.messages-mode.conversation-open #conversationScreen {
  display: grid !important;
}

.contact-picker-screen.active-chat-screen {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  min-height: 0;
}

.conversation-screen.active-chat-screen {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  min-height: 0;
  min-width: 0;
  position: relative;
  isolation: isolate;
}

.conversation-screen > * {
  grid-column: 1;
  min-width: 0;
}

.conversation-screen > .topbar {
  grid-row: 1;
}

.conversation-screen > .message-search {
  grid-row: 2;
}

.conversation-screen > .chat-background-layer {
  grid-row: 3;
  width: 100%;
}

.conversation-screen > .messages {
  grid-row: 3;
  width: 100%;
}

.conversation-screen > .new-messages-jump {
  grid-row: 4;
}

.conversation-screen > .composer {
  grid-row: 5;
  width: 100%;
}

.message-picker-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
}

.message-picker-heading p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.message-picker-tools {
  display: flex;
  align-items: center;
  gap: 7px;
}

.stories-panel {
  display: grid;
  gap: 10px;
  padding: 12px 18px 2px;
  min-width: 0;
}

.stories-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.stories-heading > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.stories-heading strong {
  font-size: 13px;
}

.stories-heading span {
  color: var(--muted);
  font-size: 10px;
}

.stories-heading button {
  min-height: 32px;
  padding: 6px 11px;
  font-size: 11px;
}

.stories-strip {
  display: flex;
  gap: 11px;
  min-width: 0;
  padding: 2px 2px 7px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: thin;
}

.story-chip {
  display: grid;
  flex: 0 0 62px;
  justify-items: center;
  gap: 5px;
  width: 62px;
  padding: 0;
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: 18px;
  box-shadow: none;
}

.story-chip:hover {
  transform: translateY(-1px);
}

.story-chip-avatar,
.story-avatar-ring {
  display: grid;
  place-items: center;
  border-radius: 999px;
}

.story-chip-avatar {
  position: relative;
  width: 52px;
  height: 52px;
  padding: 3px;
  background: linear-gradient(140deg, var(--accent), var(--accent-2) 52%, #f09ac4);
  box-shadow: 0 0 0 1px rgb(255 255 255 / 0.32), 0 9px 24px color-mix(in srgb, var(--accent), transparent 62%);
}

.story-chip.seen .story-chip-avatar {
  background: color-mix(in srgb, var(--muted), transparent 40%);
  box-shadow: 0 0 0 1px var(--glass-line);
}

.story-chip-avatar > span,
.story-chip-avatar > img {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border: 2px solid var(--panel);
  border-radius: 999px;
  object-fit: cover;
  color: white;
  background: linear-gradient(145deg, var(--accent-2), var(--accent));
  font-weight: 900;
}

.story-chip-label {
  width: 100%;
  overflow: hidden;
  font-size: 10px;
  font-weight: 800;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.story-add-mark {
  position: absolute;
  right: -2px;
  bottom: -2px;
  display: grid;
  place-items: center;
  width: 19px;
  height: 19px;
  border: 2px solid var(--panel);
  border-radius: 999px;
  color: white;
  background: var(--accent);
  font-size: 14px;
  line-height: 1;
}

.avatar-wrap.has-story {
  padding: 2px;
  border-radius: 15px;
  background: linear-gradient(140deg, var(--accent), var(--accent-2) 52%, #f09ac4);
  box-shadow: 0 0 0 1px rgb(255 255 255 / 0.26);
}

.avatar-wrap.has-story.story-seen {
  background: color-mix(in srgb, var(--muted), transparent 42%);
}

.avatar-wrap.has-story .avatar {
  width: 100%;
  height: 100%;
  border: 2px solid var(--panel);
  border-radius: 12px;
}

/* Every active Story avatar is a stable, keyboard-accessible viewer button. */
.story-avatar-trigger {
  cursor: pointer;
  touch-action: manipulation;
  transition: filter 150ms ease, outline-color 150ms ease, box-shadow 150ms ease;
}

.story-avatar-trigger:not(.avatar-wrap).has-story {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.story-avatar-trigger:not(.avatar-wrap).has-story.story-seen {
  outline-color: color-mix(in srgb, var(--muted), transparent 20%);
}

.story-avatar-trigger:hover {
  filter: brightness(1.08) saturate(1.08);
}

.story-avatar-trigger:focus-visible {
  outline: 3px solid var(--focus) !important;
  outline-offset: 3px;
}

.menu-presence-toggle {
  margin-bottom: 14px;
}

.message-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 12px 18px 0;
}

.tab-label-short {
  display: none;
}

.message-picker-actions {
  display: flex;
  justify-content: flex-end;
  padding: 8px 18px 0;
}

.message-picker-actions button {
  min-height: 36px;
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 900;
}

.message-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  color: var(--muted);
  background: var(--glass);
  border: 1px solid var(--glass-line);
  box-shadow: var(--inner-glow);
}

.message-tab.active {
  color: white;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent), white 16%), var(--accent));
}

.tab-badge {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  color: white;
  background: var(--danger);
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
}

.message-contact-list {
  display: grid;
  grid-auto-rows: max-content;
  align-content: start;
  gap: 10px;
  padding: 18px;
  min-height: 0;
  max-height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.message-contact {
  display: grid;
  gap: 10px;
  align-self: start;
  width: 100%;
  min-height: max-content;
  padding: 12px;
  color: var(--text);
  background: var(--glass);
  border: 1px solid var(--glass-line);
  text-align: left;
  box-shadow: var(--inner-glow), var(--shadow);
  backdrop-filter: blur(22px) saturate(1.35);
}

.message-contact-summary {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto 40px;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.message-contact:hover,
.message-contact.selected {
  background: var(--glass-strong);
  border-color: color-mix(in srgb, var(--accent), var(--glass-line) 45%);
}

.message-contact .avatar {
  width: 44px;
  height: 44px;
}

.message-contact .avatar-wrap {
  width: 44px;
  height: 44px;
}

.message-contact-action {
  width: 100%;
  min-height: 38px;
  color: white;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent), white 18%), var(--accent));
  border-radius: 13px;
  padding: 9px 12px;
  font-size: 12px;
  font-weight: 900;
  box-shadow: var(--inner-glow);
}

.contact-options-button {
  grid-column: 4;
  width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--accent), var(--glass-line) 45%);
  border-radius: 12px;
  color: white;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent-2), white 14%), var(--accent-2));
  font-size: 24px;
  font-weight: 900;
  line-height: 1;
  box-shadow: var(--inner-glow), 0 8px 18px color-mix(in srgb, var(--accent-2), transparent 72%);
}

.contact-options-button:hover {
  transform: none;
}

.message-empty {
  justify-self: center;
  align-self: center;
}

.topbar,
.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 18px;
  background: var(--glass);
  border-bottom: 1px solid var(--glass-line);
  box-shadow: var(--inner-glow);
  backdrop-filter: blur(26px) saturate(1.35);
}

.panel-heading {
  align-items: center;
}

.conversation-screen .topbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
}

.back-button {
  min-height: 36px;
  padding: 7px 10px;
}

.icon-command {
  width: 40px;
  min-width: 40px;
  padding: 0;
  font-size: 21px;
  line-height: 1;
}

.sync-command {
  min-height: 40px;
  padding-inline: 14px;
  white-space: nowrap;
}

.icon-command.spinning {
  animation: reload-spin 700ms linear infinite;
}

@keyframes reload-spin {
  to {
    transform: rotate(360deg);
  }
}

.message-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--glass-line);
  background: var(--glass);
}

.message-search input {
  min-width: 0;
}

.chat-heading {
  display: grid;
  gap: 2px;
  justify-items: start;
  min-width: 0;
}

.chat-heading h2,
.chat-heading p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-heading h2 {
  font-size: 16px;
}

.chat-heading p {
  margin-top: 2px;
  font-size: 11px;
}

.chat-identity {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.active-chat-avatar {
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  overflow: hidden;
  border: 1px solid var(--glass-line);
  border-radius: 50%;
  color: white;
  background: linear-gradient(145deg, var(--accent-2), var(--accent));
  font-size: 13px;
  font-weight: 900;
  box-shadow: var(--inner-glow);
}

.active-chat-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.toolbar {
  display: grid;
  gap: 6px;
  justify-items: end;
  min-width: 0;
}

.toolbar-row {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: 6px;
}

.toolbar-row button {
  min-height: 36px;
  padding: 7px 10px;
  font-size: 12px;
}

.connection-panel {
  display: grid;
  grid-template-columns: auto minmax(190px, 1fr);
  gap: 8px;
  width: min(100%, 390px);
}

.connection-step {
  display: grid;
  grid-template-columns: auto;
  align-items: end;
  gap: 5px;
}

.connection-step:last-child {
  grid-template-columns: minmax(96px, 1fr) auto;
}

.connection-step:last-child .step-label {
  grid-column: 1 / -1;
}

.step-label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}

.connection-code-input {
  width: 112px;
  min-height: 38px;
  text-align: center;
  font-weight: 800;
  letter-spacing: 1px;
}

.presence-toggle {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--glass-line);
  border-radius: 999px;
  color: var(--text);
  background: var(--glass);
  font-size: 12px;
  font-weight: 800;
  text-transform: none;
  cursor: pointer;
}

.presence-toggle input {
  appearance: none;
  width: 34px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  position: relative;
}

.presence-toggle input::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: white;
  transition: transform 160ms ease;
}

.presence-toggle input:checked {
  background: var(--muted);
}

.presence-toggle input:checked::after {
  transform: translateX(16px);
}

.messages {
  position: relative;
  z-index: 1;
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 18px;
  min-height: 0;
  max-height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  overflow-anchor: none;
  overscroll-behavior: contain;
  background: transparent;
}

.messages.custom-chat-background {
  background: transparent;
}

.chat-background-layer {
  position: relative;
  z-index: 0;
  display: none;
  min-height: 0;
  overflow: hidden;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  pointer-events: none;
}

.chat-background-layer.active {
  display: block;
}

.chat-background-layer.active::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgb(255 255 255 / 0.025), rgb(0 0 0 / 0.12)),
    color-mix(in srgb, var(--panel), transparent 72%);
}

.new-messages-jump {
  justify-self: end;
  min-height: 32px;
  margin: 8px 14px 0;
  padding: 7px 12px;
  border-radius: 999px;
  color: white;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent), white 14%), var(--accent));
  box-shadow: var(--inner-glow), 0 10px 22px color-mix(in srgb, var(--accent), transparent 72%);
  font-size: 12px;
  font-weight: 900;
}

.empty-state {
  place-items: center;
  color: var(--muted);
}

.message {
  position: relative;
  min-width: 0;
  max-width: min(72ch, 82%);
  padding: 10px 12px;
  border: 1px solid var(--glass-line);
  border-radius: 17px;
  box-shadow: var(--inner-glow), 0 10px 24px rgb(0 0 0 / 0.08);
  backdrop-filter: blur(18px) saturate(1.25);
  overflow-wrap: anywhere;
  contain: layout paint;
}

.custom-message-presentation {
  color: var(--message-custom-text);
  background: var(--message-custom-background) !important;
}

.custom-message-presentation .message-meta,
.custom-message-presentation .delivery-status,
.custom-message-presentation time,
.custom-message-presentation .group-message-sender {
  color: inherit;
}

.custom-message-presentation .reply-chip {
  color: inherit;
  background: rgb(0 0 0 / 0.16);
  border-color: rgb(255 255 255 / 0.25);
}

.message p {
  margin: 0 0 5px;
  line-height: 1.4;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.message time {
  color: var(--muted);
  display: block;
  font-size: 10px;
  line-height: 1.2;
  opacity: 0.72;
}

.message-system {
  justify-self: center;
  display: inline-grid;
  gap: 2px;
  max-width: min(92%, 440px);
  padding: 7px 12px;
  border: 1px solid color-mix(in srgb, var(--glass-line), white 8%);
  border-radius: 999px;
  color: color-mix(in srgb, var(--muted), white 12%);
  background: color-mix(in srgb, var(--panel), transparent 12%);
  text-align: center;
  font-size: 11px;
  font-weight: 850;
  box-shadow: var(--inner-glow);
  backdrop-filter: blur(18px) saturate(1.2);
  overflow-wrap: anywhere;
}

.message-system time {
  color: inherit;
  font-size: 9px;
  font-weight: 700;
  opacity: .72;
}

.typing-indicator {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: min(72ch, 82%);
  padding: 9px 12px;
  border: 1px solid var(--glass-line);
  border-radius: 17px;
  color: var(--muted);
  background: var(--glass);
  font-size: 12px;
  font-weight: 800;
  box-shadow: var(--inner-glow);
}

.typing-avatars {
  display: inline-flex;
  align-items: center;
}

.typing-avatar {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  margin-left: -7px;
  overflow: hidden;
  border: 2px solid var(--glass-strong);
  border-radius: 999px;
  color: white;
  background: linear-gradient(145deg, var(--accent-2), var(--accent));
  font-size: 10px;
  font-weight: 900;
}

.typing-avatar:first-child {
  margin-left: 0;
}

.typing-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.typing-dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.typing-dots i {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--accent);
  animation: typing-bounce 1s ease-in-out infinite;
}

.typing-dots i:nth-child(2) {
  animation-delay: 130ms;
}

.typing-dots i:nth-child(3) {
  animation-delay: 260ms;
}

@keyframes typing-bounce {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.5;
  }

  40% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

.message.inbound {
  justify-self: start;
  background: color-mix(in srgb, var(--bubble-in), transparent 8%);
}

.message.outbound {
  justify-self: end;
  background: color-mix(in srgb, var(--bubble-out), var(--accent) 14%);
}

.group-message-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  justify-self: start;
  width: min(92%, 760px);
  min-width: 0;
}

.group-message-row.outbound {
  flex-direction: row-reverse;
  justify-self: end;
}

.group-message-row .message {
  justify-self: auto;
  max-width: calc(100% - 42px);
}

.group-message-avatar {
  flex: 0 0 34px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  overflow: hidden;
  border: 2px solid var(--glass-line);
  border-radius: 50%;
  color: white;
  background: linear-gradient(145deg, var(--accent-2), var(--accent));
  font-size: 12px;
  font-weight: 900;
  box-shadow: var(--inner-glow), 0 7px 18px rgb(0 0 0 / 0.14);
}

.group-message-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.group-message-sender {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 5px;
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
}

.composer {
  position: relative;
  display: grid;
  grid-template-columns: 36px 36px minmax(0, 1fr) auto;
  gap: 6px;
  padding: 10px;
  min-height: 0;
  max-height: 42vh;
  overflow-y: auto;
  background: var(--glass);
  border-top: 1px solid var(--glass-line);
  box-shadow: var(--inner-glow);
  backdrop-filter: blur(28px) saturate(1.35);
}

.chat-background-layer.has-image {
  background-position: center;
  background-size: cover;
}

.composer > input[type="text"],
.composer > #messageInput {
  min-width: 0;
  width: 100%;
}

#attachButton,
.composer-icon-button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  min-width: 36px;
  padding: 0;
  border-radius: 50%;
}

.composer-icon-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.composer-icon-button.recording {
  color: white;
  background: var(--danger);
  border-color: color-mix(in srgb, var(--danger), white 35%);
  animation: recording-pulse 1.2s ease-in-out infinite;
}

.upload-progress {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 104px;
  align-items: center;
  gap: 10px;
  padding: 7px 9px;
  border: 1px solid var(--glass-line);
  border-radius: 12px;
  color: var(--muted);
  font-size: 12px;
  background: color-mix(in srgb, var(--panel), transparent 20%);
}

.upload-progress progress {
  width: 100%;
  height: 8px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: var(--input);
}

.upload-progress progress::-webkit-progress-bar {
  background: var(--input);
  border-radius: 999px;
}

.upload-progress progress::-webkit-progress-value {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 999px;
}

#sendMessageButton {
  min-height: 36px;
  padding: 8px 11px;
}

@keyframes recording-pulse {
  0%,
  100% {
    box-shadow: var(--inner-glow), 0 0 0 0 color-mix(in srgb, var(--danger), transparent 45%);
  }

  50% {
    box-shadow: var(--inner-glow), 0 0 0 6px transparent;
  }
}

.mention-suggestions {
  grid-column: 1 / -1;
  display: grid;
  grid-auto-rows: max-content;
  gap: 5px;
  max-height: 190px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--glass-line);
  border-radius: 14px;
  background: var(--glass-strong);
  box-shadow: var(--shadow);
}

.mention-suggestions button {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-height: 40px;
  padding: 5px 8px;
  color: var(--text);
  background: transparent;
  text-align: left;
  box-shadow: none;
}

.mention-suggestions .avatar {
  width: 32px;
  height: 32px;
  border-radius: 10px;
}

.reply-preview,
.attachment-preview {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--glass-line);
  border-radius: 13px;
  color: var(--muted);
  background: var(--glass-strong);
  font-size: 12px;
  font-weight: 800;
}

.voice-recording-bar {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid color-mix(in srgb, var(--danger), transparent 50%);
  border-radius: 13px;
  color: var(--text);
  background: color-mix(in srgb, var(--danger), var(--glass-strong) 88%);
}

.voice-recording-status,
.voice-recording-actions,
.voice-preview-content {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.voice-recording-status {
  font-size: 12px;
  font-weight: 900;
}

.voice-recording-status i {
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  border-radius: 50%;
  background: var(--danger);
  animation: recording-dot 900ms ease-in-out infinite;
}

.voice-recording-actions button {
  min-height: 32px;
  padding: 6px 9px;
  font-size: 11px;
  font-weight: 900;
}

.voice-transcript-preview {
  grid-column: 1 / -1;
  max-height: 58px;
  overflow: auto;
  padding: 7px 9px;
  border: 1px solid color-mix(in srgb, var(--accent), transparent 55%);
  border-radius: 12px;
  color: var(--text);
  background: color-mix(in srgb, var(--panel), transparent 20%);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

@keyframes recording-dot {
  50% {
    opacity: 0.35;
  }
}

.reply-preview span,
.attachment-preview span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reply-preview-content {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.attachment-frame {
  display: block;
  box-sizing: border-box;
  width: min(260px, 100%);
  max-height: 260px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--glass-line);
  border-radius: 14px;
  background: var(--glass);
  box-shadow: none;
}

.attachment-frame img,
.attachment-frame video {
  display: block;
  width: 100%;
  max-height: 260px;
  object-fit: contain;
}

.attachment-video-frame {
  display: grid;
  gap: 0;
  padding: 0;
  max-height: none;
  border-radius: 18px;
  background: color-mix(in srgb, var(--panel), black 16%);
}

.video-stage {
  position: relative;
  aspect-ratio: 16 / 9;
  min-height: 0;
  overflow: hidden;
  background: black;
}

.attachment-video-frame video {
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: contain;
  background: black;
}

.video-center-play {
  position: absolute;
  inset: 50% auto auto 50%;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  min-width: 46px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 50%;
  color: white;
  background: rgba(8, 14, 26, 0.66);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.28);
  backdrop-filter: blur(12px);
  transform: translate(-50%, -50%);
  transition: opacity 150ms ease, transform 150ms ease;
}

.video-center-play:hover {
  transform: translate(-50%, -50%) scale(1.04);
}

.video-center-play.playing {
  opacity: 0;
  pointer-events: none;
}

.video-controls {
  display: grid;
  box-sizing: border-box;
  grid-template-columns: 28px minmax(22px, 1fr) auto 28px 28px;
  align-items: center;
  gap: 3px;
  min-width: 0;
  padding: 6px;
  border-top: 1px solid color-mix(in srgb, var(--glass-line), transparent 24%);
  background: color-mix(in srgb, var(--panel), transparent 6%);
}

.video-play-button,
.video-mute-button,
.video-fullscreen-button {
  display: grid;
  place-items: center;
  box-sizing: border-box;
  width: 28px;
  height: 28px;
  min-width: 28px;
  padding: 0;
  overflow: hidden;
  border-radius: 50%;
  color: var(--text);
  background: color-mix(in srgb, var(--glass), transparent 8%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.video-center-play svg,
.video-play-button svg,
.video-mute-button svg,
.video-fullscreen-button svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.video-center-play .media-fill,
.video-play-button .media-fill {
  fill: currentColor;
  stroke: none;
}

.video-progress {
  width: 100%;
  min-width: 48px;
  height: 4px;
  padding: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.video-time {
  color: var(--muted);
  font-size: 9px;
  font-weight: 850;
  white-space: nowrap;
}

.video-playback-error {
  position: absolute;
  inset: auto 8px 8px;
  z-index: 2;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid rgba(255, 150, 150, 0.42);
  border-radius: 11px;
  color: white;
  background: rgba(91, 17, 26, 0.84);
  backdrop-filter: blur(10px);
  font-size: 11px;
  font-weight: 750;
  line-height: 1.3;
}

.attachment-download,
.message-link,
.rich-message-content a {
  color: color-mix(in srgb, var(--accent), white 24%);
  font-weight: 900;
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-word;
}

.attachment-download {
  display: inline-flex;
  justify-self: start;
  width: fit-content;
  padding: 5px 8px;
  border-radius: 999px;
  color: white;
  background: color-mix(in srgb, var(--accent), transparent 22%);
  font-size: 12px;
  text-decoration: none;
}

.attachment-video-frame > .attachment-download {
  margin: 0 8px 8px;
}

.rich-message-content {
  display: grid;
  gap: 7px;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  line-height: 1.38;
}

.rich-message-content p,
.rich-message-content blockquote,
.rich-message-content ul,
.rich-message-content ol,
.rich-message-content pre,
.rich-message-content table,
.rich-message-content h1,
.rich-message-content h2,
.rich-message-content h3,
.rich-message-content h4 {
  margin: 0;
}

.rich-message-content ul,
.rich-message-content ol {
  padding-left: 19px;
}

.rich-message-content blockquote {
  padding-left: 9px;
  border-left: 3px solid color-mix(in srgb, currentColor, transparent 55%);
  color: color-mix(in srgb, currentColor, transparent 12%);
}

.rich-message-content table {
  width: max-content;
  max-width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: 10px;
  font-size: 12px;
}

.rich-message-content th,
.rich-message-content td {
  padding: 6px 8px;
  border: 1px solid color-mix(in srgb, currentColor, transparent 72%);
  vertical-align: top;
}

.rich-message-content pre,
.rich-message-content code {
  max-width: 100%;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
}

.voice-note-block {
  display: grid;
  gap: 6px;
  width: min(260px, 100%);
}

.voice-note-player {
  display: grid;
  grid-template-columns: 32px minmax(62px, 1fr) 28px auto;
  align-items: center;
  gap: 6px;
  width: min(260px, 100%);
  min-width: 0;
  padding: 8px;
  border: 1px solid color-mix(in srgb, var(--glass-line), transparent 16%);
  border-radius: 18px;
  background: color-mix(in srgb, var(--glass), transparent 8%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.media-playback-error {
  margin: 0;
  padding: 7px 9px;
  border: 1px solid rgba(255, 128, 128, 0.35);
  border-radius: 11px;
  color: #ffd6d6;
  background: rgba(105, 18, 27, 0.55);
  font-size: 11px;
  font-weight: 750;
  line-height: 1.3;
}

.voice-note-transcript {
  margin: 0;
  padding: 7px 9px;
  border: 1px solid color-mix(in srgb, currentColor, transparent 78%);
  border-radius: 12px;
  background: color-mix(in srgb, black, transparent 88%);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.35;
  white-space: pre-wrap;
  word-break: break-word;
}

.voice-note-transcript.muted {
  color: var(--muted);
}

.voice-play-button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  min-width: 32px;
  padding: 0;
  border-radius: 50%;
  color: white;
  background: var(--accent);
  box-shadow: var(--inner-glow), 0 6px 14px color-mix(in srgb, var(--accent), transparent 65%);
}

.voice-play-button svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.voice-play-button .voice-play-fill {
  fill: currentColor;
  stroke: none;
}

.voice-waveform {
  display: flex;
  align-items: center;
  gap: 1px;
  width: 100%;
  min-width: 62px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 0;
  color: inherit;
  background: transparent;
  box-shadow: none;
  overflow: hidden;
}

.voice-waveform:hover,
.voice-speed-button:hover,
.voice-play-button:hover {
  transform: none;
}

.voice-waveform i {
  display: block;
  width: 2px;
  min-width: 1px;
  max-width: 2px;
  flex: 1;
  border-radius: 2px;
  background: color-mix(in srgb, var(--muted), transparent 34%);
  transition: background 100ms ease;
}

.voice-waveform i.played {
  background: var(--accent);
}

.voice-speed-button {
  width: 28px;
  min-width: 28px;
  min-height: 20px;
  padding: 3px;
  border-radius: 5px;
  color: white;
  background: var(--accent-2);
  box-shadow: none;
  font-size: 9px;
  font-weight: 900;
}

.voice-playback-time {
  min-width: 26px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  text-align: right;
  white-space: nowrap;
}

.voice-note-audio {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.voice-note-player.playing .voice-play-button {
  background: color-mix(in srgb, var(--accent), white 12%);
}

.voice-preview-content {
  display: block;
  flex: 1;
  width: 100%;
  min-width: 0;
  overflow: hidden;
}

.media-preview-content {
  display: block;
  width: 100%;
  min-width: 0;
}

.attachment-preview .media-preview-content .attachment-frame,
.multi-send-attachment-preview .media-preview-content .attachment-frame {
  width: 100%;
}

.voice-note-preview-player {
  width: 100%;
}

.attachment-preview.voice-attachment-preview {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.voice-attachment-preview #clearAttachment {
  justify-self: end;
}

.image-viewer-dialog {
  width: min(92vw, 720px);
}

.image-viewer-card {
  width: min(92vw, 720px);
  height: min(82vh, 720px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
}

.image-viewer-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.download-button {
  display: inline-grid;
  place-items: center;
  min-height: 38px;
  padding: 9px 13px;
  border-radius: 13px;
  color: white;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent), white 16%), var(--accent));
  text-decoration: none;
  font-size: 13px;
  font-weight: 900;
}

#imageViewerImage {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
  border: 1px solid var(--glass-line);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.2);
}

.reply-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
  padding: 7px 9px;
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  color: var(--muted);
  background: var(--glass);
  font-size: 12px;
  font-weight: 800;
}

.reply-chip span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reply-thumb {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: 1px solid var(--glass-line);
  border-radius: 9px;
  object-fit: cover;
}

.message-reaction {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 42px;
  height: 28px;
  margin: 0;
  padding: 0 9px;
  border: 1px solid var(--glass-line);
  border-radius: 999px;
  color: var(--text);
  background: var(--glass);
  font-size: 16px;
  box-shadow: var(--inner-glow);
}

.message-reaction.mine {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent), transparent 82%);
}

.message-reaction strong {
  font-size: 11px;
}

.message-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 7px 0 4px;
}

.message-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 10px;
}

.delivery-status {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  opacity: 0.86;
}

.mention {
  border-radius: 5px;
  padding: 1px 3px;
  color: color-mix(in srgb, var(--accent), white 18%);
  background: color-mix(in srgb, var(--accent), transparent 82%);
  font-weight: 900;
}

.message-actions-menu {
  position: fixed;
  z-index: 80;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(52px, 1fr));
  gap: 5px;
  width: min(330px, calc(100vw - 16px));
  max-width: calc(100vw - 16px);
  padding: 5px;
  border: 1px solid var(--glass-line);
  border-radius: 999px;
  background: var(--glass-strong);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(1.3);
}

.message-actions-menu button {
  min-height: 28px;
  min-width: 0;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 11px;
}

.emoji-picker {
  position: fixed;
  z-index: 81;
  display: block;
  width: min-content;
  max-width: calc(100vw - 16px);
  padding: 7px;
  border: 1px solid var(--glass-line);
  border-radius: 16px;
  background: var(--glass-strong);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(1.3);
}

.emoji-picker-quick {
  display: flex;
  align-items: center;
  gap: 5px;
}

.emoji-picker-library {
  display: grid;
  grid-template-columns: repeat(7, 30px);
  gap: 4px;
  width: 234px;
  max-width: 100%;
  max-height: min(226px, 48vh);
  margin-top: 7px;
  padding-top: 7px;
  overflow-y: auto;
  border-top: 1px solid var(--glass-line);
  scrollbar-width: thin;
}

.emoji-picker button {
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  border-radius: 11px;
  background: var(--glass);
  font-size: 17px;
}

.emoji-picker-library button {
  width: 30px;
  height: 30px;
  min-height: 30px;
}

.emoji-picker .emoji-more-button {
  width: 25px;
  height: 25px;
  min-height: 25px;
  margin-left: 1px;
  border-radius: 999px;
  color: var(--text);
  background: color-mix(in srgb, var(--accent), transparent 78%);
  font-size: 18px;
  line-height: 1;
}

@media (max-width: 340px) {
  .emoji-picker-library {
    grid-template-columns: repeat(6, 28px);
    width: 188px;
  }

  .emoji-picker-library button {
    width: 28px;
    height: 28px;
    min-height: 28px;
  }
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  padding: 18px;
}

.info-item,
.notice,
.log {
  border: 1px solid var(--glass-line);
  border-radius: 16px;
  background: var(--glass);
  padding: 14px;
  box-shadow: var(--inner-glow), var(--shadow);
  backdrop-filter: blur(22px) saturate(1.3);
}

.info-item {
  display: grid;
  gap: 6px;
}

.info-item span {
  color: var(--muted);
  line-height: 1.35;
}

.notice {
  margin: 0 18px 18px;
  color: var(--muted);
  line-height: 1.5;
}

.log {
  margin: 0 18px 18px;
  min-height: 120px;
  white-space: pre-wrap;
  color: var(--muted);
}

.settings-grid {
  max-width: 520px;
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.settings-actions button {
  flex: 1;
  min-width: 140px;
}

.settings-shell {
  display: grid;
  align-content: start;
  gap: 16px;
  padding: 18px;
  min-height: 0;
  max-height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.settings-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.settings-tab {
  color: var(--text);
  background: var(--glass);
  border: 1px solid var(--glass-line);
}

.settings-tab.active {
  color: white;
  background: var(--accent);
  border-color: var(--accent);
}

.settings-panel {
  display: none;
}

.active-settings-panel {
  display: grid;
  gap: 14px;
}

.settings-panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.settings-panel-heading h3 {
  margin: 0;
}

.settings-panel .info-grid {
  padding: 0;
}

.settings-panel .notice,
.settings-panel .log {
  margin: 0;
}

.profile-preview {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  border: 1px solid var(--glass-line);
  box-shadow: var(--inner-glow), var(--shadow);
}

.group-picture-preview {
  width: 58px;
  height: 58px;
  border-radius: 15px;
}

.hidden {
  display: none;
}

.app-shell.call-active > .call-bar {
  display: grid;
}

dialog {
  border: 0;
  border-radius: 22px;
  padding: 0;
  width: min(720px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  color: var(--text);
  background: var(--glass-strong);
  border: 1px solid var(--glass-line);
  box-shadow: var(--inner-glow), 0 28px 90px rgb(0 0 0 / 0.32);
  backdrop-filter: blur(30px) saturate(1.35);
}

dialog::backdrop {
  background: rgb(0 0 0 / 0.55);
}

.story-composer-dialog,
.story-viewer-dialog {
  width: min(500px, calc(100vw - 18px));
  border-radius: 30px;
}

.story-composer-dialog {
  max-height: calc(100dvh - 14px);
}

.story-composer-card {
  gap: 14px;
  padding: 16px;
  max-height: calc(100dvh - 16px);
}

.story-dialog-heading,
.story-viewer-header,
.story-viewer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.story-dialog-heading h2,
.story-dialog-heading p {
  margin: 0;
}

.story-eyebrow {
  color: var(--accent-2) !important;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.story-composer-preview {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: clamp(180px, 42dvh, 380px);
  min-height: 180px;
  max-height: 380px;
  overflow: hidden;
  border: 1px solid var(--glass-line);
  border-radius: 24px;
  background: #04070b;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.18), var(--shadow);
  contain: paint;
  isolation: isolate;
}

.story-composer-preview img,
.story-composer-preview video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.story-caption-label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.story-composer-card .story-caption-label textarea {
  height: 68px;
  min-height: 68px;
  max-height: 96px;
  resize: none;
  text-transform: none;
}

.story-viewer-dialog {
  height: min(720px, calc(100dvh - 14px));
  max-height: calc(100dvh - 14px);
  color: white;
  background: rgb(5 8 14 / 0.92);
}

.story-viewer-dialog::backdrop {
  background: rgb(0 0 0 / 0.82);
  backdrop-filter: blur(16px);
}

.story-viewer-card {
  position: relative;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto auto auto;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  border-radius: inherit;
  background: radial-gradient(circle at 50% 15%, rgb(255 255 255 / 0.08), transparent 36%), #05080e;
}

.story-feedback-panel {
  z-index: 5;
  display: grid;
  gap: 8px;
  padding: 0 12px 12px;
  background: linear-gradient(180deg, transparent, rgb(0 0 0 / 0.36));
}

.story-feedback-panel.hidden {
  display: none;
}

.story-feedback-actions {
  display: grid;
  grid-template-columns: 38px 38px minmax(0, 1fr) minmax(0, 1fr);
  gap: 5px;
}

.story-feedback-panel.own-story .story-feedback-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.story-feedback-panel.own-story #likeStoryButton,
.story-feedback-panel.own-story #dislikeStoryButton {
  display: none;
}

.story-feedback-button {
  min-height: 36px;
  min-width: 0;
  padding: 7px 6px;
  border: 1px solid rgb(255 255 255 / 0.2);
  border-radius: 999px;
  color: white;
  background: rgb(255 255 255 / 0.11);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.18);
  font-size: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.story-feedback-button.active {
  color: #06101a;
  background: white;
}

.story-reaction-button {
  padding: 0;
  font-family: "Segoe UI Emoji", "Apple Color Emoji", sans-serif;
  font-size: 18px;
  line-height: 1;
}

#toggleStoryComments {
  padding-inline: 4px;
  font-size: 9px;
}

.story-comment-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px;
}

.story-comment-form input {
  min-width: 0;
  color: white;
  background: rgb(255 255 255 / 0.1);
}

.story-comment-form button {
  padding-inline: 12px;
}

.story-comments-drawer {
  display: grid;
  gap: 7px;
  min-height: 0;
  padding: 8px;
  border: 1px solid rgb(255 255 255 / 0.14);
  border-radius: 16px;
  background: rgb(8 13 23 / 0.54);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.1);
  backdrop-filter: blur(14px) saturate(135%);
}

.story-comments-drawer.hidden {
  display: none;
}

.story-comments {
  display: grid;
  gap: 6px;
  max-height: 112px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.story-comments-visibility {
  color: rgb(255 255 255 / 0.5);
  font-size: 8px;
  text-align: center;
}

.story-comment-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: start;
  gap: 7px;
  padding: 6px;
  border-radius: 12px;
  color: white;
  background: rgb(255 255 255 / 0.08);
}

.story-comment-row .story-viewer-avatar {
  width: 28px;
  height: 28px;
  font-size: 9px;
}

.story-comment-copy {
  min-width: 0;
  font-size: 10px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.story-comment-copy strong {
  display: block;
  margin-bottom: 1px;
  font-size: 10px;
}

.story-comment-time {
  color: rgb(255 255 255 / 0.5);
  font-size: 8px;
  white-space: nowrap;
}

.story-comments-empty {
  padding: 5px;
  color: rgb(255 255 255 / 0.58);
  font-size: 10px;
  text-align: center;
}

.destination-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
}

.destination-heading h2,
.destination-heading p,
.destination-heading span {
  margin: 0;
}

.destination-heading > div {
  display: grid;
  gap: 2px;
}

.destination-heading > div > span {
  color: var(--muted);
  font-size: 12px;
}

.destination-eyebrow {
  color: var(--accent-2) !important;
  font-size: 10px;
  font-weight: 950;
  text-transform: uppercase;
}

.discovery-view.active-view,
.content-library-view.active-view {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  min-height: 0;
}

.content-library-view.active-view {
  grid-template-rows: auto auto minmax(0, 1fr);
}

.destination-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 10px 16px 0;
}

.destination-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: var(--muted);
  background: var(--glass);
  border: 1px solid var(--glass-line);
}

.destination-tab.active {
  color: white;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent), white 16%), var(--accent));
}

.soon-pill {
  padding: 2px 6px;
  border-radius: 999px;
  color: var(--text);
  background: color-mix(in srgb, var(--accent-2), transparent 72%);
  font-size: 9px;
  font-weight: 950;
}

.discover-controls {
  display: flex;
  gap: 7px;
  padding: 10px 16px 0;
}

.discover-filter {
  min-height: 32px;
  padding: 6px 11px;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--glass-line);
  border-radius: 999px;
  font-size: 11px;
}

.discover-filter.active {
  color: var(--text);
  background: var(--glass-strong);
}

.discover-stories,
.content-tab-panel {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.discover-stories {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: max-content;
  align-content: start;
  gap: 11px;
  padding: 14px 16px 18px;
  scrollbar-gutter: stable;
}

.discover-story-tile.story-reveal {
  animation: story-card-reveal 260ms cubic-bezier(.2,.8,.2,1) both;
}

@keyframes story-card-reveal {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
  to { opacity: 1; transform: none; }
}

.discover-story-tile {
  position: relative;
  min-width: 0;
  aspect-ratio: 9 / 14;
  isolation: isolate;
}

.discover-story-card {
  position: absolute;
  z-index: 2;
  inset: 0;
  width: auto;
  height: auto;
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--glass-line);
  border-radius: 24px;
  color: white;
  background: #07101d;
  text-align: left;
  box-shadow: var(--inner-glow), var(--shadow);
}

.discover-story-tile.has-story-stack .discover-story-card {
  inset: 0 7px 8px 0;
}

.story-stack-layer {
  position: absolute;
  border: 1px solid color-mix(in srgb, var(--accent), white 18%);
  border-radius: 22px;
  background: color-mix(in srgb, var(--panel-strong), var(--accent) 12%);
  box-shadow: var(--inner-glow), 0 9px 22px rgb(0 0 0 / 0.2);
}

.story-stack-back {
  z-index: 0;
  inset: 8px 0 0 8px;
  opacity: 0.52;
}

.story-stack-middle {
  z-index: 1;
  inset: 4px 4px 4px 4px;
  opacity: 0.74;
}

.discover-story-more {
  position: absolute;
  z-index: 5;
  top: 7px;
  right: 7px;
  display: grid;
  place-items: center;
  width: 29px;
  min-width: 29px;
  height: 29px;
  min-height: 29px;
  padding: 0;
  border: 1px solid rgb(255 255 255 / 0.34);
  border-radius: 999px;
  color: white;
  background: rgb(6 11 20 / 0.58);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.2), 0 7px 18px rgb(0 0 0 / 0.28);
  backdrop-filter: blur(10px);
  font-size: 17px;
  line-height: 1;
}

.discover-story-tile.has-story-stack .discover-story-more {
  right: 13px;
}

.story-stack-count {
  position: absolute;
  z-index: 3;
  right: 8px;
  bottom: 8px;
  display: grid;
  place-items: center;
  min-width: 23px;
  height: 23px;
  padding-inline: 6px;
  border: 1px solid rgb(255 255 255 / 0.3);
  border-radius: 999px;
  color: white;
  background: rgb(6 11 20 / 0.62);
  font-size: 10px;
  font-weight: 900;
  backdrop-filter: blur(10px);
}

.discover-story-card img,
.discover-story-card video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.discover-story-card::after {
  content: "";
  position: absolute;
  inset: 38% 0 0;
  background: linear-gradient(transparent, rgb(0 0 0 / 0.84));
}

.discover-story-owner,
.discover-story-meta {
  position: absolute;
  z-index: 2;
  left: 10px;
  right: 10px;
}

.discover-story-owner {
  top: 8px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding-right: 25px;
}

.discover-story-owner .story-viewer-avatar {
  flex-basis: 25px;
  width: 25px;
  height: 25px;
  font-size: 10px;
}

.discover-story-owner strong {
  min-width: 0;
  overflow: hidden;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.discover-story-meta {
  bottom: 8px;
  display: grid;
  gap: 3px;
  padding-right: 22px;
}

.discover-story-meta strong {
  display: -webkit-box;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
  font-size: 11px;
  line-height: 1.25;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.discover-story-meta span {
  color: rgb(255 255 255 / 0.72);
  font-size: 10px;
}

.discover-empty,
.content-empty {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  gap: 7px;
  min-height: 220px;
  padding: 24px;
  border: 1px dashed var(--glass-line);
  border-radius: 24px;
  color: var(--muted);
  text-align: center;
}

.content-tab-panel {
  display: none;
  padding: 14px 16px 18px;
}

.content-tab-panel.active-content-tab-panel {
  display: grid;
  align-content: start;
  gap: 14px;
}

.content-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.content-stats article {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 11px 7px;
  border: 1px solid var(--glass-line);
  border-radius: 18px;
  background: var(--glass);
  box-shadow: var(--inner-glow);
  text-align: center;
}

.content-stats strong {
  font-size: 18px;
}

.content-stats span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 850;
  text-transform: uppercase;
}

.content-story-list {
  display: grid;
  gap: 12px;
}

.content-story-card {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 12px;
  padding: 11px;
  border: 1px solid var(--glass-line);
  border-radius: 24px;
  background: var(--glass);
  box-shadow: var(--inner-glow), var(--shadow);
}

.content-story-preview {
  width: 86px;
  aspect-ratio: 9 / 13;
  overflow: hidden;
  border-radius: 17px;
  background: #05080e;
}

.content-story-preview img,
.content-story-preview video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.content-story-details {
  display: grid;
  align-content: start;
  gap: 9px;
  min-width: 0;
}

.content-story-summary,
.content-story-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.content-story-summary span {
  padding: 4px 7px;
  border-radius: 999px;
  color: var(--muted);
  background: color-mix(in srgb, var(--panel), transparent 26%);
  font-size: 10px;
}

.content-story-actions button,
.content-story-actions a {
  min-height: 31px;
  padding: 6px 9px;
  border-radius: 11px;
  font-size: 10px;
}

.content-story-responses {
  display: grid;
  gap: 6px;
}

.content-response-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  padding: 7px;
  border-radius: 13px;
  background: color-mix(in srgb, var(--panel), transparent 35%);
  font-size: 10px;
}

.content-response-row .story-viewer-avatar {
  width: 28px;
  height: 28px;
  font-size: 9px;
}

.content-response-row span {
  overflow-wrap: anywhere;
}

.reels-coming-soon {
  place-items: center;
  align-content: center !important;
  min-height: 100%;
  text-align: center;
}

.reels-coming-soon p {
  max-width: 420px;
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.reels-mark {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border: 1px solid var(--glass-line);
  border-radius: 26px;
  color: white;
  background: linear-gradient(145deg, var(--accent), var(--accent-2));
  box-shadow: var(--inner-glow), var(--shadow);
  font-size: 25px;
}

.story-progress {
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(var(--story-count, 1), minmax(0, 1fr));
  gap: 4px;
  padding: 10px 12px 4px;
}

.story-progress-segment {
  height: 3px;
  overflow: hidden;
  border-radius: 999px;
  background: rgb(255 255 255 / 0.28);
}

.story-progress-segment::after {
  content: "";
  display: block;
  width: var(--story-progress, 0%);
  height: 100%;
  background: white;
}

.story-progress-segment.complete::after {
  width: 100%;
}

.story-viewer-header {
  z-index: 3;
  padding: 7px 12px 10px;
  text-shadow: 0 1px 8px rgb(0 0 0 / 0.8);
}

.story-viewer-header > div {
  display: grid;
  flex: 1;
  gap: 1px;
  min-width: 0;
}

.story-viewer-header span {
  color: rgb(255 255 255 / 0.72);
  font-size: 11px;
}

.story-viewer-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  overflow: hidden;
  border: 2px solid rgb(255 255 255 / 0.78);
  border-radius: 999px;
  background: linear-gradient(145deg, var(--accent-2), var(--accent));
  font-weight: 900;
}

.story-viewer-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.story-viewer-close {
  width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  border-radius: 999px;
  color: white;
  background: rgb(0 0 0 / 0.34);
  border: 1px solid rgb(255 255 255 / 0.2);
}

.story-viewer-stage {
  position: relative;
  z-index: 1;
  min-height: 0;
  overflow: hidden;
  background: #020307;
}

.story-viewer-stage img,
.story-viewer-stage video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.story-nav {
  position: absolute;
  z-index: 4;
  top: 20%;
  bottom: 15%;
  width: 26%;
  padding: 0;
  border: 0;
  border-radius: 0;
  color: transparent;
  background: transparent;
  box-shadow: none;
}

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

.story-viewer-caption {
  z-index: 3;
  margin: 0;
  padding: 10px 18px 4px;
  color: white;
  font-size: 14px;
  line-height: 1.4;
  text-align: center;
  text-shadow: 0 2px 8px rgb(0 0 0 / 0.9);
  overflow-wrap: anywhere;
}

.story-viewer-footer {
  z-index: 3;
  min-height: 50px;
  padding: 8px 14px 12px;
  color: rgb(255 255 255 / 0.74);
  font-size: 11px;
}

.dialog-card {
  display: grid;
  gap: 12px;
  padding: 18px;
  max-height: calc(100dvh - 24px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.dialog-card h3,
.dialog-card p {
  margin: 0;
}

.dialog-card p {
  color: var(--muted);
}

.contact-code {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  border: 1px solid var(--glass-line);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--text);
  background: var(--glass);
  font-weight: 800;
  letter-spacing: 0;
}

.onboarding-card {
  max-width: 540px;
  gap: 18px;
  padding: 26px;
  border: 2px solid var(--accent);
  box-shadow: 0 24px 70px rgb(0 0 0 / 0.34);
}

.onboarding-card h3 {
  color: var(--accent);
  font-size: 24px;
}

.onboarding-message {
  color: var(--text);
  font-size: 25px;
  font-weight: 900;
  line-height: 1.22;
}

.onboarding-card .dialog-actions {
  justify-content: stretch;
}

.onboarding-card .dialog-actions button {
  flex: 1;
  min-height: 48px;
  font-size: 15px;
  font-weight: 800;
}

.onboarding-card .dialog-actions button:disabled {
  cursor: wait;
}

.dialog-card textarea {
  min-height: 240px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
}

.multi-send-card textarea {
  min-height: 110px;
  resize: vertical;
  font-family: inherit;
  font-size: 13px;
}

.multi-send-card #multiSendFeedback {
  min-height: 18px;
  font-size: 12px;
}

.call-dialog {
  width: min(520px, calc(100vw - 20px));
}

.call-dialog[open] {
  position: fixed;
  inset: 72px 10px auto auto;
  margin: 0;
  z-index: 45;
  max-height: calc(100dvh - 82px);
}

.call-card {
  gap: 12px;
  padding: 12px;
  overflow: hidden;
  text-align: left;
}

.call-card audio {
  display: none;
}

.call-panel-header {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) 36px;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 2px;
}

.call-panel-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.call-close-button {
  width: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 50%;
  font-size: 15px;
  font-weight: 950;
}

.call-avatar {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  overflow: hidden;
  border: 1px solid var(--glass-line);
  border-radius: 50%;
  color: white;
  background:
    radial-gradient(circle at 28% 22%, rgb(255 255 255 / 0.34), transparent 28%),
    linear-gradient(145deg, var(--accent-2), var(--accent));
  box-shadow: var(--inner-glow), 0 10px 24px color-mix(in srgb, var(--accent), transparent 72%);
  font-size: 22px;
  font-weight: 950;
}

.call-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.call-eyebrow {
  margin: 0;
  color: var(--accent) !important;
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.call-card h2 {
  margin: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.call-status-text {
  min-height: 16px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.call-video-stage {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  min-height: clamp(210px, 45dvh, 390px);
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border: 1px solid var(--glass-line);
  border-radius: 18px;
  background:
    radial-gradient(circle at 20% 15%, color-mix(in srgb, var(--accent), transparent 60%), transparent 34%),
    linear-gradient(145deg, color-mix(in srgb, var(--panel), black 12%), color-mix(in srgb, var(--panel-2), black 20%));
  box-shadow: var(--inner-glow);
}

.call-video-stage.audio-only {
  display: none;
}

.call-video-stage.group-call-mode {
  display: grid;
  min-height: clamp(230px, 48dvh, 410px);
  aspect-ratio: 4 / 3;
}

.call-video-stage.group-call-mode > .remote-video-placeholder,
.call-video-stage.group-call-mode > #remoteCallVideo,
.call-video-stage.group-call-mode > #localCallVideo,
.call-video-stage.group-call-mode > .local-video-label {
  display: none;
}

.group-call-grid {
  position: absolute;
  inset: 8px;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: minmax(0, 1fr);
  gap: 7px;
}

.group-call-grid[data-count="1"] {
  grid-template-columns: minmax(0, 1fr);
}

.group-call-tile {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgb(255 255 255 / 0.16);
  border-radius: 14px;
  background: color-mix(in srgb, var(--panel-2), black 12%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.1);
}

.group-call-tile.local {
  cursor: pointer;
}

.group-call-tile video {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: none;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.group-call-tile.local video {
  transform: scaleX(-1);
}

.group-call-tile.camera-active video {
  display: block;
}

.group-call-placeholder {
  display: grid;
  place-items: center;
}

.group-call-avatar {
  display: grid;
  place-items: center;
  width: clamp(46px, 13vw, 72px);
  height: clamp(46px, 13vw, 72px);
  overflow: hidden;
  border: 2px solid color-mix(in srgb, var(--accent), white 34%);
  border-radius: 50%;
  color: white;
  background: linear-gradient(145deg, var(--accent-2), var(--accent));
  box-shadow: 0 10px 26px color-mix(in srgb, var(--accent), transparent 58%);
  font-size: 20px;
  font-weight: 950;
}

.group-call-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.group-call-person {
  position: absolute;
  left: 7px;
  right: 7px;
  bottom: 7px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  min-width: 0;
  padding: 5px 7px;
  border: 1px solid rgb(255 255 255 / 0.14);
  border-radius: 9px;
  color: white;
  background: rgb(5 11 23 / 0.58);
  backdrop-filter: blur(10px);
}

.group-call-person strong,
.group-call-person small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-call-person strong {
  font-size: 10px;
}

.group-call-person small {
  color: rgb(255 255 255 / 0.72);
  font-size: 8px;
  font-weight: 800;
}

.group-call-tile.connecting {
  opacity: 0.82;
}

.call-video-stage video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#remoteCallVideo {
  position: absolute;
  inset: 0;
  display: none;
  z-index: 1;
}

#remoteCallVideo.active {
  display: block;
}

#localCallVideo {
  position: absolute;
  top: 12px;
  right: 12px;
  display: none;
  width: clamp(82px, 29%, 132px);
  aspect-ratio: 3 / 4;
  height: auto;
  border: 2px solid rgb(255 255 255 / 0.84);
  border-radius: 14px;
  background: #000;
  box-shadow: 0 14px 34px rgb(0 0 0 / 0.48);
  transform: scaleX(-1);
  z-index: 2;
  cursor: pointer;
  transition: width 180ms ease, height 180ms ease, inset 180ms ease, border-radius 180ms ease;
}

#localCallVideo.active {
  display: block;
}

.local-video-label {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 2;
  display: none;
  padding: 3px 7px;
  border-radius: 999px;
  color: white;
  background: rgb(0 0 0 / 0.58);
  font-size: 10px;
  font-weight: 900;
  pointer-events: none;
}

#localCallVideo.active + .local-video-label {
  display: block;
}

.call-video-stage.local-video-primary #localCallVideo.active {
  inset: 0;
  width: 100%;
  min-width: 0;
  max-width: none;
  height: 100%;
  aspect-ratio: auto;
  border: 0;
  border-radius: 0;
  z-index: 1;
}

.call-video-stage.local-video-primary #remoteCallVideo.active {
  inset: 12px 12px auto auto;
  width: clamp(82px, 29%, 132px);
  height: auto;
  aspect-ratio: 3 / 4;
  border: 2px solid rgb(255 255 255 / 0.84);
  border-radius: 14px;
  box-shadow: 0 14px 34px rgb(0 0 0 / 0.48);
  z-index: 2;
}

.call-video-stage.local-video-primary .local-video-label {
  inset: auto auto 14px 14px;
}

.call-video-adjustments {
  position: absolute;
  left: 0;
  bottom: 10px;
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(2, 30px);
  gap: 2px;
  width: auto;
  max-width: calc(100% - 20px);
  padding: 6px 5px 6px 3px;
  overflow: visible;
  border: 1px solid rgb(255 255 255 / 0.16);
  border-left: 0;
  border-radius: 0 10px 10px 0;
  color: white;
  background: rgb(7 16 31 / 0.28);
  box-shadow: 0 6px 18px rgb(0 0 0 / 0.14);
  backdrop-filter: blur(8px) saturate(1.12);
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.call-video-adjustments.hidden {
  display: none;
}

.call-video-adjustments.collapsed {
  transform: translateX(calc(-100% + 4px));
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.call-video-adjustments.collapsed label,
.call-video-adjustments.collapsed small {
  opacity: 0;
  pointer-events: none;
}

.call-adjustments-handle {
  position: absolute;
  top: 50%;
  right: -15px;
  z-index: 2;
  width: 17px;
  min-width: 17px;
  height: 42px;
  min-height: 42px;
  padding: 0;
  transform: translateY(-50%);
  border: 1px solid rgb(255 255 255 / 0.3);
  border-left: 0;
  border-radius: 0 999px 999px 0;
  color: white;
  background: rgb(7 16 31 / 0.46);
  box-shadow: 5px 0 14px rgb(0 0 0 / 0.16);
  backdrop-filter: blur(8px);
  font-size: 13px;
  line-height: 1;
}

.call-adjustments-handle:hover {
  transform: translateY(-50%);
  background: color-mix(in srgb, var(--accent), transparent 28%);
}

.call-video-adjustments label {
  position: relative;
  justify-items: center;
  gap: 3px;
  width: 30px;
  min-width: 0;
  padding: 0;
  color: white;
  font-size: 9px;
  line-height: 1;
}

.call-video-adjustments label:nth-child(2) {
  justify-self: center;
  margin: 0;
}

.call-video-adjustments input[type="range"] {
  width: 12px;
  height: 76px;
  margin: 0;
  writing-mode: vertical-lr;
  direction: rtl;
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background: transparent;
  transform: none;
}

.call-video-adjustments input[type="range"]::-webkit-slider-runnable-track {
  width: 4px;
  height: 100%;
  border: 1px solid rgb(255 255 255 / 0.2);
  border-radius: 999px;
  background: rgb(255 255 255 / 0.24);
}

.call-video-adjustments input[type="range"]::-webkit-slider-thumb {
  width: 12px;
  height: 12px;
  margin-left: -5px;
  -webkit-appearance: none;
  border: 2px solid rgb(255 255 255 / 0.8);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 3px 10px rgb(0 0 0 / 0.3);
}

.call-video-adjustments small {
  display: none;
}

.remote-video-placeholder {
  display: grid;
  justify-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.camera-off-symbol {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  color: transparent;
  background: linear-gradient(145deg, var(--accent-2), var(--accent));
  box-shadow: var(--inner-glow), 0 10px 24px color-mix(in srgb, var(--accent), transparent 72%);
}

.call-media-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
}

.call-media-actions button {
  min-height: 42px;
  padding: 8px 9px;
  font-size: 12px;
  font-weight: 900;
}

.call-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
}

.call-actions button {
  min-height: 44px;
  font-weight: 900;
}

.call-actions button:only-child,
.call-actions #endCall:not(.hidden) {
  grid-column: 1 / -1;
}

.call-size-limited,
.call-size-limited:hover {
  transform: none;
  color: var(--muted);
  background: color-mix(in srgb, var(--panel-2), transparent 14%);
  border-color: var(--glass-line);
  box-shadow: none;
  cursor: pointer;
  opacity: 0.72;
}

.group-call-limit-dialog {
  width: min(390px, calc(100vw - 24px));
}

.group-call-limit-card {
  justify-items: center;
  gap: 12px;
  padding: 24px;
  text-align: center;
}

.group-call-limit-card h2,
.group-call-limit-card p {
  margin: 0;
}

.group-call-limit-card p {
  color: var(--muted);
  line-height: 1.5;
}

.group-call-limit-card button {
  width: 100%;
}

.group-call-limit-icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border: 1px solid color-mix(in srgb, var(--accent), white 18%);
  border-radius: 20px;
  color: white;
  background: linear-gradient(145deg, var(--accent-2), var(--accent));
  box-shadow: var(--inner-glow), 0 16px 36px color-mix(in srgb, var(--accent), transparent 62%);
  font-size: 19px;
  font-weight: 950;
}

@media (max-width: 430px) {
  .call-bar {
    grid-template-columns: auto minmax(0, 1fr) auto auto;
  }

  .call-bar #callMute {
    display: none;
  }

  .call-dialog[open] {
    inset: 68px 8px auto 8px;
    width: auto;
  }

  .call-media-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .call-media-actions button {
    padding-inline: 5px;
    font-size: 11px;
  }

  .call-video-stage {
    min-height: clamp(190px, 40dvh, 320px);
  }
}

.multi-send-composer-tools,
.background-image-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.multi-send-composer-tools button,
.background-image-actions button {
  flex: 1 1 140px;
}

#multiSendVoice.recording {
  color: white;
  background: var(--danger);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 100;
  transform: translateX(-50%);
  padding: 12px 16px;
  border: 1px solid var(--glass-line);
  border-radius: 16px;
  color: white;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent), white 14%), var(--accent));
  box-shadow: var(--shadow), var(--inner-glow);
  font-size: 14px;
  font-weight: 900;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.contact-dialog-card {
  min-width: min(360px, calc(100vw - 32px));
}

.contact-profile-hero {
  display: grid;
  justify-items: center;
  gap: 7px;
  padding: 8px 4px 12px;
  text-align: center;
}

.contact-profile-hero h3 {
  max-width: 100%;
  overflow-wrap: anywhere;
  font-size: 22px;
}

.contact-profile-hero #contactDialogStatus {
  font-size: 13px;
}

.contact-dialog-avatar {
  display: grid;
  place-items: center;
  width: 112px;
  height: 112px;
  overflow: hidden;
  border: 3px solid color-mix(in srgb, var(--accent), white 28%);
  border-radius: 50%;
  color: white;
  background: linear-gradient(145deg, var(--accent-2), var(--accent));
  font-size: 36px;
  font-weight: 900;
  box-shadow: var(--inner-glow), 0 18px 42px color-mix(in srgb, var(--accent), transparent 66%);
}

.contact-dialog-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-editor-dialog {
  width: min(520px, calc(100vw - 20px));
}

.profile-editor-card {
  gap: 16px;
}

.profile-editor-heading h3 {
  font-size: 20px;
}

.profile-editor-heading p {
  margin-top: 5px;
}

.profile-editor-stage {
  position: relative;
  justify-self: center;
  width: min(320px, calc(100vw - 68px), calc(100dvh - 290px));
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--glass-line);
  border-radius: 18px;
  background: #111827;
  box-shadow: var(--inner-glow), var(--shadow);
}

#profileEditorCanvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

#profileEditorCanvas:active {
  cursor: grabbing;
}

.profile-editor-guide {
  position: absolute;
  inset: 8%;
  pointer-events: none;
  border: 2px solid rgb(255 255 255 / 0.9);
  border-radius: 50%;
  box-shadow: 0 0 0 999px rgb(0 0 0 / 0.3);
}

.profile-editor-stage.background-editor-mode .profile-editor-guide {
  inset: 3%;
  border-radius: 14px;
  box-shadow: 0 0 0 999px rgb(0 0 0 / 0.22);
}

.profile-editor-zoom {
  max-width: 360px;
  width: 100%;
  justify-self: center;
}

.profile-editor-zoom input {
  padding: 0;
  accent-color: var(--accent);
}

.profile-editor-tools {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.profile-editor-tools button {
  min-width: 0;
  padding-inline: 8px;
}

.contact-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.group-role-label {
  color: var(--accent);
  font-size: 12px;
}

.chat-background-control {
  gap: 8px;
}

.color-control-row {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 8px;
}

.color-control-row input[type="color"] {
  height: 42px;
  padding: 4px;
}

.notifications-toggle {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--glass-line);
  border-radius: 15px;
  color: var(--text);
  background: var(--glass);
  font-size: 14px;
  font-weight: 800;
  text-transform: none;
}

.notifications-toggle input {
  width: 18px;
  height: 18px;
}

@media (max-width: 760px) {
  .app-shell {
    grid-template-columns: 92px 1fr;
  }

  .app-shell.sidebar-mode {
    grid-template-columns: 92px minmax(0, 1fr);
  }

  .app-shell.messages-mode {
    grid-template-columns: 92px 1fr;
  }

  .app-shell.settings-mode {
    grid-template-columns: 92px 1fr;
  }

  .sidebar {
    grid-column: 2;
  }

  .content {
    grid-column: 1 / -1;
  }

  .app-shell.messages-mode .content {
    grid-column: 2;
  }

  .app-shell.settings-mode .content {
    grid-column: 2;
  }

  .app-shell.discover-mode .content,
  .app-shell.content-mode .content {
    grid-column: 2;
  }

  .app-shell.discover-mode.reels-active {
    grid-template-columns: minmax(0, 1fr);
  }

  .app-shell.discover-mode.reels-active .rail {
    position: fixed;
    z-index: 24;
    inset: 0 auto 0 0;
    width: 92px;
    transform: translateX(0);
    transition: transform 260ms cubic-bezier(.2,.8,.2,1), opacity 200ms ease;
  }

  .app-shell.discover-mode.reels-active .content {
    grid-column: 1;
    padding-left: 92px;
    transition: padding-left 260ms cubic-bezier(.2,.8,.2,1);
  }

  .app-shell.discover-mode.reels-active.reel-focus-mode .rail {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-104%);
  }

  .app-shell.discover-mode.reels-active.reel-focus-mode .content {
    padding-left: 0;
  }

  .app-shell.discover-mode.reels-active .reel-focus-toggle {
    display: grid;
    width: 36px;
    height: 42px;
    min-height: 42px;
    padding: 0;
    place-items: center;
    border: 1px solid rgb(255 255 255 / 28%);
    border-radius: 999px;
    color: white;
    background: color-mix(in srgb, var(--panel) 72%, transparent);
    box-shadow: 0 10px 28px rgb(0 0 0 / 28%), inset 0 1px 0 rgb(255 255 255 / 24%);
    backdrop-filter: blur(24px) saturate(160%);
    transition: background 180ms ease, transform 180ms cubic-bezier(.2,.8,.2,1);
  }

  .reel-focus-toggle > span:first-child {
    font-size: 27px;
    line-height: 1;
  }

  .reel-focus-unread {
    position: absolute;
    top: 3px;
    right: 3px;
    display: grid;
    min-width: 15px;
    height: 15px;
    padding-inline: 2px;
    place-items: center;
    border: 1px solid var(--panel);
    border-radius: 999px;
    color: white;
    background: var(--unread);
    font-size: 8px;
    font-weight: 950;
  }

  .reel-focus-unread.hidden {
    display: none;
  }

  .app-shell.discover-mode.reels-active.reel-focus-mode .discovery-view.active-view {
    grid-template-rows: minmax(0, 1fr);
  }

  .app-shell.discover-mode.reels-active.reel-focus-mode .destination-heading,
  .app-shell.discover-mode.reels-active.reel-focus-mode .destination-tabs {
    display: none;
  }

  .app-shell.discover-mode.reels-active.reel-focus-mode #discoverReelsPanel {
    position: relative;
    height: 100%;
    overflow: hidden;
    grid-template-rows: minmax(0, 1fr);
  }

  .app-shell.discover-mode.reels-active.reel-focus-mode .reel-feed-navigation {
    position: absolute;
    z-index: 9;
    top: 10px;
    right: 8px;
    left: 8px;
  }

  .app-shell.discover-mode.reels-active.reel-focus-mode .reel-feed-tabs {
    position: static;
    width: min(210px, calc(100% - 42px));
    padding: 5px;
    border-radius: 999px;
    transform: none;
  }

  .app-shell.discover-mode.reels-active.reel-focus-mode .reel-feed-tabs button {
    min-height: 32px;
    border-radius: 999px;
  }

  .app-shell.discover-mode.reels-active.reel-focus-mode .reels-feed {
    grid-row: 1;
    height: 100%;
    gap: 0;
    padding: 0;
  }

  .app-shell.discover-mode.reels-active.reel-focus-mode .reel-card {
    width: 100%;
    height: 100%;
    min-height: 100%;
    aspect-ratio: auto;
    border-radius: 0;
    scroll-snap-align: start;
  }

  .app-shell.discover-mode.reels-active.reel-focus-mode .reel-card > video {
    object-fit: cover;
  }

  .active-view {
    height: 100vh;
  }

  .conversation-screen .topbar {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
  }

  .conversation-screen .toolbar {
    grid-column: 1 / -1;
    justify-items: stretch;
    width: 100%;
  }

  .conversation-screen .toolbar-row {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) minmax(0, 1fr);
    width: 100%;
  }

  .connection-panel,
  .connection-step:last-child {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .connection-code-input {
    width: 100%;
  }

  .message-contact {
    gap: 9px;
  }

  .message-contact-summary {
    grid-template-columns: 44px minmax(0, 1fr) 36px;
  }

  .message-contact-summary .unread-count {
    display: none;
  }

  .contact-options-button {
    grid-column: 3;
    width: 36px;
    height: 36px;
    min-height: 36px;
  }

}

@media (max-width: 430px) {
  .app-shell,
  .app-shell.sidebar-mode,
  .app-shell.messages-mode,
  .app-shell.settings-mode,
  .app-shell.discover-mode,
  .app-shell.content-mode {
    grid-template-columns: 76px minmax(0, 1fr);
  }

  .rail {
    gap: 8px;
    padding-inline: 7px;
  }

  .rail-button {
    width: 62px;
    padding-inline: 3px;
    font-size: 10px;
  }

  .app-shell.discover-mode.reels-active .rail {
    width: 76px;
  }

  .app-shell.discover-mode.reels-active .content {
    padding-left: 76px;
  }

  .message-picker-heading {
    align-items: stretch;
    gap: 8px;
    padding: 12px;
  }

  .message-picker-tools {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 40px minmax(58px, auto);
  }

  .message-tabs,
  .message-picker-actions,
  .message-contact-list {
    padding-inline: 10px;
  }

  .conversation-screen .topbar {
    padding: 8px;
  }

  .active-chat-avatar {
    flex-basis: 34px;
    width: 34px;
    height: 34px;
  }

  .destination-heading {
    gap: 8px;
    padding: 11px 10px;
  }

  .destination-heading h2 {
    font-size: 20px;
  }

  .destination-heading > button {
    min-width: 64px;
    min-height: 38px;
    padding: 7px 9px;
    font-size: 10px;
  }

  .destination-tabs,
  .discover-controls,
  .discover-stories,
  .content-tab-panel {
    padding-inline: 9px;
  }

  .content-stats {
    gap: 6px;
  }

  .content-stats article {
    padding-inline: 4px;
  }

  .content-stats span {
    font-size: 8px;
  }

  .content-story-card {
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 9px;
    padding: 9px;
    border-radius: 19px;
  }

  .content-story-preview {
    width: 72px;
    border-radius: 14px;
  }

  .content-story-details {
    gap: 7px;
  }

  .content-story-details > strong {
    display: -webkit-box;
    overflow: hidden;
    font-size: 13px;
    line-height: 1.25;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .content-story-details > .muted {
    font-size: 10px;
    line-height: 1.35;
  }

  .content-story-summary {
    gap: 4px;
  }

  .content-story-summary span {
    padding: 3px 5px;
    font-size: 9px;
  }

  .content-story-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px;
  }

  .content-story-actions button,
  .content-story-actions a {
    width: 100%;
    min-width: 0;
    padding-inline: 4px;
    text-align: center;
  }
}

@media (max-width: 340px) {
  .app-shell,
  .app-shell.sidebar-mode,
  .app-shell.messages-mode,
  .app-shell.settings-mode,
  .app-shell.discover-mode,
  .app-shell.content-mode {
    grid-template-columns: 76px minmax(0, 1fr);
  }

  .rail {
    padding-inline: 7px;
  }

  .rail-button {
    width: 62px;
    padding-inline: 3px;
    font-size: 11px;
  }

  .conversation-screen .toolbar-row button {
    min-width: 0;
    padding-inline: 4px;
    overflow: hidden;
    font-size: 9px;
    text-overflow: ellipsis;
  }

  .composer {
    grid-template-columns: 34px 34px minmax(0, 1fr) auto;
    gap: 4px;
    padding: 7px;
  }

  .message-tabs {
    gap: 5px;
  }

  .message-tab {
    gap: 4px;
    min-width: 0;
    padding-inline: 5px;
    font-size: 9px;
  }

  .tab-label-full {
    display: none;
  }

  .tab-label-short {
    display: inline;
  }

  .tab-badge {
    min-width: 17px;
    height: 17px;
    padding-inline: 4px;
    font-size: 9px;
  }

  #attachButton,
  .composer-icon-button {
    width: 34px;
    height: 34px;
    min-width: 34px;
  }

  #sendMessageButton {
    padding-inline: 8px;
    font-size: 12px;
  }

  .destination-heading {
    align-items: flex-end;
    gap: 7px;
    padding: 11px 10px;
  }

  .destination-heading h2 {
    font-size: 18px;
  }

  .destination-heading > button {
    min-height: 34px;
    padding: 6px 9px;
    font-size: 10px;
  }

  .destination-tabs,
  .discover-controls,
  .discover-stories,
  .content-tab-panel {
    padding-inline: 9px;
  }

  .destination-tab {
    min-width: 0;
    padding-inline: 4px;
    font-size: 10px;
  }

  .soon-pill {
    padding-inline: 4px;
    font-size: 8px;
  }

  .content-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .content-story-card {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    padding: 8px;
    border-radius: 18px;
  }

  .content-story-preview {
    width: 100%;
    height: 116px;
    aspect-ratio: auto;
    border-radius: 13px;
  }

  .content-story-actions button,
  .content-story-actions a {
    padding-inline: 7px;
  }
}

@media (max-height: 700px) {
  .profile-editor-card {
    gap: 10px;
    padding: 14px;
  }

  .profile-editor-heading h3 {
    font-size: 18px;
  }

  .profile-editor-heading p {
    margin-top: 2px;
    font-size: 12px;
  }

  .profile-editor-stage {
    width: min(280px, calc(100vw - 60px), calc(100dvh - 270px));
    border-radius: 15px;
  }

  .profile-editor-tools,
  .profile-editor-card .dialog-actions {
    gap: 6px;
  }

  .profile-editor-tools button,
  .profile-editor-card .dialog-actions button {
    min-height: 38px;
    padding-block: 8px;
  }
}

.startup-failure {
  position: fixed;
  z-index: 10000;
  inset: 54px 12px auto 12px;
  display: grid;
  gap: 8px;
  padding: 16px;
  color: var(--text);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border: 1px solid color-mix(in srgb, #ef4444 72%, var(--border));
  border-radius: 8px;
  box-shadow: 0 16px 44px rgb(0 0 0 / 28%);
  backdrop-filter: blur(18px);
}

.startup-failure strong {
  font-size: 17px;
}

.startup-failure span {
  color: var(--muted);
  line-height: 1.45;
}

.startup-failure button {
  justify-self: start;
}

/* Stories and Reels share encrypted media but use purpose-built viewing flows. */
.discover-content-panel,
.content-tab-panel {
  display: none;
  min-height: 0;
}

.discover-content-panel.active-discover-content-panel,
.content-tab-panel.active-content-tab-panel {
  display: block;
}

#discoverStoriesPanel.active-discover-content-panel,
#discoverReelsPanel.active-discover-content-panel {
  display: grid;
  min-height: 0;
  overflow: hidden;
  grid-template-rows: auto minmax(0, 1fr);
}

#discoverStoriesPanel.active-discover-content-panel {
  grid-template-rows: auto minmax(0, 1fr);
}

.story-draft-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(132px, 72%);
  gap: 9px;
  width: 100%;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 2px;
}

.story-draft-strip article {
  position: relative;
  aspect-ratio: 9 / 14;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--accent) 42%, var(--line));
  border-radius: 20px;
  background: #05070b;
  scroll-snap-align: center;
}

.story-draft-strip img,
.story-draft-strip video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.story-draft-strip article > span {
  position: absolute;
  z-index: 2;
  top: 8px;
  left: 8px;
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 999px;
  color: #fff;
  background: rgb(3 7 18 / 72%);
  backdrop-filter: blur(12px);
  font-size: 11px;
  font-weight: 900;
}

.story-draft-count {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.caption-mention-suggestions {
  display: grid;
  gap: 3px;
  max-height: 190px;
  padding: 6px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  box-shadow: 0 18px 38px rgb(0 0 0 / 24%);
  backdrop-filter: blur(22px) saturate(150%);
}

.caption-mention-suggestions.hidden,
.reel-overlay-inspector.hidden,
.reel-reply-banner.hidden {
  display: none;
}

.caption-mention-suggestions button {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-width: 0;
  padding: 7px;
  text-align: left;
  background: transparent;
  box-shadow: none;
}

.caption-mention-suggestions button span:last-child {
  display: grid;
  min-width: 0;
}

.caption-mention-suggestions small {
  color: var(--muted);
}

.caption-mention {
  display: inline;
  width: auto;
  min-height: 0;
  padding: 0;
  border: 0;
  color: color-mix(in srgb, var(--accent) 70%, white);
  background: transparent;
  box-shadow: none;
  font: inherit;
  font-weight: 900;
}

.reel-feed-navigation {
  position: sticky;
  z-index: 4;
  top: 0;
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

.reel-feed-tabs {
  position: relative;
  z-index: 4;
  display: grid;
  flex: 0 1 210px;
  width: min(210px, 100%);
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: color-mix(in srgb, var(--panel) 76%, transparent);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 14%);
  backdrop-filter: blur(22px) saturate(150%);
}

.reel-feed-tabs button {
  min-height: 36px;
  min-width: 0;
  padding-inline: 5px;
  background: transparent;
  box-shadow: none;
  font-size: 10px;
}

.reel-feed-tabs button.active {
  color: var(--text-on-accent, #07111d);
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 78%, white), var(--accent));
  box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 30%, transparent), inset 0 1px 0 rgb(255 255 255 / 50%);
}

.reels-feed {
  display: grid;
  grid-auto-rows: 100%;
  min-height: 0;
  gap: 0;
  padding: 0;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  scroll-behavior: auto;
  overscroll-behavior-y: contain;
  scrollbar-width: thin;
}

.reel-card {
  position: relative;
  width: min(100%, 430px);
  height: 100%;
  min-height: 100%;
  aspect-ratio: auto;
  margin-inline: auto;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, white 24%, var(--line));
  border-radius: clamp(24px, 8vw, 38px);
  background: #020407;
  box-shadow: 0 28px 74px rgb(0 0 0 / 38%), inset 0 1px 0 rgb(255 255 255 / 20%);
  scroll-snap-align: start;
  scroll-snap-stop: normal;
  isolation: isolate;
}

.reel-card > video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.reel-load-state {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: none;
  padding: 24px;
  place-items: center;
  color: rgb(255 255 255 / 76%);
  background: radial-gradient(circle at center, rgb(28 40 61 / 72%), #020407 72%);
  text-align: center;
  line-height: 1.4;
}

.reel-card.loading .reel-load-state,
.reel-card.failed .reel-load-state {
  display: grid;
}

.reel-card.failed .reel-load-state {
  z-index: 7;
}

.video-prepare-dialog {
  width: min(94vw, 520px);
}

.video-prepare-card {
  display: grid;
  gap: 14px;
  max-height: min(88vh, 720px);
  overflow-y: auto;
}

.video-prepare-card > video {
  width: 100%;
  max-height: 42vh;
  border: 1px solid var(--glass-line);
  border-radius: 22px;
  background: #000;
  object-fit: contain;
}

.video-prepare-timeline {
  display: grid;
  gap: 12px;
}

.video-prepare-timeline label {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 5px 12px;
  align-items: center;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.video-prepare-timeline label span {
  justify-self: end;
  color: var(--text);
}

.video-prepare-timeline input {
  grid-column: 1 / -1;
  width: 100%;
}

.video-prepare-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.video-prepare-summary span {
  padding: 7px 10px;
  border: 1px solid var(--glass-line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--glass);
  font-size: 10px;
  font-weight: 800;
}

.video-prepare-card progress {
  width: 100%;
  accent-color: var(--accent);
}

.reel-gradient {
  position: absolute;
  z-index: 1;
  inset: 44% 0 0;
  pointer-events: none;
  background: linear-gradient(180deg, transparent, rgb(0 0 0 / 22%) 25%, rgb(0 0 0 / 82%));
}

.reel-play-state {
  position: absolute;
  z-index: 4;
  top: 50%;
  left: 50%;
  display: grid;
  width: 62px;
  height: 62px;
  place-items: center;
  border: 1px solid rgb(255 255 255 / 36%);
  border-radius: 999px;
  opacity: 0;
  color: #fff;
  background: rgb(0 0 0 / 42%);
  backdrop-filter: blur(18px);
  transform: translate(-50%, -50%) scale(.82);
  transition: opacity 160ms ease, transform 220ms cubic-bezier(.2,.8,.2,1);
}

.reel-card.paused .reel-play-state {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.reel-copy {
  position: absolute;
  z-index: 3;
  right: 74px;
  bottom: 22px;
  left: 18px;
  color: #fff;
  text-shadow: 0 2px 10px rgb(0 0 0 / 85%);
}

.reel-copy strong {
  font-size: 15px;
}

.reel-copy p {
  max-height: 5.8em;
  margin: 7px 0;
  overflow: hidden;
  line-height: 1.38;
  overflow-wrap: anywhere;
}

.reel-copy > span {
  color: rgb(255 255 255 / 76%);
  font-size: 10px;
}

.reel-actions {
  position: absolute;
  z-index: 5;
  right: 10px;
  bottom: 20px;
  display: grid;
  justify-items: center;
  gap: 10px;
}

.reel-actions > button {
  display: grid;
  width: 52px;
  min-height: 52px;
  padding: 5px;
  place-items: center;
  border: 1px solid rgb(255 255 255 / 22%);
  border-radius: 999px;
  color: #fff;
  background: rgb(7 11 20 / 48%);
  box-shadow: 0 8px 24px rgb(0 0 0 / 26%), inset 0 1px 0 rgb(255 255 255 / 22%);
  backdrop-filter: blur(18px) saturate(150%);
  transition: transform 180ms cubic-bezier(.2,.8,.2,1), background 180ms ease;
}

.reel-actions > button:hover,
.reel-actions > button:focus-visible {
  transform: translateY(-2px) scale(1.06);
}

.reel-actions > button:active {
  transform: scale(.88);
}

.reel-actions > button.active {
  color: #ff7b9e;
  background: rgb(119 22 58 / 62%);
}

.reel-actions b {
  font-size: 21px;
  line-height: 1;
}

.reel-actions button > span:last-child {
  font-size: 10px;
}

.reel-profile-action {
  position: relative;
  margin-bottom: 2px;
  overflow: hidden;
}

.reel-profile-action > span:first-child {
  display: grid;
  width: 40px;
  height: 40px;
  overflow: hidden;
  place-items: center;
  border: 2px solid #fff;
  border-radius: 999px;
  background: var(--accent);
}

.reel-profile-action img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.reel-audio-disc b {
  display: grid;
  width: 34px;
  height: 34px;
  overflow: hidden;
  place-items: center;
  border: 2px solid rgb(255 255 255 / 78%);
  border-radius: 999px;
  background: #080a10;
  animation: reel-disc-spin 4.5s linear infinite;
  animation-play-state: paused;
}

.reel-audio-disc.active b {
  animation-play-state: running;
}

.reel-audio-disc img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.reel-audio-disc.reel-audio-toggle b {
  place-items: center;
  background: rgb(10 14 24 / 74%);
  font-size: 18px;
  animation: none;
}

.reel-actions .reel-audio-toggle > span:last-child {
  max-width: 100%;
  overflow: hidden;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0;
  white-space: nowrap;
}

.reel-actions > .reel-audio-toggle.active {
  color: #d9fff3;
  background: rgb(18 111 87 / 72%);
}

@keyframes reel-disc-spin {
  to { transform: rotate(1turn); }
}

.reel-profile-action i {
  position: absolute;
  right: 0;
  bottom: -2px;
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border: 2px solid #fff;
  border-radius: 999px;
  color: #fff;
  background: #ff315c;
  font-size: 16px;
  font-style: normal;
  line-height: 1;
}

.reel-rendered-overlays,
.reel-overlay-layer {
  position: absolute;
  z-index: 3;
  inset: 0;
  pointer-events: none;
}

.reel-overlay {
  position: absolute;
  width: max-content;
  max-width: 78%;
  min-height: 0;
  padding: 5px 8px;
  border: 0;
  border-radius: 10px;
  pointer-events: none;
  background: transparent;
  box-shadow: none;
  font-weight: 900;
  line-height: 1.12;
  overflow-wrap: anywhere;
  text-align: center;
  text-shadow: 0 2px 7px rgb(0 0 0 / 78%);
  transition: opacity 120ms ease;
}

.reel-overlay.timeline-hidden {
  opacity: 0;
  pointer-events: none;
}

.reel-overlay-glass {
  border: 1px solid rgb(255 255 255 / 32%);
  background: rgb(0 0 0 / 35%);
  backdrop-filter: blur(14px);
}

.reel-overlay-bold {
  color: #05070b !important;
  background: #fff;
  text-shadow: none;
}

.reel-overlay-outline {
  -webkit-text-stroke: 1px rgb(0 0 0 / 82%);
  text-shadow: 0 2px 0 #000, 2px 0 0 #000, -2px 0 0 #000;
}

.reel-editor-stage {
  position: relative;
  width: min(100%, 390px);
  aspect-ratio: 9 / 16;
  min-height: 370px;
  max-height: 62vh;
  margin-inline: auto;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--accent) 42%, var(--line));
  border-radius: 28px;
  background: #020407;
  box-shadow: 0 22px 54px rgb(0 0 0 / 32%), inset 0 1px 0 rgb(255 255 255 / 18%);
}

.reel-editor-stage > video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.reel-overlay-layer {
  pointer-events: none;
}

.reel-overlay.editor-overlay {
  pointer-events: auto;
  cursor: grab;
  touch-action: none;
}

.reel-overlay.editor-overlay.selected {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.reel-overlay.editor-overlay.unsafe {
  outline-color: #ff5d6c;
  color: #fff !important;
  background: rgb(188 26 44 / 78%);
}

.reel-safe-preview {
  position: absolute;
  z-index: 2;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 130ms ease;
}

.reel-safe-preview.visible {
  opacity: 1;
}

.reel-safe-tabs {
  position: absolute;
  top: 15px;
  left: 50%;
  color: rgb(255 255 255 / 84%);
  font-size: 10px;
  font-weight: 800;
  transform: translateX(-50%);
}

.reel-safe-actions {
  position: absolute;
  right: 10px;
  bottom: 70px;
  display: grid;
  gap: 10px;
}

.reel-safe-actions i {
  width: 39px;
  height: 39px;
  border: 1px dashed rgb(255 255 255 / 72%);
  border-radius: 999px;
  background: rgb(0 0 0 / 25%);
}

.reel-safe-caption {
  position: absolute;
  right: 64px;
  bottom: 20px;
  left: 14px;
  height: 64px;
  border: 1px dashed rgb(255 255 255 / 62%);
  border-radius: 12px;
  background: rgb(0 0 0 / 18%);
}

.reel-editor-stage.unsafe-overlay::after {
  content: "Move into the clear area";
  position: absolute;
  z-index: 8;
  top: 54px;
  left: 50%;
  padding: 7px 11px;
  border-radius: 999px;
  color: #fff;
  background: rgb(190 24 44 / 88%);
  font-size: 10px;
  font-weight: 900;
  transform: translateX(-50%);
}

.reel-composer-dialog {
  width: min(96vw, 620px);
  max-height: min(96dvh, 880px);
}

.reel-composer-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 0;
  width: 100%;
  height: min(92dvh, 840px);
  max-height: min(92dvh, 840px);
  padding: 0;
  overflow: hidden;
  background: color-mix(in srgb, var(--panel) 94%, transparent);
}

.reel-editor-heading {
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--line);
}

.reel-editor-scroll-area {
  display: grid;
  align-content: start;
  gap: 12px;
  min-height: 0;
  padding: 12px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.reel-editor-panel,
.reel-overlay-inspector {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: color-mix(in srgb, var(--panel-2) 74%, transparent);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 12%);
}

.reel-editor-panel > header,
.reel-inspector-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.reel-quick-tools {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.reel-tool-button {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 5px;
  align-items: center;
  min-width: 0;
  min-height: 42px;
  padding: 6px 5px;
  text-align: left;
}

.reel-tool-button b {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 10px;
  color: var(--text-on-accent, #07111d);
  background: color-mix(in srgb, var(--accent) 72%, white);
  font-size: 16px;
}

.reel-tool-button span {
  min-width: 0;
  font-size: 10px;
}

.reel-tag-tool {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 8px;
}

.reel-emoji-picker {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 5px;
  margin-top: 8px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--panel) 82%, transparent);
}

.reel-emoji-picker.hidden {
  display: none;
}

.reel-emoji-picker button {
  min-width: 0;
  min-height: 34px;
  padding: 3px;
  border-radius: 10px;
  background: transparent;
  box-shadow: none;
  font-size: 18px;
}

.reel-emoji-picker button:hover,
.reel-emoji-picker button:focus-visible {
  background: var(--glass-hover);
}

.reel-tag-tool > * {
  min-width: 0;
}

.reel-overlay-inspector {
  display: grid;
  gap: 12px;
}

.reel-inspector-heading {
  margin-bottom: 0;
}

.reel-inspector-heading > div {
  display: grid;
  min-width: 0;
}

.reel-inspector-heading span,
.reel-timing-controls > strong {
  color: var(--muted);
  font-size: 9px;
  font-weight: 900;
  text-transform: uppercase;
}

.reel-inspector-heading .danger-button {
  width: auto;
  min-height: 34px;
  padding: 6px 11px;
}

.reel-overlay-inspector label,
.reel-overlay-text-field {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.reel-overlay-text-field.hidden {
  display: none;
}

.reel-inspector-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.reel-inspector-grid input[type="color"] {
  width: 100%;
  min-height: 40px;
  padding: 4px;
}

.reel-range-control {
  grid-column: 1 / -1;
}

.reel-range-control > span {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.reel-range-control output {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.reel-range-control input {
  width: 100%;
  padding: 0;
}

.reel-timing-controls {
  display: grid;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.reel-caption-panel .story-caption-label {
  margin: 0;
}

.reel-caption-panel textarea {
  min-height: 76px;
  resize: vertical;
}

.reel-editor-feedback {
  min-height: 18px;
  margin: -2px 4px 0;
}

.reel-editor-actions {
  display: grid;
  grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr);
  gap: 8px;
  padding: 11px 14px max(11px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 90%, transparent);
  backdrop-filter: blur(24px) saturate(150%);
}

.reel-editor-actions button {
  min-width: 0;
  min-height: 44px;
}

/* Keep reel editing controls visible above mobile browsers' native video UI. */
@media (max-width: 640px) {
  .reel-composer-dialog {
    width: 100vw;
    max-width: 100vw;
    max-height: 100dvh;
    margin: 0;
  }

  .reel-composer-card {
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }

  .reel-editor-heading {
    padding: max(12px, env(safe-area-inset-top)) 14px 10px;
  }

  .reel-editor-scroll-area {
    gap: 10px;
    padding: 10px;
    scrollbar-gutter: auto;
  }

  .reel-add-panel {
    order: -1;
    position: sticky;
    z-index: 12;
    top: -1px;
    padding: 10px;
    border-color: color-mix(in srgb, var(--accent) 34%, var(--line));
    background: color-mix(in srgb, var(--panel) 92%, transparent);
    box-shadow: 0 12px 28px rgb(0 0 0 / 24%), inset 0 1px 0 rgb(255 255 255 / 16%);
    backdrop-filter: blur(24px) saturate(155%);
  }

  .reel-add-panel > header {
    margin-bottom: 7px;
  }

  .reel-add-panel > header strong::after {
    content: " to your reel";
    color: var(--muted);
    font-weight: 600;
  }

  .reel-tool-button {
    min-height: 46px;
    padding: 7px 9px;
  }

  .reel-tool-button span,
  .reel-tag-tool button {
    color: var(--text);
    font-size: 12px;
    white-space: nowrap;
  }

  .reel-tag-tool {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .reel-tag-tool select,
  .reel-tag-tool button {
    min-height: 42px;
  }

  .reel-editor-stage {
    isolation: isolate;
    width: auto;
    height: min(52dvh, 500px);
    min-height: 0;
    max-height: none;
    max-width: 100%;
    aspect-ratio: 9 / 16;
    contain: layout paint;
  }

  .reel-editor-stage > video {
    display: block;
  }

  .reel-caption-panel textarea {
    min-height: 64px;
  }

  .reel-editor-actions {
    position: sticky;
    z-index: 20;
    bottom: 0;
  }
}

.content-reel-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.content-reel-heading > div {
  display: grid;
  min-width: 0;
}

.content-reel-heading span {
  color: var(--muted);
  font-size: 11px;
}

.content-reel-card .content-story-preview {
  aspect-ratio: 9 / 14;
}

.reel-comments-dialog {
  width: min(100vw, 560px);
  max-height: min(84vh, 760px);
  margin: auto auto 0;
  border-radius: 28px 28px 0 0;
}

.reel-comments-sheet {
  display: grid;
  grid-template-rows: auto minmax(180px, 1fr) auto auto;
  max-height: min(84vh, 760px);
  overflow: hidden;
  color: var(--text);
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  backdrop-filter: blur(30px) saturate(155%);
}

.reel-comments-sheet > header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 7px;
  align-items: center;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  text-align: center;
}

.reel-comments-sheet > header select {
  width: auto;
  min-height: 34px;
  padding: 5px 28px 5px 10px;
  font-size: 10px;
}

.reel-comments-sheet > header strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reel-comments-list {
  display: grid;
  align-content: start;
  gap: 13px;
  padding: 14px;
  overflow-y: auto;
}

.reel-comment {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 30px;
  gap: 9px;
  align-items: start;
}

.reel-comment p {
  margin: 4px 0;
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.reel-comment footer {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  align-items: center;
  color: var(--muted);
  font-size: 10px;
}

.reel-comment footer button,
.reel-comment-like {
  width: auto;
  min-height: 24px;
  padding: 2px 4px;
  color: var(--muted);
  background: transparent;
  box-shadow: none;
  font-size: 10px;
}

.reel-comment-like {
  display: grid;
  justify-items: center;
  padding-top: 5px;
  font-size: 16px;
}

.reel-comment-like.active {
  color: #ff315c;
  transform: scale(1.08);
}

.reel-comment-reply {
  grid-template-columns: 30px minmax(0, 1fr) 26px;
  margin-top: 12px;
}

.reel-comments-empty {
  display: grid;
  place-items: center;
  gap: 5px;
  min-height: 180px;
  color: var(--muted);
  text-align: center;
}

.reel-reply-banner {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  padding: 7px 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
}

.reel-reply-banner button {
  width: 28px;
  min-height: 28px;
  padding: 0;
  border-radius: 999px;
}

.reel-comment-form {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 10px 12px max(10px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
}

.reel-comment-form input {
  min-width: 0;
}

.reel-comment-form button {
  min-height: 38px;
}

@media (max-width: 360px) {
  .reel-card {
    width: 100%;
    min-height: 100%;
    border-radius: 24px;
  }

  .reel-copy {
    right: 62px;
    bottom: 14px;
    left: 12px;
  }

  .reel-actions {
    right: 6px;
    bottom: 12px;
    gap: 7px;
  }

  .reel-actions > button {
    width: 48px;
    min-height: 46px;
  }

  .reel-profile-action > span:first-child {
    width: 36px;
    height: 36px;
  }

  .reel-editor-stage {
    height: min(46dvh, 360px);
    min-height: 300px;
    max-height: 360px;
    aspect-ratio: auto;
    border-radius: 22px;
  }

  .reel-overlay-inspector {
    gap: 10px;
  }

  .reel-inspector-grid {
    grid-template-columns: 1fr;
  }

  .reel-editor-scroll-area {
    padding: 9px;
  }

  .reel-editor-actions {
    padding-inline: 10px;
  }

  .content-reel-heading {
    grid-template-columns: 1fr;
  }
}

/* Visual stabilization: keep every workspace readable at side-panel widths. */
.member-option > span:last-child,
.member-option .contact-main {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.member-option strong,
.member-option small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-option small {
  color: var(--muted);
  font-size: 10px;
}

.member-option .avatar-fallback {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  overflow: hidden;
  border-radius: 12px;
  color: white;
  background: linear-gradient(145deg, var(--accent-2), var(--accent));
  font-size: 12px;
  font-weight: 900;
}

.message-picker-tools > *,
.toolbar-row > *,
.settings-tabs > *,
.group-member-actions > * {
  min-width: 0;
}

.multi-send-short {
  display: none;
}

@media (max-width: 760px) {
  .conversation-screen .toolbar-row {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .conversation-screen .toolbar-row button {
    width: 100%;
  }

  .settings-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .settings-tab {
    min-height: 38px;
    padding: 7px 8px;
    font-size: 11px;
  }
}

@media (max-width: 430px) {
  .message-picker-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    padding: 10px;
  }

  .message-picker-heading h2 {
    font-size: 19px;
    line-height: 1.05;
  }

  .message-picker-heading p {
    font-size: 11px;
  }

  .message-picker-tools {
    grid-template-columns: minmax(70px, 1fr) 36px minmax(44px, .65fr) minmax(44px, .65fr);
    gap: 5px;
  }

  .message-picker-tools .presence-toggle,
  .message-picker-tools button {
    width: 100%;
    min-height: 36px;
    padding-inline: 6px;
    font-size: 10px;
  }

  .message-picker-tools .presence-toggle {
    justify-content: center;
    gap: 5px;
  }

  .message-picker-tools .presence-toggle input {
    flex: 0 0 32px;
  }

  .message-picker-tools .icon-command {
    width: 36px;
    min-width: 36px;
    font-size: 18px;
  }

  .stories-panel {
    gap: 7px;
    padding: 9px 10px 0;
  }

  .stories-heading {
    gap: 8px;
  }

  .stories-heading span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .stories-heading button {
    flex: 0 0 auto;
  }

  .stories-strip {
    gap: 8px;
    padding-bottom: 5px;
  }

  .story-chip {
    flex-basis: 54px;
    width: 54px;
  }

  .story-chip-avatar {
    width: 46px;
    height: 46px;
  }

  .message-tabs {
    padding-top: 9px;
  }

  .message-tab {
    min-height: 36px;
    padding-inline: 6px;
    font-size: 10px;
  }

  .message-contact-list {
    gap: 8px;
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .message-contact {
    gap: 8px;
    padding: 10px;
  }

  .message-contact-action {
    min-height: 35px;
    padding-block: 7px;
  }

  .conversation-screen .toolbar-row {
    gap: 5px;
  }

  .conversation-screen .toolbar-row button {
    min-height: 34px;
    padding-inline: 4px;
    overflow: hidden;
    font-size: 10px;
    text-overflow: ellipsis;
  }

  .settings-shell {
    gap: 12px;
    padding: 12px 10px 16px;
  }

  .settings-tabs {
    gap: 6px;
  }

  .settings-panel-heading {
    align-items: center;
  }

  .settings-panel-heading h3 {
    min-width: 0;
    font-size: 16px;
  }

  .group-member-row {
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 9px;
    padding: 10px;
  }

  .group-member-actions {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: stretch;
  }

  .group-member-actions button {
    width: 100%;
  }

  .discover-stories {
    gap: 8px;
  }

  .discover-story-card,
  .story-stack-layer {
    border-radius: 18px;
  }

  .discover-story-owner,
  .discover-story-meta {
    left: 7px;
    right: 7px;
  }

  .discover-story-owner {
    top: 6px;
    gap: 4px;
  }

  .discover-story-owner .story-viewer-avatar {
    flex-basis: 23px;
    width: 23px;
    height: 23px;
  }

  .discover-story-meta {
    bottom: 7px;
    padding-right: 18px;
  }

  .discover-story-more {
    top: 5px;
    right: 5px;
    width: 25px;
    min-width: 25px;
    height: 25px;
    min-height: 25px;
    font-size: 15px;
  }
}

@media (max-width: 340px) {
  .message-picker-heading p {
    display: none;
  }

  .message-picker-tools {
    grid-template-columns: minmax(66px, 1fr) 34px 42px 42px;
  }

  .multi-send-full {
    display: none;
  }

  .multi-send-short {
    display: inline;
  }

  .discover-story-tile {
    aspect-ratio: 4 / 5;
  }

  .discover-story-owner strong,
  .discover-story-meta span {
    font-size: 9px;
  }

  .discover-story-meta strong {
    font-size: 10px;
    -webkit-line-clamp: 1;
  }

  .member-option {
    grid-template-columns: 18px 30px minmax(0, 1fr);
    gap: 7px;
    padding: 7px;
  }

  .member-option .avatar,
  .member-option .avatar-fallback {
    width: 30px;
    height: 30px;
  }
}
