@font-face {
  font-family: "Vazirmatn";
  src: url("/fonts/Vazirmatn.woff2") format("woff2-variations"), url("/fonts/Vazirmatn.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

/* ---------- tokens ----------
   flat greys, one eucalyptus green (#4f7f64), no gradients or glows. */
:root {
  --bg: #121212;
  --bg-2: #1b1b1b;
  --surface: #232323;
  --surface-2: #2e2e2e;
  --surface-3: #3b3b3b;
  --line: rgba(255,255,255,.07);
  --line-2: rgba(255,255,255,.11);
  --text: #e9e9e9;
  --text-2: #b9b9b9;
  --text-3: #8b8b8b;
  --brand-1: #4f7f64;
  --brand-2: #4f7f64;
  --brand: #4f7f64;
  --brand-soft: rgba(79,127,100,.16);
  --out-bg: #4f7f64;
  --out-text: #fff;
  --read-bg: #4f7f64;
  --in-bg: #3b3b3b;
  --in-text: #e9e9e9;
  --ok: #4caf50;
  --warn: #f59e0b;
  --bad: #f44336;
  --read: #fff;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 2px 10px rgba(0,0,0,.35);
  --shadow-lg: 0 8px 28px rgba(0,0,0,.5);
  --ease: cubic-bezier(.2,.8,.2,1);
  font-family: "Vazirmatn", "Segoe UI", Tahoma, system-ui, sans-serif;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #ffffff; --bg-2: #f6f6f6; --surface: #ffffff; --surface-2: #f0f0f0; --surface-3: #e3e3e3;
    --line: rgba(0,0,0,.07); --line-2: rgba(0,0,0,.12);
    --text: #1b1b1b; --text-2: #5e5e5e; --text-3: #848484;
    --in-bg: #e9e9e9; --in-text: #1b1b1b; --brand-soft: rgba(79,127,100,.1); --read: #fff;
    --shadow: 0 2px 10px rgba(0,0,0,.1);
    --shadow-lg: 0 8px 28px rgba(0,0,0,.16);
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.65;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; overflow: hidden;
}
[hidden] { display: none !important; }
.sprite { position: absolute; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
button:disabled { opacity: .35; cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--brand-1); outline-offset: 2px; border-radius: 10px; }

.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.i .fill, .i.fill { fill: currentColor; stroke: none; }
.flip { transform: scaleX(-1); }
.muted { color: var(--text-2); font-size: 14px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 18px; border-radius: 99px; font-weight: 600; font-size: 15px;
  background: var(--surface-2); border: 1px solid var(--line-2); transition: transform .12s var(--ease), filter .2s, background .2s;
}
.btn:active:not(:disabled) { transform: scale(.98); }
.btn-primary { background: var(--brand); color: #fff; border: 0; box-shadow: none; }
.btn-primary:hover { filter: brightness(1.1); }
.btn-ghost { background: var(--surface-3); border: 0; }
.btn-lg { height: 50px; font-size: 16px; border-radius: 99px; }
.btn-sm { height: 34px; padding: 0 14px; font-size: 13px; border-radius: 99px; }
.btn .i { width: 18px; height: 18px; }
.wide { width: 100%; }
.btn-icon {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: var(--text-2);
  transition: background .2s, color .2s;
}
.btn-icon:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.btn-icon.sm { width: 36px; height: 36px; }

/* ---------- landing ---------- */
.landing { height: 100%; overflow-y: auto; position: relative; display: flex; justify-content: center; padding: 48px 16px 40px; }
.landing-glow { display: none;
  position: fixed; inset: -20% -10% auto; height: 70vh; pointer-events: none;
  background: radial-gradient(40% 50% at 30% 30%, rgba(124,92,255,.28), transparent 70%),
              radial-gradient(35% 45% at 75% 20%, rgba(79,127,100,.22), transparent 70%);
  filter: blur(20px);
}
.landing-inner { position: relative; width: 100%; max-width: 480px; animation: rise .6s var(--ease); }
.landing-inner.narrow { max-width: 420px; }
.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 36px; }
/* Najva mark ("Lab o Goosh"): the glyph fills its 40u tile, dark on the brand green. */
.brand-mark { width: 40px; height: 40px; border-radius: 23%; background: var(--brand); display: grid; place-items: center; color: #fff; box-shadow: none; }
.brand-mark .i { width: 100%; height: 100%; }
.brand-name { font-size: 22px; font-weight: 800; letter-spacing: -.3px; }
.hero-title { font-size: clamp(30px, 7vw, 42px); line-height: 1.25; margin: 0 0 14px; font-weight: 800; letter-spacing: -.5px; }
.hero-title.small { font-size: 28px; }
.grad { background: var(--brand); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-sub { color: var(--text-2); margin: 0 0 28px; font-size: 15.5px; }
.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 18px; padding: 20px;
}
.field-label { display: block; font-size: 13px; color: var(--text-2); margin: 0 0 8px; font-weight: 500; }
.opt { font-size: 11px; color: var(--text-3); background: var(--surface-2); padding: 1px 8px; border-radius: 99px; margin-inline-start: 4px; }
.field {
  display: flex; align-items: center; gap: 10px; height: 50px; padding: 0 14px; margin-bottom: 14px;
  background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 14px; transition: border-color .2s, box-shadow .2s;
}
.field:focus-within { border-color: var(--brand-1); box-shadow: none; }
.field .i { color: var(--text-3); width: 18px; height: 18px; }
.field input { flex: 1; min-width: 0; border: 0; background: none; outline: none; height: 100%; }
.field-link { padding-inline-end: 6px; }
.field-link input { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.5px; color: var(--text-2); }
.step-ok { display: inline-flex; align-items: center; gap: 6px; color: var(--ok); font-weight: 600; font-size: 14px; margin-bottom: 14px; }
.step-ok .i { width: 18px; height: 18px; stroke-width: 2.4; }
.checklist { list-style: none; padding: 0; margin: 0 0 18px; display: grid; gap: 10px; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; color: var(--text-2); }
.checklist .i { width: 18px; height: 18px; color: var(--brand-1); margin-top: 2px; }
.features { display: grid; gap: 10px; margin-top: 22px; }
.feature { display: flex; gap: 14px; align-items: center; padding: 14px 16px; border-radius: 16px; background: color-mix(in srgb, var(--surface) 60%, transparent); border: 1px solid var(--line); }
.feature .i { width: 22px; height: 22px; color: var(--brand-1); padding: 9px; box-sizing: content-box; background: var(--brand-soft); border-radius: 12px; }
.feature b { display: block; font-size: 14.5px; }
.feature span { font-size: 12.5px; color: var(--text-3); }
.busy-box { position: relative; margin: auto; text-align: center; color: var(--text-2); }
.orbit { width: 84px; height: 84px; margin: 0 auto 20px; border-radius: 50%; display: grid; place-items: center; position: relative; background: var(--brand-soft); color: var(--brand-1); }
.orbit::before { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid transparent; border-top-color: var(--brand-1); border-right-color: var(--brand-2); animation: spin 1s linear infinite; }
.orbit .i { width: 32px; height: 32px; }

/* ---------- chat layout ---------- */
#chat { height: 100%; height: 100dvh; display: flex; flex-direction: column; max-width: 900px; margin: 0 auto; position: relative; background: var(--bg); }
@media (min-width: 900px) and (max-width: 1023.98px) { #chat { border-inline: 1px solid var(--line); } }
/* The conversation column. On the phone it is the only pane; on the laptop it
   sits next to the room rail. */
.conv { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; z-index: 6;
  padding: 10px 12px; padding-top: max(10px, env(safe-area-inset-top));
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.peer { display: flex; align-items: center; gap: 12px; min-width: 0; }
.avatar-sm { position: relative; width: 42px; height: 42px; border-radius: 50%; background: var(--brand); display: grid; place-items: center; color: #fff; flex: none; }
.avatar-sm .i { width: 22px; height: 22px; }
.presence { position: absolute; bottom: 0; inset-inline-end: 0; width: 12px; height: 12px; border-radius: 50%; border: 2.5px solid var(--bg); background: var(--text-3); }
.presence.green { background: var(--ok); }
.presence.amber { background: var(--warn); animation: pulse 1.4s infinite; }
.presence.red { background: var(--bad); }
.peer-text { min-width: 0; }
.peer-name { font-weight: 700; font-size: 15.5px; }
.peer-status { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 4px; }
.peer-status.secure { color: var(--ok); }
.top-actions { display: flex; align-items: center; gap: 2px; flex: none; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; height: 32px; padding: 0 10px; margin-inline-end: 4px;
  border-radius: 99px; background: var(--brand-soft); color: var(--brand-1); font-size: 12.5px; font-weight: 600;
}
.chip .i { width: 16px; height: 16px; }
@media (prefers-color-scheme: dark) { .chip { color: #8fb3ff; } }

.popover {
  position: absolute; top: calc(62px + env(safe-area-inset-top)); z-index: 20; background: var(--surface-2);
  border: 0; border-radius: 12px; padding: 6px; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; min-width: 220px; animation: pop .16s var(--ease); transform-origin: top left;
}
.menu-pop { inset-inline-end: 10px; min-width: 260px; }
.ttl-pop { inset-inline-end: 96px; }
.popover button { display: flex; align-items: center; gap: 10px; text-align: start; padding: 10px 12px; border-radius: 10px; font-size: 14px; }
.popover button:hover { background: var(--surface-3); }
.popover button.active { color: var(--brand-1); font-weight: 700; background: var(--brand-soft); }
.popover .i { width: 18px; height: 18px; color: var(--text-2); }
.popover .danger, .popover .danger .i { color: var(--bad); }
.menu-code { margin-inline-start: auto; font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; color: var(--text-2); letter-spacing: .5px; }
.popover hr { border: 0; border-top: 1px solid var(--line); margin: 4px 6px; }
.pop-title { font-size: 12px; color: var(--text-3); padding: 6px 12px 4px; }
.switch { margin-inline-start: auto; width: 34px; height: 20px; border-radius: 99px; background: var(--surface-3); position: relative; transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 2px; inset-inline-start: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s var(--ease); box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch.on { background: var(--brand-1); }
.switch.on::after { transform: translateX(-14px); }

.banner { display: flex; gap: 10px; align-items: flex-start; margin: 10px 12px 0; padding: 12px 14px; font-size: 13px; border-radius: 14px; background: rgba(239,68,68,.12); color: #fca5a5; border: 1px solid rgba(239,68,68,.25); }
@media (prefers-color-scheme: light) { .banner { color: #b91c1c; } }

.stream { flex: 1; min-height: 0; position: relative; display: flex; flex-direction: column; }
#messages {
  flex: 1; overflow-y: auto; list-style: none; margin: 0; padding: 16px 12px 8px;
  display: flex; flex-direction: column; gap: 3px; overscroll-behavior: contain;
}
.empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px; pointer-events: none; animation: rise .5s var(--ease); }
.empty-badge { width: 64px; height: 64px; border-radius: 20px; background: var(--brand-soft); color: var(--brand-1); display: grid; place-items: center; margin-bottom: 16px; }
.empty-badge .i { width: 30px; height: 30px; }
.empty h2 { font-size: 17px; margin: 0 0 6px; }
.empty p { font-size: 13.5px; color: var(--text-2); max-width: 380px; margin: 0 0 16px; }
.empty-tips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.empty-tips span { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-3); background: var(--surface); border: 1px solid var(--line); padding: 5px 10px; border-radius: 99px; }
.empty-tips .i { width: 15px; height: 15px; }

/* ---------- bubbles ---------- */
.msg {
  position: relative; max-width: min(76%, 520px); padding: 8px 12px 6px; border-radius: var(--radius);
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  animation: bubble .18s var(--ease); margin-top: 8px;
}
.msg.out { align-self: flex-start; background: var(--out-bg); color: var(--out-text); }
.msg.in { align-self: flex-end; background: var(--in-bg); color: var(--in-text); }
.msg.out + .msg.out, .msg.in + .msg.in { margin-top: 2px; }
.msg.out + .msg.out { border-start-start-radius: 4px; }
.msg.in + .msg.in { border-start-end-radius: 4px; }
.msg.out:has(+ .msg.out) { border-end-start-radius: 4px; }
.msg.in:has(+ .msg.in) { border-end-end-radius: 4px; }
.msg.media { padding: 4px; }
.msg.media .meta { padding: 0 8px 2px; }
.msg .body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; }
.msg .body.big { font-size: 40px; line-height: 1.25; }
.msg.big-emoji { background: none; border: 0; box-shadow: none; padding: 0 4px; }
.msg.big-emoji .meta { color: var(--text-3); }
.meta { display: flex; gap: 6px; align-items: center; justify-content: flex-end; font-size: 11px; opacity: .75; margin-top: 2px; direction: ltr; }
.meta .timer { display: inline-flex; align-items: center; gap: 3px; font-variant-numeric: tabular-nums; }
.meta .timer .i { width: 12px; height: 12px; stroke-width: 2.2; }
.meta .timer.waiting { opacity: .7; }
.tick { display: inline-flex; }
.tick .i { width: 15px; height: 15px; stroke-width: 2.3; }
.msg.out .tick { opacity: .8; }
.msg.read .tick { color: var(--read); opacity: 1; }
/* Sent and read by the other side: green bubble + "read" label. */
.msg.out.read { background: var(--read-bg); }
.msg.out.read .tick { color: #fff; }
.read-label { display: none; font-weight: 600; direction: rtl; }
.msg.out.read .read-label { display: inline; }
.msg.out.read.big-emoji, .msg.out.read.gif { background: none; }
.msg.out.read.big-emoji .read-label, .msg.out.read.gif .read-label, .msg.out.read.big-emoji .tick, .msg.out.read.gif .tick { color: var(--brand-1); }
.msg.queued { opacity: .7; }
.msg.failed { outline: 1px solid var(--bad); }
.msg.flash { animation: flash 1.2s var(--ease); }
.react-btn {
  position: absolute; top: 50%; transform: translateY(-50%); width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line-2); color: var(--text-2);
  opacity: 0; transition: opacity .15s; box-shadow: var(--shadow);
}
.msg.out .react-btn { inset-inline-end: -38px; }
.msg.in .react-btn { inset-inline-start: -38px; }
.react-btn .i { width: 16px; height: 16px; }
@media (hover: hover) { .msg:hover .react-btn { opacity: 1; } }
.reacts { position: absolute; bottom: -12px; display: flex; gap: 2px; padding: 1px 5px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line-2); box-shadow: var(--shadow); font-size: 13px; line-height: 20px; cursor: pointer; }
.msg.out .reacts { inset-inline-end: 10px; }
.msg.in .reacts { inset-inline-start: 10px; }
.msg.has-reacts { margin-bottom: 14px; }
.reacts .count { font-size: 11px; color: var(--text-2); }

/* instagram card */
.ig-card { display: block; width: min(300px, 64vw); text-decoration: none; color: inherit; border-radius: 16px; overflow: hidden; background: rgba(0,0,0,.18); }
.msg.in .ig-card { background: var(--surface-2); }
.ig-thumb { position: relative; aspect-ratio: 4 / 5; background: linear-gradient(135deg, #f58529, #dd2a7b 50%, #8134af); display: grid; place-items: center; overflow: hidden; }
.ig-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.ig-thumb .i { width: 44px; height: 44px; color: #fff; opacity: .9; }
.ig-play { position: absolute; width: 54px; height: 54px; border-radius: 50%; background: rgba(0,0,0,.45); backdrop-filter: blur(6px); display: grid; place-items: center; }
.ig-play .i { width: 22px; height: 22px; color: #fff; margin-inline-start: -3px; }
.ig-info { padding: 9px 12px 10px; }
.ig-brand { display: flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; opacity: .8; }
.ig-brand .i { width: 14px; height: 14px; }
.ig-title { font-size: 13px; line-height: 1.5; margin-top: 3px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ig-card + .body { padding: 6px 4px 0; }

/* youtube card */
.ig-card.yt-card { width: min(320px, 68vw); }
.ig-card.yt-card .ig-thumb { aspect-ratio: 16 / 9; background: #000; }
.ig-card.yt-card .ig-thumb > .i { width: 38px; height: 38px; opacity: .55; }
.yt-badge { width: 22px; height: 15px; border-radius: 5px; background: #f03; display: grid; place-items: center; flex: none; }
.yt-badge .i { width: 9px; height: 9px; color: #fff; margin-inline-start: -1px; opacity: 1; }
.yt-author { font-size: 11.5px; opacity: .65; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.yt-meta { font-size: 11px; opacity: .5; margin-top: 1px; }
.yt-dur { position: absolute; inset-inline-end: 6px; bottom: 6px; padding: 1px 5px; border-radius: 5px; background: rgba(0,0,0,.78); color: #fff; font-size: 11px; font-weight: 600; direction: ltr; }
.yt-brand { opacity: 1; }

/* media */
.media-wrap { position: relative; border-radius: 16px; overflow: hidden; width: min(280px, 64vw); background: #000; cursor: pointer; touch-action: none; }
.media-wrap img, .media-wrap video { display: block; width: 100%; max-height: 360px; object-fit: cover; filter: blur(22px) saturate(1.2); transform: scale(1.15); pointer-events: none; }
.media-veil { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: #fff; background: rgba(0,0,0,.18); font-size: 12.5px; font-weight: 600; text-shadow: 0 1px 4px rgba(0,0,0,.5); }
.media-veil .i { width: 28px; height: 28px; padding: 10px; box-sizing: content-box; border-radius: 50%; background: rgba(0,0,0,.35); backdrop-filter: blur(8px); }
.media-loading { width: min(280px, 64vw); aspect-ratio: 4 / 3; border-radius: 16px; background: var(--surface-2); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--text-2); font-size: 12.5px; }
.msg.out .media-loading { background: rgba(0,0,0,.18); color: #fff; }
.media-loading .i { width: 30px; height: 30px; }
.progress { width: 70%; height: 4px; border-radius: 99px; background: rgba(127,127,127,.25); overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: currentColor; border-radius: inherit; transition: width .2s; }
.file-card { display: flex; align-items: center; gap: 12px; min-width: 220px; padding: 6px 4px; text-decoration: none; color: inherit; }
.file-card .file-ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: rgba(0,0,0,.18); flex: none; }
.msg.in .file-card .file-ic { background: var(--brand-soft); color: var(--brand-1); }
.file-card .name { font-weight: 600; font-size: 13.5px; overflow-wrap: anywhere; }
.file-card .size { font-size: 12px; opacity: .7; }

/* stacked instagram posts */
.ig-stack { display: flex; align-items: center; gap: 14px; padding: 10px 14px 10px 10px; cursor: pointer; min-width: min(300px, 70vw); }
.ig-stack .meta { position: absolute; bottom: 6px; inset-inline-end: 12px; }
.stack-cards { position: relative; width: 76px; height: 92px; flex: none; }
.stack-card { position: absolute; inset: 0; border-radius: 12px; overflow: hidden; background: linear-gradient(135deg, #f58529, #dd2a7b 50%, #8134af); display: grid; place-items: center; border: 2px solid var(--in-bg); box-shadow: 0 4px 12px rgba(0,0,0,.3); }
.msg.out .stack-card { border-color: var(--out-bg); }
.stack-card img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.stack-card .i { color: #fff; width: 26px; height: 26px; }
.stack-card:nth-last-child(3) { transform: rotate(-9deg) translateX(10px); opacity: .75; }
.stack-card:nth-last-child(2) { transform: rotate(-4deg) translateX(5px); opacity: .9; }
.stack-cards .ig-play { width: 32px; height: 32px; left: 50%; top: 50%; transform: translate(-50%, -50%); }
.stack-cards .ig-play .i { width: 14px; height: 14px; }
.stack-count { position: absolute; top: -6px; inset-inline-start: -6px; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 99px; background: var(--brand); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; box-shadow: none; }
.stack-info { flex: 1; min-width: 0; padding-bottom: 14px; }
.stack-info .ig-brand { font-size: 14px; opacity: 1; }
.stack-sub { font-size: 12px; opacity: .75; margin-top: 4px; }

/* modal */
.modal { position: fixed; inset: 0; z-index: 45; background: rgba(0,0,0,.6); display: grid; place-items: center; padding: 16px; animation: fade .2s; }
.modal-card { width: 100%; max-width: 400px; max-height: calc(100dvh - 32px); overflow-y: auto; background: var(--surface); border: 0; border-radius: 16px; padding: 16px; box-shadow: var(--shadow-lg); animation: pop .2s var(--ease); }
.igm-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.igm-kind { font-weight: 700; font-size: 14.5px; }
.igm-from { font-size: 12px; color: var(--text-3); }
.igm-media { position: relative; aspect-ratio: 4 / 5; max-height: 46dvh; width: 100%; border-radius: 18px; overflow: hidden; background: linear-gradient(135deg, #f58529, #dd2a7b 50%, #8134af); display: grid; place-items: center; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.igm-media img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.igm-media > .i { width: 54px; height: 54px; color: #fff; }
.igm-media .ig-play { left: 50%; top: 50%; transform: translate(-50%, -50%); }
.igm-title { font-size: 13.5px; line-height: 1.6; margin: 12px 2px 4px; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.igm-note { font-size: 14px; margin: 6px 2px; padding: 8px 12px; background: var(--surface-2); border-radius: 12px; }
.igm-label { font-size: 12.5px; font-weight: 700; color: var(--text-2); margin: 14px 2px 8px; }
.igm-reacts { display: flex; justify-content: space-between; gap: 4px; background: var(--surface-2); border-radius: 99px; padding: 5px; }
.igm-reacts button { flex: 1; height: 44px; border-radius: 99px; font-size: 24px; transition: transform .15s var(--ease), background .15s; }
.igm-reacts button:hover { transform: scale(1.18); }
.igm-reacts button.mine { background: var(--brand-soft); box-shadow: inset 0 0 0 2px var(--brand-1); transform: scale(1.08); }
.igm-replies { margin: 12px 0 4px; display: grid; gap: 6px; }
.ig-reply { display: flex; align-items: baseline; gap: 6px; font-size: 13.5px; line-height: 1.55; padding: 8px 12px; background: var(--brand-soft); border-radius: 14px; }
.ig-reply .who { font-weight: 700; font-size: 12px; color: var(--text-2); flex: none; }
.ig-reply .emo { flex: none; }
.ig-reply .txt { overflow-wrap: anywhere; }
.ig-title.has-replies { display: grid; gap: 4px; -webkit-line-clamp: unset; }
.ig-title.has-replies .ig-reply { padding: 5px 9px; font-size: 12.5px; background: rgba(0,0,0,.18); }
.msg.in .ig-title.has-replies .ig-reply { background: var(--brand-soft); }
.igm-form { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.igm-form input { flex: 1; min-width: 0; height: 44px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--line-2); background: var(--bg-2); outline: none; transition: border-color .2s, box-shadow .2s; }
.igm-form input:focus { border-color: var(--brand-1); box-shadow: 0 0 0 4px var(--brand-soft); }
.send.sm { width: 44px; height: 44px; }
.send.sm .i { width: 19px; height: 19px; }
.igm-peer {font-size: 12.5px; color: var(--text-2); text-align: center; margin-top: 10px; }
.igm-nav { display: flex; align-items: center; justify-content: space-between; margin: 12px 0 4px; }
.igm-mid { text-align: center; }
.igm-count { font-size: 12.5px; color: var(--text-2); font-weight: 600; }
.igm-dots { display: flex; gap: 4px; justify-content: center; margin-top: 4px; }
.igm-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--surface-3); }
.igm-dots i.done { background: color-mix(in srgb, var(--brand-1) 45%, transparent); }
.igm-dots i.on { background: var(--brand-1); width: 16px; border-radius: 99px; }
#igm-open { margin-top: 12px; text-decoration: none; }
.view-time { position: absolute; top: max(14px, env(safe-area-inset-top)); left: 16px; right: 16px; height: 3px; border-radius: 99px; background: rgba(255,255,255,.18); overflow: hidden; }
.view-time i { display: block; height: 100%; background: #fff; transform-origin: right; transition: transform .25s linear; }
#messages { touch-action: pan-y; }
.viewer { touch-action: none; }

/* activity (reaction) lines */
.act-run { align-self: center; max-width: 92%; margin: 10px 0 4px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.act { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-2); background: var(--surface); border: 1px solid var(--line); padding: 3px 4px 3px 12px; border-radius: 99px; cursor: pointer; }
.act .mini { width: 24px; height: 24px; border-radius: 7px; object-fit: cover; background: var(--surface-3); display: grid; place-items: center; font-size: 11px; overflow: hidden; }
.act .mini .i { width: 14px; height: 14px; }
.act .snip { max-width: 140px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-3); }
.act-summary { display: none; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); background: var(--surface); border: 1px solid var(--line-2); padding: 5px 14px 5px 6px; border-radius: 99px; box-shadow: var(--shadow); }
.act-summary .stack { display: flex; }
.act-summary .stack span { width: 24px; height: 24px; border-radius: 50%; background: var(--surface-2); border: 2px solid var(--surface); display: grid; place-items: center; font-size: 12px; margin-inline-start: -8px; }
.act-summary .stack span:first-child { margin-inline-start: 0; }
.act-summary .chev { transition: transform .2s; width: 14px; height: 14px; }
.act-run.grouped .act-summary { display: inline-flex; }
.act-run.grouped .act-items { display: none; }
.act-run.grouped.open .act-items { display: flex; }
.act-run.grouped.open .chev { transform: rotate(180deg); }
.act-items { display: flex; flex-direction: column; align-items: center; gap: 4px; }

.notice { align-self: center; font-size: 12px; color: var(--text-3); padding: 4px 12px; text-align: center; margin: 8px 0; animation: rise .3s var(--ease); }
.notice.warn { color: var(--warn); }

.typing { display: flex; gap: 4px; align-items: center; margin: 0 16px 6px; padding: 10px 14px; background: var(--in-bg); border-radius: 18px; width: fit-content; align-self: flex-end; }
.typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }

/* ---------- composer ---------- */
.composer-wrap { position: relative; padding: 8px 10px; padding-bottom: max(10px, env(safe-area-inset-bottom)); background: var(--bg); }
.composer { display: flex; align-items: flex-end; gap: 8px; }
.input-shell { flex: 1; min-width: 0; display: flex; align-items: flex-end; gap: 2px; padding: 2px 4px; background: var(--surface-2); border: 1px solid transparent; border-radius: 22px; transition: border-color .2s, box-shadow .2s; }
.input-shell:focus-within { border-color: transparent; box-shadow: none; }
.input-shell textarea { flex: 1; min-width: 0; resize: none; border: 0; outline: none; background: none; max-height: 150px; min-height: 36px; padding: 6px 4px; line-height: 1.6; font-size: 15px; }
.input-shell textarea::placeholder { color: var(--text-3); }
.send { width: 42px; height: 42px; margin-bottom: 2px; border-radius: 50%; flex: none; background: var(--brand); color: #fff; display: grid; place-items: center; box-shadow: none; transition: transform .15s var(--ease), opacity .2s; }
.send .i { width: 21px; height: 21px; transform: scaleX(-1); }
.send:active { transform: scale(.92); }
.send.idle { opacity: .5; }
.upload-hint { font-size: 12px; color: var(--text-2); padding: 0 8px 6px; display: flex; align-items: center; gap: 6px; }
.emoji-panel {
  position: absolute; bottom: calc(100% + 6px); inset-inline: 10px; max-height: 300px; overflow-y: auto; z-index: 8;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 20px; box-shadow: var(--shadow-lg); padding: 8px 10px; animation: pop .16s var(--ease);
}
.emoji-panel h4 { font-size: 11.5px; color: var(--text-3); margin: 8px 6px 4px; font-weight: 600; }
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); }
.emoji-grid button { height: 40px; font-size: 24px; border-radius: 10px; transition: background .12s, transform .12s; }
.emoji-grid button:hover { background: var(--surface-2); transform: scale(1.12); }
.gif-btn { height: 26px; padding: 0 7px; margin: 5px 2px; border-radius: 8px; border: 1.5px solid currentColor; color: var(--text-2); font-size: 11px; font-weight: 800; letter-spacing: .5px; font-family: ui-sans-serif, system-ui, sans-serif; }
.gif-btn:hover { color: var(--brand-1); }
.gif-panel { height: min(380px, 58dvh); max-height: none; display: flex; flex-direction: column; gap: 8px; overflow: hidden; }
.gif-search, .gif-topics, .gif-foot { flex: none; }
.gif-search { display: flex; gap: 6px; align-items: center; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 99px; padding: 2px 4px 2px 12px; }
.gif-search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; height: 36px; }
.gif-search .i { transform: scaleX(-1); }
.gif-topics { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chip-btn { flex: none; font-size: 12.5px; padding: 5px 11px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); white-space: nowrap; }
.chip-btn:hover { background: var(--brand-soft); }
.gif-grid { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); grid-auto-rows: 84px; align-content: start; gap: 6px; overflow-y: auto; overscroll-behavior: contain; }
.gif-cell { width: 100%; height: 100%; border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.gif-cell img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.gif-cell.loading { animation: blink 1.4s infinite; }
.gif-msg { grid-column: 1 / -1; text-align: center; color: var(--text-3); font-size: 13px; padding: 30px 0; }
.gif-foot { font-size: 10.5px; color: var(--text-3); text-align: center; }
.msg.gif { padding: 3px; background: none !important; border: 0 !important; box-shadow: none; }
.msg.gif .meta { color: var(--text-3); padding: 0 4px; }
.gif-mini { display: block; width: 96px; max-height: 96px; object-fit: cover; border-radius: 12px; pointer-events: none; user-select: none; -webkit-user-select: none; }
.media-loading.gif-loading { width: 96px; aspect-ratio: 1; }
body { touch-action: manipulation; }

/* music message */
.msg.music { padding: 8px 10px 6px; min-width: min(280px, 72vw); }
.music-msg { display: flex; align-items: center; gap: 10px; }
.music-play { width: 44px; height: 44px; border-radius: 50%; flex: none; display: grid; place-items: center; background: rgba(255,255,255,.18); color: inherit; }
.msg.in .music-play { background: var(--brand); color: #fff; }
.music-play .i { width: 20px; height: 20px; }
.music-info { flex: 1; min-width: 0; }
.music-title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.music-sub { font-size: 11.5px; opacity: .7; }
.music-save { flex: none; display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; padding: 6px 9px; border-radius: 99px; background: rgba(0,0,0,.2); color: inherit; }
.msg.in .music-save { background: var(--brand-soft); color: var(--brand-1); }
.music-save .i { width: 14px; height: 14px; }
.music-save.saved { background: rgba(34,197,94,.18); color: #4ade80; }

/* mini player */
.mini-player { position: relative; display: flex; align-items: center; gap: 6px; margin-bottom: 8px; padding: 4px 6px 6px 4px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 16px; overflow: hidden; animation: rise .25s var(--ease); }
.mp-info { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 6px 8px; text-align: start; }
#mp-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13.5px; font-weight: 600; }
.mp-ctrls { display: flex; align-items: center; flex: none; }
.mp-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 2.5px; background: var(--surface-3); }
.mp-progress i { display: block; height: 100%; background: var(--brand); transform-origin: left; transform: scaleX(0); }
.mp-eq { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; flex: none; }
.mp-eq i { width: 3px; height: 4px; background: var(--brand-1); border-radius: 2px; }
.mini-player.playing .mp-eq i { animation: eq .9s ease-in-out infinite; }
.mini-player.playing .mp-eq i:nth-child(2) { animation-delay: .2s; }
.mini-player.playing .mp-eq i:nth-child(3) { animation-delay: .4s; }
@keyframes eq { 0%, 100% { height: 4px; } 50% { height: 14px; } }

/* library */
.music-card { max-width: 420px; }
.np { text-align: center; padding: 6px 4px 14px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.np-art { width: 84px; height: 84px; margin: 4px auto 12px; border-radius: 22px; background: var(--brand); color: #fff; display: grid; place-items: center; box-shadow: none; }
.np-art .i { width: 38px; height: 38px; }
.np-title { font-weight: 700; font-size: 15px; margin-bottom: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#np-seek { width: 100%; accent-color: var(--brand-1); }
.np-times { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.np-ctrls { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 6px; }
.np-ctrls .btn-icon.on { color: var(--brand-1); background: var(--brand-soft); }
.np-main { width: 58px; height: 58px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; box-shadow: none; }
.np-main .i { width: 26px; height: 26px; }
.lib-actions { display: flex; gap: 8px; margin-bottom: 10px; }
.lib-actions .btn { flex: 1; }
.lib-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; max-height: 36dvh; overflow-y: auto; }
.lib-list li { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 4px; border-radius: 12px; cursor: pointer; }
.lib-list li:hover { background: var(--surface-2); }
.lib-list li.current { background: var(--brand-soft); }
.lib-list li.current .lib-title { color: var(--brand-1); }
.lib-num { width: 22px; text-align: center; font-size: 12px; color: var(--text-3); flex: none; }
.lib-info { flex: 1; min-width: 0; }
.lib-title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-sub { font-size: 11.5px; color: var(--text-3); }
.lib-del { color: var(--text-3); }
.lib-del:hover { color: var(--bad) !important; }
.lib-empty { text-align: center; color: var(--text-3); font-size: 13px; margin: 18px 0; }
.lib-note { display: flex; gap: 6px; align-items: flex-start; font-size: 11.5px; color: var(--text-3); margin: 12px 2px 0; }
.lib-note .i { width: 14px; height: 14px; flex: none; margin-top: 2px; }
.drop-zone {position: absolute; inset: 0; z-index: 15; background: color-mix(in srgb, var(--bg) 80%, transparent); backdrop-filter: blur(6px); display: grid; place-items: center; }
.drop-zone div { border: 2px dashed var(--brand-1); border-radius: 24px; padding: 40px 50px; display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--brand-1); font-weight: 600; }
.drop-zone .i { width: 40px; height: 40px; }

/* ---------- reaction bar / viewer / shield ---------- */
.react-bar { position: fixed; z-index: 30; display: flex; gap: 2px; padding: 5px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line-2); box-shadow: var(--shadow-lg); animation: pop .16s var(--ease); }
.react-bar button { width: 42px; height: 42px; border-radius: 50%; font-size: 24px; transition: transform .15s var(--ease), background .15s; }
.react-bar button:hover { transform: scale(1.25) translateY(-3px); }
.react-bar button.mine { background: var(--brand-soft); }
.viewer { position: fixed; inset: 0; z-index: 48; background: #000; display: grid; place-items: center; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
/* sized to the screen itself: a % height inside the grid has nothing to measure against */
.viewer img, .viewer video { max-width: 100vw; max-height: 100vh; max-height: 100dvh; object-fit: contain; pointer-events: none; }
.viewer .hint { position: absolute; bottom: max(20px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); color: rgba(255,255,255,.7); font-size: 12px; background: rgba(255,255,255,.08); padding: 5px 12px; border-radius: 99px; }
.shield { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: color-mix(in srgb, var(--bg) 70%, transparent); backdrop-filter: blur(40px) saturate(.6); -webkit-backdrop-filter: blur(40px) saturate(.6); }
.shield div { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--text-2); text-align: center; }
.shield .i { width: 40px; height: 40px; color: var(--brand-1); margin-bottom: 6px; }
.shield span { font-size: 13px; color: var(--text-3); }

/* ---------- call ---------- */
.call { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: max(24px, env(safe-area-inset-top)) 20px max(36px, env(safe-area-inset-bottom)); color: #fff; animation: fade .25s; }
.call-bg { position: absolute; inset: 0; z-index: -1; background: #1b1b1b; }
.call-top { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.1); padding: 6px 12px; border-radius: 99px; color: rgba(255,255,255,.85); text-align: center; }
.call-top .i { width: 14px; height: 14px; color: #86efac; }
.call-center { text-align: center; }
.call-avatar { position: relative; width: 132px; height: 132px; margin: 0 auto 22px; }
.call-avatar .face { position: absolute; inset: 0; border-radius: 50%; background: var(--brand); display: grid; place-items: center; box-shadow: none; }
.call-avatar .face .i { width: 56px; height: 56px; stroke-width: 1.5; }
.ring { position: absolute; inset: 0; border-radius: 50%; border: 2px solid rgba(79,127,100,.55); animation: ripple 2.4s var(--ease) infinite; }
.ring.r2 { animation-delay: 1.2s; }
.call.active .ring { animation: none; opacity: 0; }
.call-name { font-size: 24px; font-weight: 700; }
.call-state { color: rgba(255,255,255,.7); margin-top: 4px; }
.call-timer { font-size: 16px; color: rgba(255,255,255,.85); direction: ltr; font-variant-numeric: tabular-nums; margin-top: 2px; }
.call-actions { display: flex; gap: 28px; align-items: center; }
.round { width: 68px; height: 68px; border-radius: 50%; display: grid; place-items: center; color: #fff; transition: transform .15s var(--ease), background .2s; }
.round:active { transform: scale(.92); }
.round .i { width: 28px; height: 28px; }
.round.glass { background: rgba(255,255,255,.12); backdrop-filter: blur(10px); border: 1px solid rgba(255,255,255,.12); }
.round.glass.off { background: #fff; color: #111; }
.round.danger { background: #ef4444; box-shadow: 0 10px 30px -8px rgba(239,68,68,.7); }
.round.success { background: #22c55e; box-shadow: 0 10px 30px -8px rgba(34,197,94,.7); animation: nudge 1.4s infinite; }
.hang { transform: rotate(135deg); }

/* ---------- dialog / toast ---------- */
.dialog { background: var(--surface); color: var(--text); border: 0; border-radius: 16px; padding: 26px 22px 20px; max-width: 420px; width: calc(100% - 32px); box-shadow: var(--shadow-lg); text-align: center; }
.dialog::backdrop { background: rgba(5,6,10,.6); backdrop-filter: blur(4px); }
.dialog h2 { margin: 0 0 14px; font-size: 18px; }
.dialog-icon { width: 56px; height: 56px; margin: 0 auto 12px; border-radius: 18px; background: var(--brand-soft); color: var(--brand-1); display: grid; place-items: center; }
.dialog-icon .i { width: 28px; height: 28px; }
.code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 21px; font-weight: 600; letter-spacing: 1px; word-spacing: 8px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin: 0 0 14px; }
.meta-line { font-size: 12px; color: var(--text-3); }
.toast { position: fixed; bottom: calc(96px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); z-index: 60; background: #3b3b3b; color: #fff; border: 0; padding: 10px 18px; border-radius: 8px; font-size: 13px; box-shadow: var(--shadow-lg); max-width: calc(100% - 32px); text-align: center; animation: rise .25s var(--ease); }

/* ---------- entry steps ---------- */
.btn-soft { background: var(--surface-2); border: 1px solid var(--line-2); }
.btn-soft:hover { background: var(--surface-3); }
.step { display: grid; gap: 0; animation: rise .35s var(--ease); }
#choose-step { gap: 10px; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-size: 13px; margin-bottom: 14px; width: fit-content; padding: 4px 8px 4px 2px; border-radius: 8px; }
.back:hover { color: var(--text); background: var(--surface-2); }
.back .i { width: 16px; height: 16px; transform: scaleX(-1); }
.code-display { position: relative; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 14px 52px; margin-bottom: 8px; background: var(--brand-soft); border: 1px dashed color-mix(in srgb, var(--brand-1) 50%, transparent); border-radius: 16px; }
.code-display span { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 32px; font-weight: 700; letter-spacing: 4px; color: var(--text); }
#regen-btn { position: absolute; top: 50%; inset-inline-end: 10px; transform: translateY(-50%); }
.code-label { text-align: center; }
.latin { font-family: ui-sans-serif, system-ui, "Segoe UI", sans-serif; font-size: .95em; }
.help { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; color: var(--text-2); margin: 0 0 16px; }
.help .i { width: 16px; height: 16px; margin-top: 3px; color: var(--brand-1); }
.strength { height: 4px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin: -6px 0 6px; }
.strength i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--bad); transition: width .25s var(--ease), background .25s; }
.strength-text { font-size: 12px; color: var(--text-3); margin-bottom: 14px; }
.form-error { display: flex; gap: 8px; align-items: center; font-size: 13px; color: #fca5a5; background: rgba(239,68,68,.1); border: 1px solid rgba(239,68,68,.25); padding: 9px 12px; border-radius: 12px; margin-bottom: 14px; }
@media (prefers-color-scheme: light) { .form-error { color: #b91c1c; } }
.otp { width: 100%; height: 64px; text-align: center; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 32px; font-weight: 700; letter-spacing: 10px; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 16px; outline: none; margin-bottom: 14px; transition: border-color .2s, box-shadow .2s; }
.otp:focus { border-color: var(--brand-1); box-shadow: 0 0 0 4px var(--brand-soft); }
.otp::placeholder { color: var(--text-3); letter-spacing: 8px; }
.room-chip { display: inline-flex; align-items: center; gap: 6px; width: fit-content; font-size: 13px; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--line); padding: 5px 12px; border-radius: 99px; margin-bottom: 14px; }
.room-chip b { font-family: ui-monospace, Consolas, monospace; color: var(--text); letter-spacing: 1px; }
.room-chip .i { width: 15px; height: 15px; }
.eye { color: var(--text-3); margin-inline-start: -6px; }
.room-tag { font-family: ui-monospace, Consolas, monospace; font-size: 11px; font-weight: 600; color: var(--text-3); background: var(--surface-2); padding: 1px 7px; border-radius: 6px; margin-inline-start: 4px; letter-spacing: .5px; vertical-align: 1px; }
.share-card { pointer-events: auto; width: min(340px, 100%); background: var(--surface); border: 1px solid var(--line-2); border-radius: 20px; padding: 16px; margin: 0 0 16px; box-shadow: var(--shadow); }
.share-label { font-size: 12.5px; color: var(--text-2); }
.share-code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 34px; font-weight: 800; letter-spacing: 5px; margin: 4px 0 10px; background: var(--brand); -webkit-background-clip: text; background-clip: text; color: transparent; }
.share-actions { display: flex; gap: 8px; justify-content: center; }
.share-actions a { text-decoration: none; }
.share-note { font-size: 11.5px; color: var(--text-3); margin-top: 10px; }

/* ---------- lock screen ---------- */
.lock { position: fixed; inset: 0; z-index: 110; background: var(--bg); display: grid; place-items: center; padding: 24px 16px; overflow-y: auto; }
.lock-box { position: relative; width: 100%; max-width: 380px; text-align: center; animation: rise .35s var(--ease); }
.lock-icon { width: 76px; height: 76px; margin: 0 auto 18px; border-radius: 23%; background: var(--brand); color: #fff; display: grid; place-items: center; box-shadow: none; }
.lock-icon .i { width: 100%; height: 100%; }
.lock h2 { margin: 0 0 6px; font-size: 22px; }
.lock p { margin: 0 0 20px; color: var(--text-2); font-size: 14px; }
.lock p b { font-family: ui-monospace, Consolas, monospace; color: var(--text); }
.lock .field { text-align: start; }
.lock-call { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ok); background: rgba(34,197,94,.1); padding: 5px 12px; border-radius: 99px; margin-bottom: 14px; }
.lock-call .i { width: 15px; height: 15px; }
.lock.shake .lock-box { animation: shake .4s; }
.btn-link { margin-top: 16px; font-size: 13px; color: var(--text-3); text-decoration: underline; text-underline-offset: 3px; }
.btn-link:hover { color: var(--bad); }

/* ---------- motion ---------- */
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .35; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.94); } }
@keyframes bubble { from { opacity: 0; transform: translateY(6px) scale(.98); } }
@keyframes blink { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }
@keyframes ripple { 0% { transform: scale(1); opacity: .8; } 100% { transform: scale(1.7); opacity: 0; } }
@keyframes nudge { 0%, 100% { transform: rotate(0); } 10%, 30% { transform: rotate(-12deg); } 20%, 40% { transform: rotate(12deg); } 50% { transform: rotate(0); } }
@keyframes flash { 0%, 100% { box-shadow: 0 0 0 0 transparent; } 30% { box-shadow: 0 0 0 4px var(--brand-1); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

.peer-name { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
@media (max-width: 520px) {
  .msg { max-width: 84%; }
  .ttl-pop { inset-inline-end: 60px; }
  .peer-name { font-size: 14.5px; }
  .room-tag { display: none; } /* the code is in the menu and on the lock screen */
  .avatar-sm { width: 38px; height: 38px; }
  .peer { gap: 10px; }
  .peer-status { font-size: 11.5px; }
  .chip { height: 30px; padding: 0 9px; font-size: 12px; margin-inline-end: 2px; }
  .top-actions .btn-icon { width: 36px; height: 36px; }
  .landing { padding-top: 32px; }
}
/* On 320-359px phones the header needs every pixel for the peer's name, so
   the delete-timer chip keeps its icon but drops its (long) label. */
@media (max-width: 359.98px) {
  #ttl-label { display: none; }
  #ttl-btn { padding: 0 8px; }
}

/* Nothing to print. */
@media print { body * { display: none !important; } }
.meta .timer.kept { color: #4ade80; opacity: 1; }
.msg.in .meta .timer.kept { color: var(--ok); }

/* confirm dialog */
.confirm-dlg { max-width: 380px; }
.dialog-icon.danger { background: rgba(239,68,68,.14); color: var(--bad); }
.cf-text { color: var(--text-2); font-size: 14px; margin: 0 0 18px; white-space: pre-line; }
.cf-actions { display: flex; gap: 10px; }
.cf-actions .btn { flex: 1; }
.btn-danger { background: #dc2626; color: #fff; border: 0; box-shadow: 0 8px 22px -8px rgba(220,38,38,.7); }
.btn-danger:hover { filter: brightness(1.08); }
.aiv-text { display: block; width: 100%; box-sizing: border-box; resize: vertical; min-height: 96px; margin: 0 0 16px; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--brand-soft); color: inherit; font: inherit; font-size: 16px; line-height: 1.7; }
.aiv-text:focus { outline: 2px solid var(--brand-1); outline-offset: 1px; }

/* keep sheet */
.sheet { position: fixed; inset: 0; z-index: 46; background: rgba(5,6,10,.5); display: flex; align-items: flex-end; justify-content: center; padding: 12px; animation: fade .15s; }
.sheet-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 22px; padding: 10px; box-shadow: var(--shadow-lg); animation: rise .2s var(--ease); margin-bottom: env(safe-area-inset-bottom); }
.sheet-title { text-align: center; font-size: 13px; color: var(--text-3); padding: 6px 0 8px; }
.sheet-btn { width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px; height: 50px; border-radius: 14px; font-weight: 700; font-size: 15px; background: var(--brand-soft); color: var(--brand-1); margin-bottom: 6px; }
.sheet-btn.danger { background: rgba(239,68,68,.12); color: var(--bad); }
.sheet-btn.muted { background: var(--surface-2); color: var(--text-2); font-weight: 600; }
.sheet-btn .i { width: 19px; height: 19px; }
.sheet-note { font-size: 11.5px; color: var(--text-3); text-align: center; margin: 4px 6px 4px; }

/* kept items */
.msg.kept .media-wrap { box-shadow: 0 0 0 2px rgba(74,222,128,.55); }
.seg { display: flex; gap: 4px; background: var(--surface-2); border-radius: 12px; padding: 4px; margin-bottom: 12px; }
.seg button { flex: 1; height: 36px; border-radius: 9px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; max-height: 46dvh; overflow-y: auto; }
.g-tile { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--surface-2); display: grid; place-items: center; cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.g-tile img { width: 100%; height: 100%; object-fit: cover; filter: blur(7px) saturate(1.2); transform: scale(1.2); pointer-events: none; }
.g-tile > .i { width: 28px; height: 28px; color: var(--text-3); }
.g-badge { position: absolute; width: 30px; height: 30px; border-radius: 50%; background: rgba(0,0,0,.4); backdrop-filter: blur(6px); display: grid; place-items: center; color: #fff; pointer-events: none; }
.g-badge .i { width: 15px; height: 15px; }
.g-del { position: absolute; top: 5px; inset-inline-start: 5px; width: 28px; height: 28px; border-radius: 50%; background: rgba(0,0,0,.45); color: #fff; display: grid; place-items: center; }
.g-del .i { width: 14px; height: 14px; }
.g-hint { display: flex; align-items: center; gap: 6px; justify-content: center; font-size: 12px; color: var(--text-3); margin: 0 0 10px; }
.g-hint .i { width: 15px; height: 15px; }
.wipe-link { display: block; margin: 14px auto 0; }

/* three devices in one room */
.msg .sender { display: none; font-size: 11.5px; font-weight: 700; color: var(--brand-1); margin-bottom: 2px; }
body.multi .msg.in .sender { display: block; }
.msg.media .sender, .msg.gif .sender { padding: 0 8px; }
.peer-title { overflow: hidden; text-overflow: ellipsis; }
.sas-row { margin: 4px 0; }
.sas-row + .sas-row { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.sas-name { font-family: "Vazirmatn", system-ui, sans-serif; font-size: 12.5px; font-weight: 600; color: var(--text-2); letter-spacing: 0; word-spacing: 0; margin-bottom: 4px; }

/* confidential text (anti-zoom): a Telegram-style spoiler. Text keeps its
   layout but its glyphs are not painted, and pictures are pushed out of their
   own box (object-position), so nothing readable is drawn; the box shows only
   drifting dots until it is held or hovered. */
:root { --spoil: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' fill='%23a3a9b3'%3E%3Ccircle cx='13.0' cy='6.0' r='1' fill-opacity='0.35'/%3E%3Ccircle cx='2.9' cy='21.4' r='0.7' fill-opacity='0.95'/%3E%3Ccircle cx='2.3' cy='20.3' r='0.5' fill-opacity='0.35'/%3E%3Ccircle cx='17.3' cy='2.8' r='0.5' fill-opacity='0.95'/%3E%3Ccircle cx='17.0' cy='33.1' r='0.5' fill-opacity='0.5'/%3E%3Ccircle cx='25.2' cy='23.3' r='0.5' fill-opacity='0.95'/%3E%3Ccircle cx='23.4' cy='2.0' r='0.6' fill-opacity='0.35'/%3E%3Ccircle cx='22.3' cy='5.3' r='0.8' fill-opacity='0.5'/%3E%3Ccircle cx='21.6' cy='22.8' r='0.9' fill-opacity='0.5'/%3E%3Ccircle cx='4.1' cy='22.8' r='0.6' fill-opacity='0.65'/%3E%3Ccircle cx='3.9' cy='28.5' r='0.9' fill-opacity='0.35'/%3E%3Ccircle cx='24.8' cy='19.9' r='0.9' fill-opacity='0.8'/%3E%3Ccircle cx='31.1' cy='18.6' r='0.8' fill-opacity='0.65'/%3E%3Ccircle cx='12.0' cy='31.8' r='1' fill-opacity='0.5'/%3E%3Ccircle cx='3.3' cy='12.0' r='0.8' fill-opacity='0.65'/%3E%3Ccircle cx='29.2' cy='11.5' r='0.5' fill-opacity='0.35'/%3E%3Ccircle cx='20.5' cy='6.6' r='0.7' fill-opacity='0.5'/%3E%3Ccircle cx='37.3' cy='16.9' r='1' fill-opacity='0.35'/%3E%3Ccircle cx='30.6' cy='22.9' r='0.7' fill-opacity='0.65'/%3E%3Ccircle cx='27.8' cy='23.8' r='0.9' fill-opacity='0.8'/%3E%3Ccircle cx='2.8' cy='3.7' r='0.7' fill-opacity='0.8'/%3E%3Ccircle cx='27.9' cy='2.6' r='1' fill-opacity='0.65'/%3E%3Ccircle cx='25.9' cy='39.7' r='0.8' fill-opacity='0.65'/%3E%3Ccircle cx='28.7' cy='35.5' r='0.7' fill-opacity='0.35'/%3E%3Ccircle cx='37.6' cy='14.2' r='0.9' fill-opacity='0.35'/%3E%3Ccircle cx='19.7' cy='8.7' r='0.7' fill-opacity='0.5'/%3E%3Ccircle cx='29.5' cy='15.9' r='0.8' fill-opacity='0.35'/%3E%3Ccircle cx='6.7' cy='16.1' r='0.7' fill-opacity='0.5'/%3E%3Ccircle cx='32.8' cy='34.6' r='0.7' fill-opacity='0.8'/%3E%3Ccircle cx='39.5' cy='27.3' r='0.8' fill-opacity='0.5'/%3E%3Ccircle cx='6.0' cy='7.0' r='0.6' fill-opacity='0.5'/%3E%3Ccircle cx='0.5' cy='33.2' r='0.6' fill-opacity='0.65'/%3E%3Ccircle cx='11.3' cy='5.8' r='0.9' fill-opacity='0.65'/%3E%3Ccircle cx='24.4' cy='12.7' r='0.6' fill-opacity='0.95'/%3E%3C/svg%3E"), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' fill='%23a3a9b3'%3E%3Ccircle cx='30.4' cy='21.0' r='1' fill-opacity='0.35'/%3E%3Ccircle cx='14.6' cy='27.9' r='1' fill-opacity='0.95'/%3E%3Ccircle cx='12.6' cy='12.8' r='0.5' fill-opacity='0.8'/%3E%3Ccircle cx='20.3' cy='2.0' r='0.5' fill-opacity='0.5'/%3E%3Ccircle cx='14.1' cy='3.5' r='0.9' fill-opacity='0.35'/%3E%3Ccircle cx='3.3' cy='18.1' r='0.9' fill-opacity='0.35'/%3E%3Ccircle cx='30.4' cy='19.6' r='0.5' fill-opacity='0.5'/%3E%3Ccircle cx='19.7' cy='4.8' r='0.7' fill-opacity='0.65'/%3E%3Ccircle cx='19.3' cy='15.2' r='0.5' fill-opacity='0.8'/%3E%3Ccircle cx='31.8' cy='14.9' r='0.8' fill-opacity='0.65'/%3E%3Ccircle cx='2.7' cy='3.3' r='0.7' fill-opacity='0.65'/%3E%3Ccircle cx='15.3' cy='22.1' r='0.9' fill-opacity='0.35'/%3E%3Ccircle cx='6.6' cy='30.5' r='0.7' fill-opacity='0.5'/%3E%3Ccircle cx='22.1' cy='29.3' r='0.9' fill-opacity='0.65'/%3E%3Ccircle cx='31.3' cy='27.6' r='1' fill-opacity='0.65'/%3E%3Ccircle cx='16.6' cy='29.1' r='0.7' fill-opacity='0.5'/%3E%3Ccircle cx='17.0' cy='24.9' r='0.7' fill-opacity='0.5'/%3E%3Ccircle cx='19.6' cy='25.2' r='0.6' fill-opacity='0.5'/%3E%3Ccircle cx='26.2' cy='23.7' r='0.6' fill-opacity='0.5'/%3E%3Ccircle cx='16.6' cy='11.4' r='0.5' fill-opacity='0.35'/%3E%3Ccircle cx='25.3' cy='15.1' r='0.6' fill-opacity='0.95'/%3E%3Ccircle cx='30.6' cy='14.3' r='1' fill-opacity='0.65'/%3E%3Ccircle cx='30.6' cy='11.7' r='0.6' fill-opacity='0.35'/%3E%3Ccircle cx='7.3' cy='6.3' r='0.6' fill-opacity='0.8'/%3E%3Ccircle cx='20.0' cy='28.8' r='0.5' fill-opacity='0.8'/%3E%3Ccircle cx='29.1' cy='11.0' r='1' fill-opacity='0.35'/%3E%3C/svg%3E"); --spoil-size: 40px 40px, 32px 32px; }
/* white dots on the coloured outgoing bubble */
.msg.out:not(.gif):not(.big-emoji) { --spoil: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' fill='%23ffffff'%3E%3Ccircle cx='13.0' cy='6.0' r='1' fill-opacity='0.35'/%3E%3Ccircle cx='2.9' cy='21.4' r='0.7' fill-opacity='0.95'/%3E%3Ccircle cx='2.3' cy='20.3' r='0.5' fill-opacity='0.35'/%3E%3Ccircle cx='17.3' cy='2.8' r='0.5' fill-opacity='0.95'/%3E%3Ccircle cx='17.0' cy='33.1' r='0.5' fill-opacity='0.5'/%3E%3Ccircle cx='25.2' cy='23.3' r='0.5' fill-opacity='0.95'/%3E%3Ccircle cx='23.4' cy='2.0' r='0.6' fill-opacity='0.35'/%3E%3Ccircle cx='22.3' cy='5.3' r='0.8' fill-opacity='0.5'/%3E%3Ccircle cx='21.6' cy='22.8' r='0.9' fill-opacity='0.5'/%3E%3Ccircle cx='4.1' cy='22.8' r='0.6' fill-opacity='0.65'/%3E%3Ccircle cx='3.9' cy='28.5' r='0.9' fill-opacity='0.35'/%3E%3Ccircle cx='24.8' cy='19.9' r='0.9' fill-opacity='0.8'/%3E%3Ccircle cx='31.1' cy='18.6' r='0.8' fill-opacity='0.65'/%3E%3Ccircle cx='12.0' cy='31.8' r='1' fill-opacity='0.5'/%3E%3Ccircle cx='3.3' cy='12.0' r='0.8' fill-opacity='0.65'/%3E%3Ccircle cx='29.2' cy='11.5' r='0.5' fill-opacity='0.35'/%3E%3Ccircle cx='20.5' cy='6.6' r='0.7' fill-opacity='0.5'/%3E%3Ccircle cx='37.3' cy='16.9' r='1' fill-opacity='0.35'/%3E%3Ccircle cx='30.6' cy='22.9' r='0.7' fill-opacity='0.65'/%3E%3Ccircle cx='27.8' cy='23.8' r='0.9' fill-opacity='0.8'/%3E%3Ccircle cx='2.8' cy='3.7' r='0.7' fill-opacity='0.8'/%3E%3Ccircle cx='27.9' cy='2.6' r='1' fill-opacity='0.65'/%3E%3Ccircle cx='25.9' cy='39.7' r='0.8' fill-opacity='0.65'/%3E%3Ccircle cx='28.7' cy='35.5' r='0.7' fill-opacity='0.35'/%3E%3Ccircle cx='37.6' cy='14.2' r='0.9' fill-opacity='0.35'/%3E%3Ccircle cx='19.7' cy='8.7' r='0.7' fill-opacity='0.5'/%3E%3Ccircle cx='29.5' cy='15.9' r='0.8' fill-opacity='0.35'/%3E%3Ccircle cx='6.7' cy='16.1' r='0.7' fill-opacity='0.5'/%3E%3Ccircle cx='32.8' cy='34.6' r='0.7' fill-opacity='0.8'/%3E%3Ccircle cx='39.5' cy='27.3' r='0.8' fill-opacity='0.5'/%3E%3Ccircle cx='6.0' cy='7.0' r='0.6' fill-opacity='0.5'/%3E%3Ccircle cx='0.5' cy='33.2' r='0.6' fill-opacity='0.65'/%3E%3Ccircle cx='11.3' cy='5.8' r='0.9' fill-opacity='0.65'/%3E%3Ccircle cx='24.4' cy='12.7' r='0.6' fill-opacity='0.95'/%3E%3C/svg%3E"), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' fill='%23ffffff'%3E%3Ccircle cx='30.4' cy='21.0' r='1' fill-opacity='0.35'/%3E%3Ccircle cx='14.6' cy='27.9' r='1' fill-opacity='0.95'/%3E%3Ccircle cx='12.6' cy='12.8' r='0.5' fill-opacity='0.8'/%3E%3Ccircle cx='20.3' cy='2.0' r='0.5' fill-opacity='0.5'/%3E%3Ccircle cx='14.1' cy='3.5' r='0.9' fill-opacity='0.35'/%3E%3Ccircle cx='3.3' cy='18.1' r='0.9' fill-opacity='0.35'/%3E%3Ccircle cx='30.4' cy='19.6' r='0.5' fill-opacity='0.5'/%3E%3Ccircle cx='19.7' cy='4.8' r='0.7' fill-opacity='0.65'/%3E%3Ccircle cx='19.3' cy='15.2' r='0.5' fill-opacity='0.8'/%3E%3Ccircle cx='31.8' cy='14.9' r='0.8' fill-opacity='0.65'/%3E%3Ccircle cx='2.7' cy='3.3' r='0.7' fill-opacity='0.65'/%3E%3Ccircle cx='15.3' cy='22.1' r='0.9' fill-opacity='0.35'/%3E%3Ccircle cx='6.6' cy='30.5' r='0.7' fill-opacity='0.5'/%3E%3Ccircle cx='22.1' cy='29.3' r='0.9' fill-opacity='0.65'/%3E%3Ccircle cx='31.3' cy='27.6' r='1' fill-opacity='0.65'/%3E%3Ccircle cx='16.6' cy='29.1' r='0.7' fill-opacity='0.5'/%3E%3Ccircle cx='17.0' cy='24.9' r='0.7' fill-opacity='0.5'/%3E%3Ccircle cx='19.6' cy='25.2' r='0.6' fill-opacity='0.5'/%3E%3Ccircle cx='26.2' cy='23.7' r='0.6' fill-opacity='0.5'/%3E%3Ccircle cx='16.6' cy='11.4' r='0.5' fill-opacity='0.35'/%3E%3Ccircle cx='25.3' cy='15.1' r='0.6' fill-opacity='0.95'/%3E%3Ccircle cx='30.6' cy='14.3' r='1' fill-opacity='0.65'/%3E%3Ccircle cx='30.6' cy='11.7' r='0.6' fill-opacity='0.35'/%3E%3Ccircle cx='7.3' cy='6.3' r='0.6' fill-opacity='0.8'/%3E%3Ccircle cx='20.0' cy='28.8' r='0.5' fill-opacity='0.8'/%3E%3Ccircle cx='29.1' cy='11.0' r='1' fill-opacity='0.35'/%3E%3C/svg%3E"); }
@keyframes spoil { to { background-position: 40px 40px, -32px 32px; } }
body.veil .msg .body, body.veil .msg .ig-title, body.veil .msg .music-title, body.veil .msg .file-card .name, body.veil .act .snip, body.veil .mg-title { -webkit-text-fill-color: transparent; background-image: var(--spoil); background-size: var(--spoil-size); animation: spoil 4s linear infinite; }
body.veil .msg.peek .body, body.veil .msg.peek .ig-title, body.veil .msg.peek .music-title, body.veil .msg.peek .file-card .name, body.veil .act.peek .snip { -webkit-text-fill-color: unset; background-image: none; animation: none; }
@media (hover: hover) {
  body.veil .msg:hover .body, body.veil .msg:hover .ig-title, body.veil .msg:hover .music-title, body.veil .msg:hover .file-card .name, body.veil .act:hover .snip, body.veil .mg-list li:hover .mg-title { -webkit-text-fill-color: unset; background-image: none; animation: none; }
}
body.veil #input:not(:focus):not(:placeholder-shown) { -webkit-text-fill-color: transparent; background-image: var(--spoil); background-size: var(--spoil-size); animation: spoil 4s linear infinite; }

/* content manager */
.manage-card { max-width: 520px; }
.mg-usage { background: var(--surface-2); border-radius: 16px; padding: 12px 14px; margin-bottom: 12px; }
.mg-row { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; }
.mg-row.small { font-size: 12px; color: var(--text-2); margin-top: 6px; }
.mg-track { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin: 6px 0 8px; }
.mg-track i { display: block; height: 100%; width: 0; background: var(--brand); border-radius: inherit; transition: width .4s var(--ease); }
.mg-note { display: flex; gap: 6px; font-size: 11.5px; color: var(--text-3); margin: 0; }
.mg-note .i { width: 14px; height: 14px; flex: none; margin-top: 2px; }
.mg-search { display: flex; align-items: center; gap: 6px; height: 40px; padding: 0 8px 0 12px; margin-bottom: 10px; background: var(--surface-2); border: 1px solid transparent; border-radius: 99px; transition: border-color .2s, box-shadow .2s; }
.mg-search:focus-within { border-color: var(--brand-1); box-shadow: none; }
.mg-search > .i { width: 18px; height: 18px; color: var(--text-3); flex: none; }
.mg-search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; height: 100%; font-size: 14.5px; }
.mg-search input::placeholder { color: var(--text-3); }
.mg-search input::-webkit-search-cancel-button { display: none; }
.mg-more { justify-content: center; cursor: default; }
.mg-more:hover { background: none !important; }
.mg-seg { overflow-x: auto; scrollbar-width: none; }
.mg-seg button { flex: none; padding: 0 12px; }
.mg-tools { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; color: var(--text-2); margin: 0 4px 6px; min-height: 22px; }
.mg-tools label { display: flex; gap: 6px; align-items: center; cursor: pointer; }
.mg-list { list-style: none; margin: 0 0 12px; padding: 0; max-height: 42dvh; overflow-y: auto; display: grid; gap: 4px; }
.mg-list li { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; cursor: pointer; }
.mg-list li:hover { background: var(--surface-2); }
.mg-list li.selected { background: rgba(239,68,68,.08); }
.mg-list input[type="checkbox"], .mg-tools input[type="checkbox"] { width: 18px; height: 18px; accent-color: #dc2626; flex: none; }
.mg-ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-1); flex: none; }
.mg-ic .i { width: 18px; height: 18px; }
.mg-info { flex: 1; min-width: 0; }
.mg-title { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mg-meta { font-size: 11px; color: var(--text-3); }
.load-older { align-self: center; margin: 4px 0 10px; list-style: none; }

/* confidential mode: GIFs too, plus a tap-to-show button on every message */
/* Instagram previews follow the anti-zoom too: thumbnails, stacked cards and
   the post sheet stay blurred until a finger rests on them (or the mouse hovers). */
body.veil .msg .ig-thumb img, body.veil .msg .stack-card img { object-position: -9999px -9999px; background-color: rgba(127,127,127,.2); background-image: var(--spoil); background-size: var(--spoil-size); animation: spoil 4s linear infinite; }
body.veil .msg.peek .ig-thumb img, body.veil .msg.reveal .ig-thumb img, body.veil .msg.peek .stack-card img { object-position: 50% 50%; background: none; animation: none; }
body.veil .igm-media img { object-position: -9999px -9999px; background-color: rgba(127,127,127,.2); background-image: var(--spoil); background-size: var(--spoil-size); animation: spoil 4s linear infinite; }
body.veil .igm-title, body.veil .igm-note, body.veil .igm-replies { -webkit-text-fill-color: transparent; background-image: var(--spoil); background-size: var(--spoil-size); animation: spoil 4s linear infinite; }
body.veil #ig-modal.peek .igm-media img { object-position: 50% 50%; background: none; animation: none; }
body.veil #ig-modal.peek .igm-title, body.veil #ig-modal.peek .igm-note, body.veil #ig-modal.peek .igm-replies { -webkit-text-fill-color: unset; background-image: none; animation: none; }
body.veil #igm-text:not(:focus):not(:placeholder-shown) { -webkit-text-fill-color: transparent; background-image: var(--spoil); background-size: var(--spoil-size); animation: spoil 4s linear infinite; }
@media (hover: hover) {
  body.veil .msg:hover .ig-thumb img, body.veil .msg:hover .stack-card img, body.veil .igm-media:hover img { object-position: 50% 50%; background: none; animation: none; }
  body.veil .igm-title:hover, body.veil .igm-note:hover, body.veil .igm-replies:hover { -webkit-text-fill-color: unset; background-image: none; animation: none; }
}
/* GIFs and emoji get the spoiler on the picture itself */
body.veil .msg .gif-mini, body.veil .msg .body img.emo, body.veil .act .snip img.emo, body.veil .msg .ig-title img.emo, body.veil .mg-title img.emo {
  object-position: -9999px -9999px;
  border-radius: 8px;
  background-color: rgba(127,127,127,.2);
  background-image: var(--spoil);
  background-size: var(--spoil-size);
  animation: spoil 4s linear infinite;
}
body.veil .msg .gif-mini { border-radius: 12px; }
body.veil .msg.peek .gif-mini, body.veil .msg.reveal .gif-mini,
body.veil .msg.peek .body img.emo, body.veil .msg.reveal .body img.emo, body.veil .act.peek .snip img.emo,
body.veil .msg.peek .ig-title img.emo, body.veil .msg.reveal .ig-title img.emo { object-position: 50% 50%; background: none; animation: none; }
body.veil .msg.reveal .body, body.veil .msg.reveal .ig-title, body.veil .msg.reveal .music-title, body.veil .msg.reveal .file-card .name { -webkit-text-fill-color: unset; background-image: none; animation: none; }
@media (hover: hover) { body.veil .msg:hover .gif-mini, body.veil .msg:hover .body img.emo, body.veil .act:hover .snip img.emo, body.veil .msg:hover .ig-title img.emo, body.veil .mg-list li:hover .mg-title img.emo { object-position: 50% 50%; background: none; animation: none; } }
/* Emoji are pictures, so a transparent text fill does not hide them: every
   other veiled line (quotes, edit history, reply texts, Instagram replies)
   puts the spoiler on its emoji too. Reaction emoji themselves (the badge
   under a bubble, the activity line, the emoji of a reply line) stay visible:
   phones have no hover, so veiled reactions looked like they never arrived. */
body.veil :is(.msg .quote-text, .msg .edit-prev-text, .act .snip, .ig-reply-prev, .igm-title, .igm-note, .igm-replies) img.emo {
  object-position: -9999px -9999px; border-radius: 6px; background-color: rgba(127,127,127,.2); background-image: var(--spoil); background-size: var(--spoil-size); animation: spoil 4s linear infinite;
}
body.veil :is(.msg.peek, .msg.reveal) :is(.quote-text, .edit-prev-text, .reacts) img.emo, body.veil .act.peek img.emo,
body.veil #ig-modal.peek :is(.ig-reply-prev, .igm-title, .igm-note, .igm-replies) img.emo { object-position: 50% 50%; background: none; animation: none; }
body.veil .ig-reply > .emo img.emo { object-position: 50% 50%; background: none; animation: none; }
body.veil .ig-reply > .emo { -webkit-text-fill-color: currentColor; }
@media (hover: hover) { body.veil .msg:hover :is(.quote-text, .edit-prev-text, .reacts) img.emo, body.veil .act:hover img.emo, body.veil :is(.igm-title, .igm-note, .igm-replies):hover img.emo { object-position: 50% 50%; background: none; animation: none; } }
.peek-btn { display: none; width: 26px; height: 22px; border-radius: 8px; place-items: center; color: inherit; opacity: .85; margin-inline-end: 2px; }
.peek-btn .i { width: 15px; height: 15px; }
body.veil .peek-btn { display: inline-grid; }
.msg.reveal .peek-btn { background: rgba(127,127,127,.22); opacity: 1; }

/* replies */
.reply-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; padding: 8px 10px; background: var(--surface); border: 1px solid var(--line-2); border-inline-start: 3px solid var(--brand-1); border-radius: 14px; animation: rise .2s var(--ease); }
.reply-bar > .i { width: 18px; height: 18px; color: var(--brand-1); flex: none; transform: scaleX(-1); }
.reply-info { flex: 1; min-width: 0; }
.reply-who { font-size: 12px; font-weight: 700; color: var(--brand-1); }
.reply-snip { font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quote { cursor: pointer; margin: 2px 0 6px; padding: 5px 9px; border-radius: 10px; border-inline-start: 3px solid currentColor; background: rgba(0,0,0,.16); font-size: 12.5px; max-width: 100%; }
.msg.in .quote { background: var(--brand-soft); border-inline-start-color: var(--brand-1); }
.quote-who { font-weight: 700; font-size: 11.5px; opacity: .9; }
.quote-text { opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg.media .quote { margin: 4px 6px 6px; }
.react-bar .reply-btn { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; color: var(--text-2); border-inline-start: 1px solid var(--line-2); border-radius: 0 50% 50% 0; }
.react-bar .reply-btn .i { width: 20px; height: 20px; transform: scaleX(-1); }
.react-bar .reply-btn:hover { color: var(--brand-1); }
/* voice messages */
.msg.voice { padding: 8px 10px 6px; min-width: min(270px, 72vw); }
.voice-msg { display: flex; align-items: center; gap: 10px; direction: ltr; }
.voice-play { width: 40px; height: 40px; border-radius: 50%; flex: none; display: grid; place-items: center; background: rgba(255,255,255,.18); color: inherit; }
.msg.in .voice-play { background: var(--brand); color: #fff; }
.voice-play .i { width: 19px; height: 19px; }
.voice-wave { flex: 1; min-width: 110px; height: 30px; display: flex; align-items: center; gap: 2px; cursor: pointer; }
.voice-wave i { flex: 1; min-width: 2px; max-width: 4px; border-radius: 2px; background: currentColor; opacity: .38; transition: opacity .12s; }
.voice-wave i.on { opacity: 1; }
.msg.in .voice-wave i.on { background: var(--brand-1); }
.voice-time { font-size: 11.5px; opacity: .8; font-variant-numeric: tabular-nums; min-width: 34px; text-align: end; }
.msg.voice .quote { margin-bottom: 8px; }
body.veil .msg.voice .voice-wave { background-image: var(--spoil); background-size: var(--spoil-size); animation: spoil 4s linear infinite; border-radius: 6px; }
body.veil .msg.voice:not(.peek):not(.reveal) .voice-wave i { visibility: hidden; }
body.veil .msg.voice.peek .voice-wave, body.veil .msg.voice.reveal .voice-wave { background-image: none; animation: none; }
.rec-bar { flex: 1; display: flex; align-items: center; gap: 8px; min-height: 46px; padding: 4px 12px 4px 4px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 24px; animation: rise .2s var(--ease); min-width: 0; }
.rec-bar.cancelling { border-color: var(--bad); }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--bad); flex: none; animation: blink 1s infinite; }
.rec-time { font-variant-numeric: tabular-nums; font-size: 14px; min-width: 38px; }
.rec-fx { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; color: var(--brand-1); background: var(--brand-soft); padding: 2px 8px; border-radius: 99px; flex: none; white-space: nowrap; }
.rec-fx .i { width: 12px; height: 12px; }
.rec-level { flex: 1; min-width: 40px; height: 26px; display: flex; align-items: center; gap: 2px; direction: ltr; overflow: hidden; }
.rec-level i { flex: 1; min-width: 2px; max-width: 4px; height: 8%; border-radius: 2px; background: var(--brand-1); opacity: .85; transition: height .08s linear; }
.rec-hint { font-size: 11px; color: var(--text-3); flex: none; white-space: nowrap; }
.rec-bar.cancelling .rec-hint { color: var(--bad); }
.rec-bar.cancelling .rec-level i { background: var(--bad); }
#mic-btn { display: none; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
#mic-btn .i { transform: none; }
.composer.can-record #mic-btn, .composer.recording #mic-btn { display: grid; }
.composer.can-record #send-btn, .composer.recording #send-btn { display: none; }
.composer.recording .input-shell { display: none; }
.composer.recording #mic-btn { background: var(--bad); box-shadow: 0 8px 20px -6px rgba(239,68,68,.7); }
.composer.recording.holding #mic-btn { transform: scale(1.18); }
.composer.recording.locked #mic-btn { background: var(--brand); box-shadow: none; }
.composer.recording.locked #mic-btn .i { transform: scaleX(-1); }
@media (max-width: 400px) { .rec-hint { display: none; } }
.call-fx { margin-top: 10px; display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; padding: 5px 12px; border-radius: 99px; background: rgba(255,255,255,.14); color: #fff; }
.call-fx .i { width: 14px; height: 14px; }

/* swipe to reply */
#messages { overflow-x: hidden; }
.msg.swiping { transition: none; }
.msg.swipe-back { transition: transform .2s var(--ease); }
.msg.swiping .react-btn, .msg.swipe-back .react-btn { opacity: 0 !important; }
.swipe-ic {
  position: absolute; top: 50%; right: -46px; width: 32px; height: 32px; margin-top: -16px; border-radius: 50%;
  display: grid; place-items: center; background: var(--surface); color: var(--brand-1); border: 1px solid var(--line-2);
  box-shadow: var(--shadow); pointer-events: none; opacity: var(--swipe, 0); transform: scale(calc(.55 + .45 * var(--swipe, 0)));
  transition: background .15s, color .15s;
}
.swipe-ic .i { width: 17px; height: 17px; transform: scaleX(-1); }
.msg.swipe-armed .swipe-ic { background: var(--brand-1); color: #fff; border-color: transparent; }
.msg.swipe-back .swipe-ic { opacity: 0; transition: opacity .18s; }
body.veil .msg .quote-text { -webkit-text-fill-color: transparent; background-image: var(--spoil); background-size: var(--spoil-size); animation: spoil 4s linear infinite; }
body.veil .msg.peek .quote-text, body.veil .msg.reveal .quote-text { -webkit-text-fill-color: unset; background-image: none; animation: none; }
@media (hover: hover) { body.veil .msg:hover .quote-text { -webkit-text-fill-color: unset; background-image: none; animation: none; } }

/* jump to the latest message */
.to-bottom { position: absolute; inset-inline-end: 14px; bottom: 12px; z-index: 5; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); color: var(--text-2); border: 1px solid var(--line-2); box-shadow: var(--shadow-lg); animation: rise .18s var(--ease); cursor: pointer; }
.to-bottom .i { width: 20px; height: 20px; transform: rotate(-90deg); }
.to-bottom-n { position: absolute; top: -6px; inset-inline-end: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--brand-1); color: #fff; font-size: 11px; line-height: 20px; text-align: center; }
.to-bottom[hidden], .to-bottom-n[hidden] { display: none; }

/* ============================================================
   Responsive: phone vs laptop
   Phone  — one column. The room panel only exists inside the ⋯ popover,
            so the rail contributes no box at all (`display: contents`).
   Laptop — a real two-pane layout: a persistent room/settings rail beside
            the conversation, the way desktop messengers are laid out.
   ============================================================ */
.rail, .rail-pane { display: contents; }
.rail-nav, .rail-head, .rail-search, .chat-list, .rail-room, .rail-foot { display: none; }

@media (min-width: 1024px) {
  /* ---------- conversation pane ---------- */
  #chat {
    max-width: none; margin: 0; border: 0;
    display: grid; grid-template-columns: 388px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr);
    background: var(--bg-2);
  }
  .conv { background: var(--bg); }

  .topbar { padding: 14px 22px; }
  .banner { margin: 12px 22px 0; }
  #messages { padding: 22px 26px 12px; }
  .msg { max-width: min(64%, 620px); }
  #typing { margin: 0 26px 6px; }
  .composer-wrap { padding: 12px 22px 18px; }
  .composer, .mini-player { max-width: 940px; margin-inline: auto; }
  .mini-player { margin-bottom: 8px; }
  .emoji-panel { inset-inline: 22px; max-width: 940px; margin-inline: auto; }
  .ttl-pop { top: 64px; inset-inline-end: 16px; }
  .menu-code { display: none; }
  .to-bottom { inset-inline-end: 30px; bottom: 18px; }
  .empty h2 { font-size: 19px; }
  .empty p { max-width: 460px; }
  .drop-zone { inset-inline-start: 388px; }

  /* ---------- rail: Signal Desktop's nav strip + list pane ---------- */
  .rail { display: flex; min-height: 0; background: var(--bg-2); border-inline-end: 1px solid var(--line); }
  .rail-nav {
    display: flex; flex-direction: column; align-items: center; gap: 6px; width: 68px; flex: none;
    padding: 14px 0 12px; border-inline-end: 1px solid var(--line);
  }
  .nav-brand { width: 36px; height: 36px; margin-bottom: 10px; }
  .nav-brand .i { width: 100%; height: 100%; }
  .nav-btn { position: relative; width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; color: var(--text-2); transition: background .15s, color .15s; }
  .nav-btn .i { width: 22px; height: 22px; }
  .nav-btn:hover { background: var(--surface-2); color: var(--text); }
  .nav-btn.active { background: var(--surface-3); color: var(--text); }
  .nav-gap { flex: 1; }
  .nav-badge, .row-badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--brand); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
  .nav-badge { position: absolute; top: 3px; inset-inline-end: 1px; }

  .rail-pane { display: flex; flex-direction: column; flex: 1; min-width: 0; min-height: 0; padding: 0 10px 10px; }
  .rail-head { display: flex; align-items: center; justify-content: space-between; height: 60px; padding: 0 6px; flex: none; }
  .rail-title { margin: 0; font-size: 19px; font-weight: 700; }
  .rail-search { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px; margin: 0 2px 10px; border-radius: 8px; background: var(--surface-2); flex: none; cursor: text; }
  .rail-search .i { width: 16px; height: 16px; color: var(--text-3); }
  .rail-search input { flex: 1; min-width: 0; height: 100%; border: 0; outline: none; background: none; font-size: 13.5px; }
  .rail-search input::placeholder { color: var(--text-3); }
  .rail-search input::-webkit-search-cancel-button { display: none; }
  .chat-list { display: block; list-style: none; margin: 0; padding: 0; flex: 1 1 auto; min-height: 0; overflow-y: auto; }
  .chat-row { width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 10px; text-align: start; transition: background .15s; }
  .chat-row:hover { background: var(--surface-2); }
  .chat-row.active { background: var(--surface-3); }
  .chat-row .avatar-sm { width: 48px; height: 48px; }
  .chat-row .avatar-sm .i { width: 24px; height: 24px; }
  .chat-row .presence { border-color: var(--bg-2); }
  .chat-row.active .presence { border-color: var(--surface-3); }
  .row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
  .row-top, .row-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
  .row-name { font-size: 14.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .row-time { flex: none; font-size: 12px; color: var(--text-3); }
  .row-snip { font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .row-snip.status { color: var(--text-3); }
  body.veil .row-snip:not(.status) { -webkit-text-fill-color: transparent; background-image: var(--spoil); background-size: var(--spoil-size); animation: spoil 4s linear infinite; }
  body.veil .chat-row:hover .row-snip { -webkit-text-fill-color: unset; background-image: none; animation: none; }
  body.veil .row-snip:not(.status) img.emo { object-position: -9999px -9999px; border-radius: 6px; background-color: rgba(127,127,127,.2); background-image: var(--spoil); background-size: var(--spoil-size); animation: spoil 4s linear infinite; }
  body.veil .chat-row:hover .row-snip img.emo { object-position: 50% 50%; background: none; animation: none; }
  .row-badge { flex: none; }
  .rail-room { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 8px 2px 0; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); flex: none; }
  .rail-room-label { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-3); }
  .rail-room-label .i { width: 14px; height: 14px; }
  .rail-room-code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 17px; font-weight: 700; letter-spacing: 2px; }
  .rail-foot { display: flex; gap: 8px; align-items: flex-start; font-size: 11px; line-height: 1.7; color: var(--text-3); margin: 10px 6px 0; flex: none; }
  .rail-foot .i { width: 13px; height: 13px; flex: none; margin-top: 3px; }

  /* settings view: the ⋯ list fills the pane instead of the chat list */
  #menu { display: none !important; }
  .rail[data-view="settings"] #menu {
    display: flex !important; position: static; inset: auto; width: auto; min-width: 0; flex: 1 1 auto; min-height: 0;
    overflow-y: auto; overscroll-behavior: contain;
    background: none; border: 0; box-shadow: none; padding: 0; animation: none;
  }
  .rail[data-view="settings"] .rail-search, .rail[data-view="settings"] .chat-list, .rail[data-view="settings"] .rail-room { display: none; }
  #menu button { padding: 11px 12px; border-radius: 8px; }
  #menu button:hover { background: var(--surface-2); }
  #menu hr { margin: 6px 10px; }

  /* ---------- landing: hero beside the entry card ---------- */
  .landing { padding: 56px 40px; align-items: center; }
  .landing-inner {
    max-width: 1080px; display: grid; gap: 0 60px; align-items: center;
    grid-template-columns: minmax(0, 1fr) 440px;
    grid-template-areas: "brand panel" "title panel" "sub panel" "feats panel";
  }
  .landing-inner .brand { grid-area: brand; margin-bottom: 26px; }
  .landing-inner .hero-title { grid-area: title; font-size: 46px; }
  .landing-inner .hero-sub { grid-area: sub; max-width: 48ch; font-size: 16px; margin-bottom: 34px; }
  .landing-inner .step { grid-area: panel; align-self: center; }
  .landing-inner .features { grid-area: feats; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 0; }
  .landing-inner .feature { flex-direction: column; align-items: flex-start; gap: 10px; padding: 16px; }
  .landing-inner .report-link { grid-column: 1; justify-self: start; margin: 16px 0 0; }

  /* ---------- dialogs, lock screen ---------- */
  .modal-card { max-width: 440px; }
  .manage-card { max-width: 560px; }
  .lock-box { max-width: 400px; }

  /* ---------- tidy scrollbars (pointer devices only) ---------- */
  #messages, #menu, .rail, .chat-list, .modal-card, .emoji-panel { scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent; }
  #messages::-webkit-scrollbar, #menu::-webkit-scrollbar, .modal-card::-webkit-scrollbar, .emoji-panel::-webkit-scrollbar { width: 10px; height: 10px; }
  #messages::-webkit-scrollbar-thumb, #menu::-webkit-scrollbar-thumb, .modal-card::-webkit-scrollbar-thumb, .emoji-panel::-webkit-scrollbar-thumb { background: var(--surface-3); border: 3px solid transparent; border-radius: 99px; background-clip: content-box; }
  #messages::-webkit-scrollbar-thumb:hover, #menu::-webkit-scrollbar-thumb:hover { background: var(--text-3); background-clip: content-box; }
}

/* ---------- phone: touch-sized controls ---------- */
@media (max-width: 1023.98px) and (pointer: coarse) {
  .top-actions .btn-icon { width: 44px; height: 44px; }
  .popover button { padding: 13px 12px; }
  .sheet-btn { height: 54px; }
  .lib-list li, .mg-list li { padding-block: 11px; }
}

/* ---------- animated emoji (Animated Fluent set, /emoji/) ---------- */
img.emo { display: inline-block; width: 1.3em; height: 1.3em; vertical-align: -0.3em; margin: 0 .03em; object-fit: contain; user-select: none; -webkit-user-drag: none; pointer-events: none; }
.msg .body.big { line-height: 1; }
.msg .body.big img.emo { width: 64px; height: 64px; vertical-align: middle; margin: 0 1px; }
.react-bar button img.emo { width: 32px; height: 32px; vertical-align: middle; }
.reacts img.emo { width: 18px; height: 18px; vertical-align: -4px; }
.igm-reacts button img.emo { width: 30px; height: 30px; vertical-align: middle; }
.act-summary .stack img.emo { width: 18px; height: 18px; }
.react-bar .more-btn, .igm-reacts .more-btn { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; color: var(--text-2); background: var(--surface-2); flex: none; }
.react-bar .more-btn:hover, .igm-reacts .more-btn:hover { color: var(--text); background: var(--surface-3); }
.react-bar .more-btn .i, .igm-reacts .more-btn .i { width: 20px; height: 20px; }

/* picker */
.emoji-panel:not(.gif-panel) { display: flex; flex-direction: column; height: min(400px, 60dvh); max-height: none; padding: 8px; overflow: hidden; }
.emoji-panel[hidden] { display: none !important; }
.emo-head { display: flex; align-items: center; gap: 8px; flex: none; padding: 2px 2px 6px; }
.emo-search { flex: 1; display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px; border-radius: 8px; background: var(--surface-2); min-width: 0; }
.emo-search .i { width: 16px; height: 16px; color: var(--text-3); flex: none; }
.emo-search input { flex: 1; min-width: 0; border: 0; outline: none; background: none; font-size: 13.5px; height: 100%; }
.emo-search input::-webkit-search-cancel-button { display: none; }
.emo-tones { display: flex; gap: 4px; flex: none; }
.tone { width: 20px; height: 20px; border-radius: 50%; border: 2px solid transparent; }
.tone.on { border-color: var(--brand-1); }
.tone.t0 { background: #ffc83d; } .tone.t1 { background: #f7dece; } .tone.t2 { background: #f3d2a2; }
.tone.t3 { background: #d5ab88; } .tone.t4 { background: #af7e57; } .tone.t5 { background: #7c533e; }
.emo-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 2px; }
.emo-body .emoji-grid { grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); }
.emo-btn { height: 42px; border-radius: 8px; display: grid; place-items: center; font-size: 26px; transition: background .12s; }
.emo-btn:hover { background: var(--surface-2); transform: none; }
.emo-btn img.emo { width: 32px; height: 32px; margin: 0; vertical-align: middle; }
.emo-none { text-align: center; color: var(--text-3); font-size: 13px; padding: 24px 8px; }
/* picking a reaction: float the picker in the middle of the chat */
.emoji-panel.pick-mode { position: fixed; z-index: 55; /* above the Instagram sheet (45) */ inset: auto; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(420px, calc(100vw - 32px)); height: min(440px, 70dvh); box-shadow: var(--shadow-lg); animation: fade .15s; }

/* ---------- edited messages ---------- */
/* The earlier wording sits under the message in its own colour (amber), so
   it can't be mistaken for the current text. */
.edit-prev { margin-top: 6px; padding: 3px 9px 4px; border-inline-start: 2px solid currentColor; border-radius: 4px; font-size: 12.5px; line-height: 1.6; color: #b86e00; background: rgba(245,158,11,.1); }
.msg.out .edit-prev { color: #ffd88a; background: rgba(0,0,0,.14); }
@media (prefers-color-scheme: dark) { .msg.in .edit-prev { color: #f5b545; } }
.edit-prev-label { font-size: 11px; font-weight: 700; opacity: .85; }
.edit-prev-text { white-space: pre-wrap; overflow-wrap: anywhere; text-decoration: line-through; text-decoration-thickness: 1px; text-decoration-color: color-mix(in srgb, currentColor 55%, transparent); }
.edit-prev-text + .edit-prev-text { margin-top: 3px; padding-top: 3px; border-top: 1px dashed color-mix(in srgb, currentColor 35%, transparent); }
.msg.big-emoji .edit-prev { color: var(--text-2); background: var(--surface-2); }
.meta .edited { font-weight: 600; direction: rtl; }
body.veil .msg .edit-prev-text { -webkit-text-fill-color: transparent; background-image: var(--spoil); background-size: var(--spoil-size); animation: spoil 4s linear infinite; }
body.veil .msg.peek .edit-prev-text, body.veil .msg.reveal .edit-prev-text { -webkit-text-fill-color: unset; background-image: none; animation: none; }
@media (hover: hover) { body.veil .msg:hover .edit-prev-text { -webkit-text-fill-color: unset; background-image: none; animation: none; } }
.react-bar .edit-btn { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; color: var(--text-2); flex: none; }
.react-bar .edit-btn:hover { color: var(--brand-1); }
.react-bar .edit-btn .i { width: 19px; height: 19px; }
.reply-bar.editing { border-inline-start-color: #f59e0b; }
.reply-bar.editing > .i, .reply-bar.editing .reply-who { color: #f59e0b; transform: none; }

/* ---------- update bar (Signal-style, blue) ---------- */
.update-bar { display: flex; align-items: center; gap: 10px; margin: 10px 12px 0; padding: 10px 12px; border-radius: 12px; background: var(--brand); color: #fff; font-size: 13px; line-height: 1.6; animation: rise .25s var(--ease); }
.update-bar > .i { width: 20px; height: 20px; flex: none; }
.update-bar span { flex: 1; min-width: 0; }
.update-bar .btn { flex: none; background: #fff; color: var(--brand-1); border: 0; font-weight: 700; }
@media (min-width: 1024px) { .update-bar { margin: 12px 22px 0; } }

/* ---------- captions on photos / videos / GIFs ---------- */
.msg .body.caption { padding: 6px 8px 0; font-size: 14.5px; }
.msg.out.gif.captioned { background: var(--out-bg) !important; }
.msg.in.gif.captioned { background: var(--in-bg) !important; }
.msg.gif.captioned .meta { color: inherit; }
.cap-sheet .sheet-card { display: flex; flex-direction: column; gap: 8px; }
.cap-strip { display: flex; gap: 6px; overflow-x: auto; padding: 2px; }
.cap-strip img, .cap-strip video { width: 88px; height: 88px; object-fit: cover; border-radius: 10px; flex: none; filter: blur(8px); }
.cap-strip:hover img, .cap-strip:hover video { filter: none; }
.cap-input { width: 100%; resize: none; border: 1px solid transparent; outline: none; border-radius: 12px; padding: 10px 12px; background: var(--surface-2); font: inherit; font-size: 15px; line-height: 1.6; }
.cap-input:focus { border-color: var(--brand-1); }
body.veil .cap-input:not(:focus):not(:placeholder-shown) { -webkit-text-fill-color: transparent; background-image: var(--spoil); background-size: var(--spoil-size); animation: spoil 4s linear infinite; }

/* earlier photos of an edited photo: blurred thumbnails, hold to look */
.edit-prev-row { display: flex; gap: 8px; align-items: center; }
.edit-prev-row + .edit-prev-row { margin-top: 4px; }
.edit-prev-media { width: 56px; height: 56px; border-radius: 8px; overflow: hidden; flex: none; background: rgba(0,0,0,.2); cursor: pointer; touch-action: none; }
.edit-prev-media img, .edit-prev-media video { width: 100%; height: 100%; object-fit: cover; filter: blur(7px) saturate(1.2); transform: scale(1.15); pointer-events: none; }
.edit-prev-media.show img, .edit-prev-media.show video { filter: none; transform: none; }
.msg.media .edit-prev { margin: 6px 6px 2px; }
.reply-bar .edit-swap { flex: none; }

/* notes under Instagram posts */
.ig-reply { flex-wrap: wrap; }
.ig-reply.mine { cursor: pointer; }
.ig-reply.mine .txt::after { content: " ✎"; opacity: .55; font-size: 11px; }
.ig-reply-prev { flex-basis: 100%; margin-top: 2px; padding-inline-start: 8px; border-inline-start: 2px solid currentColor; font-size: 12px; color: #b86e00; }
@media (prefers-color-scheme: dark) { .ig-reply-prev { color: #f5b545; } }
.msg.out .ig-reply-prev { color: #ffd88a; }
body.veil .ig-reply-prev { -webkit-text-fill-color: transparent; background-image: var(--spoil); background-size: var(--spoil-size); animation: spoil 4s linear infinite; }
body.veil #ig-modal.peek .ig-reply-prev { -webkit-text-fill-color: unset; background-image: none; animation: none; }
#igm-text.editing { border-color: #f59e0b; box-shadow: 0 0 0 3px rgba(245,158,11,.18); }

/* hidden scheduler (five taps on the contact's name) */
.sched-card { max-width: 440px; }
.sched-text { margin: 4px 0 10px; }
.sched-row { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.sched-row select { flex: 1; min-width: 0; height: 40px; padding: 0 8px; border: 1px solid transparent; border-radius: 10px; background: var(--surface-2); color: var(--text); font: inherit; font-size: 14px; }
.sched-row select:focus { outline: none; border-color: var(--brand-1); }
.sched-time span { color: var(--text-2); font-size: 13.5px; flex: none; }
.sched-time select { flex: 0 1 90px; }
.sched-sub { font-size: 12.5px; color: var(--text-2); margin: 16px 4px 6px; }
.sched-list li { cursor: default; }
.sched-list .mg-title { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* Sand unveil: when a veiled line is held, hovered or its eye tapped, its
   dots pour down as sand on a canvas over the page (.sand-layer, drawn by
   unveilSand in app.js) and the text fades in at once as plain text. */
body.veil :is(.msg.peek, .msg.reveal, .act.peek) :is(.body, .ig-title, .music-title, .file-card .name, .quote-text, .edit-prev-text, .snip) { -webkit-text-fill-color: unset; background-image: none; animation: none; }
@media (hover: hover) { body.veil :is(.msg:hover, .act:hover) :is(.body, .ig-title, .music-title, .file-card .name, .quote-text, .edit-prev-text, .snip) { -webkit-text-fill-color: unset; background-image: none; animation: none; } }
body.veil :is(.msg.peek, .msg.reveal, .act.peek, .msg:hover, .act:hover) :is(.body, .ig-title, .music-title, .file-card .name, .quote-text, .edit-prev-text, .snip).unveiled { -webkit-text-fill-color: unset; background: none; -webkit-background-clip: border-box; background-clip: border-box; animation: none; }
.sand-layer { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 90; pointer-events: none; }

/* download permissions */
.dl-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.dl-btn { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 6px 10px; border-radius: 99px; background: rgba(0,0,0,.2); color: inherit; }
.msg.in .dl-btn { background: var(--brand-soft); color: var(--brand-1); }
.dl-btn .i { width: 14px; height: 14px; flex: none; }
.dl-btn.wait { opacity: .65; }
.dl-btn.grant, .msg.in .dl-btn.grant { background: rgba(34,197,94,.18); color: #4ade80; }
@media (prefers-color-scheme: light) { .dl-btn.grant, .msg.in .dl-btn.grant { color: #15803d; } }
.music-dl { padding: 6px; }
button.file-card { width: 100%; text-align: start; font: inherit; background: none; border: 0; cursor: pointer; }
.lib-dl { color: var(--text-3); }
.lib-dl:hover { color: var(--brand-1) !important; }
.banner.info { background: var(--brand-soft); color: var(--text); border-color: rgba(79,127,100,.35); }
.banner.info > .i { color: var(--brand-1); }
.banner-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.menu-val { margin-inline-start: auto; padding: 2px 8px; border-radius: 99px; background: var(--surface-3); font-size: 12px; white-space: nowrap; }
.menu-badge { margin-inline-start: auto; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--brand); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
.btn-icon.has-dot { position: relative; }
.btn-icon.has-dot::after { content: ''; position: absolute; top: 6px; inset-inline-end: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.dl-list li.dl-req .mg-ic { background: rgba(234,179,8,.16); color: #eab308; }
.dl-acts { display: flex; gap: 6px; flex: none; }

/* Service notice from the admin panel (relay {t:'notice'}). */
.svc-notice { position: fixed; top: 0; inset-inline: 0; z-index: 9000; display: flex; align-items: center; gap: 10px; padding: 8px 14px calc(8px); padding-top: calc(8px + env(safe-area-inset-top)); background: #1d3b5a; color: #fff; font-size: 14px; line-height: 1.6; box-shadow: 0 2px 10px rgb(0 0 0 / .3); }
.svc-notice.warn { background: #6b4b0e; }
.svc-notice.alert { background: #7a1f2b; }
.svc-notice span { flex: 1; }
.svc-notice button { background: none; border: 0; color: inherit; font-size: 22px; line-height: 1; cursor: pointer; padding: 0 4px; }

/* Home: link to the public abuse report form. */
.report-link { display: flex; width: fit-content; align-items: center; gap: 6px; margin: 18px auto 0; font-size: 13px; color: var(--muted, #8696a0); text-decoration: none; opacity: .85; }
.report-link:hover { opacity: 1; text-decoration: underline; text-underline-offset: 3px; }
.report-link .i { width: 15px; height: 15px; }
