/* Heyra Web. Design notes:
   The mark is two glass shapes that overlap, so the interface borrows its shapes: direct chats are arches,
   groups are bowls, the chat wall is a faint tiling of both. One quiet moment of motion (the shapes slide
   together on the welcome and sign-in screens). Everything else is flat and calm. Dark and light follow the system. */

@font-face { font-family: "Inter"; font-weight: 400; font-style: normal; font-display: swap; src: url("/fonts/inter-400.woff") format("woff"); }
@font-face { font-family: "Inter"; font-weight: 600; font-style: normal; font-display: swap; src: url("/fonts/inter-600.woff") format("woff"); }
@font-face { font-family: "Inter Display"; font-weight: 700; font-style: normal; font-display: swap; src: url("/fonts/inter-display-700.woff") format("woff"); }

:root {
  color-scheme: dark;

  --font: Inter, "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Inter Display", Inter, "Segoe UI", system-ui, sans-serif;

  --bg: #0e1020;
  --panel: #141730;
  --raised: #1c2040;
  --field: #10132a;
  --hover: rgba(255, 255, 255, .05);
  --line: rgba(255, 255, 255, .08);
  --line-strong: rgba(255, 255, 255, .16);

  --text: #edeffa;
  --text-2: #b6bbd5;
  --muted: #868cae;

  --violet: #7958ff;
  --violet-press: #6a4bf0;
  --violet-soft: rgba(121, 88, 255, .18);
  --sky: #28b9ff;
  --ok: #35d39a;
  --danger: #ff6b86;
  --focus: #5fc9ff;

  --in-bg: #1d2142;
  --in-ink: #edeffa;
  --out-bg: #6a4bff;
  --out-ink: #ffffff;
  --wall-bg: #0e1020;
  --wall: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240' viewBox='0 0 240 240'%3E%3Cg fill='%23ffffff' fill-opacity='.03'%3E%3Cpath d='M92 150 V118 A26 26 0 0 1 118 92 A26 26 0 0 1 144 118 V150 Z' transform='translate(12 6)'/%3E%3Cpath d='M112 112 H156 V136 A22 22 0 0 1 134 158 H134 A22 22 0 0 1 112 136 Z' transform='translate(12 6)'/%3E%3C/g%3E%3C/svg%3E");

  --pop: 0 14px 44px rgba(0, 0, 0, .5);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;

    --bg: #f1f2f9;
    --panel: #ffffff;
    --raised: #eceef8;
    --field: #f5f6fc;
    --hover: rgba(16, 18, 37, .05);
    --line: rgba(16, 18, 37, .09);
    --line-strong: rgba(16, 18, 37, .18);

    --text: #101225;
    --text-2: #3d4366;
    --muted: #666c8e;

    --violet: #6a4bff;
    --violet-press: #5a3de8;
    --violet-soft: rgba(106, 75, 255, .12);
    --sky: #0a8fd6;
    --ok: #12905f;
    --danger: #d12f52;
    --focus: #0a8fd6;

    --in-bg: #ffffff;
    --in-ink: #101225;
    --out-bg: #6a4bff;
    --out-ink: #ffffff;
    --wall-bg: #eceef8;
    --wall: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240' viewBox='0 0 240 240'%3E%3Cg fill='%236a4bff' fill-opacity='.055'%3E%3Cpath d='M92 150 V118 A26 26 0 0 1 118 92 A26 26 0 0 1 144 118 V150 Z' transform='translate(12 6)'/%3E%3Cpath d='M112 112 H156 V136 A22 22 0 0 1 134 158 H134 A22 22 0 0 1 112 136 Z' transform='translate(12 6)'/%3E%3C/g%3E%3C/svg%3E");

    --pop: 0 14px 40px rgba(16, 18, 37, .18);
  }
}

:root[data-theme="light"] {
  color-scheme: light;

  --bg: #f1f2f9;
  --panel: #ffffff;
  --raised: #eceef8;
  --field: #f5f6fc;
  --hover: rgba(16, 18, 37, .05);
  --line: rgba(16, 18, 37, .09);
  --line-strong: rgba(16, 18, 37, .18);

  --text: #101225;
  --text-2: #3d4366;
  --muted: #666c8e;

  --violet: #6a4bff;
  --violet-press: #5a3de8;
  --violet-soft: rgba(106, 75, 255, .12);
  --sky: #0a8fd6;
  --ok: #12905f;
  --danger: #d12f52;
  --focus: #0a8fd6;

  --in-bg: #ffffff;
  --in-ink: #101225;
  --out-bg: #6a4bff;
  --out-ink: #ffffff;
  --wall-bg: #eceef8;
  --wall: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240' viewBox='0 0 240 240'%3E%3Cg fill='%236a4bff' fill-opacity='.055'%3E%3Cpath d='M92 150 V118 A26 26 0 0 1 118 92 A26 26 0 0 1 144 118 V150 Z' transform='translate(12 6)'/%3E%3Cpath d='M112 112 H156 V136 A22 22 0 0 1 134 158 H134 A22 22 0 0 1 112 136 Z' transform='translate(12 6)'/%3E%3C/g%3E%3C/svg%3E");

  --pop: 0 14px 40px rgba(16, 18, 37, .18);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  font-feature-settings: "cv11", "ss03", "calt";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

#app { height: 100%; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
input:focus-visible, textarea:focus-visible { outline-offset: 0; }

::selection { background: var(--violet-soft); }

.ic { display: block; flex-shrink: 0; }

/* ---------- shared controls ---------- */

input, textarea {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--field);
  color: var(--text);
}
input::placeholder, textarea::placeholder { color: var(--muted); }
input:focus, textarea:focus { border-color: var(--violet); }

button.primary, button.ghost {
  height: 46px;
  padding: 0 18px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-weight: 600;
}
button.primary { background: var(--violet); color: #fff; }
button.primary:hover:not(:disabled) { background: var(--violet-press); }
button.ghost { background: transparent; border-color: var(--line-strong); color: var(--text); }
button.ghost:hover:not(:disabled) { background: var(--hover); }
button:disabled { opacity: .55; cursor: default; }
button.wide { width: 100%; }

.icon-btn {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text-2);
}
.icon-btn:hover { background: var(--hover); color: var(--text); }

.status { font-size: 12px; color: var(--muted); }
.status.error { color: var(--danger); min-height: 18px; }

/* ---------- avatars: the shapes of the mark ---------- */

.av {
  --size: 44px;
  flex: 0 0 var(--size);
  width: var(--size);
  height: var(--size);
  display: inline-grid;
  place-items: center;
  font-weight: 600;
  font-size: calc(var(--size) * .42);
  line-height: 1;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), inset 0 -1px 0 rgba(0, 0, 0, .12);
}
.av { position: relative; overflow: hidden; }
.av > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.av.has-img > span { display: none; }
.av-md { --size: 40px; }
.av-lg { --size: 46px; }
.av-xl { --size: 84px; }
.av-arch { border-radius: 50% 50% 20% 20% / 50% 50% 20% 20%; }
.av-arch > span { transform: translateY(8%); }
.av-bowl { border-radius: 20% 20% 50% 50% / 20% 20% 50% 50%; }
.av-bowl > span { transform: translateY(-8%); }
.av-tile { border-radius: 30%; }
.av-leaf { border-radius: 50% 22% 50% 22%; }

.tone-0 { background: linear-gradient(150deg, #a48cff, #6a4bff); color: #fff; }
.tone-1 { background: linear-gradient(150deg, #7be0ff, #1fa6f0); color: #052338; }
.tone-2 { background: linear-gradient(150deg, #86efc6, #22b07d); color: #04281c; }
.tone-3 { background: linear-gradient(150deg, #ffd885, #f0a020); color: #3a2400; }
.tone-4 { background: linear-gradient(150deg, #ff9fba, #e8456e); color: #fff; }
.tone-5 { background: linear-gradient(150deg, #a4adff, #4d5be0); color: #fff; }

/* ---------- sign in ---------- */

.auth { min-height: 100%; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }

.auth-art {
  position: relative;
  display: grid;
  place-items: center;
  padding: 48px;
  background: #0f1124;
  color: #edeffa;
  overflow: hidden;
}
.auth-art::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240' viewBox='0 0 240 240'%3E%3Cg fill='%23ffffff' fill-opacity='.03'%3E%3Cpath d='M92 150 V118 A26 26 0 0 1 118 92 A26 26 0 0 1 144 118 V150 Z' transform='translate(12 6)'/%3E%3Cpath d='M112 112 H156 V136 A22 22 0 0 1 134 158 H134 A22 22 0 0 1 112 136 Z' transform='translate(12 6)'/%3E%3C/g%3E%3C/svg%3E");
}
.auth-art-inner { position: relative; display: grid; justify-items: start; gap: 22px; max-width: 420px; }
.auth-mark { width: 210px; }
.auth-word { color: #fff; }
.auth-art p { font-size: 17px; line-height: 1.5; color: #b6bbd5; }

.auth-pane { display: grid; place-items: center; padding: 32px 24px; background: var(--panel); }
.auth-card { width: min(400px, 100%); display: grid; gap: 14px; }
.auth-brand { display: none; align-items: center; gap: 10px; margin-bottom: 8px; color: var(--text); }
.auth-card h1 { font-family: var(--font-display); font-size: 32px; line-height: 1.1; letter-spacing: -.02em; }
.auth-sub { color: var(--text-2); }
.auth-foot { margin-top: 10px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }

#authStep, #verifyStep { display: grid; gap: 14px; }
#authStep[hidden], #verifyStep[hidden], #phoneField[hidden], #emailField[hidden] { display: none; }
#phoneField, #emailField { display: grid; gap: 6px; }
.field-label { font-size: 13px; font-weight: 600; color: var(--text-2); }

.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border-radius: 14px; background: var(--raised); }
.seg button { height: 38px; padding: 0 8px; border: 0; border-radius: 10px; background: transparent; color: var(--text-2); font-weight: 600; font-size: 14px; }
.seg button:hover:not(.primary) { color: var(--text); }
.seg button.primary { background: var(--violet); color: #fff; height: 38px; }

.or { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.or::before, .or::after { content: ""; height: 1px; background: var(--line); }

.qr-steps { margin: 0; padding-left: 20px; color: var(--text-2); display: grid; gap: 6px; }
.qr-box { width: fit-content; margin: 4px auto; padding: 14px; border-radius: 18px; background: #fff; box-shadow: 0 0 0 1px var(--line); }
.qr-box canvas { display: block; width: 240px; height: 240px; image-rendering: pixelated; }

/* The one moment of motion: the two shapes slide together and the overlap appears. */
.mark-intro { display: block; width: 100%; height: auto; overflow: visible; }
.mi-a { animation: mi-a .9s cubic-bezier(.2, .8, .2, 1) both; }
.mi-b { animation: mi-b .9s cubic-bezier(.2, .8, .2, 1) both; }
.mi-lens { animation: mi-lens .55s .75s ease-out both; }
@keyframes mi-a { from { transform: translate(-22px, -8px); opacity: 0; } }
@keyframes mi-b { from { transform: translate(22px, 8px); opacity: 0; } }
@keyframes mi-lens { from { opacity: 0; } }

/* ---------- app shell ---------- */

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

.side {
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-right: 1px solid var(--line);
}

.side-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 18px 10px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); }

.search-wrap { position: relative; margin: 6px 14px 8px; color: var(--muted); }
.search-wrap .ic { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); pointer-events: none; }
.search { height: 42px; padding-left: 40px; border-radius: 999px; border-color: transparent; background: var(--raised); }
.search:focus { border-color: var(--violet); }

.list { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 8px 12px; scrollbar-width: thin; }
.list-head { padding: 14px 10px 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.list-empty { padding: 18px 12px; color: var(--muted); font-size: 14px; }

.conv {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  text-align: left;
  color: var(--text);
}
.conv:hover { background: var(--hover); }
.conv.active { background: var(--violet-soft); }
.conv-text { min-width: 0; display: grid; gap: 1px; }
.conv-text b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-text span { font-size: 13px; color: var(--muted); }

.me {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 12px 18px;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  text-align: left;
  color: var(--text-2);
}
.me:hover { background: var(--hover); }
.me-copy { flex: 1; min-width: 0; display: grid; }
.me-copy strong { color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-copy span { font-size: 12px; color: var(--muted); }

.main { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--wall-bg); }

.top {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 66px;
  padding: 0 14px 0 18px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.who { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; }
.who-text { min-width: 0; display: grid; }
.who-text b { font-family: var(--font-display); font-size: 17px; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-sub { display: flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--muted); }
.who-sub .ic { color: var(--ok); }
.who-sub.locked .ic { color: var(--danger); }
.actions { display: flex; gap: 2px; }
.back { display: none; margin-left: -6px; }

.shell:not(.chat-open) .top,
.shell:not(.chat-open) .heyra-composer-area { display: none; }

/* ---------- messages ---------- */

.messages {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 20px clamp(14px, 5vw, 64px);
  overflow-y: auto;
  overscroll-behavior: contain;
  background-color: var(--wall-bg);
  background-image: var(--wall);
  scrollbar-width: thin;
}
.messages > * { flex-shrink: 0; }

.welcome { margin: auto; max-width: 400px; display: grid; justify-items: center; gap: 12px; text-align: center; padding: 24px; }
.welcome-art { width: 132px; margin-bottom: 8px; }
.welcome h2 { font-family: var(--font-display); font-size: 26px; letter-spacing: -.02em; line-height: 1.15; }
.welcome p { color: var(--text-2); }
.welcome-note { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); text-align: left; font-size: 14px; }
.welcome-note .ic { color: var(--danger); margin-top: 2px; }

.empty { margin: auto; padding: 10px 16px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); color: var(--text-2); font-size: 14px; }

.daysep { align-self: center; margin: 14px 0 8px; }
.daysep span { display: inline-block; padding: 4px 12px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); font-size: 12px; font-weight: 600; color: var(--text-2); }

.bubble {
  position: relative;
  align-self: flex-start;
  max-width: min(620px, 74%);
  padding: 8px 12px 6px;
  border-radius: 18px 18px 18px 6px;
  background: var(--in-bg);
  color: var(--in-ink);
  box-shadow: 0 1px 0 var(--line), 0 0 0 1px var(--line);
  overflow-wrap: anywhere;
}
.bubble.mine { align-self: flex-end; border-radius: 18px 18px 6px 18px; background: var(--out-bg); color: var(--out-ink); box-shadow: none; }
.bubble .status { margin-top: 2px; text-align: right; font-size: 11px; color: inherit; opacity: .62; font-variant-numeric: tabular-nums; }
.bubble.deleted { opacity: .7; }
.msg-deleted { font-style: italic; font-size: 14px; }
.msg-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-quote { margin-bottom: 6px; padding: 5px 10px; border-left: 3px solid var(--sky); border-radius: 4px 8px 8px 4px; background: rgba(0, 0, 0, .16); font-size: 13px; opacity: .9; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bubble:not(.mine) .msg-quote { background: var(--hover); }
.msg-more { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 8px; background: rgba(0, 0, 0, .32); color: #fff; opacity: 0; transition: opacity .12s; }
.msg-more .ic { transform: rotate(90deg); }
.bubble:hover .msg-more, .msg-more:focus-visible { opacity: 1; }
@media (hover: none) { .msg-more { opacity: .75; } }
.msg-react { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.msg-chip { padding: 1px 8px; border-radius: 999px; background: rgba(255, 255, 255, .16); font-size: 12px; }
.bubble:not(.mine) .msg-chip { background: var(--raised); }
.msg-chip.mine { box-shadow: inset 0 0 0 1px var(--sky); }
.heyra-file { margin-bottom: 4px; }
.heyra-file a { color: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.heyra-file img, .heyra-file video { display: block; max-width: 100%; border-radius: 12px; }

.messages[data-themed] .bubble.mine { background: var(--hm-sent); color: var(--hm-sent-ink); }
.messages[data-themed] .bubble:not(.mine) { background: var(--hm-recv); color: var(--hm-recv-ink); box-shadow: none; }

/* ---------- composer ---------- */

.heyra-composer-area { flex: 0 0 auto; padding: 10px 14px calc(12px + env(safe-area-inset-bottom)); background: var(--panel); border-top: 1px solid var(--line); }
.composer { display: flex; align-items: center; gap: 8px; }
.composer input { flex: 1; min-width: 0; height: 44px; padding: 0 18px; border-radius: 999px; border-color: transparent; background: var(--raised); }
.composer input:focus { border-color: var(--violet); }
.send { width: 44px; height: 44px; flex: 0 0 44px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; background: var(--violet); color: #fff; }
.send:hover:not(:disabled) { background: var(--violet-press); }
.send.busy { opacity: .6; }

/* ---------- menus and dialogs ---------- */

.hm-menu { position: fixed; z-index: 60; min-width: 220px; padding: 6px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line-strong); box-shadow: var(--pop); color: var(--text); }
.hm-item { display: block; width: 100%; padding: 10px 12px; border: 0; border-radius: 10px; background: transparent; text-align: left; color: var(--text); }
.hm-item:hover, .hm-item:focus-visible { background: var(--hover); outline: none; }
.hm-item:focus-visible { box-shadow: inset 0 0 0 2px var(--focus); }
.pm-item, .at-item { display: flex; align-items: center; gap: 12px; }
.at-ico { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 10px; background: var(--violet-soft); color: var(--violet); }
.pm-item .ic { color: var(--text-2); }
.ma-danger { color: var(--danger); }
.ma-menu { min-width: 190px; }
.ma-emoji { display: flex; gap: 2px; min-width: 0; }
.ma-emoji-btn { width: 40px; height: 40px; border: 0; border-radius: 12px; background: transparent; font-size: 22px; }
.ma-emoji-btn:hover, .ma-emoji-btn:focus-visible { background: var(--hover); }

.hm-backdrop { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 16px; background: rgba(6, 8, 20, .6); }
.hm-card { width: min(480px, 100%); max-height: min(86vh, 720px); display: flex; flex-direction: column; border-radius: 22px; background: var(--panel); border: 1px solid var(--line-strong); box-shadow: var(--pop); color: var(--text); }
.hm-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 10px; }
.hm-head b { font-family: var(--font-display); font-size: 18px; letter-spacing: -.01em; }
.hm-x { width: 34px; height: 34px; border: 0; border-radius: 10px; background: var(--hover); color: var(--text-2); font-size: 14px; }
.hm-body { padding: 4px 18px 16px; overflow-y: auto; min-height: 0; display: grid; gap: 12px; }
.hm-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 18px 16px; border-top: 1px solid var(--line); }
.hm-muted { color: var(--muted); font-size: 14px; line-height: 1.5; }
.hm-error { color: var(--danger); }
.hm-label { margin-top: 4px; color: var(--muted); font-size: 13px; font-weight: 600; }
.hm-hero { display: grid; justify-items: center; gap: 6px; padding: 6px 0 12px; text-align: center; }
.hm-title { font-family: var(--font-display); font-size: 22px; overflow-wrap: anywhere; }
.hm-about { font-size: 14px; color: var(--text-2); }
.hm-avatar { width: 84px; height: 84px; display: grid; place-items: center; border-radius: 50% 50% 20% 20% / 50% 50% 20% 20%; font-size: 34px; font-weight: 600; color: #fff; background: linear-gradient(150deg, #a48cff, #6a4bff); }
.hm-avatar { position: relative; overflow: hidden; }
.hm-avatar > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hm-link { display: block; padding: 0; border: 0; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.hm-link:hover, .hm-link:focus-visible { color: var(--violet); text-decoration: underline; outline: none; }
.who { cursor: pointer; }
.who:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 12px; }
.hm-avatar.sm { width: 40px; height: 40px; font-size: 17px; flex-shrink: 0; }
.hm-section { padding: 14px; border-radius: 16px; background: var(--raised); display: grid; gap: 8px; }
.hm-chips, .hm-swatches, .hm-row { display: flex; flex-wrap: wrap; gap: 8px; }
.hm-chip { padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line-strong); background: transparent; color: var(--text-2); font-size: 14px; }
.hm-chip.on { background: var(--violet); border-color: var(--violet); color: #fff; font-weight: 600; }
.hm-chip:disabled { cursor: default; opacity: .6; }
.hm-btn { padding: 10px 16px; border-radius: 12px; border: 1px solid var(--line-strong); background: transparent; color: var(--text); }
.hm-btn:hover:not(:disabled) { background: var(--hover); }
.hm-btn:disabled { opacity: .5; cursor: default; }
.hm-btn.hm-primary { background: var(--violet); border-color: var(--violet); color: #fff; font-weight: 600; }
.hm-btn.hm-danger { color: var(--danger); border-color: var(--danger); }
.hm-btn.hm-small { padding: 6px 10px; font-size: 13px; }
.hm-stack { display: grid; gap: 8px; margin-top: 6px; }
.hm-member { display: flex; align-items: center; gap: 12px; padding: 6px 0; }
.hm-grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.hm-role { font-size: 13px; color: var(--sky); }
.hm-row-end { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.hm-input { height: auto; padding: 11px 13px; }
.hm-pick { display: grid; gap: 4px; max-height: 300px; overflow-y: auto; }
.hm-check { display: flex; align-items: center; gap: 10px; padding: 8px 4px; cursor: pointer; }
.hm-check input { width: auto; height: auto; }
.hm-swatch { width: 34px; height: 34px; padding: 0; border-radius: 50%; border: 2px solid var(--line-strong); }
.hm-swatch.on { border-color: var(--text); box-shadow: 0 0 0 3px var(--violet-soft); }
.hm-toast { position: fixed; z-index: 90; left: 50%; bottom: 26px; transform: translateX(-50%); max-width: min(92vw, 460px); padding: 12px 18px; border-radius: 14px; background: #23264a; color: #fff; box-shadow: var(--pop); font-size: 14px; }
.ma-edit { height: auto; padding: 12px; resize: vertical; }
.ma-dest { text-align: left; }

/* attachments and replies in the composer */
.at-tray { display: flex; gap: 10px; padding: 0 0 10px; overflow-x: auto; }
.at-tray[hidden], .ma-replybar[hidden] { display: none; }
.at-chip { position: relative; flex: 0 0 auto; display: flex; align-items: center; gap: 10px; max-width: 280px; padding: 8px 36px 8px 8px; border-radius: 14px; background: var(--raised); }
.at-chip.bad { box-shadow: inset 0 0 0 1px var(--danger); }
.at-thumb { width: 46px; height: 46px; object-fit: cover; border-radius: 10px; background: var(--field); flex-shrink: 0; }
.at-icon { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 10px; background: var(--violet-soft); color: var(--violet); flex-shrink: 0; }
.at-audio { height: 36px; width: 200px; flex-shrink: 0; }
.at-meta { min-width: 0; display: grid; gap: 2px; }
.at-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.at-sub { font-size: 12px; color: var(--muted); }
.at-chip.bad .at-sub { color: var(--danger); white-space: normal; }
.at-x, .ma-x { display: grid; place-items: center; padding: 0; border: 0; border-radius: 8px; background: var(--hover); color: var(--text-2); }
.at-x { position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; }
.ma-x { flex-shrink: 0; width: 26px; height: 26px; }
.at-x:disabled { opacity: .4; cursor: default; }
.at-rec { flex: 0 0 auto; display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 14px; background: var(--raised); box-shadow: inset 0 0 0 1px var(--danger); font-size: 14px; }
.at-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: at-pulse 1.1s ease-in-out infinite; }
.at-time { min-width: 34px; font-variant-numeric: tabular-nums; }
@keyframes at-pulse { 50% { opacity: .3; } }

.ma-replybar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; padding: 8px 12px; border-left: 3px solid var(--sky); border-radius: 4px 12px 12px 4px; background: var(--raised); }
.ma-replytext { min-width: 0; display: grid; font-size: 13px; color: var(--text-2); }
.ma-replytext b { font-size: 12px; color: var(--sky); }
.ma-replytext span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- narrow screens: one screen at a time ---------- */

@media (max-width: 900px) {
  .shell { grid-template-columns: 290px minmax(0, 1fr); }
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .auth-brand { display: flex; }
}

@media (max-width: 700px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .shell:not(.chat-open) .main { display: none; }
  .shell.chat-open .side { display: none; }
  .back { display: grid; }
  .top { padding-left: 10px; }
  .bubble { max-width: 86%; }
  .messages { padding: 14px 12px; }
  .auth-pane { padding: 24px 18px; align-items: start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---- Appearance choices (account menu) ---- */
:root[data-wall="plain"] { --wall: none; }
:root[data-wall="plain"] .auth-art::before { background-image: none; }
:root[data-theme="light"] { color-scheme: light; }
.pm { min-width: 260px; }
.pm-group { padding: 8px 8px 6px; }
.pm-label { display: block; margin: 0 0 6px 2px; font-size: 12px; font-weight: 600; color: var(--muted); }
.pm-seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border-radius: 12px; background: var(--hover); }
.pm-seg button { padding: 7px 8px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-weight: 600; font-size: 13px; }
.pm-seg button[aria-checked="true"] { background: var(--violet); color: #fff; }
.pm-seg button:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.pm-sep { height: 1px; margin: 6px 4px; background: var(--line); }

/* ---------- Status ---------- */
.side-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 4px 14px 6px; padding: 4px; border-radius: 14px; background: var(--hover); }
.side-tabs button { position: relative; padding: 8px 10px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-weight: 600; font-size: 14px; }
.side-tabs button[aria-selected="true"] { background: var(--violet); color: #fff; }
.side-tabs button:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.tab-dot { display: inline-block; width: 8px; height: 8px; margin-left: 6px; border-radius: 50%; background: var(--sky); vertical-align: middle; }
.tab-dot[hidden] { display: none; }
#statusPane[hidden], #list[hidden], .search-wrap[hidden] { display: none; }
.st-ring { position: relative; flex: 0 0 auto; display: inline-grid; padding: 3px; border-radius: 50% 50% 22% 22% / 50% 50% 22% 22%; background: linear-gradient(140deg, var(--violet), var(--sky)); }
.st-ring.seen { background: var(--line-strong); }
.st-ring.none { background: transparent; padding: 0; }
.st-ring .av { box-shadow: 0 0 0 2px var(--panel); }
.st-ring.none .av { box-shadow: none; }
.st-plus { position: absolute; right: -4px; bottom: -2px; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--violet); color: #fff; box-shadow: 0 0 0 2px var(--panel); }
.st-add { display: flex; align-items: center; gap: 10px; width: 100%; margin: 2px 0 4px; padding: 8px 12px; border: 0; border-radius: 12px; background: transparent; color: var(--violet); font-weight: 600; font-size: 14px; text-align: left; }
.st-add:hover { background: var(--hover); }

.sv { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; background: rgba(6, 7, 16, .86); }
.sv-card { position: relative; width: min(460px, 100vw); height: min(92vh, 860px); display: flex; flex-direction: column; overflow: hidden; border-radius: 22px; background: #0b0c1a; color: #fff; box-shadow: 0 30px 80px rgba(0, 0, 0, .5); }
@media (max-width: 520px) { .sv-card { height: 100dvh; border-radius: 0; } }
.sv-bars { position: absolute; z-index: 3; top: 10px; left: 12px; right: 12px; display: flex; gap: 4px; }
.sv-bars span { flex: 1; height: 3px; border-radius: 3px; background: rgba(255, 255, 255, .3); overflow: hidden; }
.sv-bars i { display: block; height: 100%; background: #fff; }
.sv-head { position: absolute; z-index: 3; top: 20px; left: 0; right: 0; display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: linear-gradient(rgba(0, 0, 0, .55), transparent); }
.sv-meta { flex: 1; min-width: 0; display: grid; line-height: 1.25; }
.sv-meta b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sv-meta span { font-size: 12.5px; color: rgba(255, 255, 255, .75); }
.sv-x { display: grid; place-items: center; width: 38px; height: 38px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .14); color: #fff; }
.sv-x:hover, .sv-x:focus-visible { background: rgba(255, 255, 255, .26); outline: none; }
.sv-stage { flex: 1; min-height: 0; display: grid; place-items: center; background: #000; }
.sv-stage.sv-textbg { padding: 90px 28px 110px; text-align: center; }
.sv-text { margin: 0; max-width: 100%; font-family: var(--font-display); font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; white-space: pre-wrap; }
.sv-media { max-width: 100%; max-height: 100%; width: 100%; height: 100%; object-fit: contain; }
.sv-loading { color: rgba(255, 255, 255, .7); }
.sv-zones { position: absolute; z-index: 2; top: 78px; bottom: 96px; left: 0; right: 0; display: grid; grid-template-columns: 1fr 1fr; }
.sv-zones button { border: 0; background: transparent; cursor: pointer; }
.sv-zones button:focus-visible { outline: 2px solid var(--focus); outline-offset: -4px; }
.sv-foot { position: absolute; z-index: 3; left: 0; right: 0; bottom: 0; padding: 40px 14px 14px; background: linear-gradient(transparent, rgba(0, 0, 0, .65)); display: grid; gap: 10px; }
.sv-caption { margin: 0; text-align: center; font-size: 15px; overflow-wrap: anywhere; }
.sv-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sv-act { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border: 0; border-radius: 999px; background: rgba(255, 255, 255, .16); color: #fff; font-size: 14px; font-weight: 600; }
.sv-act:hover, .sv-act:focus-visible { background: rgba(255, 255, 255, .26); outline: none; }
.sv-act.danger { color: #ff9aa9; }
.sv-modal { z-index: 90; }

.st-form { display: grid; gap: 12px; }
.st-mode { margin-bottom: 2px; }
.st-area { display: grid; gap: 10px; }
.st-text { min-height: 150px; resize: none; border: 0; color: #fff; font-family: var(--font-display); font-size: 22px; font-weight: 700; text-align: center; line-height: 1.3; }
.st-text::placeholder { color: rgba(255, 255, 255, .7); }
.st-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.st-swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.st-sw { width: 28px; height: 28px; border: 2px solid transparent; border-radius: 50%; }
.st-sw[aria-checked="true"] { border-color: var(--text); box-shadow: 0 0 0 2px var(--panel) inset; }
.st-sw:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.st-preview { display: grid; place-items: center; min-height: 200px; max-height: 320px; overflow: hidden; border-radius: 16px; background: var(--raised); }
.st-preview img, .st-preview video { max-width: 100%; max-height: 320px; }
.st-choose { display: grid; justify-items: center; gap: 8px; padding: 36px 20px; border: 0; background: transparent; color: var(--muted); font-weight: 600; }
.st-choose:hover { color: var(--violet); }
.st-field { display: grid; gap: 6px; }
.st-msg { min-height: 20px; margin: 0; }

.st-thumb { flex: 0 0 46px; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 14px; background: var(--raised); color: #fff; }
.sv-stage.zoomed { display: block; overflow: auto; }
.sv-stage.zoomed .sv-media { width: 220%; height: 220%; max-width: none; max-height: none; }
.sv-zones.off { pointer-events: none; }
.sv-foot .sv-zoom { justify-self: start; }
.st-audio { display: grid; gap: 12px; justify-items: center; padding: 24px 16px; width: 100%; text-align: center; overflow-wrap: anywhere; }
.st-audio audio { width: 100%; }
.st-mode button { font-size: 13px; padding: 7px 4px; }


/* ---------------- calls ---------------- */

.hc { position: fixed; inset: 0; z-index: 100; display: grid; background: #090b1a; color: #fff; }
.hc[hidden] { display: none; }
.hc-remote { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #090b1a; }
.hc-remote.off { visibility: hidden; }
.hc-local { position: absolute; right: 16px; top: 16px; z-index: 2; width: min(30vw, 180px); aspect-ratio: 3 / 4; object-fit: cover; border-radius: 16px; border: 1px solid rgba(255, 255, 255, .22); background: #141730; transform: scaleX(-1); }
.hc-local[hidden] { display: none; }
.hc-center { position: relative; z-index: 1; align-self: center; justify-self: center; display: grid; gap: 10px; justify-items: center; padding: 24px; text-align: center; }
.hc-av .av { transform: scale(1.6); margin: 26px; }
.hc-name { font-size: 26px; font-weight: 650; text-shadow: 0 1px 12px rgba(0, 0, 0, .5); }
.hc-state { color: #c9cde6; font-size: 15px; font-variant-numeric: tabular-nums; text-shadow: 0 1px 12px rgba(0, 0, 0, .5); }
.hc-bar { position: absolute; left: 0; right: 0; bottom: max(28px, env(safe-area-inset-bottom)); z-index: 3; display: flex; justify-content: center; gap: 20px; }
.hc-btn { width: 62px; height: 62px; border: 0; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .16); color: #fff; cursor: pointer; transition: background .15s; }
.hc-btn:hover { background: rgba(255, 255, 255, .26); }
.hc-btn.on { background: #fff; color: #101225; }
.hc-btn.end { background: #e5384f; }
.hc-btn.end:hover { background: #cf2d44; }
.hc-btn.end svg { transform: rotate(135deg); }
.hc-btn.accept { background: #1fb97d; }
.hc-btn.accept:hover { background: #17a06a; }
.hc-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }

/* ---------------- photo viewer ---------------- */

.pv { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; overflow: hidden; touch-action: none; background: rgba(5, 6, 16, .95); }
.pv-img { max-width: 96vw; max-height: 86vh; object-fit: contain; border-radius: 8px; transform-origin: center; will-change: transform; user-select: none; -webkit-user-drag: none; cursor: zoom-in; }
.pv-img.zoomed { cursor: grab; }
.pv-name { position: absolute; top: max(18px, env(safe-area-inset-top)); left: 20px; right: 70px; color: #fff; font-weight: 600; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-x { position: absolute; top: max(12px, env(safe-area-inset-top)); right: 14px; width: 42px; height: 42px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .14); color: #fff; font-size: 18px; cursor: pointer; }
.pv-x:hover { background: rgba(255, 255, 255, .24); }
.pv-x:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.pv-hint { position: absolute; left: 0; right: 0; bottom: max(16px, env(safe-area-inset-bottom)); text-align: center; color: #aab0cf; font-size: 13px; pointer-events: none; }
.hm-viewable { cursor: zoom-in; }
.hm-viewable:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { .hc-btn { transition: none; } }

.actions .icon-btn[hidden] { display: none; }
