/* Parivaar - mobile-first, large type for elders, light + dark */
:root {
  --pri: #3f3a9e; --pri-d: #322e83; --on-pri: #fff; --accent: #ffb347;
  --bg: #f5f3ee; --surface: #ffffff; --text: #1d1b26; --muted: #6c6a78; --line: #ebe7df;
  --chatbg: #efe9df; --mine: #e2e1ff; --theirs: #ffffff; --sys: #fff3d6; --sys-t: #5c4a1c;
  --danger: #c62828; --ok: #1e9e57; --read: #2f7cf6; --shadow: 0 1px 1.5px rgba(0, 0, 0, .13);
  --radius: 14px; font-size: 17px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --pri: #2b2873; --pri-d: #221f5e; --bg: #0f1118; --surface: #171a24; --text: #ecebf4; --muted: #9c9aab;
    --line: #262a37; --chatbg: #0c0e14; --mine: #3a368f; --theirs: #1f2330; --sys: #2a2516; --sys-t: #e8d9a8;
    --shadow: 0 1px 1.5px rgba(0, 0, 0, .5); --read: #6aa7ff;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Devanagari", sans-serif;
  background: var(--bg); color: var(--text); overscroll-behavior: none; -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }
a { color: var(--read); }
#app { position: fixed; inset: 0; display: flex; flex-direction: column; }
.screen { display: flex; flex-direction: column; height: 100%; min-height: 0; position: relative; }

/* icons */
svg.i { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
svg.i.fill { fill: currentColor; stroke: none; }
svg.i.sm { width: 15px; height: 15px; vertical-align: -2px; margin-right: 4px; }

/* top bar */
.bar {
  display: flex; align-items: center; gap: 2px; min-height: 58px; padding: 0 4px;
  padding-top: env(safe-area-inset-top); background: var(--pri); color: var(--on-pri); flex: none;
}
.bar .titles { flex: 1; min-width: 0; padding: 0 6px; }
.bar .titles.tap { cursor: pointer; }
.bar .title { font-size: 1.15rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .sub { font-size: .8rem; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .sub.typing { color: var(--accent); opacity: 1; font-weight: 600; }
.bar-av { flex: none; }
.ibtn { width: 46px; height: 46px; border: 0; background: transparent; border-radius: 50%; display: grid; place-items: center; flex: none; padding: 0; }
.ibtn:active { background: rgba(127, 127, 127, .22); }
.ibtn.sm { width: 36px; height: 36px; }
.ibtn.dark { color: var(--muted); }
.ibtn.danger { color: var(--danger); }

/* lists */
.list { flex: 1; overflow-y: auto; background: var(--surface); -webkit-overflow-scrolling: touch; padding-bottom: env(safe-area-inset-bottom); }
.row { display: flex; align-items: center; gap: 14px; padding: 11px 16px; cursor: pointer; border-bottom: 1px solid var(--line); min-height: 72px; user-select: none; }
.row:active { background: var(--line); }
.row .main { flex: 1; min-width: 0; }
.row .top { display: flex; gap: 8px; align-items: baseline; }
.row .name { flex: 1; font-weight: 600; font-size: 1.02rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .name.mono { font-family: ui-monospace, Consolas, monospace; letter-spacing: 1px; }
.row .time { font-size: .76rem; color: var(--muted); flex: none; }
.row .time.unread { color: var(--ok); font-weight: 700; }
.row .bottom { display: flex; gap: 6px; align-items: center; color: var(--muted); font-size: .9rem; margin-top: 2px; }
.row .preview { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .preview svg.tick { width: 17px; height: 17px; vertical-align: -3px; margin-right: 2px; }
.row .preview .typing { color: var(--ok); font-weight: 600; }
.row .preview .missed { color: var(--danger); }
.row.danger .name { color: var(--danger); }
.row.pick input { width: 24px; height: 24px; accent-color: var(--pri); }
.badge { background: var(--ok); color: #fff; border-radius: 12px; min-width: 24px; height: 24px; padding: 0 7px; font-size: .8rem; display: grid; place-items: center; font-weight: 700; flex: none; }
.tag { font-size: .72rem; color: var(--ok); border: 1px solid var(--ok); border-radius: 6px; padding: 0 5px; flex: none; }
.section { padding: 16px 16px 6px; font-size: .85rem; color: var(--pri); font-weight: 700; background: var(--bg); }
@media (prefers-color-scheme: dark) { .section { color: #a9a6ff; } }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.hint { padding: 24px 20px; text-align: center; }
.pad { padding: 14px 16px; }
.kv { padding: 10px 16px; color: var(--muted); font-size: .92rem; border-bottom: 1px solid var(--line); }
.lbl { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 6px; }

/* avatars */
.avatar { width: 50px; height: 50px; border-radius: 50%; flex: none; display: grid; place-items: center; color: #fff; font-weight: 700; overflow: hidden; background: #888; user-select: none; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.group svg.i { width: 55%; height: 55%; }
.avatar.icon { width: 44px; height: 44px; background: var(--line); color: var(--muted); }
.avatar.icon.pri { background: var(--pri); color: #fff; }

/* buttons + inputs */
.btn { border: 0; border-radius: 12px; padding: 12px 18px; font-weight: 600; background: var(--line); color: var(--text); display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn.primary { background: var(--pri); color: #fff; }
@media (prefers-color-scheme: dark) { .btn.primary { background: #4c47c2; } }
.btn.danger { background: var(--danger); color: #fff; }
.btn.wide { width: 100%; margin-top: 12px; }
.btn.big { font-size: 1.08rem; padding: 15px 18px; }
.btn.small { padding: 7px 12px; font-size: .85rem; }
.btn:disabled { opacity: .6; }
.btn svg.i { width: 22px; height: 22px; }
.input { width: 100%; font: inherit; padding: 13px 14px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); color: var(--text); outline: none; }
.input:focus { border-color: var(--pri); }
.input.big { font-size: 1.1rem; padding: 15px 16px; }
.input.code { text-align: center; font-size: 1.6rem; letter-spacing: 4px; font-family: ui-monospace, Consolas, monospace; text-transform: uppercase; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.err { color: var(--danger); min-height: 1.4em; margin-top: 10px; font-size: .95rem; }

/* join + splash */
.join, .splash { align-items: center; justify-content: center; padding: 24px 18px; overflow-y: auto; background: linear-gradient(180deg, var(--pri) 0 34%, var(--bg) 34%); }
.join-card { width: 100%; max-width: 420px; background: var(--surface); border-radius: 20px; padding: 28px 22px; box-shadow: 0 8px 30px rgba(0, 0, 0, .15); text-align: center; }
.join-card h1 { margin: 10px 0 2px; font-size: 1.9rem; }
.join-text { margin: 22px 0 12px; font-size: 1.02rem; }
.lock svg.i { width: 15px; height: 15px; vertical-align: -2px; }
.logo { width: 76px; height: 76px; border-radius: 22px; background: var(--pri); color: var(--accent); display: grid; place-items: center; margin: 0 auto; }
.logo svg.i { width: 44px; height: 44px; fill: var(--accent); stroke: none; }
.splash { gap: 20px; color: var(--text); }
.splash p { text-align: center; max-width: 320px; }
.spinner { width: 34px; height: 34px; border: 4px solid var(--line); border-top-color: var(--pri); border-radius: 50%; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* floating */
.fab { position: absolute; right: 18px; bottom: calc(20px + env(safe-area-inset-bottom)); width: 62px; height: 62px; border-radius: 20px; border: 0; background: var(--pri); color: #fff; box-shadow: 0 4px 14px rgba(0, 0, 0, .28); display: grid; place-items: center; }
@media (prefers-color-scheme: dark) { .fab { background: #4c47c2; } }
#conn { position: fixed; top: calc(62px + env(safe-area-inset-top)); left: 50%; transform: translate(-50%, -8px); background: #333; color: #fff; padding: 6px 14px; border-radius: 16px; font-size: .85rem; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 50; }
#conn.show { opacity: .92; transform: translate(-50%, 0); transition-delay: 1.5s; }
#toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); background: #222; color: #fff; padding: 11px 18px; border-radius: 12px; max-width: 90vw; text-align: center; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 400; font-size: .95rem; }
#toast.show { opacity: .95; transform: translate(-50%, 0); }
#banner { position: fixed; top: calc(6px + env(safe-area-inset-top)); left: 8px; right: 8px; z-index: 300; display: flex; justify-content: center; pointer-events: none; }
.banner { pointer-events: auto; width: 100%; max-width: 520px; display: flex; gap: 12px; align-items: center; background: var(--surface); color: var(--text); padding: 10px 14px; border-radius: 14px; box-shadow: 0 6px 22px rgba(0, 0, 0, .25); animation: drop .25s ease-out; cursor: pointer; }
.banner-txt { min-width: 0; flex: 1; }
.banner-title { font-weight: 700; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.banner-body { color: var(--muted); font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@keyframes drop { from { transform: translateY(-30px); opacity: 0; } }

/* overlays */
.ov { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 18px; opacity: 0; transition: opacity .15s; }
.ov.show { opacity: 1; }
.ov.bottom { align-items: flex-end; padding: 0; }
.ov.full { padding: 0; background: #000; }
.sheet { width: 100%; max-width: 560px; background: var(--surface); border-radius: 18px 18px 0 0; padding: 8px 0 calc(10px + env(safe-area-inset-bottom)); transform: translateY(30px); transition: transform .18s; }
.ov.show .sheet { transform: none; }
.sheet-title { padding: 12px 20px 6px; color: var(--muted); font-size: .9rem; font-weight: 600; }
.sheet-item { width: 100%; display: flex; align-items: center; gap: 18px; padding: 15px 22px; border: 0; background: transparent; text-align: left; font-size: 1.02rem; }
.sheet-item:active { background: var(--line); }
.sheet-item svg.i { color: var(--muted); }
.sheet-item.danger, .sheet-item.danger svg.i { color: var(--danger); }
.dialog { width: 100%; max-width: 400px; background: var(--surface); border-radius: 18px; padding: 20px; box-shadow: 0 10px 40px rgba(0, 0, 0, .3); }
.dialog-title { font-size: 1.15rem; font-weight: 700; margin-bottom: 10px; }
.dialog-body { color: var(--text); margin-bottom: 18px; line-height: 1.4; }
.dialog-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.bigcode { font-family: ui-monospace, Consolas, monospace; font-size: 2rem; font-weight: 700; letter-spacing: 4px; text-align: center; padding: 16px 8px; background: var(--bg); border-radius: 12px; margin: 6px 0 10px; user-select: all; }
.invite-box { padding: 16px; text-align: center; }

/* image viewer */
.viewer { position: absolute; inset: 0; display: flex; flex-direction: column; color: #fff; }
.viewer-bar { display: flex; align-items: center; padding: env(safe-area-inset-top) 4px 0; min-height: 58px; background: rgba(0, 0, 0, .5); }
.viewer-bar .titles { flex: 1; min-width: 0; padding: 0 6px; }
.viewer-bar .title { font-weight: 600; }
.viewer-bar .sub { font-size: .8rem; opacity: .8; }
.viewer-img { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: auto; }
.viewer-img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer-img.zoom { display: block; }
.viewer-img.zoom img { max-width: none; max-height: none; width: 200%; }
.viewer-cap { padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); background: rgba(0, 0, 0, .5); }

/* chat */
.msgs-wrap { flex: 1; min-height: 0; position: relative; display: flex; }
.msgs { flex: 1; overflow-y: auto; background: var(--chatbg); padding: 6px 10px 10px; display: flex; flex-direction: column; -webkit-overflow-scrolling: touch; }
.tobottom { position: absolute; right: 14px; bottom: 12px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--surface); color: var(--muted); box-shadow: 0 2px 8px rgba(0, 0, 0, .25); display: none; place-items: center; }
.tobottom.show { display: grid; }
.loading { flex: 1; display: grid; place-items: center; }
.loadmore { align-self: center; margin: 8px 0; }
.day { align-self: center; background: var(--surface); color: var(--muted); font-size: .76rem; padding: 5px 12px; border-radius: 8px; margin: 12px 0 6px; box-shadow: var(--shadow); position: sticky; top: 4px; z-index: 2; }
.sys { align-self: center; background: var(--sys); color: var(--sys-t); font-size: .82rem; padding: 5px 12px; border-radius: 8px; margin: 6px 0; max-width: 88%; text-align: center; box-shadow: var(--shadow); }
.m { display: flex; margin: 1.5px 0; }
.m.first { margin-top: 7px; }
.m.mine { justify-content: flex-end; }
.m.flash .bubble { animation: flash 1.2s; }
@keyframes flash { 30% { filter: brightness(.8); } }
.bubble {
  max-width: min(82%, 540px); background: var(--theirs); border-radius: var(--radius); padding: 6px 9px 7px; box-shadow: var(--shadow);
  position: relative; overflow-wrap: anywhere; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; line-height: 1.35;
}
.m.mine .bubble { background: var(--mine); }
.m.first:not(.mine) .bubble { border-top-left-radius: 4px; }
.m.first.mine .bubble { border-top-right-radius: 4px; }
.from { font-size: .83rem; font-weight: 700; margin-bottom: 2px; }
.text { white-space: pre-wrap; }
.text::after { content: ""; display: inline-block; width: 60px; height: 1px; }
.m.mine .text::after { width: 80px; }
.meta { position: absolute; right: 8px; bottom: 4px; font-size: .68rem; color: var(--muted); display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.meta svg.tick { width: 17px; height: 17px; }
svg.tick.read { color: var(--read); }
svg.tick.failed { color: var(--danger); }
.bubble.deleted { color: var(--muted); font-style: italic; }
.bubble.pad-meta { padding-bottom: 20px; }
.bubble.media-only { padding: 3px; }
.bubble.media-only .meta { background: rgba(0, 0, 0, .45); color: #fff; padding: 1px 6px; border-radius: 9px; right: 8px; bottom: 7px; }
.bubble.media-only .meta svg.tick.read { color: #9cc6ff; }
.media { position: relative; margin-bottom: 2px; }
.media img, .media video { display: block; border-radius: 11px; object-fit: cover; background: rgba(0, 0, 0, .08); max-width: 100%; }
.media img { cursor: zoom-in; }
.vdur { position: absolute; left: 8px; bottom: 7px; background: rgba(0, 0, 0, .45); color: #fff; font-size: .7rem; padding: 1px 6px; border-radius: 9px; pointer-events: none; }
.prog { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: 4px; background: rgba(0, 0, 0, .35); color: #fff; border-radius: 11px; font-size: .8rem; font-weight: 600; }
.voice .prog, .filecard .prog { position: static; background: none; color: var(--muted); display: flex; }
.prog .ring { width: 30px; height: 30px; border: 3px solid rgba(255, 255, 255, .4); border-top-color: #fff; border-radius: 50%; animation: spin 1s linear infinite; }
.voice .prog .ring, .filecard .prog .ring { width: 18px; height: 18px; border-color: var(--line); border-top-color: var(--pri); }
.quote { border-left: 4px solid var(--pri); background: rgba(127, 127, 127, .12); border-radius: 7px; padding: 4px 9px; margin-bottom: 5px; font-size: .86rem; cursor: pointer; min-width: 0; }
.qfrom { font-weight: 700; font-size: .8rem; }
.qtext { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.voice { display: flex; align-items: center; gap: 10px; min-width: 230px; padding: 2px 0; }
.voice .play { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--pri); color: #fff; display: grid; place-items: center; flex: none; }
.voice .play svg.i { width: 18px; height: 18px; }
.acol { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.abar { height: 5px; background: rgba(127, 127, 127, .3); border-radius: 3px; position: relative; cursor: pointer; }
.abar::before { content: ""; position: absolute; inset: -10px 0; }
.afill { height: 100%; width: 0; background: var(--pri); border-radius: 3px; }
@media (prefers-color-scheme: dark) { .afill { background: #a9a6ff; } }
.atime { font-size: .72rem; color: var(--muted); }
.filecard { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); background: rgba(127, 127, 127, .12); padding: 10px; border-radius: 10px; min-width: 220px; }
.ficon { width: 40px; height: 40px; border-radius: 8px; background: var(--pri); color: #fff; display: grid; place-items: center; flex: none; }
.fmeta { flex: 1; min-width: 0; }
.fname { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .92rem; }
.fsize { font-size: .75rem; color: var(--muted); }
.callrow { justify-content: center; margin: 8px 0; }
.callpill { display: inline-flex; align-items: center; gap: 8px; border: 0; background: var(--surface); padding: 8px 14px; border-radius: 18px; box-shadow: var(--shadow); color: var(--text); font-size: .9rem; }
.callpill svg.i { width: 18px; height: 18px; color: var(--ok); }
.callpill.missed svg.i, .callpill.missed span:first-of-type { color: var(--danger); }
.ctime { font-size: .72rem; color: var(--muted); }
.replybar { display: flex; align-items: center; gap: 6px; padding: 6px 8px 0 12px; background: var(--chatbg); }
.replybar .quote { flex: 1; margin: 0; background: var(--surface); }
.composer, .recbar { display: flex; align-items: flex-end; gap: 6px; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); background: var(--chatbg); flex: none; }
.composer .box { flex: 1; min-width: 0; display: flex; align-items: flex-end; background: var(--surface); border-radius: 26px; padding: 2px 2px 2px 14px; box-shadow: var(--shadow); }
.composer textarea { flex: 1; min-width: 0; border: 0; outline: 0; resize: none; background: transparent; color: var(--text); font: inherit; font-size: 1.05rem; padding: 11px 4px; max-height: 140px; line-height: 1.3; }
.composer .attach { width: 44px; height: 46px; color: var(--muted); }
.sendbtn { width: 52px; height: 52px; border-radius: 50%; border: 0; background: var(--pri); color: #fff; display: grid; place-items: center; flex: none; }
@media (prefers-color-scheme: dark) { .sendbtn, .voice .play, .ficon { background: #4c47c2; } }
.recbar { align-items: center; padding-left: 8px; }
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--danger); animation: blink 1s infinite; }
.rec-time { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 48px; }
.rec-label { flex: 1; color: var(--muted); }
@keyframes blink { 50% { opacity: .2; } }

/* info + profile */
.info-head { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 24px 16px 18px; background: var(--surface); border-bottom: 8px solid var(--bg); text-align: center; }
.info-name { font-size: 1.4rem; font-weight: 700; display: flex; align-items: center; gap: 4px; margin-top: 8px; }
.info-actions { display: flex; gap: 12px; margin-top: 14px; }
.act { display: flex; flex-direction: column; align-items: center; gap: 4px; border: 1px solid var(--line); background: transparent; border-radius: 14px; padding: 10px 14px; min-width: 88px; color: var(--pri); font-size: .82rem; }
@media (prefers-color-scheme: dark) { .act { color: #a9a6ff; } }
.profile-av { position: relative; cursor: pointer; }
.profile-av .cam { position: absolute; right: 2px; bottom: 2px; width: 42px; height: 42px; border-radius: 50%; background: var(--pri); color: #fff; display: grid; place-items: center; border: 3px solid var(--surface); }

/* calls */
#call-root { position: fixed; inset: 0; z-index: 250; }
.call { position: absolute; inset: 0; background: #12131c; color: #fff; display: flex; flex-direction: column; overflow: hidden; }
.call.incoming { background: radial-gradient(circle at 50% 30%, #3f3a9e 0, #12131c 70%); justify-content: space-between; padding: calc(60px + env(safe-area-inset-top)) 20px calc(40px + env(safe-area-inset-bottom)); }
.call-center { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.call-name { font-size: 1.6rem; font-weight: 700; }
.call-status { opacity: .85; font-size: 1rem; font-variant-numeric: tabular-nums; }
.call-answer { display: flex; justify-content: space-around; padding-bottom: 30px; }
.ans { display: flex; flex-direction: column; align-items: center; gap: 10px; font-size: .95rem; opacity: .95; }
.round { width: 72px; height: 72px; border-radius: 50%; border: 0; display: grid; place-items: center; color: #fff; }
.round svg.i { width: 32px; height: 32px; }
.round.red { background: #e53935; }
.round.green { background: #22b35e; }
.round.pulse { animation: pulse 1.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(34, 179, 94, .6); } 100% { box-shadow: 0 0 0 22px rgba(34, 179, 94, 0); } }
svg.i.hang { transform: rotate(135deg); }
.call-top { position: absolute; top: 0; left: 0; right: 0; padding: calc(28px + env(safe-area-inset-top)) 16px 30px; text-align: center; background: linear-gradient(rgba(0, 0, 0, .55), transparent); z-index: 3; pointer-events: none; }
.call.is-audio .call-top { background: none; padding-top: calc(70px + env(safe-area-inset-top)); }
.tiles { position: absolute; inset: 0; display: grid; gap: 3px; background: #000; }
.call.is-audio .tiles { background: transparent; place-content: center; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 18px; padding: 170px 20px 150px; }
.call.is-video .tiles[data-n="2"] { grid-template-rows: 1fr 1fr; }
.call.is-video .tiles[data-n="3"], .call.is-video .tiles[data-n="4"] { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.call.is-video .tiles[data-n="5"], .call.is-video .tiles[data-n="6"], .call.is-video .tiles[data-n="7"] { grid-template-columns: 1fr 1fr; grid-template-rows: repeat(4, 1fr); }
.tile { position: relative; display: grid; place-items: center; background: #1d1f2b; overflow: hidden; min-height: 0; }
.call.is-audio .tile { background: transparent; gap: 8px; }
.tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; }
.tile.has-video video { opacity: 1; }
.tile.has-video .tile-av { display: none; }
.tile-name { position: absolute; left: 10px; top: 10px; font-size: .85rem; background: rgba(0, 0, 0, .4); padding: 2px 8px; border-radius: 8px; z-index: 1; }
.tiles[data-n="1"] .tile:first-child .tile-name, .tiles[data-n="2"] .tile:first-child .tile-name,
.tiles:not([data-n="1"]):not([data-n="2"]) .tile:nth-child(-n+2) .tile-name { top: calc(96px + env(safe-area-inset-top)); }
.call.is-audio .tile-name { position: static; background: none; font-size: 1rem; }
.tile-state { position: absolute; top: 45%; font-size: .85rem; opacity: .8; }
.call.is-audio .tile-state { position: static; }
.tile.live .tile-state { display: none; }
.tile.waiting { background: transparent; }
.call.is-video .tile.waiting { background: #1d1f2b; }
video.local { position: absolute; right: 12px; bottom: calc(118px + env(safe-area-inset-bottom)); width: 108px; height: 150px; object-fit: cover; border-radius: 12px; z-index: 4; background: #222; box-shadow: 0 2px 10px rgba(0, 0, 0, .5); }
video.local.mirror { transform: scaleX(-1); }
video.local.off { opacity: .15; }
.call-ctrls { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; align-items: center; gap: 12px; padding: 18px 10px calc(22px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, rgba(0, 0, 0, .6)); z-index: 5; flex-wrap: wrap; }
.cbtn { display: flex; flex-direction: column; align-items: center; gap: 5px; border: 0; background: transparent; color: #fff; font-size: .72rem; width: 64px; }
.cbtn svg.i { width: 54px; height: 54px; padding: 14px; border-radius: 50%; background: rgba(255, 255, 255, .16); }
.cbtn.on svg.i { background: #fff; color: #12131c; }
.round.end { width: 64px; height: 64px; margin-bottom: 18px; }
body.in-call #banner, body.in-call #conn { display: none; }

@media (min-width: 900px) {
  #app { max-width: 900px; margin: 0 auto; box-shadow: 0 0 30px rgba(0, 0, 0, .12); }
}
