:root {
  /* System bar insets: the Android app (Capacitor) injects --safe-area-inset-*; browsers give env(). */
  --sat: var(--safe-area-inset-top, env(safe-area-inset-top, 0px));
  --sab: var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));
  /* Night (default). html.light switches to day; the user picks it in Settings → Appearance. */
  --bg: #0d1420; --panel: #141c2a; --panel-2: #1d2738; --line: rgba(255,255,255,.07);
  --glass: rgba(18,26,40,.72); --shadow: 0 1px 2px rgba(0,0,0,.35);
  --text: #e9eef7; --muted: #8794a8; --accent: #5b8def; --accent-2: #4a7bd8;
  --in: #1b2535; --in-text: #e9eef7; --out: #2f5aa8; --out-text: #ffffff; --out-muted: rgba(255,255,255,.62);
  --danger: #ef5a63; --online: #4cd964; --radius: 17px; --radius-s: 6px; --fs: 15px;
}
html.light {
  --bg: #eef1f6; --panel: #ffffff; --panel-2: #eff2f7; --line: rgba(12,24,44,.08);
  --glass: rgba(255,255,255,.76); --shadow: 0 1px 2px rgba(16,32,64,.14);
  --text: #0f1726; --muted: #6b788c;
  --in: #ffffff; --in-text: #0f1726; --out: #dbe7ff; --out-text: #0f1726; --out-muted: #6a83a8;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
html, body { overflow: hidden; overscroll-behavior: none; }
/* Fixed to the visible area; app.js resizes it to visualViewport so the iOS keyboard leaves no gap. */
#app { position: fixed; top: 0; left: 0; right: 0; height: 100vh; height: 100dvh; display: flex; }
/* iOS zooms into inputs with font-size < 16px */
@media (pointer: coarse) { input, textarea { font-size: 16px; } }
.msg video { width: min(420px, 70vw); }

/* auth */
.auth { margin: auto; width: min(360px, calc(100% - 32px)); background: var(--panel); padding: 28px;
  border-radius: 20px; display: flex; flex-direction: column; gap: 12px; }
.logo { width: 72px; height: 72px; border-radius: 22px; background: var(--accent); margin: 0 auto 4px;
  display: grid; place-items: center; font-size: 40px; font-weight: 800; color: #fff; }
.auth h1 { margin: 0; text-align: center; font-size: 26px; }
.auth p { margin: 0 0 6px; text-align: center; color: var(--muted); }
.field { width: 100%; padding: 11px 14px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel-2); outline: none; }
.field:focus { border-color: var(--accent); }
.btn { padding: 11px 14px; border-radius: 10px; border: 0; background: var(--accent); color: #fff; font-weight: 600; }
@media (hover: hover) { .btn:hover { background: var(--accent-2); } }
.btn.ghost { background: transparent; color: var(--accent); }
.err { color: var(--danger); min-height: 1.2em; font-size: 13px; text-align: center; }

/* layout */
.sidebar { width: 360px; max-width: 100%; background: var(--panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0; }
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; background: var(--bg); }
.top { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--panel);
  border-bottom: 1px solid var(--line); min-height: 56px; }
/* Bars at the top of the screen go below the status bar. */
.sidebar > .top, .main > .top, .page > .top { padding-top: calc(10px + var(--sat)); min-height: calc(56px + var(--sat)); }
.conn { padding-top: calc(4px + var(--sat)) !important; }
.top .grow { flex: 1; min-width: 0; }
.icon-btn { width: 38px; height: 38px; border-radius: 50%; border: 0; background: transparent;
  display: grid; place-items: center; color: var(--muted); font-size: 20px; flex: none; }
@media (hover: hover) { .icon-btn:hover { background: var(--panel-2); color: var(--text); } }
.search { flex: 1; padding: 9px 14px; border-radius: 20px; border: 0; background: var(--panel-2); outline: none; }

.list { flex: 1; overflow-y: auto; }
.item { display: flex; gap: 12px; padding: 9px 12px; align-items: center; cursor: pointer; }
@media (hover: hover) { .item:hover { background: var(--panel-2); } }
.item.active { background: var(--accent); color: #fff; }
.item.active .sub, .item.active .time { color: #e3ecff; }
.item .meta { flex: 1; min-width: 0; }
.item .row { display: flex; justify-content: space-between; gap: 8px; }
.name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sub { color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.time { color: var(--muted); font-size: 12px; flex: none; }
.badge { background: var(--accent); color: #fff; border-radius: 12px; padding: 0 7px; font-size: 12px;
  min-width: 22px; text-align: center; line-height: 22px; flex: none; }
.item.active .badge { background: #fff; color: var(--accent); }
.section { padding: 10px 14px 4px; color: var(--muted); font-size: 13px; }
.empty { margin: auto; color: var(--muted); text-align: center; padding: 20px; }

.avatar { width: 46px; height: 46px; border-radius: 50%; flex: none; display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 18px; position: relative; background-size: cover; background-position: center; }
.avatar.sm { width: 38px; height: 38px; font-size: 15px; }
.avatar.online::after { content: ""; position: absolute; right: 1px; bottom: 1px; width: 11px; height: 11px;
  border-radius: 50%; background: #4cd964; border: 2px solid var(--panel); }

/* chat */
.messages { flex: 1; overflow-y: auto; padding: 12px 10px; display: flex; flex-direction: column; gap: 4px; }
.msg { max-width: min(520px, 82%); padding: 6px 10px 5px; border-radius: var(--radius); background: var(--in);
  align-self: flex-start; word-wrap: break-word; white-space: pre-wrap; position: relative;
  box-shadow: 0 1px 1px rgba(0,0,0,.12); }
.msg.out { background: var(--out); align-self: flex-end; }
.msg .author { font-size: 13px; font-weight: 600; color: var(--accent); margin-bottom: 2px; }
.msg .stamp { font-size: 11px; color: var(--muted); float: right; margin: 6px 0 0 10px; }
.msg.media { padding: 3px; }
.msg.media .txt { padding: 4px 7px 2px; }
.msg.media .stamp { margin-right: 6px; }
.msg img, .msg video { display: block; max-width: 100%; max-height: 420px; border-radius: 11px; background: #000; }
.msg img { cursor: zoom-in; }
.msg audio { display: block; max-width: 100%; }
.msg a.file { display: block; padding: 8px 10px; color: var(--accent); }
.day { align-self: center; background: rgba(0,0,0,.25); color: #fff; font-size: 12px; padding: 3px 10px;
  border-radius: 12px; margin: 8px 0; }
.typing { color: var(--accent); }

.composer { display: flex; align-items: flex-end; gap: 6px; padding: 8px; background: var(--panel);
  border-top: 1px solid var(--line); padding-bottom: max(8px, var(--sab)); }
.composer textarea { flex: 1; resize: none; border: 0; outline: none; background: var(--panel-2);
  border-radius: 20px; padding: 9px 14px; max-height: 160px; min-height: 38px; }
.send { background: var(--accent); color: #fff; }
@media (hover: hover) { .send:hover { background: var(--accent-2); color: #fff; } }

.upload { margin: 0 10px 6px; background: var(--panel-2); border-radius: 10px; padding: 6px 10px; font-size: 13px; }
.bar { height: 4px; background: var(--line); border-radius: 2px; margin-top: 4px; overflow: hidden; }
.bar > div { height: 100%; background: var(--accent); width: 0; transition: width .15s; }

.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.9); display: grid; place-items: center; z-index: 10; cursor: zoom-out; }
.lightbox img { max-width: 96vw; max-height: 96vh; }

.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: grid; place-items: center; z-index: 5; }
.modal { background: var(--panel); border-radius: 16px; width: min(400px, calc(100% - 32px)); max-height: 80vh;
  display: flex; flex-direction: column; padding: 16px; gap: 10px; }
.modal h3 { margin: 0; }
.modal .list { max-height: 50vh; }
.check { margin-left: auto; width: 20px; height: 20px; }

.drop { position: absolute; inset: 0; background: rgba(91,141,239,.25); border: 3px dashed var(--accent);
  display: grid; place-items: center; font-size: 20px; pointer-events: none; z-index: 4; }

/* mobile: one pane at a time; the chat slides over the list (and can be swiped back) */
.back { display: none; }
@media (max-width: 760px) {
  #app { overflow: hidden; }
  .sidebar, .main { position: absolute; top: 0; left: 0; right: 0; bottom: 0; width: 100%; }
  .sidebar { border-right: 0; transition: transform .3s cubic-bezier(.2,.8,.25,1), opacity .3s; }
  .main { z-index: 2; transform: translateX(100%); visibility: hidden; box-shadow: -6px 0 24px rgba(0,0,0,.25);
    transition: transform .3s cubic-bezier(.2,.8,.25,1), visibility 0s linear .3s; }
  #app.in-chat .main { transform: none; visibility: visible; transition: transform .3s cubic-bezier(.2,.8,.25,1), visibility 0s; }
  #app.in-chat .sidebar { transform: translateX(-28%); opacity: .6; pointer-events: none; }
  .back { display: grid; }
}

/* connection banner */
.conn { display: none; position: absolute; top: 0; left: 0; right: 0; z-index: 6; background: #b5462f; color: #fff;
  font-size: 13px; text-align: center; padding: 4px 8px; }
body.offline .conn { display: block; }

/* message status */
.stamp { white-space: nowrap; }
.ticks { margin-left: 3px; font-size: 11px; letter-spacing: -3px; padding-right: 3px; }
.ticks.read { color: #4fc3f7; }
.ticks.pending { letter-spacing: 0; font-size: 10px; }
.ticks.failed { color: #fff; background: var(--danger); border-radius: 50%; display: inline-block; width: 14px; height: 14px;
  line-height: 14px; text-align: center; letter-spacing: 0; padding: 0; font-weight: 700; }
.msg.out .ticks.sent, .msg.out .ticks.delivered { color: var(--out-muted); }
.msg.out .ticks.read { color: #9fe3ff; }
html.light .msg.out .ticks.read { color: #2a7de0; }
html.light .ticks.read { color: #2a7de0; }
.time .ticks { color: var(--accent); }
.item.active .time .ticks { color: #fff; }
.msg.failed { cursor: pointer; opacity: .85; }
.msg.big { background: transparent !important; box-shadow: none; font-size: 40px; line-height: 1.15; padding: 0 2px; }
.msg.big .stamp { font-size: 11px; background: rgba(0,0,0,.35); color: #fff; padding: 1px 6px; border-radius: 8px; }

.link { background: none; border: 0; color: var(--accent); padding: 0 6px; font-size: 13px; }

/* composer with emoji button inside the field */
.input-wrap { flex: 1; position: relative; display: flex; min-width: 0; }
.input-wrap textarea { padding-right: 42px; }
.emoji-btn { position: absolute; right: 2px; bottom: 0; font-size: 22px; }

/* emoji panel: popover on desktop, keyboard-sized panel on phones */
.emoji-panel { display: flex; flex-direction: column; background: var(--panel); border-top: 1px solid var(--line); height: 290px; flex: none; position: relative; z-index: 2; }
.emoji-body { flex: 1; overflow-y: auto; padding: 0 6px; }
.emoji-title { color: var(--muted); font-size: 13px; padding: 10px 4px 4px; position: sticky; top: 0; background: var(--panel); }
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); }
.emoji { font-size: 26px; height: 42px; border: 0; background: none; border-radius: 8px; padding: 0; line-height: 1; }
@media (hover: hover) { .emoji:hover { background: var(--panel-2); } }
.emoji-tabs { display: flex; overflow-x: auto; border-top: 1px solid var(--line); padding: 2px 4px; padding-bottom: max(2px, var(--sab)); flex: none; }
.emoji-tab { font-size: 20px; border: 0; background: none; padding: 6px 9px; border-radius: 8px; flex: none; }
@media (hover: hover) { .emoji-tab:hover { background: var(--panel-2); } }
@media (min-width: 761px) and (pointer: fine) {
  .emoji-panel { position: absolute; right: 56px; bottom: 60px; width: 360px; height: 380px; border: 1px solid var(--line);
    border-radius: 14px; box-shadow: 0 8px 30px rgba(0,0,0,.35); overflow: hidden; z-index: 3; }
}
.main.with-emoji .composer { padding-bottom: 8px; }

/* ---------- voice notes ---------- */
.msg.t-voice { padding: 6px 10px 5px; min-width: 230px; }
.voice { display: flex; align-items: center; gap: 10px; }
.voice-btn { width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--accent); color: #fff;
  display: grid; place-items: center; flex: none; }
.msg.out .voice-btn { background: var(--out-text); color: var(--out); }
.voice-mid { flex: 1; min-width: 0; }
.voice-bars { display: flex; align-items: center; gap: 2px; height: 26px; cursor: pointer; }
.voice-bars span { flex: 1; max-width: 3px; min-width: 2px; border-radius: 2px; background: currentColor; opacity: .35; }
.voice-bars span.on { opacity: 1; color: var(--accent); }
.msg.out .voice-bars span.on { color: #fff; }
.voice-time { font-size: 12px; color: var(--muted); min-width: 34px; text-align: right; }
.msg.t-voice .txt, .msg.t-voice > div:last-child { padding: 0; }

/* ---------- video circles ---------- */
.msg.t-circle { background: transparent !important; box-shadow: none; padding: 0; }
.circle { position: relative; width: 220px; height: 220px; flex: none; border-radius: 50%; overflow: hidden; cursor: pointer; background: #000; }
.circle video { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 50%; max-height: none; }
.circle-ring { position: absolute; inset: 0; pointer-events: none; }
.circle-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.circle-ring circle { fill: none; stroke: #fff; stroke-width: 2.5; stroke-dasharray: 302; stroke-dashoffset: 302; stroke-linecap: round; opacity: .9; }
.circle-icon { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; pointer-events: none; }
.circle-icon svg { width: 46px; height: 46px; background: rgba(0,0,0,.4); border-radius: 50%; padding: 10px; box-sizing: border-box; }
.circle-time { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); background: rgba(0,0,0,.45); color: #fff;
  font-size: 12px; padding: 1px 7px; border-radius: 10px; pointer-events: none; }
.msg.t-circle .stamp { background: rgba(0,0,0,.35); color: #fff; padding: 1px 6px; border-radius: 8px; margin-top: 4px; }
.msg.t-circle .ticks { color: #fff !important; }
.expired { padding: 8px 10px; color: var(--muted); font-style: italic; font-size: 14px; }

/* ---------- recording ---------- */
.composer { position: relative; }
.recbtn { touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
@media (hover: hover) { .recbtn:hover { color: var(--accent); } }
.rec-bar { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: var(--panel); display: flex; align-items: center; gap: 10px;
  padding: 0 8px; z-index: 9; }
.rec-status { color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rec-bar:not(.live) .rec-dot { background: var(--muted); }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); transition: transform .08s; flex: none; }
.rec-time { font-variant-numeric: tabular-nums; min-width: 40px; }
.rec-bar .grow { flex: 1; }
.rec-cancel { color: var(--danger); }
.rec-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 8; display: grid; place-items: center; pointer-events: none; }
.rec-circle { position: relative; width: 280px; height: 280px; border-radius: 50%; overflow: hidden; background: #000; }
.rec-circle video { width: 100%; height: 100%; display: block; object-fit: cover; transform: scaleX(-1); border-radius: 50%; }
@media (max-width: 340px) { .rec-circle { width: 230px; height: 230px; } .circle { width: 190px; height: 190px; } }
.rec-ring circle { stroke: var(--danger); stroke-width: 3; }

.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: rgba(20,28,38,.92); color: #fff;
  padding: 8px 14px; border-radius: 12px; font-size: 14px; z-index: 40; transition: opacity .4s, transform .4s; max-width: 90vw; text-align: center;
  animation: toastIn .25s cubic-bezier(.2,.8,.25,1); pointer-events: none; }
.toast.out { opacity: 0; transform: translate(-50%, 8px); }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 12px) scale(.96); } }

/* ---------- replies ---------- */
.reply-bar { display: none; align-items: center; gap: 10px; padding: 6px 8px 6px 14px; background: var(--panel); border-top: 1px solid var(--line); }
.reply-bar.on { display: flex; }
.reply-icon { color: var(--accent); font-size: 20px; flex: none; }
.reply-body { flex: 1; min-width: 0; border-left: 2px solid var(--accent); padding-left: 8px; cursor: pointer; }
.reply-name { color: var(--accent); font-size: 13px; font-weight: 600; }
.reply-text, .quote-text { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quote { border-left: 3px solid var(--accent); background: rgba(255,255,255,.06); border-radius: 6px; padding: 3px 8px; margin: 2px 0 4px;
  cursor: pointer; min-width: 120px; max-width: 100%; white-space: normal; }
html.light .quote { background: rgba(0,0,0,.05); }
.msg.media .quote { margin: 4px 6px; }
.msg.t-circle .quote, .msg.big .quote { background: var(--in); }
.quote-name { font-size: 13px; font-weight: 600; }
.msg.out .quote-text { color: var(--out-muted); }
.msg.out .quote { border-color: var(--out-text) !important; background: rgba(255,255,255,.12); }
.msg.out .quote-name { color: var(--out-text) !important; }
html.light .msg.out .quote { border-color: var(--accent) !important; background: rgba(40,90,200,.08); }
html.light .msg.out .quote-name { color: var(--accent) !important; }

/* reply affordances */
.msg { touch-action: pan-y; }
.reply-btn { position: absolute; top: 50%; transform: translateY(-50%); width: 30px; height: 30px; border-radius: 50%; border: 0;
  background: var(--panel-2); color: var(--muted); display: none; place-items: center; font-size: 15px; }
.msg:not(.out) .reply-btn { right: -38px; }
.msg.out .reply-btn { left: -38px; }
@media (hover: hover) and (pointer: fine) { .msg:hover .reply-btn { display: grid; } }
.msg::before { content: ''; position: absolute; top: 50%; transform: translateY(-50%) scale(.6); opacity: 0; transition: opacity .1s, transform .1s;
  width: 30px; height: 30px; border-radius: 50%; background: var(--panel-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%235b8def' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 18v-2a4 4 0 0 0-4-4H4'/%3E%3Cpath d='m9 17-5-5 5-5'/%3E%3C/svg%3E") center / 18px no-repeat; }
.msg[data-swipe="l"]::before { right: -40px; }
.msg[data-swipe="r"]::before { left: -40px; }
.msg.swipe-ready::before { opacity: 1; transform: translateY(-50%) scale(1); }
@keyframes flash { 0%, 60% { box-shadow: 0 0 0 3px var(--accent); } 100% { box-shadow: 0 0 0 0 transparent; } }
.msg.flash { animation: flash 1.4s ease-out; }
.messages { overflow-x: hidden; }

.rec-overlay { position: fixed; inset: 0 0 64px 0; }

/* ---------- calls ---------- */
.call { position: fixed; inset: 0; z-index: 30; background: radial-gradient(circle at 50% 30%, #2b4a6e, #0e1621 70%); color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between; overflow: hidden; }
.call-remote { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; display: none; }
.call.remote-video .call-remote { display: block; }
.call-local { position: absolute; right: 12px; top: calc(12px + var(--sat)); width: 110px; height: 150px; object-fit: cover;
  border-radius: 12px; background: #000; display: none; z-index: 2; box-shadow: 0 4px 16px rgba(0,0,0,.4); }
.call-local.on { display: block; }
.call-local.mirror { transform: scaleX(-1); }
.call-info { position: relative; z-index: 1; margin-top: calc(70px + var(--sat)); display: flex; flex-direction: column; align-items: center; gap: 10px;
  text-shadow: 0 1px 4px rgba(0,0,0,.5); }
.call.remote-video .call-info { margin-top: calc(20px + var(--sat)); flex-direction: row; gap: 10px; align-self: flex-start; margin-left: 16px; }
.call-avatar { width: 110px !important; height: 110px !important; font-size: 40px !important; }
.call.remote-video .call-avatar { width: 40px !important; height: 40px !important; font-size: 16px !important; }
.call-name { font-size: 24px; font-weight: 600; }
.call.remote-video .call-name { font-size: 16px; }
.call-status { font-size: 15px; opacity: .85; font-variant-numeric: tabular-nums; }
.call.incoming .call-avatar { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255,255,255,.35); } 50% { box-shadow: 0 0 0 18px rgba(255,255,255,0); } }
.call-controls { position: relative; z-index: 2; display: flex; gap: 18px; justify-content: center; flex-wrap: wrap;
  padding: 20px 16px calc(36px + var(--sab)); transition: opacity .2s; }
.call.hide-controls.remote-video .call-controls, .call.hide-controls.remote-video .call-info { opacity: 0; pointer-events: none; }
.call-btn { background: none; border: 0; color: #fff; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; }
.call-btn-icon { width: 60px; height: 60px; border-radius: 50%; background: rgba(255,255,255,.18); display: grid; place-items: center; backdrop-filter: blur(6px); }
.call-btn.off .call-btn-icon { background: #fff; color: #17212b; }
.call-btn.hang .call-btn-icon { background: #e5535b; }
.call-btn.accept .call-btn-icon { background: #4cd964; }
.call.ended .call-status { font-size: 17px; }
.call-log { padding: 8px 10px; cursor: pointer; }
.call-log.missed { color: #ff8a8a; }
.msg.t-call .txt { padding: 0 8px 4px; }

/* ---------- push ---------- */
.push-banner:empty { display: none; }
.push-inner { display: flex; align-items: center; gap: 8px; margin: 8px; padding: 8px 6px 8px 12px; border-radius: 12px;
  background: var(--panel-2); font-size: 13px; line-height: 1.3; }
.push-inner span { flex: 1; }
.push-inner .btn { padding: 6px 12px; font-size: 13px; flex: none; }
.push-inner .icon-btn { width: 30px; height: 30px; font-size: 14px; }
.push-section { display: flex; flex-direction: column; gap: 4px; }
.push-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.push-btns .btn { padding: 4px 0; margin-right: 12px; }
.howto { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; line-height: 1.4; }
.ios-share { display: inline-block; border: 1px solid currentColor; border-radius: 4px; padding: 0 4px; font-size: 12px; }
.call-sheet { position: absolute; left: 0; right: 0; bottom: 0; z-index: 5; background: rgba(23,33,43,.97); color: #fff;
  border-radius: 18px 18px 0 0; padding: 14px 18px calc(18px + var(--sab)); display: flex; flex-direction: column; gap: 14px;
  max-height: 75%; overflow-y: auto; box-shadow: 0 -8px 30px rgba(0,0,0,.4); }
.call-sheet-head { display: flex; align-items: center; justify-content: space-between; font-size: 16px; }
.call-sheet-close { background: none; border: 0; color: #fff; font-size: 18px; width: 32px; height: 32px; }
.call-row { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.call-row-top { display: flex; justify-content: space-between; opacity: .9; }
.call-val { font-variant-numeric: tabular-nums; opacity: .8; }
.call-row input[type=range] { width: 100%; accent-color: var(--accent); height: 28px; }
.call-select { width: 100%; padding: 8px 10px; border-radius: 10px; background: #243444; color: #fff; border: 1px solid #33475b; font-size: 15px; }
.call-note { font-size: 12px; opacity: .65; line-height: 1.35; }
@media (min-width: 761px) { .call-sheet { left: auto; right: 16px; bottom: 120px; width: 360px; border-radius: 16px; } }
.invite-section { display: flex; flex-direction: column; gap: 6px; }
.invite-link { font-size: 13px; padding: 8px 10px; }
.invite-note { color: var(--accent) !important; font-size: 14px; }
.modal { overflow-y: auto; }

/* chat menu / hidden marker */
.item { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.item.is-hidden .name::after { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--muted);
  opacity: .5; margin-left: 6px; vertical-align: middle; }
.menu-item { display: block; width: 100%; text-align: left; padding: 12px 10px; border: 0; border-radius: 10px; background: none; font-size: 15px; }
@media (hover: hover) { .menu-item:hover { background: var(--panel-2); } }
.menu-item.danger { color: var(--danger); }

/* ---------- message actions ---------- */
.fwd { font-size: 13px; color: var(--accent); margin-bottom: 2px; }
.fwd b { font-weight: 600; }
.reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; padding: 0 2px 2px; }
.msg.media .reactions { padding: 0 6px 4px; }
.reaction { border: 0; border-radius: 12px; padding: 2px 8px; font-size: 14px; background: rgba(255,255,255,.08); color: inherit; line-height: 1.5; }
.reaction.mine { background: var(--accent); color: #fff; }
.msg.out .reaction:not(.mine) { background: rgba(255,255,255,.14); }
html.light .reaction { background: rgba(0,0,0,.06); }
html.light .msg.out .reaction:not(.mine) { background: rgba(40,90,200,.12); }
.modal-bg.sheet { align-items: end; }
@media (max-width: 760px) { .modal-bg.sheet .modal { width: 100%; border-radius: 16px 16px 0 0; padding-bottom: max(16px, var(--sab)); } }
.quick-reacts { display: flex; justify-content: space-between; gap: 4px; padding-bottom: 6px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.qr { font-size: 26px; background: none; border: 0; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; transition: transform .1s; }
.qr.mine { background: var(--panel-2); transform: scale(1.1); }
@media (hover: hover) { .qr:hover { background: var(--panel-2); transform: scale(1.1); } }
.qr.more { font-size: 22px; color: var(--muted); }
.picker-wrap { max-height: 60vh; overflow-y: auto; }
.emoji-grid.picker { grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); }
.main.selecting .msg { cursor: pointer; }
.main.selecting .reply-btn { display: none !important; }
.msg.selected { box-shadow: 0 0 0 2px var(--accent); }
.msg.selected::after { content: '✓'; position: absolute; top: -6px; width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: #fff;
  font-size: 12px; display: grid; place-items: center; }
.msg.out.selected::after { left: -6px; }
.msg:not(.out).selected::after { right: -6px; }
.sel-act { padding: 6px 10px; }
.sel-act.danger { color: var(--danger); }
.sel-act:disabled { opacity: .4; }

/* ---------- touch & motion ---------- */
html { -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; }
body { touch-action: manipulation; }
.messages, .main > .top, .msgs-wrap { touch-action: pan-y; }
/* Phones: no stray text selection or iOS callouts on long press — copying is in the message menu. */
@media (pointer: coarse) {
  body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
  input, textarea, [contenteditable] { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }
  .msg img, .msg video, .avatar { -webkit-touch-callout: none; }
}
.icon-btn, .btn, .menu-item, .qr, .reaction, .item, .emoji, .emoji-tab, .voice-btn, .to-bottom { transition: transform .12s, background-color .15s, opacity .15s; }
.icon-btn:active, .qr:active, .voice-btn:active, .to-bottom:active { transform: scale(.88); }
.btn:active, .reaction:active { transform: scale(.96); }
.emoji:active { transform: scale(1.25); }
.menu-item:active, .item:active { background: var(--panel-2); }
.item.active:active { background: var(--accent); }
.composer .icon-btn.pop { animation: pop .18s cubic-bezier(.2,.8,.25,1.4); }
@keyframes pop { from { transform: scale(.4); opacity: 0; } }

/* messages: appear, press, leave */
.msg { transition: transform .25s cubic-bezier(.2,.8,.25,1), opacity .2s; }
.msg.appear { animation: msgIn .26s cubic-bezier(.2,.8,.25,1); }
.msg.out.appear { animation-name: msgInOut; }
@keyframes msgIn { from { opacity: 0; transform: translate(-10px, 10px) scale(.96); } }
@keyframes msgInOut { from { opacity: 0; transform: translate(10px, 10px) scale(.96); } }
.msg.pressing { transform: scale(.96); transition-duration: .35s; }
.item.pressing { background: var(--panel-2); }
.msg.leaving { opacity: 0; transform: scale(.85); transition: opacity .18s, transform .18s; }
.reactions.pop .reaction { animation: pop .25s cubic-bezier(.2,.8,.25,1.5); }
.like-burst { position: fixed; font-size: 46px; pointer-events: none; z-index: 30; animation: like .65s ease-out forwards; }
@keyframes like { 0% { transform: translate(-50%, -50%) scale(.2); opacity: 0; } 30% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; }
  100% { transform: translate(-50%, -110%) scale(1); opacity: 0; } }
.day { position: sticky; top: 4px; z-index: 1; background: rgba(20,28,38,.72); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.msg a.file { text-decoration: none; }
.reply-bar.on { animation: barIn .2s cubic-bezier(.2,.8,.25,1); }
@keyframes barIn { from { opacity: 0; transform: translateY(10px); } }
.emoji-panel { animation: barIn .2s cubic-bezier(.2,.8,.25,1); }

/* jump to latest */
.msgs-wrap { flex: 1; position: relative; display: flex; flex-direction: column; min-height: 0; }
.to-bottom { position: absolute; right: 12px; bottom: 12px; width: 44px; height: 44px; border-radius: 50%; border: 0; z-index: 2;
  background: var(--panel); color: var(--muted); box-shadow: 0 2px 10px rgba(0,0,0,.3); display: grid; place-items: center;
  opacity: 0; transform: scale(.6) translateY(10px); pointer-events: none; }
.to-bottom.on { opacity: 1; transform: none; pointer-events: auto; }
.to-bottom .badge { position: absolute; top: -6px; left: 50%; transform: translateX(-50%); }
.to-bottom .badge:empty { display: none; }

/* modals and bottom sheets */
.modal-bg { animation: fadeIn .2s ease; transition: opacity .2s; }
.modal-bg .modal { animation: modalIn .22s cubic-bezier(.2,.8,.25,1); transition: transform .22s cubic-bezier(.2,.8,.25,1); }
.modal-bg.closing { opacity: 0; pointer-events: none; }
.modal-bg.closing .modal { transform: scale(.96); }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes modalIn { from { opacity: 0; transform: scale(.94); } }
@media (max-width: 760px) {
  .modal-bg.sheet .modal { animation-name: sheetIn; animation-duration: .28s; max-height: 85vh; }
  .modal-bg.sheet.closing .modal { transform: translateY(100%); }
  .modal-bg.sheet .modal::before { content: ''; display: block; width: 36px; height: 4px; border-radius: 2px; background: var(--muted);
    opacity: .4; margin: -6px auto 2px; flex: none; }
}
@keyframes sheetIn { from { transform: translateY(100%); } }
.modal .ask-text { color: var(--muted); margin: -4px 0 4px; line-height: 1.4; white-space: pre-line; }
.lightbox { animation: fadeIn .2s ease; transition: background-color .2s, opacity .2s; touch-action: none; }
.lightbox img { animation: modalIn .22s cubic-bezier(.2,.8,.25,1); transition: transform .22s cubic-bezier(.2,.8,.25,1); }
.lightbox.closing { opacity: 0; }

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

/* ---------- icons (Lucide) ---------- */
.ico { display: block; flex: none; }
.icon-btn .ico { pointer-events: none; }
.emoji-btn .ico { width: 22px; height: 22px; }
.menu-item { display: flex; align-items: center; gap: 14px; }
.menu-item .ico { color: var(--muted); }
.menu-item.danger .ico { color: var(--danger); }
.reply-icon .ico { width: 22px; height: 22px; }
.reply-btn .ico { width: 16px; height: 16px; }
.qr.more .ico { width: 24px; height: 24px; }
.emoji-tab { color: var(--muted); display: grid; place-items: center; padding: 7px; flex: 1 0 auto; }
.emoji-tabs { justify-content: space-between; }
.emoji-tab .ico { width: 20px; height: 20px; }
.push-inner > .ico { color: var(--accent); }
.with-icon { display: inline-flex; align-items: center; gap: 8px; }
.with-icon .ico { color: var(--accent); }
.ios-share { border: 0; padding: 0; vertical-align: -3px; }
.ios-share .ico { display: inline-block; }
.msg a.file, .expired, .call-log { display: flex; align-items: center; gap: 8px; }
.call-log .ico { color: var(--accent); }
.call-log.missed .ico { color: #ff8a8a; }
.ticks { display: inline-flex; vertical-align: -3px; letter-spacing: 0; padding-right: 0; }
.ticks .ico { display: block; }
.ticks.pending .ico { margin: 1px; }
.ticks.failed { background: none; width: auto; height: auto; color: var(--danger); display: inline-flex; line-height: 1; }
.time .ticks { vertical-align: -3px; margin-right: 2px; }
.call-sheet-close { display: grid; place-items: center; }
.voice-btn .ico { width: 20px; height: 20px; }
.circle-icon .ico { width: 46px; height: 46px; background: rgba(0,0,0,.4); border-radius: 50%; padding: 12px; box-sizing: border-box; }

/* ---------- pages: settings, privacy, profiles ---------- */
.page { position: absolute; inset: 0; z-index: 4; background: var(--bg); display: flex; flex-direction: column;
  animation: pageIn .3s cubic-bezier(.2,.8,.25,1); transition: transform .3s cubic-bezier(.2,.8,.25,1); }
.page.closing { transform: translateX(100%); pointer-events: none; }
@keyframes pageIn { from { transform: translateX(100%); } }
@media (min-width: 761px) {
  .page { left: auto; width: 420px; border-left: 1px solid var(--line); box-shadow: -10px 0 30px rgba(0,0,0,.3); }
}
.page > .top { flex: none; }
.page-body { flex: 1; overflow-y: auto; padding: 0 0 calc(24px + var(--sab)); overscroll-behavior: contain; touch-action: pan-y; }
.card { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 22px 16px 16px; background: var(--panel); text-align: center; }
.avatar.big { width: 96px; height: 96px; font-size: 36px; margin-bottom: 8px; cursor: default; }
.avatar.big[style*="url"] { cursor: zoom-in; }
.card-name { font-size: 21px; font-weight: 600; word-break: break-word; }
.card-sub { color: var(--muted); font-size: 14px; }
.card-sub.on, .top .sub.on { color: var(--accent); }
.card-bio { margin-top: 6px; font-size: 14px; line-height: 1.4; white-space: pre-wrap; max-width: 360px; }
.pacts { display: flex; gap: 8px; padding: 0 12px 14px; background: var(--panel); justify-content: center; }
.pacts:empty { display: none; }
.pact { flex: 1; max-width: 110px; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border: 0; border-radius: 12px;
  background: var(--panel-2); color: var(--accent); font-size: 12px; transition: transform .12s, background-color .15s; }
.pact:active { transform: scale(.94); }
.section { margin-top: 12px; }
.section-title { padding: 8px 16px 6px; color: var(--accent); font-size: 14px; font-weight: 600; }
.section-box { background: var(--panel); }
.section-note { padding: 8px 16px 2px; color: var(--muted); font-size: 13px; line-height: 1.4; }
.row-item { display: flex; align-items: center; gap: 16px; width: 100%; min-height: 50px; padding: 8px 16px; border: 0; background: none;
  text-align: left; color: var(--text); font-size: 15px; position: relative; }
.row-item + .row-item::before { content: ''; position: absolute; top: 0; right: 0; left: 54px; border-top: 1px solid var(--line); }
.row-item.tap { cursor: pointer; transition: background-color .15s; }
.row-item.tap:active { background: var(--panel-2); }
@media (hover: hover) { .row-item.tap:hover { background: var(--panel-2); } }
.row-icon { color: var(--muted); }
.row-item.danger, .row-item.danger .row-icon { color: var(--danger); }
.row-main { flex: 1; min-width: 0; }
.row-label { overflow: hidden; text-overflow: ellipsis; word-break: break-word; }
.row-sub { color: var(--muted); font-size: 13px; margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-value { color: var(--muted); font-size: 14px; flex: none; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chev { color: var(--muted); opacity: .6; }
.row-check { color: var(--accent); }
.row-item > .avatar.sm { margin: -2px 0; }
.row-item .push-section, .row-item .invite-section { width: 100%; }
.btn.small { padding: 6px 10px; font-size: 13px; flex: none; }
.switch { appearance: none; -webkit-appearance: none; width: 44px; height: 26px; border-radius: 13px; background: var(--panel-2);
  border: 1px solid var(--line); position: relative; flex: none; margin: 0; cursor: pointer; transition: background-color .2s; }
.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .2s cubic-bezier(.2,.8,.25,1); }
.switch:checked { background: var(--accent); border-color: var(--accent); }
.switch:checked::after { transform: translateX(18px); }
.switch:disabled { opacity: .6; }
.menu-item.chosen { color: var(--accent); }
.menu-item .grow { flex: 1; }

/* chat header opens the profile; muted chats; blocked chat */
.head-info { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; cursor: pointer; border-radius: 10px; }
.head-info:active { opacity: .7; }
.name .muted-ico { display: inline-block; vertical-align: -2px; margin-left: 5px; color: var(--muted); }
.badge.muted { background: var(--muted); }
.block-bar { display: none; justify-content: center; padding: 8px; padding-bottom: max(8px, var(--sab)); background: var(--panel); border-top: 1px solid var(--line); }
.main.is-blocked .composer, .main.is-blocked .reply-bar { display: none; }
.main.is-blocked .block-bar { display: flex; }
.msg .author, .fwd.link { cursor: pointer; }

/* Android app download */
.apk-card { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 22px 16px 18px; background: var(--panel); text-align: center; }
.apk-card .logo { margin: 0; }
.apk-card .btn { min-width: 220px; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.apk-steps { margin: 0; padding: 4px 16px 4px 34px; display: flex; flex-direction: column; gap: 8px; line-height: 1.4; font-size: 14px; }

/* ======================================================================
   Look: wallpaper, bubbles, glass bars (Settings → Appearance)
   ====================================================================== */
html { -webkit-font-smoothing: antialiased; }
:root, [data-wall="night"] { --wb: #142036; --w1: #22375f; --w2: #2d2452; --w3: #123c48; --w4: #1c1e40; --wp: #fff; --wpo: .075; }
[data-wall="graphite"] { --wb: #1c1f26; --w1: #2b2f39; --w2: #22252d; --w3: #30303b; --w4: #191b21; --wp: #fff; --wpo: .06; }
[data-wall="ocean"] { --wb: #b4d8f1; --w1: #8cc1ea; --w2: #d0e9f7; --w3: #97d2e5; --w4: #c3dbf4; --wp: #0d3b66; --wpo: .14; }
[data-wall="mint"] { --wb: #cde8d5; --w1: #ade0c6; --w2: #e3f2c4; --w3: #a3d8cd; --w4: #dcefd8; --wp: #0f4d3a; --wpo: .13; }
[data-wall="peach"] { --wb: #f6d5c3; --w1: #f4bda4; --w2: #f6c1d3; --w3: #fde2b2; --w4: #eecde6; --wp: #6b2b2b; --wpo: .12; }
[data-wall="lilac"] { --wb: #d7cef3; --w1: #c1b4f0; --w2: #e7c8ef; --w3: #b9caf4; --w4: #ebdaf2; --wp: #3b2a6b; --wpo: .13; }

/* The wallpaper sits behind everything in the chat column. */
.wall { position: absolute; inset: 0; z-index: 0; pointer-events: none; background-color: var(--wb);
  background-image:
    radial-gradient(circle at 12% 16%, var(--w1) 0, transparent 52%),
    radial-gradient(circle at 90% 8%, var(--w2) 0, transparent 50%),
    radial-gradient(circle at 84% 88%, var(--w3) 0, transparent 55%),
    radial-gradient(circle at 8% 94%, var(--w4) 0, transparent 52%); }
.wall::after { content: ''; position: absolute; inset: 0; background: var(--wp); opacity: var(--wpo);
  -webkit-mask: url(wallpaper/pattern.svg) 0 0 / 640px 640px repeat; mask: url(wallpaper/pattern.svg) 0 0 / 640px 640px repeat; }
html[data-pattern="off"] .wall::after { display: none; }
[data-wall="none"] { --wb: var(--bg); --w1: transparent; --w2: transparent; --w3: transparent; --w4: transparent; --wpo: 0; }
.main > .reply-bar, .main > .uploads, .main > .block-bar { position: relative; z-index: 1; }
.main > .empty { position: relative; z-index: 1; background: var(--glass); border-radius: 16px; padding: 12px 18px;
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }

/* Glass bars over the wallpaper; messages scroll under the header. */
.main > .chat-head { position: absolute; top: 0; left: 0; right: 0; z-index: 3; height: calc(57px + var(--sat));
  background: var(--glass); -webkit-backdrop-filter: blur(20px) saturate(1.6); backdrop-filter: blur(20px) saturate(1.6); }
.main .messages { padding-top: calc(57px + var(--sat) + 8px); }
.main .day { top: calc(57px + var(--sat) + 6px); }
.composer, .reply-bar, .block-bar { background: var(--glass); -webkit-backdrop-filter: blur(20px) saturate(1.6); backdrop-filter: blur(20px) saturate(1.6); }
.reply-bar + .composer { border-top: 0; }
.composer textarea { background: var(--panel); box-shadow: inset 0 0 0 1px var(--line); }
.day { background: var(--glass); color: var(--text); font-weight: 500; box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.messages > .empty { background: var(--glass); border-radius: 16px; padding: 14px 18px; color: var(--text);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }

/* Bubbles: runs of messages from one person stick together; the last one gets a tail. */
.messages { gap: 2px; }
.msg { font-size: var(--fs); color: var(--in-text); box-shadow: var(--shadow); line-height: 1.38; }
.msg.out { color: var(--out-text); }
.msg.gfirst { margin-top: 6px; }
.msg:not(.out):not(.gfirst) { border-top-left-radius: var(--radius-s); }
.msg:not(.out):not(.glast) { border-bottom-left-radius: var(--radius-s); }
.msg.out:not(.gfirst) { border-top-right-radius: var(--radius-s); }
.msg.out:not(.glast) { border-bottom-right-radius: var(--radius-s); }
.msg:not(.out).glast { border-bottom-left-radius: 4px; }
.msg.out.glast { border-bottom-right-radius: 4px; }
.msg:not(.gfirst) > .author { display: none; }
.tail { display: none; position: absolute; bottom: 0; width: 9px; height: 17px; pointer-events: none; color: var(--in); }
.msg.glast > .tail { display: block; }
.msg:not(.out) > .tail { left: -8px; }
.msg.out > .tail { right: -8px; transform: scaleX(-1); color: var(--out); }
.msg.big > .tail, .msg.t-circle > .tail { display: none !important; }
.msg.big, .msg.t-circle { box-shadow: none; }
.msg .stamp { color: var(--muted); }
.msg.out .stamp { color: var(--out-muted); }
.msg.out .fwd, .msg.out a.file, .msg.out .call-log, .msg.out .call-log .ico { color: var(--out-text); }
.msg.out .voice-time { color: var(--out-muted); }
html.light .msg.out .fwd, html.light .msg.out a.file, html.light .msg.out .call-log .ico { color: var(--accent); }
html:not(.light) .msg.out .reaction.mine { background: var(--out-text); color: var(--out); }
.msg.big .stamp, .msg.t-circle .stamp { color: #fff; }

/* Avatars: soft two-tone fill (set from app.js), crisp initials. */
.avatar { text-shadow: 0 1px 1px rgba(0,0,0,.18); letter-spacing: .02em; }

/* Chat list */
.list .item { gap: 13px; padding: 8px 12px; position: relative; }
.list .item .avatar:not(.sm) { width: 54px; height: 54px; font-size: 20px; }
.list .item .name { font-size: 16px; }
.list .item .sub { font-size: 14.5px; margin-top: 2px; }
.list > .item + .item::before { content: ''; position: absolute; top: 0; right: 0; left: 79px; border-top: 1px solid var(--line); }
.list > .item.active::before, .list > .item.active + .item::before { display: none; }
.badge { font-weight: 600; }

/* Appearance page */
.walls { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; padding: 12px 16px 14px; background: var(--panel); }
.wall-pick { position: relative; aspect-ratio: 3 / 4; border-radius: 14px; overflow: hidden; border: 0; padding: 0; cursor: pointer;
  box-shadow: inset 0 0 0 1px var(--line); transition: transform .12s; }
.wall-pick:active { transform: scale(.96); }
.wall-pick .wall { border-radius: inherit; }
.wall-pick .wall::after { -webkit-mask-size: 320px 320px; mask-size: 320px 320px; }
.wall-pick .bub { position: absolute; z-index: 1; left: 10px; right: 26px; height: 14px; border-radius: 8px; background: var(--in); box-shadow: var(--shadow); }
.wall-pick .bub.o { left: 30px; right: 10px; background: var(--out); }
.wall-pick .cap { position: absolute; z-index: 1; left: 0; right: 0; bottom: 0; padding: 6px 4px; font-size: 12px; font-weight: 600;
  color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.45)); }
.wall-pick.on { box-shadow: inset 0 0 0 3px var(--accent); }
.wall-pick.on::after { content: ''; position: absolute; z-index: 2; top: 7px; right: 7px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 12px no-repeat; }
.font-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--panel); }
.font-row input[type=range] { flex: 1; accent-color: var(--accent); }
.font-row .a-s { font-size: 13px; color: var(--muted); }
.font-row .a-l { font-size: 20px; color: var(--muted); }
.look-preview { position: relative; height: 150px; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; gap: 3px; padding: 12px 14px; }
.look-preview .msg { max-width: 75%; z-index: 1; animation: none; }

/* ---------- call: mini window, picture-in-picture, screen sharing ---------- */
.call-min { position: absolute; z-index: 3; top: calc(12px + var(--sat)); left: 12px; width: 44px; height: 44px; border-radius: 50%; border: 0;
  background: rgba(255,255,255,.16); color: #fff; display: grid; place-items: center; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.call.ended .call-min { display: none; }
.call.remote-screen .call-remote { object-fit: contain; }
.call-btn.active-share .call-btn-icon { background: #fff; color: #17212b; }
/* Collapsed call: a small floating window over the chats; tap to open, drag to move. */
.call.mini { inset: auto 12px calc(84px + var(--sab)) auto; width: 112px; height: 160px; border-radius: 18px; z-index: 30;
  box-shadow: 0 10px 34px rgba(0,0,0,.45); justify-content: center; cursor: pointer; touch-action: none; animation: miniIn .22s cubic-bezier(.2,.8,.25,1); }
.call.mini:not(.remote-video) { width: 132px; height: 132px; }
.call.mini .call-controls, .call.mini .call-local, .call.mini .call-min, .call.mini .call-sheet, .call.mini .call-name { display: none; }
.call.mini .call-info { margin: 0; gap: 6px; flex-direction: column; align-self: center; }
.call.mini.remote-video .call-info { position: absolute; left: 0; right: 0; bottom: 6px; margin: 0; align-items: center; }
.call.mini.remote-video .call-avatar { display: none; }
.call.mini .call-avatar { width: 56px !important; height: 56px !important; font-size: 22px !important; animation: none; }
.call.mini .call-status { font-size: 13px; background: rgba(0,0,0,.35); padding: 1px 8px; border-radius: 10px; }
@keyframes miniIn { from { transform: scale(.6); opacity: 0; } }
/* Android picture-in-picture: the whole app shrinks to a tiny window — show just the other person. */
@media (max-width: 320px) and (max-height: 600px) {
  .call { inset: 0 !important; width: auto !important; height: auto !important; border-radius: 0 !important; }
  .call .call-controls, .call .call-local, .call .call-min, .call .call-sheet { display: none !important; }
  .call .call-info { margin: 0 !important; }
  .call .call-name { font-size: 14px !important; }
}
.call.remote-video .call-info { margin-left: 68px; }

.move-inner { background: color-mix(in srgb, var(--accent) 16%, var(--panel)); }
.move-inner > .ico { color: var(--accent); }
