:root {
  color-scheme: light dark;
  --bg: #f6f7fb; --card: #fff; --fg: #14161c; --mut: #636a7a; --line: #e3e6ee;
  --accent: #4f46e5; --accent-fg: #fff; --accent-soft: #eef0ff;
  --ok: #0f8a4a; --warn: #b26200; --bad: #c62828; --warn-soft: #fff5e6;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1115; --card: #181b22; --fg: #eceef3; --mut: #9aa1b2; --line: #2a2f3a;
    --accent: #8b85ff; --accent-fg: #0f1115; --accent-soft: #23233d;
    --ok: #4cc585; --warn: #f0a640; --bad: #ff7b72; --warn-soft: #2d2415;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1115; --card: #181b22; --fg: #eceef3; --mut: #9aa1b2; --line: #2a2f3a;
  --accent: #8b85ff; --accent-fg: #0f1115; --accent-soft: #23233d;
  --ok: #4cc585; --warn: #f0a640; --bad: #ff7b72; --warn-soft: #2d2415;
}
:root[data-theme="light"] { color-scheme: light; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; background: var(--bg); color: var(--fg);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
body.dragging main { outline: 3px dashed var(--accent); outline-offset: -8px; border-radius: 20px; }
main { max-width: 560px; margin: 0 auto; padding: 8px 16px 48px; }
[hidden] { display: none !important; }
h1 { font-size: 26px; line-height: 1.25; margin: 24px 0 8px; letter-spacing: -0.01em; }
h2 { font-size: 18px; margin: 0 0 12px; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--mut); margin: 24px 4px 8px; }
.lead { color: var(--mut); margin: 0 0 24px; }
.mut { color: var(--mut); } .small { font-size: 13px; } .center { text-align: center; }
.fine { color: var(--mut); font-size: 13px; margin-top: 20px; }

.bar { max-width: 560px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; gap: 10px; align-items: center; font-weight: 700; color: inherit; text-decoration: none; font-size: 17px; }
.logo { width: 28px; height: 28px; border-radius: 8px; background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M16 7v13m0 0l-5-5m5 5l5-5M9 24h14' stroke='white' stroke-width='3' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/100% no-repeat; }

button { font: inherit; color: var(--fg); background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 9px 16px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:hover { border-color: var(--mut); }
button:disabled { opacity: .5; cursor: default; }
button.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); font-weight: 600; }
button.ghost { background: transparent; border-color: transparent; color: var(--mut); }
button.link { background: none; border: 0; padding: 4px 6px; color: var(--accent); font-weight: 600; }
.row { display: flex; gap: 8px; align-items: center; } .row.end { justify-content: flex-end; } .row.centered { justify-content: center; }

.choices { display: grid; gap: 12px; }
.choice { display: flex; gap: 16px; align-items: center; text-align: left; padding: 18px; border-radius: var(--radius); width: 100%; }
.choice b { display: block; font-size: 18px; }
.choice small { display: block; color: var(--mut); font-size: 14px; font-weight: 400; }
.choice.primary small { color: inherit; opacity: .85; }

.ic { width: 44px; height: 44px; flex: none; border-radius: 12px; background: var(--accent-soft); position: relative; }
.choice.primary .ic { background: rgba(255,255,255,.18); }
.ic::after { content: ""; position: absolute; inset: 0; background: currentColor; -webkit-mask: var(--m) center/24px no-repeat; mask: var(--m) center/24px no-repeat; }
.choice:not(.primary) .ic::after, .big .ic::after { background: var(--accent); }
.ic-down { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 4v11m0 0l-5-5m5 5l5-5M5 20h14' stroke='black' stroke-width='2.2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.ic-up { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 16V5m0 0L7 10m5-5l5 5M5 20h14' stroke='black' stroke-width='2.2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.ic-plus { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 5v14M5 12h14' stroke='black' stroke-width='2.4' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 12px 0; }
.card.warn { background: var(--warn-soft); border-color: transparent; }
.card.shared { display: flex; gap: 12px; align-items: center; justify-content: space-between; border-color: var(--accent, currentColor); }
.card.shared p { margin: 0; }
.pair { text-align: center; }
.qr { width: min(240px, 70vw); aspect-ratio: 1; margin: 4px auto 8px; background: #fff; border-radius: 12px; padding: 10px; }
.qr svg { width: 100%; height: 100%; display: block; }
.linkrow { display: flex; gap: 8px; margin: 12px 0 4px; }
.linkrow input { flex: 1; min-width: 0; font: 14px ui-monospace, SFMono-Regular, Menlo, monospace; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--fg); }

.status { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 16px 4px; font-weight: 500; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--mut); flex: none; }
.status.ok .dot { background: var(--ok); }
.status.wait .dot { background: var(--warn); animation: pulse 1.2s ease-in-out infinite; }
.status.bad .dot { background: var(--bad); }
@keyframes pulse { 50% { opacity: .3; } }
.badge { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); }

.drop { margin: 8px 0; text-align: center; }
.big { width: 100%; display: flex; align-items: center; justify-content: center; gap: 12px; padding: 16px; border: 2px dashed var(--line); border-radius: var(--radius); font-weight: 600; font-size: 17px; background: var(--card); }
.big .ic { width: 36px; height: 36px; }
.big.primary { border-style: solid; }
.big.quiet { padding: 10px; font-size: 15px; border-width: 1px; }
.big.quiet .ic { width: 28px; height: 28px; }
.big.quiet .ic::after { -webkit-mask-size: 18px; mask-size: 18px; }
#room { display: flex; flex-direction: column; }
#room.recv #lists { order: 1; } #room.recv .drop { order: 2; margin-top: 20px; } #room.recv #storageNote { order: 4; }
.big.primary .ic { background: rgba(255,255,255,.18); } .big.primary .ic::after { background: currentColor; }
@media (hover: none) { .hide-touch { display: none; } }

.textbox summary { cursor: pointer; font-weight: 600; color: var(--mut); }
.textbox[open] summary { margin-bottom: 10px; }
textarea { width: 100%; font: inherit; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--fg); resize: vertical; margin-bottom: 8px; }

.listhead { display: flex; align-items: baseline; gap: 12px; }
.listhead #saveAll { margin-left: auto; }
.items { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
#room > * { min-width: 0; }
.item { min-width: 0; }
#missing li, .toast { overflow-wrap: anywhere; }
.item { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.item .top { display: flex; align-items: center; gap: 10px; }
.item .name { flex: 1; min-width: 0; font-weight: 600; display: flex; white-space: nowrap; cursor: default; }
.item .name .head { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.item .name .tail { flex: none; }
.item .name.full { display: block; white-space: normal; overflow-wrap: anywhere; }
.item .text { flex: 1; min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 9em; overflow: auto; font-size: 15px; }
.item .meta { font-size: 13px; color: var(--mut); margin-top: 6px; display: flex; justify-content: space-between; gap: 8px; }
.item .meta .st.ok { color: var(--ok); font-weight: 600; } .item .meta .st.bad { color: var(--bad); } .item .meta .st.wait { color: var(--warn); }
.bar-track { height: 6px; border-radius: 99px; background: var(--line); margin-top: 8px; overflow: hidden; }
.bar-fill { height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width .25s linear; }
.item.done .bar-fill { background: var(--ok); }
.item.paused .bar-fill { background: var(--warn); }
.item .x { padding: 4px 8px; border: 0; background: none; color: var(--mut); font-size: 18px; line-height: 1; }
.item .acts { display: flex; gap: 6px; }
.item .acts button { padding: 6px 12px; font-size: 14px; }

.big-ic { width: 64px; height: 64px; margin: 32px auto 0; border-radius: 50%; background: var(--accent-soft); }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; max-width: calc(100vw - 32px); box-shadow: 0 6px 24px rgba(0,0,0,.2); z-index: 10; }

/* header tools */
.tools { display: flex; gap: 4px; align-items: center; }
.iconbtn { width: 40px; height: 40px; padding: 0; display: grid; place-items: center; background: transparent; border-color: transparent; border-radius: 10px; color: var(--mut); }
.iconbtn:hover { background: var(--card); border-color: var(--line); color: var(--fg); }
.ic-s { width: 22px; height: 22px; background: currentColor; -webkit-mask: var(--m) center/contain no-repeat; mask: var(--m) center/contain no-repeat; }
.ic-install { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3v12m0 0l-4.5-4.5M12 15l4.5-4.5M4 17v2a2 2 0 002 2h12a2 2 0 002-2v-2'/%3E%3C/svg%3E"); }
.ic-theme { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 12.8A9 9 0 1111.2 3a7 7 0 009.8 9.8z'/%3E%3C/svg%3E"); }
:root[data-theme="dark"] .ic-theme { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='4.5'/%3E%3Cpath d='M12 2v2m0 16v2M4.9 4.9l1.4 1.4m11.4 11.4l1.4 1.4M2 12h2m16 0h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4'/%3E%3C/svg%3E"); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .ic-theme { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='4.5'/%3E%3Cpath d='M12 2v2m0 16v2M4.9 4.9l1.4 1.4m11.4 11.4l1.4 1.4M2 12h2m16 0h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4'/%3E%3C/svg%3E"); }
}

/* content below the tool */
body:not([data-screen="home"]) .info { display: none; }
#info { scroll-margin-top: 64px; }
.info { max-width: 560px; margin: 8px auto 0; padding: 32px 16px 8px; border-top: 1px solid var(--line); }
.info > h2 { font-size: 20px; margin: 0 0 8px; }
.info > h2 + details, .info > p + details { margin-top: 16px; }
.info > p { color: var(--mut); margin: 0; }
.info > h2:not(:first-child) { margin-top: 32px; }
.info details { border-bottom: 1px solid var(--line); }
.info summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 2px; }
.info summary::-webkit-details-marker { display: none; }
.info summary h3 { margin: 0; font-size: 16px; font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--fg); }
.info summary::after { content: "+"; font-size: 22px; line-height: 1; color: var(--mut); flex: none; transition: transform .2s; }
.info details[open] summary::after { transform: rotate(45deg); }
.info summary:hover h3 { color: var(--accent); }
.info details p, .info details ol { color: var(--mut); margin: 0 0 12px; }
.info details ol { padding-left: 22px; } .info details li { margin: 4px 0; }
.info details b { color: var(--fg); font-weight: 600; }

.foot { max-width: 560px; margin: 0 auto; padding: 24px 16px calc(24px + env(safe-area-inset-bottom)); text-align: center; color: var(--mut); font-size: 13px; }
.foot p { margin: 0; }
.foot a { color: var(--accent); text-decoration: none; font-weight: 600; }
.foot a:hover { text-decoration: underline; }

/* device name */
.me { margin: -8px 4px 8px; }
.me b { color: var(--fg); }
.me .link { font-size: 13px; padding: 2px 4px; }

/* chat */
body[data-screen="room"] main { padding-bottom: 96px; }
.fab { position: fixed; right: calc(20px + env(safe-area-inset-right)); bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 20; width: 56px; height: 56px; border-radius: 50%; padding: 0; display: grid; place-items: center; background: var(--accent); color: var(--accent-fg); border: 0; box-shadow: 0 6px 20px rgba(0,0,0,.25); }
.fab:hover { filter: brightness(1.08); }
.fab .ic-s { width: 26px; height: 26px; }
.fab.on .ic-chat { --m: var(--m-close); }
.unread { position: absolute; top: -2px; right: -2px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 99px; background: var(--bad); color: #fff; font-size: 12px; font-weight: 700; line-height: 22px; text-align: center; }
:root { --m-close: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E"); }
.ic-chat { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M4 5h16v11H9l-5 4z'/%3E%3C/svg%3E"); }
.ic-close { --m: var(--m-close); }
.ic-send { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 12l16-8-6 16-3-7z'/%3E%3C/svg%3E"); }

.chat { position: fixed; z-index: 19; display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 12px 40px rgba(0,0,0,.25); overflow: hidden;
  right: calc(20px + env(safe-area-inset-right)); bottom: calc(88px + env(safe-area-inset-bottom)); width: 360px; height: min(520px, calc(100dvh - 120px)); }
.chat[hidden] { display: none; }
.chat-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 8px 10px 16px; border-bottom: 1px solid var(--line); }
.chat-head b { display: block; font-size: 15px; }
.chat-head small { display: block; font-size: 12px; color: var(--ok); }
.chat.offline .chat-head small { color: var(--mut); }
.msgs { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; background: var(--bg); }
.chat-empty { margin: auto; text-align: center; color: var(--mut); font-size: 14px; max-width: 240px; }
.msg { max-width: 82%; display: flex; flex-direction: column; }
.msg.in { align-self: flex-start; } .msg.out { align-self: flex-end; align-items: flex-end; }
.bubble { padding: 8px 12px; border-radius: 16px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; }
.msg.in .bubble { background: var(--card); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg.out .bubble { background: var(--accent); color: var(--accent-fg); border-bottom-right-radius: 4px; }
.msg-meta { display: flex; gap: 6px; align-items: center; font-size: 11px; color: var(--mut); margin: 2px 4px 0; }
.msg-meta .link { font-size: 11px; padding: 0 2px; }
.chat-form { display: flex; gap: 8px; align-items: flex-end; padding: 10px; border-top: 1px solid var(--line); background: var(--card); }
.chat-form textarea { margin: 0; resize: none; min-height: 42px; max-height: 140px; padding: 9px 12px; border-radius: 20px; }
.chat-form .send { width: 42px; height: 42px; flex: none; padding: 0; border-radius: 50%; display: grid; place-items: center; }

@media (max-width: 640px) {
  .chat { inset: 0; width: auto; height: auto; border-radius: 0; border: 0; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); z-index: 30; }
  body.chat-open { overflow: hidden; }
  body.chat-open .fab { display: none; }
}

/* nearby devices */
.nearby { margin-top: 28px; }
.nearby h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--mut); margin: 0 4px 10px; }
.nearby p { margin: 8px 4px; }
.peers { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.peer { width: 100%; display: flex; align-items: center; gap: 10px; text-align: left; padding: 12px; border-radius: var(--radius); }
.peer:hover { border-color: var(--accent); }
.avatar { width: 38px; height: 38px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.avatar { position: relative; }
.avatar .online { position: absolute; right: -1px; bottom: -1px; width: 13px; height: 13px; border-radius: 50%; background: #22c55e; border: 2.5px solid var(--card); }
.who { min-width: 0; }
.who b, .who small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who small { color: var(--mut); font-size: 12px; }
.invite { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--fg); padding: 20px; max-width: min(360px, calc(100vw - 32px)); box-shadow: 0 12px 40px rgba(0,0,0,.3); }
.invite::backdrop { background: rgba(0,0,0,.4); }
.invite p { margin: 0 0 16px; }

/* files in the chat */
.chat-form .attach { width: 42px; height: 42px; flex: none; padding: 0; border-radius: 50%; display: grid; place-items: center; background: transparent; border-color: transparent; color: var(--mut); }
.chat-form .attach:hover { color: var(--accent); }
.ic-attach { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 11.5l-8.6 8.6a5 5 0 01-7.1-7.1l8.6-8.6a3.3 3.3 0 014.7 4.7l-8.6 8.6a1.7 1.7 0 01-2.4-2.4l7.9-7.9'/%3E%3C/svg%3E"); }
.msg.file { max-width: 86%; min-width: 0; }
.msg.file .bubble { display: flex; flex-direction: column; gap: 2px; min-width: 0; max-width: 100%; }
.msg.file .name { display: flex; white-space: nowrap; font-weight: 600; min-width: 0; }
.msg.file .name .head { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.msg.file .name .tail { flex: none; }
.msg.file .name.full { display: block; white-space: normal; overflow-wrap: anywhere; }
.msg.file small { font-size: 12px; opacity: .85; }

/* WhatsApp-style chat: media, download, ticks, typing */
.bubble.has-media { padding: 4px; }
.bubble .media { display: block; max-width: 100%; width: 260px; max-height: 320px; object-fit: cover; border-radius: 12px; background: #000; cursor: zoom-in; }
.bubble video.media { cursor: default; object-fit: contain; }
.bubble.has-media small { padding: 4px 8px 2px; }
.bubble .bar-track { margin-top: 6px; }
.filerow { display: flex; align-items: center; gap: 8px; min-width: 0; }
.filerow .ic-s { flex: none; width: 26px; height: 26px; opacity: .8; }
.ic-file { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M6 2h8l5 5v15H6z'/%3E%3Cpath d='M14 2v5h5'/%3E%3C/svg%3E"); }
.ic-check { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 12.5l5 5L20 6.5'/%3E%3C/svg%3E"); }
.dl { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--accent); color: var(--accent-fg); border-color: transparent; }
.dl .ic-s { width: 15px; height: 15px; }
.dl.done { background: var(--accent-soft); color: var(--ok); }
.tick { display: inline-block; width: 18px; height: 12px; background: var(--mut); -webkit-mask: var(--m) center/contain no-repeat; mask: var(--m) center/contain no-repeat;
  --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 16' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 8.5l4 4L18 3'/%3E%3C/svg%3E"); }
.tick.delivered, .tick.seen { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 16' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 8.5l4 4L14 3M10 12.5L19 3'/%3E%3C/svg%3E"); }
.tick.seen { background: #34b7f1; }
.typing .bubble { display: flex; gap: 4px; padding: 12px 14px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--mut); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
.typing[hidden] { display: none; }
@keyframes blink { 0%, 60%, 100% { opacity: .25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
.viewer { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: rgba(0,0,0,.92); color: #fff; }
.viewer[open] { display: flex; flex-direction: column; }
.viewer-bar { display: flex; align-items: center; gap: 8px; padding: 10px 12px; padding-top: max(10px, env(safe-area-inset-top)); }
.viewer-bar span:first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-bar .iconbtn { color: #fff; background: transparent; border-color: transparent; }
.viewer-body { flex: 1; min-height: 0; display: grid; place-items: center; padding: 8px; }
.viewer-body img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* group chat */
.ghead { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 8px 0 12px; }
.ghead small { display: block; color: var(--mut); font-size: 13px; margin-top: 2px; }
.bubble .who { display: block; font-size: 12px; color: var(--accent); margin-bottom: 2px; }
#gTyping small { margin: 2px 6px; font-size: 11px; }
.gtargets { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 8px; text-align: left; }
.gtarget { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius); }
.gtarget .who b { display: block; } .gtarget .who small { color: var(--mut); }

/* ---------- landing / home (2026 redesign) ---------- */
.ic-lock { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='10' width='16' height='11' rx='2.5'/%3E%3Cpath d='M8 10V7a4 4 0 018 0v3'/%3E%3C/svg%3E"); }
.ic-users { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='8' r='3.5'/%3E%3Cpath d='M2.5 20a6.5 6.5 0 0113 0M16 4.6a3.5 3.5 0 010 6.8M18 14.5a6.5 6.5 0 013.5 5.5'/%3E%3C/svg%3E"); }
.ic-clip { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='5' y='4' width='14' height='17' rx='2.5'/%3E%3Cpath d='M9 4V3h6v1M9 11h6M9 15h4'/%3E%3C/svg%3E"); }
.ic-inf { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M12 12c-2-2.7-3.6-4-5.5-4a4 4 0 000 8c1.9 0 3.5-1.3 5.5-4zm0 0c2 2.7 3.6 4 5.5 4a4 4 0 000-8c-1.9 0-3.5 1.3-5.5 4z'/%3E%3C/svg%3E"); }
.ic-folder { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M3 6.5A1.5 1.5 0 014.5 5H10l2 2.5h7.5A1.5 1.5 0 0121 9v9.5a1.5 1.5 0 01-1.5 1.5h-15A1.5 1.5 0 013 18.5z'/%3E%3C/svg%3E"); }
.ic-bell { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9a6 6 0 0112 0c0 5 2 6.5 2 6.5H4S6 14 6 9zM10 19a2 2 0 004 0'/%3E%3C/svg%3E"); }
.ic-wifi { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M2.5 9a14 14 0 0119 0M5.5 12.5a9.5 9.5 0 0113 0M8.7 16a5 5 0 016.6 0'/%3E%3Ccircle cx='12' cy='19.2' r='1.2' fill='black'/%3E%3C/svg%3E"); }
.ic-retry { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 12a8 8 0 11-2.3-5.6M20 4v4.5h-4.5'/%3E%3C/svg%3E"); }
.ic-phone { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Crect x='6.5' y='2.5' width='11' height='19' rx='2.5'/%3E%3Cpath d='M11 18.5h2'/%3E%3C/svg%3E"); }
.ic-laptop { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'%3E%3Crect x='4.5' y='5' width='15' height='10.5' rx='1.5'/%3E%3Cpath d='M2 19h20'/%3E%3C/svg%3E"); }

body[data-screen="home"] main, body[data-screen="home"] .bar, .info, .foot { max-width: 1080px; }
.hero { display: grid; gap: 28px; padding: 12px 0 8px; }
.eyebrow { display: inline-flex; align-items: center; gap: 6px; margin: 8px 0 0; padding: 5px 12px 5px 10px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-size: 13px; font-weight: 600; }
.eyebrow .ic-s { width: 15px; height: 15px; }
.hero h1 { font-size: clamp(32px, 6vw, 52px); line-height: 1.08; letter-spacing: -0.03em; margin: 16px 0 14px; }
.hero .lead { font-size: 18px; max-width: 520px; margin-bottom: 18px; }
.ticks-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; color: var(--mut); }
.ticks-list li { display: flex; gap: 10px; align-items: center; }
.ticks-list li::before { content: ""; width: 18px; height: 18px; flex: none; border-radius: 50%; background: var(--accent-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234f46e5' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4 8-9'/%3E%3C/svg%3E") center/12px no-repeat; }
.start { background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 16px; box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 18px 50px -20px rgba(79,70,229,.35); align-self: start; }
.go { width: 100%; display: flex; align-items: center; gap: 14px; text-align: left; padding: 18px; border: 0; border-radius: 16px; color: #fff;
  background: linear-gradient(135deg, #6366f1, #4f46e5 55%, #7c3aed); box-shadow: 0 10px 24px -10px rgba(79,70,229,.8); transition: transform .15s; }
.go:hover { transform: translateY(-1px); }
.go b { display: block; font-size: 19px; } .go small { display: block; opacity: .85; font-size: 14px; }
.go .ic { background: rgba(255,255,255,.18); } .go .ic::after { background: #fff; }
.go .arrow { margin-left: auto; font-size: 22px; opacity: .9; }
.devices { margin: 2px 0 14px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.devhead { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin: 0 2px 10px; }
.devhead h2 { font-size: 15px; margin: 0; }
.devhead { align-items: center; flex-wrap: nowrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-width: 0; max-width: 62%; padding: 5px 10px; border-radius: 99px; font-size: 13px; font-weight: 600; color: var(--mut); background: var(--bg); }
.chip .myName { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip .ic-s { width: 14px; height: 14px; flex: none; }
.chip .pen { opacity: .7; }
.devices .empty { text-align: center; padding: 18px 12px 10px; border: 1.5px dashed var(--line); border-radius: 16px; }
.devices .empty p { margin: 0 0 12px; font-size: 15px; }
.ghosts { display: flex; justify-content: center; gap: 12px; margin-bottom: 12px; }
.ghosts > span { width: 52px; height: 52px; border-radius: 16px; background: var(--accent-soft); }
.ghosts > span { display: grid; place-items: center; }
.ghosts .ic-s { width: 26px; height: 26px; color: var(--accent); opacity: .6; }
.ghost-add { display: grid; place-items: center; color: var(--accent); font-size: 26px; font-weight: 600; border: 1.5px dashed var(--accent); background: none !important; }
.empty .add { padding: 10px 22px; }
.empty .scan { display: flex; justify-content: center; align-items: center; gap: 8px; margin: 12px 0 0 !important; font-size: 12px !important; }
.pulse { width: 8px; height: 8px; }
.pulse { width: 10px; height: 10px; flex: none; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 rgba(15,138,74,.5); animation: pulse 1.8s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 10px rgba(15,138,74,0); } 100% { box-shadow: 0 0 0 0 rgba(15,138,74,0); } }
@media (min-width: 900px) {
  .hero { grid-template-columns: 1.1fr 1fr; gap: 56px; padding-top: 40px; align-items: center; }
}

.info { padding: 8px 16px; border-top: 0; }
.sec { padding: 56px 0 8px; }
.kicker { margin: 0 0 6px; color: var(--accent); font-weight: 700; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; }
.info .sec > h2 { font-size: clamp(24px, 4vw, 34px); letter-spacing: -0.02em; line-height: 1.15; margin: 0 0 12px; }
.sub { color: var(--mut); max-width: 640px; margin: 0 0 28px; }
.features { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.features li { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 20px; }
.features .fi { display: block; width: 42px; height: 42px; border-radius: 12px; background: var(--accent-soft); position: relative; -webkit-mask: none; mask: none; margin-bottom: 14px; }
.features .fi::after { content: ""; position: absolute; inset: 10px; background: var(--accent); -webkit-mask: var(--m) center/contain no-repeat; mask: var(--m) center/contain no-repeat; }
.features h3 { margin: 0 0 6px; font-size: 16px; text-transform: none; letter-spacing: 0; color: var(--fg); }
.features p { margin: 0; color: var(--mut); font-size: 14.5px; }
.steps { list-style: none; counter-reset: s; margin: 0 0 16px; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.steps li { counter-increment: s; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 20px; position: relative; }
.steps li::before { content: counter(s); display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: var(--accent-fg); font-weight: 700; margin-bottom: 12px; }
.steps b { font-size: 16px; } .steps p { color: var(--mut); margin: 6px 0 0; font-size: 14.5px; }
.steps p b { font-size: inherit; color: var(--fg); }
.flow { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 24px; margin-bottom: 20px; }
.flow .node { display: flex; flex-direction: column; align-items: center; gap: 8px; flex: none; font-size: 14px; }
.flow .node .ic-s { width: 40px; height: 40px; color: var(--accent); }
.link-line { flex: 1; position: relative; height: 2px; background: repeating-linear-gradient(90deg, var(--accent) 0 10px, transparent 10px 16px); background-size: 32px 2px; animation: flow 1s linear infinite; }
.link-line span { position: absolute; left: 50%; top: -30px; transform: translateX(-50%); white-space: nowrap; font-size: 12px; font-weight: 600; color: var(--accent); background: var(--accent-soft); padding: 3px 10px; border-radius: 99px; }
@keyframes flow { to { background-position: 32px 0; } }
@media (prefers-reduced-motion: reduce) { .link-line, .pulse { animation: none; } }
.how { margin: 0; padding-left: 20px; color: var(--mut); display: grid; gap: 10px; }
.how b { color: var(--fg); }
.cta { margin: 56px 0 24px; padding: 36px 24px; text-align: center; border-radius: 22px; color: #fff; background: linear-gradient(135deg, #4f46e5, #7c3aed); }
.cta h2 { font-size: 28px; margin: 0 0 6px; } .cta p { margin: 0 0 18px; opacity: .9; }
.cta button { background: #fff; color: #4f46e5; border-color: #fff; padding: 12px 24px; font-size: 16px; }
.foot nav { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 20px; margin-bottom: 8px; }
.foot nav a { color: var(--mut); font-weight: 500; }
@media (max-width: 899px) { .ticks-list { display: none; } .hero { gap: 18px; padding-top: 0; } .hero .lead { margin-bottom: 0; font-size: 16px; } .hero h1 { font-size: 30px; margin: 12px 0 8px; } .eyebrow { font-size: 12px; } }

/* legal pages */
.legal { max-width: 760px; margin: 0 auto; padding: 16px 16px 48px; }
.legal h1 { font-size: clamp(30px, 5vw, 40px); letter-spacing: -0.02em; margin: 24px 0 4px; }
.legal .updated { color: var(--mut); margin: 0 0 24px; }
.legal .summary { background: var(--accent-soft); border-radius: 16px; padding: 16px 20px; margin: 0 0 28px; }
.legal .summary ul { margin: 8px 0 0; padding-left: 20px; }
.legal h2 { font-size: 20px; margin: 32px 0 8px; }
.legal h3 { font-size: 16.5px; margin: 22px 0 4px; }
.legal ul { padding-left: 22px; }
.legal li { margin: 6px 0; line-height: 1.55; }
.legal p, .legal li { color: var(--fg); opacity: .92; }
.legal table { width: 100%; border-collapse: collapse; font-size: 14.5px; margin: 8px 0 16px; display: block; overflow-x: auto; }
.legal th, .legal td { text-align: left; vertical-align: top; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.legal th { color: var(--mut); font-weight: 600; font-size: 13px; }
.legal a { color: var(--accent); }

/* the device row: compact, share-sheet style */
.devrow { list-style: none; margin: 0 -16px; padding: 4px 16px 2px; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity; }
.devrow::-webkit-scrollbar { display: none; }
.devrow li { flex: none; scroll-snap-align: start; }
.dev { width: 76px; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 4px 2px; border: 0; background: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.dev .avatar { width: 56px; height: 56px; font-size: 22px; }
.dev:hover .avatar { box-shadow: 0 0 0 2px var(--accent); }
.dev .nm { max-width: 100%; font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dev .online { width: 14px; height: 14px; }
.dev .near { position: absolute; top: -2px; right: -2px; width: 20px; height: 20px; border-radius: 50%; background: var(--card); box-shadow: 0 0 0 1px var(--line); }
.dev .near::after { content: ''; position: absolute; inset: 4px; background: var(--accent); -webkit-mask: var(--m) center/contain no-repeat; mask: var(--m) center/contain no-repeat; }
.dev.add .avatar { background: none; border: 1.5px dashed var(--accent); font-weight: 500; font-size: 26px; }
.dev.add .nm { color: var(--accent); }
.hero > *, .devices { min-width: 0; }

/* ---------- app shell ---------- */
body { display: flex; flex-direction: column; }
body > main, body > .bar, body > .info, body > .foot { width: 100%; box-sizing: border-box; }
body > main { flex: 1 0 auto; }
.endbtn { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 8px 14px 8px 10px; border-radius: 99px; border: 0; font-weight: 600; font-size: 14px; color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, transparent); }
.endbtn .ic-s { width: 18px; height: 18px; }
.endbtn:hover { filter: brightness(1.1); }
.status { margin: 12px 0; padding: 12px 14px; gap: 12px; flex-wrap: nowrap; background: var(--card); border: 1px solid var(--line); border-radius: 18px; }
.pav { position: relative; flex: none; width: 44px; height: 44px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 700; font-size: 18px; }
.pav::before { content: attr(data-i); }
.pav .dot { position: absolute; right: -1px; bottom: -1px; width: 13px; height: 13px; margin: 0; border: 2.5px solid var(--card); }
.status .st { min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; line-height: 1.3; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.chips .chip { max-width: 100%; min-height: 36px; padding: 6px 12px; }
.chip.accent { color: var(--accent); background: var(--accent-soft); border-color: transparent; }
.tonal { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.tonal button { min-height: 52px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 16px; border: 0; font-weight: 600; font-size: 15px; color: var(--accent); background: var(--accent-soft); }
.tonal button[hidden] { display: none; }
.tonal .ic-s { width: 20px; height: 20px; }

@media (max-width: 899px) {
  .bar { position: sticky; top: 0; z-index: 15; padding-top: calc(10px + env(safe-area-inset-top)); margin-top: calc(-1 * env(safe-area-inset-top)); background: color-mix(in srgb, var(--bg) 88%, transparent); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
  .iconbtn { min-width: 44px; min-height: 44px; }
  body[data-screen="room"] .foot, body[data-screen="group"] .foot, body[data-screen="offline"] .foot { display: none; }
  body[data-screen="room"] main { display: flex; flex-direction: column; padding-bottom: 0; }
  #room:not([hidden]) { flex: 1; display: flex; flex-direction: column; }
  #room .drop, #room.recv .drop { order: 10; position: sticky; bottom: 0; z-index: 5; margin: auto -16px 0; padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); background: var(--bg); border-top: 1px solid var(--line); border-radius: 22px 22px 0 0; box-shadow: 0 -8px 24px -12px rgba(0,0,0,.18); }
  #room .drop .big { min-height: 60px; border-radius: 18px; }
  #room .drop .hide-touch { display: none; }
  body[data-screen="room"] .fab { bottom: calc(170px + env(safe-area-inset-bottom)); }
  .foot { padding-top: 32px; }
}
.chips .chip { background: var(--card); border: 1px solid var(--line); color: var(--fg); }
.chips .chip.accent { color: var(--accent); background: var(--accent-soft); border-color: transparent; }

/* avatars */
.avatar::before, .myAv::before { content: attr(data-i); }
.avatar.img, .pav.img, .myAv.img { background-size: cover; background-position: center; }
.avatar.emoji, .pav.emoji { background: var(--accent-soft); }
.dev .avatar.emoji { font-size: 30px; }
.pav.emoji { font-size: 24px; }
.myAv { flex: none; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; color: var(--accent); background: var(--accent-soft); }
.myAv.emoji { background: none; font-size: 16px; }
.ic-gear { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M19.4 15a1.7 1.7 0 00.3 1.8l.1.1a2 2 0 11-2.8 2.8l-.1-.1a1.7 1.7 0 00-1.8-.3 1.7 1.7 0 00-1 1.5V21a2 2 0 11-4 0v-.1a1.7 1.7 0 00-1.1-1.5 1.7 1.7 0 00-1.8.3l-.1.1a2 2 0 11-2.8-2.8l.1-.1a1.7 1.7 0 00.3-1.8 1.7 1.7 0 00-1.5-1H3a2 2 0 110-4h.1a1.7 1.7 0 001.5-1.1 1.7 1.7 0 00-.3-1.8l-.1-.1a2 2 0 112.8-2.8l.1.1a1.7 1.7 0 001.8.3H9a1.7 1.7 0 001-1.5V3a2 2 0 114 0v.1a1.7 1.7 0 001 1.5 1.7 1.7 0 001.8-.3l.1-.1a2 2 0 112.8 2.8l-.1.1a1.7 1.7 0 00-.3 1.8V9a1.7 1.7 0 001.5 1H21a2 2 0 110 4h-.1a1.7 1.7 0 00-1.5 1z'/%3E%3C/svg%3E"); }

/* settings sheet */
.sheet { width: min(440px, 100%); max-width: 100%; margin: auto; padding: 8px 20px calc(20px + env(safe-area-inset-bottom)); border: 1px solid var(--line); border-radius: 24px; background: var(--card); color: var(--fg); }
.sheet::backdrop { background: rgba(0,0,0,.45); }
.sheet h2 { margin: 8px 0 16px; font-size: 20px; }
.sheet-grip { width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 4px auto 0; }
.setav { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 18px; }
.avatar.xl { width: 72px; height: 72px; font-size: 30px; }
.avatar.xl.emoji { font-size: 40px; }
.emojis { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; }
.emojis .em { padding: 0; aspect-ratio: 1; font-size: 20px; border: 0; border-radius: 10px; background: var(--bg); min-width: 32px; }
.avacts { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.avacts button { min-height: 40px; }
.field { display: grid; gap: 6px; font-weight: 600; font-size: 14px; }
.field input { font: inherit; font-weight: 400; padding: 12px 14px; min-height: 48px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--fg); }
.wide { width: 100%; min-height: 50px; border-radius: 14px; font-size: 16px; }
@media (max-width: 899px) {
  .sheet { margin: auto 0 0; width: 100%; border-radius: 24px 24px 0 0; border-bottom: 0; }
  .emojis { grid-template-columns: repeat(6, 1fr); }
}

/* unsend and downloaded */
.bubble.unsent { font-style: italic; opacity: .75; background: none !important; color: var(--mut) !important; border: 1px dashed var(--line) !important; }
.link.unsend { font-size: 12px; padding: 2px 4px; }
.dlmark { display: inline-flex; align-items: center; gap: 1px; color: #34b7f1; }
.dlmark .ic-s { width: 13px; height: 13px; background: #34b7f1; }

/* offline mode */
.off { text-align: center; }
.offbtns { display: grid; gap: 12px; margin-top: 16px; }
#offQrBox { display: grid; gap: 12px; justify-items: center; }
#offQrBox[hidden], #offScan[hidden], .offbtns[hidden] { display: none; }
#offQrBox .qr { margin: 8px auto 4px; }
#offVideo { width: 100%; max-width: 360px; aspect-ratio: 1; object-fit: cover; border-radius: 18px; background: #000; margin: 8px auto; display: block; }
#offScan details { margin-top: 8px; text-align: left; }
#offScan summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: 14px; }
#offState { margin: 12px 0 0; min-height: 1.2em; color: var(--mut); }

.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; margin-top: 10px; padding: 8px 0; border-top: 1px solid var(--line); cursor: pointer; }
.toggle span { display: grid; }
.toggle small { color: var(--mut); font-size: 13px; }
.toggle input { appearance: none; -webkit-appearance: none; flex: none; width: 48px; height: 28px; border-radius: 99px; background: var(--line); position: relative; cursor: pointer; transition: background .15s; margin: 0; }
.toggle input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.toggle input:checked { background: var(--accent); }
.toggle input:checked::after { transform: translateX(20px); }
.toggle input:disabled { opacity: .4; }
.tick.queued { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='8'/%3E%3Cpath d='M12 8v4l3 2'/%3E%3C/svg%3E"); width: 13px; }

/* ---------- chat app (2026-09-29): chat list home, full-screen conversations ---------- */
.ic-back { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M15 5l-7 7 7 7' stroke='black' stroke-width='2.4' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.ic-more { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='5' r='2'/%3E%3Ccircle cx='12' cy='12' r='2'/%3E%3Ccircle cx='12' cy='19' r='2'/%3E%3C/svg%3E"); }
.ic-trash { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 7h16M9 7V4h6v3M6 7l1 13h10l1-13M10 11v6M14 11v6' stroke='black' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }

/* home: chat list */
.chats { margin: 0 0 14px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.chatlist { list-style: none; margin: 0 -8px; padding: 0; display: grid; }
.crow { width: 100%; display: flex; gap: 12px; align-items: center; padding: 10px 8px; border: 0; border-radius: 14px; background: none; text-align: left; }
.crow:hover { background: var(--bg); }
.crow .avatar { width: 52px; height: 52px; font-size: 21px; }
.crow .avatar.emoji { font-size: 28px; }
.crow .avatar .online { width: 14px; height: 14px; }
.cmid { flex: 1; min-width: 0; display: grid; gap: 2px; }
.ctop, .cbot { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ctop b { flex: 1; min-width: 0; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctop time { flex: none; font-size: 12px; color: var(--mut); }
.csub { flex: 1; min-width: 0; font-size: 14px; color: var(--mut); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.csub.ok { color: var(--ok); font-weight: 600; } .csub.wait { color: var(--warn); } .csub.bad { color: var(--bad); }
.cunread { flex: none; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 99px; background: var(--ok); color: #fff; font-size: 12px; font-weight: 700; line-height: 22px; text-align: center; }
.ctag { flex: none; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; color: var(--mut); background: var(--bg); border: 1px solid var(--line); }
.nochats { margin: 4px 2px 0; }

/* the conversation */
.conv:not([hidden]) { display: flex; flex-direction: column; }
.convbar { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 4px; border-bottom: 1px solid var(--line); background: var(--card); }
.convbar .pav { width: 42px; height: 42px; font-size: 17px; }
.convbar .pav .dot { background: var(--mut); }
.conv[data-st="ok"] .pav .dot { background: #22c55e; }
.conv[data-st="wait"] .pav .dot { background: var(--warn); animation: pulse 1.2s ease-in-out infinite; }
.conv[data-st="bad"] .pav .dot { background: var(--bad); }
.convwho { flex: 1; min-width: 0; display: grid; line-height: 1.25; }
.convwho b { font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.convbar .status { all: unset; display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 13px; color: var(--mut); }
.convbar #statusText { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv[data-st="ok"] #statusText { color: var(--ok); }
.convbar .badge { font-size: 11px; padding: 1px 7px; flex: none; }
.back { position: relative; }
.backcount { position: absolute; top: 2px; right: -2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--ok); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; }
.convscroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 12px; display: flex; flex-direction: column; background: var(--bg); }
.convscroll .pair { margin: 4px 0 12px; }
.convscroll .pair .qr { width: min(220px, 60vw); }
.msgshost { flex: 1 0 auto; display: flex; flex-direction: column; }
.msgshost > .msgs { flex: 1 0 auto; overflow: visible; padding: 4px 0; background: none; }
.sysnote { align-self: center; max-width: 90%; margin: 4px 0; padding: 4px 12px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-size: 12.5px; font-weight: 600; text-align: center; }
.msg.old { opacity: .78; }
.conv .chat-form { padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); }
.conv .chat-form textarea { background: var(--bg); }
@media (min-width: 900px) {
  body[data-screen="room"] main, body[data-screen="group"] main { max-width: 760px; padding-bottom: 16px; }
  .conv:not([hidden]) { height: calc(100dvh - 150px); min-height: 480px; border: 1px solid var(--line); border-radius: 22px; overflow: hidden; background: var(--card); }
}
@media (max-width: 899px) {
  body[data-screen="room"] .bar, body[data-screen="room"] .foot, body[data-screen="group"] .bar { display: none; }
  body[data-screen="room"], body[data-screen="group"] { overflow: hidden; }
  /* Exactly the visible area: when the keyboard opens the chat shrinks above it
     (--vvt/--vvh come from visualViewport in ui.js), so the header stays put. */
  .conv:not([hidden]) { position: fixed; left: 0; right: 0; top: var(--vvt, 0px); height: var(--vvh, 100dvh); z-index: 10; background: var(--card); padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left); }
  /* home reads like an app: sections on the page, no card around them */
  .start { background: none; border: 0; box-shadow: none; padding: 0; }
  body.has-chats .hero-text { display: none; }
}

/* sheets: attach, chat menu, saved chat */
.attachgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 10px; margin: 16px 0 12px; }
.attachgrid button { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 6px; border: 0; border-radius: 18px; font-size: 13px; font-weight: 600; color: var(--accent); background: var(--accent-soft); }
.attachgrid button[hidden] { display: none; }
.attachgrid .ic-s { width: 26px; height: 26px; }
.menurow { width: 100%; display: flex; gap: 14px; align-items: center; text-align: left; padding: 12px 2px; min-height: 60px; border: 0; border-top: 1px solid var(--line); border-radius: 0; background: none; }
.menurow > span:last-child { display: grid; }
.menurow small { color: var(--mut); font-size: 13px; font-weight: 400; }
.menurow .ic-s { flex: none; color: var(--mut); }
.menurow.accent, .menurow.accent .ic-s { color: var(--accent); }
.menurow.danger, .menurow.danger .ic-s { color: var(--bad); }
#convDlg .toggle { margin-top: 0; }
.sheet.tall[open] { display: flex; flex-direction: column; max-height: 88dvh; }
.histhead { display: flex; align-items: center; justify-content: space-between; }
.histhead h2 { margin: 8px 0; }
.histmsgs { flex: 1; min-height: 160px; max-height: 55dvh; border-radius: 14px; margin: 8px 0 12px; }
.histacts { gap: 8px; } .histacts button { flex: 1; min-height: 46px; }
.dangerbtn { color: var(--bad); }
body[data-screen="room"] .toast { bottom: calc(84px + env(safe-area-inset-bottom)); }

/* replies and voice messages */
.ic-mic { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Crect x='9' y='3' width='6' height='11' rx='3'/%3E%3Cpath d='M5 11a7 7 0 0 0 14 0M12 18v3'/%3E%3C/svg%3E"); }
.msg { touch-action: pan-y; position: relative; }
.msg.swipe-ok::before { content: "↩"; position: absolute; left: -34px; top: 50%; transform: translateY(-50%); width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.msg.flash .bubble { animation: flash 1.2s ease; }
@keyframes flash { 0%, 40% { box-shadow: 0 0 0 3px var(--accent); } 100% { box-shadow: 0 0 0 0 transparent; } }
.rbtn { display: none; }
@media (hover: hover) { .msg:hover .rbtn { display: inline-block; } }
.quote { display: grid; width: 100%; min-width: 120px; margin: 0 0 6px; padding: 5px 10px; border: 0; border-left: 3px solid var(--accent); border-radius: 8px; background: color-mix(in srgb, var(--accent) 10%, transparent); color: inherit; text-align: left; font-size: 13px; line-height: 1.35; }
.msg.out .quote { border-left-color: currentColor; background: rgba(255,255,255,.18); }
.quote b { font-size: 12.5px; color: var(--accent); }
.msg.out .quote b { color: inherit; }
.quote span { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; opacity: .85; white-space: normal; }
.bubble.has-media .quote { margin: 4px 4px 6px; width: auto; }
.replybar { display: flex; align-items: center; gap: 8px; padding: 8px 8px 0 14px; background: var(--card); border-top: 1px solid var(--line); }
.replybar > div { flex: 1; min-width: 0; display: grid; padding: 4px 10px; border-left: 3px solid var(--accent); border-radius: 8px; background: var(--bg); font-size: 13px; }
.replybar b { color: var(--accent); font-size: 12.5px; }
.replybar span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--mut); }
.replybar:not([hidden]) + .chat-form { border-top: 0; }
.chat-form { position: relative; }
.chat-form .send[hidden] { display: none; }
.mic { touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.recbar { position: absolute; inset: 0; display: flex; align-items: center; gap: 12px; padding: 0 10px 0 18px; background: var(--card); z-index: 2; pointer-events: none; }
.recbar.locked { pointer-events: auto; }
.recdot { width: 12px; height: 12px; border-radius: 50%; background: var(--bad); animation: pulse 1s ease-in-out infinite; flex: none; }
.rectime { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 42px; }
.rechint { flex: 1; color: var(--mut); font-size: 14px; text-align: center; }
.recbar .recdel, .recbar .recsend { display: none; }
.recbar.locked .rechint { visibility: hidden; }
.recbar.locked .recdel { display: grid; color: var(--bad); }
.recbar.locked .recsend { display: grid; }
.chat-form.recording .mic { position: relative; z-index: 3; transform: scale(1.15); background: var(--bad); border-color: var(--bad); }
.chat-form.recording:has(.recbar.locked) .mic { visibility: hidden; }
.bubble.has-voice { padding: 6px 8px; }
.bubble audio.voice { display: block; width: 240px; max-width: 100%; height: 40px; }
.bubble.has-voice small { padding: 2px 4px 0; display: block; }

/* voice player */
.ic-play { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 4.5v15l13-7.5z'/%3E%3C/svg%3E"); }
.ic-pause { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='6' y='4.5' width='4' height='15' rx='1'/%3E%3Crect x='14' y='4.5' width='4' height='15' rx='1'/%3E%3C/svg%3E"); }
.vplayer { display: flex; align-items: center; gap: 10px; width: 250px; max-width: 100%; padding: 2px 2px 0; }
.vplay { flex: none; width: 40px; height: 40px; padding: 0; border-radius: 50%; display: grid; place-items: center; border: 0; background: var(--accent); color: var(--accent-fg); }
.msg.out .vplay { background: rgba(255,255,255,.22); color: inherit; }
.vplayer.playing .ic-play { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='6' y='4.5' width='4' height='15' rx='1'/%3E%3Crect x='14' y='4.5' width='4' height='15' rx='1'/%3E%3C/svg%3E"); }
.vwave { flex: 1; min-width: 0; height: 30px; display: flex; align-items: center; gap: 2px; cursor: pointer; }
.vwave i { flex: 1; min-height: 3px; border-radius: 2px; background: currentColor; opacity: .3; transition: opacity .15s; }
.vwave i.on { opacity: 1; }
.msg.in .vwave i { background: var(--accent); }
.vtime { flex: none; font-size: 12px; font-variant-numeric: tabular-nums; opacity: .85; min-width: 32px; text-align: right; }
.convscroll > .msgs { flex: 1 0 auto; overflow: visible; padding: 4px 0; background: none; }
.convscroll > .card.pair { flex: none; }
body[data-screen="group"] .toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
.ctop b .gi { width: 15px; height: 15px; margin-right: 5px; vertical-align: -2px; color: var(--mut); }
.gform { border: 0; }

/* Safety code: 12 groups of 5 digits */
.safety { display: grid; grid-template-columns: repeat(4, auto); justify-content: center; gap: 8px 16px; margin: 14px 0 6px; font: 600 17px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .04em; }
.gsafety { max-height: 50vh; overflow: auto; }
.gsafety h3 { margin: 12px 0 0; font-size: 15px; }
.gsafety .safety { margin-top: 6px; }

/* header matches the width of the chat under it */
body[data-screen="room"] .bar, body[data-screen="group"] .bar { max-width: 760px; }

/* contacts grouped by how they can be reached */
.devgroup + .devgroup { margin-top: 8px; }
.devcap { margin: 0 2px 2px; font-size: 12px; font-weight: 600; color: var(--mut); }
.visnote { margin: 8px 2px 0; }
.ic-globe { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M3 12h18M12 3c2.5 2.6 3.7 5.6 3.7 9s-1.2 6.4-3.7 9c-2.5-2.6-3.7-5.6-3.7-9S9.5 5.6 12 3z'/%3E%3C/svg%3E"); }
.toggle select { flex: none; max-width: 52%; font: inherit; font-size: 14px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--fg); }

/* add buttons: a drawn plus, always centred */
.dev.add .avatar .ic-s, .ghost-add .ic-s { width: 26px; height: 26px; color: var(--accent); opacity: 1; }

/* online users: people who are not contacts, with filter tabs */
.online { margin-top: 2px; }
#onlineHint { margin: 4px 2px 0; }
.sysnote.held .link { font-size: inherit; padding: 0 2px; }
#inviteFrom { margin: -8px 0 14px; }
.row.end .dangerbtn { margin-right: auto; }

/* in-app confirmation dialogs (lib/ask.js) */
.askdlg { width: min(380px, calc(100vw - 32px)); }
.askdlg h2 { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; font-size: 18px; }
.askdlg p { margin: 0 0 12px; color: var(--mut); font-size: 15px; }
.askdlg .row { margin-top: 18px; }
.askic { width: 26px; height: 26px; flex: none; color: var(--accent); }
.askic.bad { color: var(--bad); }
button.primary.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.ic-shield { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round' stroke-linecap='round'%3E%3Cpath d='M12 3l7.5 3v5.5c0 4.6-3.2 8.2-7.5 9.5-4.3-1.3-7.5-4.9-7.5-9.5V6z'/%3E%3Cpath d='M12 8v4.5M12 16h.01'/%3E%3C/svg%3E"); }
.ic-isp { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='9' r='1.6'/%3E%3Cpath d='M12 11l-4 10m4-10l4 10M9.6 17h4.8M7.8 5.2a6 6 0 000 7.6M16.2 5.2a6 6 0 010 7.6M5 2.8a9.5 9.5 0 000 12.4M19 2.8a9.5 9.5 0 010 12.4'/%3E%3C/svg%3E"); }

/* online people: heading and a joined filter on one line */
.onhead { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 2px 10px; }
.onhead h2 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 15px; }
.oncount { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px 2px 7px; border-radius: 99px; background: color-mix(in srgb, var(--ok) 12%, transparent); color: var(--ok); font-size: 12.5px; }
.oncount .pulse { width: 8px; height: 8px; }
.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); flex: none; }
.seg button { display: inline-flex; align-items: center; gap: 4px; min-height: 30px; padding: 4px 9px; border: 0; border-radius: 9px; background: none; font-size: 12.5px; font-weight: 600; color: var(--mut); }
.seg button .ic-s { width: 14px; height: 14px; }
.seg button small { min-width: 16px; padding: 0 4px; border-radius: 99px; font-size: 10.5px; line-height: 16px; text-align: center; background: var(--line); color: var(--fg); }
.seg button small:empty { display: none; }
.seg button[aria-selected="true"] { background: var(--card); color: var(--accent); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.seg button[aria-selected="true"] small { background: var(--accent); color: var(--accent-fg); }
.onsearch { width: 100%; margin: 0 0 8px; font: inherit; font-size: 14px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--fg); }
.ongrid { list-style: none; margin: 0; padding: 2px 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 4px 6px; justify-items: center; }
.ongrid.scroll { max-height: 392px; overflow-y: auto; overscroll-behavior: contain; }
.onmore { display: block; margin: 4px auto 0; }
@media (max-width: 380px) { .seg button { padding: 4px 7px; } .seg button .ic-s { display: none; } }

/* a stranger's files wait: a security card in the chat */
.seccard { align-self: center; display: flex; gap: 12px; max-width: min(420px, 94%); margin: 6px 0; padding: 14px 16px; border-radius: 16px; background: var(--card); border: 1px solid color-mix(in srgb, var(--warn) 45%, var(--line)); box-shadow: 0 2px 10px -6px rgba(0,0,0,.25); }
.seccard > .ic-s { flex: none; width: 26px; height: 26px; color: var(--warn); }
.seccard b { display: block; margin-bottom: 2px; }
.seccard p { margin: 0 0 10px; color: var(--mut); font-size: 14px; }
.seccard .row button { min-height: 38px; }
button.link.dangerbtn { color: var(--bad); }

/* ---------- app layout (2026-09-30): tabs on phones, split view on computers ---------- */
/* Which home sections show under each tab: Chats, People or Send. */
body[data-tab="chats"] #home [data-pane]:not([data-pane~="chats"]),
body[data-tab="people"] #home [data-pane]:not([data-pane~="people"]),
body[data-tab="calls"] #home [data-pane]:not([data-pane~="calls"]) { display: none; }
/* Under Chats, contacts are just a row of avatars, and only when there are some. */
body[data-tab="chats"]:not(.has-contacts) #home .contacts,
body[data-tab="chats"] #noPeers, body[data-tab="chats"] .visnote { display: none; }
body[data-tab="chats"] #home .contacts { margin-bottom: 6px; padding-bottom: 8px; }
.chats { border-bottom: 0; }
.hero { display: block; padding: 0; }
.welcome .hero-text { min-width: 0; }

.tabbar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 0; padding: 6px 4px; border: 0; border-radius: 14px; background: none; color: var(--mut); font-size: 12px; font-weight: 600; }
.tabbar button:hover { color: var(--fg); }
.tabbar button[aria-current="page"] { color: var(--accent); }
.tbic { position: relative; display: grid; place-items: center; width: 56px; height: 30px; border-radius: 99px; transition: background .15s; }
.tabbar button[aria-current="page"] .tbic { background: var(--accent-soft); }
.tbic .ic-s { width: 22px; height: 22px; }
.tbn { position: absolute; top: -4px; right: 6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--ok); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
.tbn.on { background: var(--accent); color: var(--accent-fg); }

.crow.cur { background: var(--accent-soft); }
.chats .devhead .iconbtn { width: 36px; height: 36px; min-width: 0; min-height: 0; color: var(--accent); }
@media (max-width: 899px) { .chats .devhead .iconbtn { display: none; } }
.fab { z-index: 14; }
body:not([data-screen="home"]) .fab, body:not([data-screen="home"]) .tabbar, body:not([data-screen="home"]) #welcome { display: none; }

@media (max-width: 899px) {
  /* A tab bar fixed at the bottom, like a phone app. */
  .tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 16; display: grid; grid-template-columns: repeat(4, 1fr); padding: 6px max(8px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)); background: color-mix(in srgb, var(--card) 92%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border-top: 1px solid var(--line); }
  body[data-screen="home"] { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
  body[data-screen="home"] main { padding-bottom: 88px; }
  .fab { right: calc(16px + env(safe-area-inset-right)); bottom: calc(84px + env(safe-area-inset-bottom)); border-radius: 18px; }
  /* The intro only greets a first visit, above an empty chat list. */
  body.has-chats #welcome, body:not([data-tab="chats"]) #welcome { display: none; }
  #welcome { padding: 4px 0 12px; }
  body[data-screen="home"].has-chats .info, body[data-screen="home"].has-chats .foot,
  body[data-screen="home"]:not([data-tab="chats"]) .info, body[data-screen="home"]:not([data-tab="chats"]) .foot { display: none; }
  body[data-tab="people"] #home .contacts, body[data-tab="calls"] .callsec { padding-top: 4px; }
}

@media (min-width: 900px) {
  /* A web app: a rail of tabs, the list beside it, and the chat on the right. */
  body > .bar, body[data-screen] > .bar { max-width: 1400px; padding: 10px 20px; }
  body > main:not(.legal), body[data-screen] > main {
    max-width: 1400px; width: calc(100% - 40px); margin: 0 auto 20px; padding: 0;
    height: calc(100dvh - 80px); min-height: 540px;
    display: grid; grid-template-columns: 76px minmax(320px, 400px) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr);
    background: var(--card); border: 1px solid var(--line); border-radius: 22px; overflow: hidden;
    box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 24px 60px -30px rgba(79,70,229,.35);
  }
  .tabbar { grid-column: 1; grid-row: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 6px; background: var(--bg); border-right: 1px solid var(--line); }
  .tabbar button { width: 64px; padding: 6px 2px; font-size: 11.5px; }
  .tabbar .tbic { width: 48px; height: 34px; }
  .tabbar .tbn { right: 0; }
  #tabSettings { margin-top: auto; }
  body:not([data-screen="home"]) .tabbar { display: flex; }
  #home { grid-column: 2; grid-row: 1; position: relative; overflow-y: auto; overscroll-behavior: contain; padding: 16px 14px 90px; border-right: 1px solid var(--line); }
  #home .start { background: none; border: 0; box-shadow: none; padding: 0; }
  #welcome, #room, #group, #offline, #message { grid-column: 3; grid-row: 1; min-width: 0; min-height: 0; }
  #welcome { display: grid; place-items: center; padding: 40px; background: var(--bg); overflow: auto; }
  #welcome .hero-text { max-width: 560px; }
  #welcome h1 { font-size: clamp(30px, 3.2vw, 44px); }
  body:not([data-screen="home"]) #welcome { display: none; }
  .conv:not([hidden]) { height: auto; min-height: 0; border: 0; border-radius: 0; }
  #offline, #message { overflow: auto; padding: 32px 24px; background: var(--bg); }
  #offline > .card { max-width: 480px; margin: 0 auto; }
  .fab { display: none; }
  #home { padding-bottom: 24px; }
  .info, .foot { max-width: 1400px; }
}
.nochats-acts { display: flex; gap: 10px; margin: 14px 0 4px; }
.nochats-acts button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; border-radius: 14px; font-weight: 600; }
.nochats-acts .ic-s { width: 20px; height: 20px; }
body.has-chats .nochats-acts { display: none; }
@media (min-width: 900px) { .convscroll > .card.pair { width: 100%; max-width: 460px; align-self: center; } }
/* The add circle has no initials: without the empty letter the plus sits dead centre. */
.dev.add .avatar::before { content: none; }
.dev.add .avatar .ic-s { position: absolute; inset: 0; margin: auto; }

/* settings: blocked people, moving, what stays in the browser */
#settingsDlg[open] { max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain; }
/* Done is always in reach, pinned to the bottom of the sheet. */
.setdone { position: sticky; bottom: calc(-20px - env(safe-area-inset-bottom)); z-index: 2; margin: 12px -20px calc(-20px - env(safe-area-inset-bottom)); padding: 12px 20px calc(12px + env(safe-area-inset-bottom)); background: var(--card); border-top: 1px solid var(--line); box-shadow: 0 -10px 20px -14px rgba(0,0,0,.25); }
/* A bigger grab area for swiping a sheet down. */
.sheet-grip { position: relative; }
.sheet-grip::after { content: ''; position: absolute; inset: -14px -60px; }
.setblock { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.sethead { display: flex; align-items: center; justify-content: space-between; min-height: 32px; }
.sethead .link { font-size: 13px; }
.sethead small { font-size: 12.5px; }
.usage { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 12px; }
.usage .uhead { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.usage .uhead small { color: var(--mut); font-variant-numeric: tabular-nums; }
.usage .bar-track { margin-top: 6px; }
.usage li.full .bar-fill { background: var(--bad); }
.blist { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 2px; max-height: 260px; overflow-y: auto; }
.brow { display: flex; align-items: center; gap: 12px; padding: 6px 0; }
.brow .avatar { width: 40px; height: 40px; font-size: 16px; }
.bmid { flex: 1; min-width: 0; display: grid; line-height: 1.3; }
.bmid b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bmid small { color: var(--mut); font-size: 12.5px; }
.brow button { flex: none; min-height: 36px; padding: 6px 14px; font-size: 14px; font-weight: 600; }
#moveRow { margin-top: 10px; }
.storenote { margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: var(--bg); }
.storenote b { color: var(--fg); }

/* moving to another device */
.ticks-list.movelist { display: grid; margin: 0 0 14px; font-size: 15px; }
.movelist li { align-items: flex-start; }
.movelist li::before { margin-top: 3px; }
#moveDlg .card.warn { margin: 0 0 14px; }
#moveDlg .qr { width: min(240px, 64vw); }
#moveConfirm p { margin: 4px 0 8px; }
.movecode { margin: 10px auto 12px; font: 700 44px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .2em; color: var(--accent); text-indent: .2em; }
#moveProg { margin: 14px 0 4px; }
#moveProg .bar-track { height: 8px; }
#moveState { min-height: 1.4em; margin: 12px 0; color: var(--mut); }
#moveGo { margin-top: 4px; }

/* trust bar: live usage numbers under the intro (first visit only, like the intro).
   Icon and text inline, with no border or background, so nothing looks like a button. */
.trustbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 22px; margin: 22px 0 0; }
.tbstat { display: inline-flex; align-items: center; gap: 8px; font-size: 14.5px; color: var(--mut); }
.tbstat b { color: var(--fg); font-variant-numeric: tabular-nums; }
.tbstat .ic-s { width: 18px; height: 18px; color: var(--accent); }
.tbstat .pulse { width: 9px; height: 9px; }
.tbstat + .tbstat { position: relative; }
.tbstat + .tbstat::before { content: ''; position: absolute; left: -11px; top: 50%; width: 1px; height: 16px; margin-top: -8px; background: var(--line); }
@media (max-width: 899px) {
  .trustbar { justify-content: center; margin-top: 16px; }
  .tbstat { font-size: 13.5px; }
}
@media (max-width: 899px) {
  /* first visit: the trust bar follows the chat buttons, and the page has no empty gap */
  #trustBar { margin: 4px 0 8px; }
  body.has-chats #trustBar, body:not([data-tab="chats"]) #trustBar, body:not([data-screen="home"]) #trustBar { display: none; }
  body[data-screen="home"]:not(.has-chats) > main { flex: none; }
}
@media (max-width: 899px) {
  body[data-screen="home"]:not(.has-chats) main { padding-bottom: 8px; }
  body[data-screen="home"]:not(.has-chats) .info .sec:first-child { padding-top: 28px; }
}

/* ---------- calls (call.js) ---------- */
.ic-call { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M5 4h4l2 5-2.5 1.5a11 11 0 005 5L15 13l5 2v4a2 2 0 01-2 2A16 16 0 013 6a2 2 0 012-2z'/%3E%3C/svg%3E"); }
.ic-video { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'%3E%3Crect x='2.5' y='6' width='13' height='12' rx='2.5'/%3E%3Cpath d='M15.5 10.5l6-3.5v10l-6-3.5z'/%3E%3C/svg%3E"); }
.ic-flip { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 12a8 8 0 0113.7-5.6L20 8.5M20 4v4.5h-4.5M20 12a8 8 0 01-13.7 5.6L4 15.5M4 20v-4.5h4.5'/%3E%3C/svg%3E"); }
.ic-down2 { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 9l7 7 7-7' stroke='black' stroke-width='2.4' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.convbar .callbtn { color: var(--accent); }
.convbar .callbtn:disabled { color: var(--mut); opacity: .45; }

.callscr { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: calc(16px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom)); background: radial-gradient(120% 90% at 50% 20%, #2b2a5a, #0b0c12 70%); color: #fff; overflow: hidden; }
.callremote { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; visibility: hidden; }
.callscr.video .callremote { visibility: visible; }
.callscr.blur.video .callremote { filter: blur(28px) brightness(.7); }
.callunblur { position: absolute; top: 40%; left: 50%; transform: translateX(-50%); z-index: 3; max-width: 86%; padding: 12px 18px; border: 0; border-radius: 14px; background: rgba(0,0,0,.55); color: #fff; font-weight: 600; }
.calltop { position: absolute; top: calc(8px + env(safe-area-inset-top)); left: 8px; z-index: 3; }
.calltop .iconbtn { color: #fff; } .calltop .iconbtn:hover { background: rgba(255,255,255,.12); border-color: transparent; }
.callwho { position: relative; z-index: 2; display: grid; justify-items: center; gap: 6px; margin-bottom: auto; margin-top: 12vh; text-align: center; text-shadow: 0 1px 6px rgba(0,0,0,.5); }
.callwho .pav { width: 108px; height: 108px; font-size: 44px; box-shadow: 0 0 0 8px rgba(255,255,255,.06), 0 0 0 18px rgba(255,255,255,.03); }
.callwho .pav.emoji { font-size: 58px; }
.callwho b { font-size: 24px; }
.callwho small { font-size: 15px; opacity: .85; font-variant-numeric: tabular-nums; }
.callscr.video .callwho { margin-top: 0; flex-direction: row; }
.callscr.video .callwho .pav { display: none; }
.calllocal { position: absolute; z-index: 2; right: 14px; bottom: calc(118px + env(safe-area-inset-bottom)); width: 28vw; max-width: 180px; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 16px; background: #000; box-shadow: 0 6px 24px rgba(0,0,0,.45); display: none; }
.callscr.selfcam .calllocal { display: block; }
.callscr:not(.rear) .calllocal { transform: scaleX(-1); } /* the front camera shows like a mirror */
.callwarn { position: relative; z-index: 2; margin: 0 0 14px; padding: 9px 14px; border-radius: 12px; background: rgba(240,166,64,.92); color: #1b1300; font-size: 14px; font-weight: 600; text-align: center; max-width: 520px; }
.callbar, .callring { position: relative; z-index: 2; display: flex; gap: 18px; justify-content: center; align-items: flex-start; }
.cbtn { width: 62px; height: 62px; padding: 0; border: 0; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.16); color: #fff; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); position: relative; }
.cbtn:hover { background: rgba(255,255,255,.26); }
.cbtn .ic-s { width: 26px; height: 26px; }
.cbtn[aria-pressed="true"]#callMute { background: #fff; color: #111; }
.cbtn[aria-pressed="true"]#callSpk { background: #fff; color: #111; }
.ic-spk { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 9.5h3.5L12 5.5v13l-4.5-4H4z'/%3E%3Cpath d='M15.5 9a4 4 0 010 6M18 6.5a7.5 7.5 0 010 11'/%3E%3C/svg%3E"); }
/* At the ear during an audio call: pure black, every touch swallowed (lib/earmode.js). */
.calllock { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: flex-end; justify-content: center; padding-bottom: calc(40px + env(safe-area-inset-bottom)); background: #000; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.calllock[hidden] { display: none; }
.calllock small { color: rgba(255,255,255,.28); font-size: 13px; }
.cbtn#callMute[aria-pressed="true"]::after, .cbtn#callCam[aria-pressed="false"]::after { content: ''; position: absolute; width: 30px; height: 2.5px; border-radius: 2px; background: currentColor; transform: rotate(-45deg); }
.cbtn:disabled { opacity: .4; }
.cbtn.end { background: #e5484d; } .cbtn.end .ic-s { transform: rotate(135deg); }
.cbtn.ok { background: #22a55b; }
.callring .cbtn { width: 68px; height: 68px; margin-bottom: 22px; }
.callring .cbtn small { position: absolute; top: calc(100% + 6px); font-size: 13px; white-space: nowrap; }
.callpill { position: fixed; z-index: 55; bottom: calc(84px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); display: flex; gap: 10px; align-items: center; max-width: calc(100vw - 24px); padding: 9px 16px; border: 0; border-radius: 99px; background: #22a55b; color: #fff; font-size: 14px; box-shadow: 0 6px 20px rgba(0,0,0,.25); }
.callpill b { white-space: nowrap; }
.callpill span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: .9; }
@media (min-width: 900px) { .calllocal { width: 220px; max-width: 220px; aspect-ratio: 4 / 3; } }
@media (min-width: 900px) { .callremote { object-fit: contain; } }
@media (max-width: 420px) { .convbar .badge { display: none; } } /* room for the call buttons */

/* Calls tab: history and one-tap calls to contacts */
.callrow { display: flex; align-items: center; gap: 2px; }
.callrow .crow { flex: 1; min-width: 0; }
.callrow .crow:disabled { opacity: 1; cursor: default; }
.callacts { display: flex; flex: none; }
.callacts .iconbtn { color: var(--accent); }
.callacts .iconbtn:disabled { color: var(--mut); opacity: .35; }
.callhead { margin-top: 18px; }
.callsec .csub.bad { font-weight: 600; }
.tbn.miss { background: var(--bad); color: #fff; }
#newDlg .menurow:first-of-type { border-top: 0; }

/* homepage: how it compares (an honest table) */
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.cmpwrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: 18px; background: var(--card); }
.cmp { width: 100%; min-width: 640px; border-collapse: collapse; font-size: 14.5px; }
.cmp th, .cmp td { padding: 12px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.cmp tr:last-child th, .cmp tr:last-child td { border-bottom: 0; }
.cmp thead th { font-size: 15px; color: var(--fg); }
.cmp tbody th { width: 26%; font-weight: 600; color: var(--fg); }
.cmp td { color: var(--mut); }
.cmp .us { background: var(--accent-soft); color: var(--fg); }
.cmp thead .us { color: var(--accent); }
.cmp .yes { color: var(--ok); font-weight: 600; }
.cmp .no { color: var(--bad); font-weight: 600; }
.cmp .yes::before { content: '✓ '; } .cmp .no::before { content: '✗ '; }
.cmpnote { margin: 10px 2px 0; }
@media (max-width: 699px) {
  /* scroll sideways with the row names kept in view */
  .cmp tbody th, .cmp thead td { position: sticky; left: 0; z-index: 1; background: var(--card); box-shadow: 1px 0 0 var(--line); }
  .cmp tbody th { min-width: 130px; }
  .cmp { font-size: 13.5px; }
}

/* boot-check.js: the app never reached a screen */
.bootfail { position: fixed; left: 16px; right: 16px; top: 50%; transform: translateY(-50%); z-index: 2000; max-width: 560px; margin: 0 auto; padding: 18px; border-radius: 16px; background: var(--card); color: var(--fg); border: 1px solid var(--line); box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.bootfail p { margin: 6px 0 10px; color: var(--mut); }
.bootfail pre { white-space: pre-wrap; word-break: break-word; font-size: 12px; max-height: 40vh; overflow: auto; background: var(--bg); padding: 10px; border-radius: 10px; }
.bootfail button { margin-top: 10px; }
