:root {
  --bg: #0e1621; --side: #17212b; --panel: #1c2733; --line: #0b121a; --text: #e8eef4; --muted: #7f91a4;
  --in: #182533; --out: #2b5278; --accent: #5ea4e6; --danger: #e5604d; --ok: #5cc27a;
  --border: #2b3a4a; --hover: #26384a; --chip: #1a2735; --soft: #9db1c5; --soft2: #d4e0ec; --on-accent: #06121e; --wave-on: #fff;
  --msgbg: none; --sel: #2b5278; --sel-soft: #c9dcf0;
}
/* 0.8.0: themes. The call windows and the picture viewer stay dark in every theme (see the block at the end). */
:root[data-theme="light"] {
  --bg: #e9eef3; --side: #ffffff; --panel: #ffffff; --line: #d3dce5; --text: #17212b; --muted: #6a7b8c;
  --in: #ffffff; --out: #d4e8fb; --danger: #d6402d; --ok: #2e9d57;
  --border: #c9d4df; --hover: #e6edf4; --chip: #dde5ed; --soft: #5b6d7f; --soft2: #34475a; --wave-on: #1b5e9e;
}
:root[data-theme="black"] {
  --bg: #000000; --side: #0a0a0a; --panel: #121212; --line: #1c1c1c; --text: #ececec; --muted: #8a8a8a;
  --in: #161616; --out: #1f3b57;
  --border: #2a2a2a; --hover: #1e1e1e; --chip: #1a1a1a;
}
:root[data-accent="green"] { --accent: #4fbf7f; }
:root[data-accent="violet"] { --accent: #a58be8; }
:root[data-accent="orange"] { --accent: #e8944a; }
:root[data-accent="pink"] { --accent: #e86fa0; }
:root[data-theme="light"][data-accent="blue"] { --accent: #2a7fcf; }
:root[data-theme="light"][data-accent="green"] { --accent: #2e9d57; }
:root[data-theme="light"][data-accent="violet"] { --accent: #7a5ccf; }
:root[data-theme="light"][data-accent="orange"] { --accent: #cf7424; }
:root[data-theme="light"][data-accent="pink"] { --accent: #cf4a82; }
:root[data-theme="light"] { --on-accent: #ffffff; --sel: #cfe3f7; --sel-soft: #4a6076; }

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.4 "Segoe UI", system-ui, sans-serif; overflow: hidden; }
.hidden { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.err { color: var(--danger); min-height: 18px; margin-top: 8px; }
.screen { position: absolute; inset: 0; }

#netbar { position: absolute; top: 0; left: 0; right: 0; z-index: 50; background: #7a4a12; color: #fff; text-align: center; padding: 4px; font-size: 12px; }

/* sign in */
#login { display: flex; align-items: center; justify-content: center; }
.card { width: 420px; max-width: 92vw; background: var(--side); border-radius: 14px; padding: 28px; }
.card h1 { margin: 6px 0 4px; font-size: 22px; }
.card label { display: block; margin-top: 14px; color: var(--muted); font-size: 12px; }
.card input { display: block; width: 100%; margin-top: 4px; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); font-size: 15px; }
.card input:focus, #search:focus { outline: 1px solid var(--accent); }
.card #loginCode { letter-spacing: 2px; font-family: Consolas, monospace; font-size: 18px; text-transform: uppercase; }
.card button[type=submit] { width: 100%; margin-top: 18px; padding: 11px; border: 0; border-radius: 8px; background: var(--accent); color: var(--on-accent); font-weight: 600; }
.card button[disabled] { opacity: .6; cursor: default; }
.card details { margin-top: 16px; color: var(--muted); }
.card details ol { padding-left: 20px; }
.logo { width: 56px; height: 56px; border-radius: 14px; background: #253459; position: relative; }
.logo::after { content: ""; position: absolute; left: 14px; top: 10px; width: 22px; height: 22px; border: 4px solid #fff; border-radius: 50%; }
.logo::before { content: ""; position: absolute; left: 22px; top: 31px; width: 6px; height: 14px; background: #fff; border-radius: 2px; }
.logo.big { width: 84px; height: 84px; border-radius: 20px; margin: 0 auto 12px; opacity: .55; }

/* layout */
#app { display: flex; }
#side { width: 340px; min-width: 260px; background: var(--side); display: flex; flex-direction: column; border-right: 1px solid var(--line); position: relative; }
.side-top { display: flex; gap: 8px; padding: 10px; }
#search { flex: 1; min-width: 0; padding: 8px 12px; border-radius: 18px; border: 0; background: var(--bg); }
#gear { width: 36px; border: 0; border-radius: 50%; background: transparent; font-size: 18px; color: var(--muted); }
#gear:hover { background: var(--panel); color: var(--text); }
.menu { position: absolute; top: 52px; right: 10px; z-index: 20; min-width: 280px; max-height: calc(100vh - 62px); overflow-y: auto; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 6px; box-shadow: 0 8px 24px #0008; }
.menu button, .menu label { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; background: transparent; border-radius: 6px; text-align: left; }
.menu button:hover, .menu label:hover { background: var(--hover); }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }
.menu .danger { color: var(--danger); }
#chatlist { flex: 1; overflow-y: auto; }
.chat { display: flex; gap: 10px; padding: 9px 12px; cursor: pointer; align-items: center; }
.chat:hover { background: var(--hover); }
.chat.sel { background: var(--sel); }
.chat .body { flex: 1; min-width: 0; }
.chat .top { display: flex; justify-content: space-between; gap: 8px; }
.chat .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat .time { color: var(--muted); font-size: 12px; flex: none; }
.chat .bot { display: flex; justify-content: space-between; gap: 8px; }
.chat .prev { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat .prev.typing { color: var(--ok); }
.chat .prev .draftlbl { color: var(--danger); }
.chat.sel .prev, .chat.sel .time { color: var(--sel-soft); }
.badge { flex: none; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: var(--on-accent); font-size: 12px; font-weight: 700; text-align: center; line-height: 20px; }
.avatar { position: relative; flex: none; width: 46px; height: 46px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 18px; color: #fff; overflow: visible; }
.avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.avatar .dot { position: absolute; right: 0; bottom: 0; width: 12px; height: 12px; border-radius: 50%; background: var(--ok); border: 2px solid var(--side); }
#hAvatar { width: 40px; height: 40px; font-size: 16px; }
.empty-list { padding: 24px; text-align: center; color: var(--muted); }

#main { flex: 1; min-width: 0; position: relative; display: flex; flex-direction: column; }
#empty { margin: auto; text-align: center; color: var(--muted); }
#chat { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; }
#chathead { display: flex; gap: 12px; align-items: center; padding: 8px 16px; background: var(--side); border-bottom: 1px solid var(--line); }
#hTitle { font-weight: 600; }
#hSub { color: var(--muted); font-size: 12px; }
#hSub.typing, #hSub.online { color: var(--ok); }
#msgs { flex: 1; overflow-y: auto; padding: 12px 0; }
#msgList { padding: 0 16px; display: flex; flex-direction: column; }
#toBottom { position: absolute; right: 24px; bottom: 90px; width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--panel); box-shadow: 0 2px 8px #0008; font-size: 18px; }
#toBottom .n { position: absolute; top: -6px; right: -4px; }
#typingLine { height: 18px; padding: 0 20px; color: var(--ok); font-size: 12px; }

.sep { align-self: center; margin: 10px 0 6px; padding: 2px 12px; background: var(--chip); border-radius: 12px; color: var(--muted); font-size: 12px; }
.sysline { align-self: center; margin: 6px 0; padding: 3px 12px; background: var(--chip); border-radius: 12px; color: var(--muted); font-size: 12px; }
.row { display: flex; margin: 1px 0; }
.row.out { justify-content: flex-end; }
.row.gap { margin-top: 8px; }
.bubble { position: relative; max-width: min(720px, 82%); padding: 6px 10px 4px; border-radius: 12px; background: var(--in); word-wrap: break-word; overflow-wrap: anywhere; }
.row.out .bubble { background: var(--out); }
.bubble.media { padding: 3px; }
.bubble.media .cap, .bubble.media .reply { margin: 3px 7px; }
.bubble.media .meta { padding: 0 7px 2px; }
.who { font-size: 12px; font-weight: 600; margin-bottom: 2px; }
.txt { white-space: pre-wrap; }
.txt a { color: var(--accent); text-decoration: none; }
.txt a:hover { text-decoration: underline; }
.meta { display: flex; justify-content: flex-end; gap: 6px; font-size: 11px; color: var(--soft); margin-top: 1px; user-select: none; }
.meta .tick.read { color: #6ec1ff; }
.meta .tick.fail { color: var(--danger); }
.fail-actions { display: flex; gap: 8px; margin-top: 4px; font-size: 12px; }
.fail-actions button { border: 0; background: transparent; color: var(--accent); padding: 0; text-decoration: underline; }
.reply { border-left: 3px solid var(--accent); padding: 1px 8px; margin-bottom: 4px; cursor: pointer; font-size: 13px; background: #0002; border-radius: 4px; }
.reply b { display: block; color: var(--accent); font-size: 12px; }
.reply span { display: block; color: var(--soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 360px; }
.photo, .vid { display: block; max-width: 100%; max-height: 380px; border-radius: 10px; cursor: zoom-in; background: #0004; }
.vid { cursor: default; width: 100%; max-width: 420px; }
.file { display: flex; gap: 10px; align-items: center; min-width: 220px; padding: 4px 2px; }
.file .ico { flex: none; width: 40px; height: 40px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; }
.file .info { min-width: 0; flex: 1; }
.file .fname { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file .fsize { color: var(--soft); font-size: 12px; }
.file button { border: 0; background: #0003; border-radius: 6px; padding: 6px 10px; }
.file button:hover { background: #0005; }
.locked { padding: 10px 14px; color: var(--soft); font-style: italic; }
.reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.reactions:empty { display: none; }
.reactions span { background: #0003; border-radius: 10px; padding: 1px 7px; font-size: 13px; }
.reactions span.mine { background: #5ea4e655; }

.bar { display: flex; align-items: center; gap: 10px; padding: 6px 16px; background: var(--side); border-top: 1px solid var(--line); }
.bar .barText { flex: 1; min-width: 0; border-left: 3px solid var(--accent); padding-left: 8px; overflow: hidden; }
.bar b { display: block; color: var(--accent); font-size: 12px; }
.bar span { display: block; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar button { border: 0; background: transparent; color: var(--muted); font-size: 16px; }
#composer { display: flex; align-items: flex-end; gap: 8px; padding: 10px 16px; background: var(--side); }
#composer button { flex: none; width: 40px; height: 40px; border: 0; border-radius: 50%; background: transparent; font-size: 20px; color: var(--muted); }
#composer button:hover { background: var(--panel); color: var(--text); }
#sendBtn { color: var(--accent) !important; }
#input { flex: 1; resize: none; max-height: 160px; padding: 9px 14px; border-radius: 20px; border: 0; background: var(--bg); line-height: 1.35; overflow-y: auto; }
#input:focus { outline: 1px solid var(--out); }
#readonly { padding: 14px; text-align: center; background: var(--side); color: var(--muted); }
#dropHint { position: absolute; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; background: #0e1621dd; border: 3px dashed var(--accent); font-size: 18px; pointer-events: none; }

.overlay { position: fixed; inset: 0; z-index: 100; background: #000a; display: flex; align-items: center; justify-content: center; }
.dialog { width: 460px; max-width: 92vw; max-height: 86vh; overflow-y: auto; background: var(--side); border-radius: 14px; padding: 20px; }
.dialog h2 { margin: 0 0 10px; font-size: 17px; }
.dialog .btns { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.dialog .btns button { padding: 8px 16px; border: 0; border-radius: 8px; background: var(--panel); }
.dialog .btns button.primary { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.dialog .btns button.danger { background: var(--danger); color: #fff; }
.dialog .btns button[disabled] { opacity: .6; cursor: default; }
.dialog textarea { width: 100%; margin-top: 10px; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); resize: vertical; min-height: 40px; }
.stage { display: flex; gap: 10px; align-items: center; padding: 6px 0; }
.stage img { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; }
.stage .ico { width: 48px; height: 48px; border-radius: 6px; background: var(--panel); display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--muted); }
.stage .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stage .st { color: var(--muted); font-size: 12px; }
.stage .st.bad { color: var(--danger); }
#lightbox { z-index: 120; flex-direction: column; background: #000d; }
#lightbox img { max-width: 92vw; max-height: 86vh; object-fit: contain; }
#lightbox video { width: 92vw; height: 80vh; object-fit: contain; background: #000; border-radius: 8px; outline: none; }   /* big, also for a small video */
.vbox { position: relative; display: block; width: 100%; max-width: 420px; cursor: zoom-in; user-select: none; }
.vbox .vid { cursor: zoom-in; }
.vbox .vplayicon { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 56px; height: 56px; border-radius: 50%; background: #000a; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 22px; padding-left: 4px; pointer-events: none; }
.vbox:hover .vplayicon { background: #000d; }
.vbox .vdur { position: absolute; left: 8px; top: 8px; background: #000a; color: #fff; border-radius: 10px; padding: 1px 9px; font-size: 12px; pointer-events: none; }
.lbBar { margin-top: 12px; display: flex; gap: 10px; }
.lbBar button { padding: 7px 16px; border: 0; border-radius: 8px; background: var(--panel); }
.ctx { position: fixed; z-index: 150; min-width: 200px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 4px; box-shadow: 0 8px 24px #000a; }
.ctx button { display: block; width: 100%; padding: 7px 12px; border: 0; background: transparent; text-align: left; border-radius: 6px; }
.ctx button:hover { background: var(--hover); }
.ctx .danger { color: var(--danger); }
.ctx .emojis { display: flex; justify-content: space-between; padding: 4px 6px; }
.ctx .emojis button { width: auto; font-size: 18px; padding: 2px 6px; }
#toasts { position: fixed; left: 50%; bottom: 80px; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; }
.toast { background: var(--border); padding: 8px 16px; border-radius: 18px; box-shadow: 0 4px 14px #0008; max-width: 70vw; }
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 5px; }
::-webkit-scrollbar-track { background: transparent; }

/* sound off for a chat */
.hbtn { margin-left: auto; width: 36px; height: 36px; border: 0; border-radius: 50%; background: transparent; font-size: 17px; opacity: .75; }
.hbtn:hover { background: var(--panel); opacity: 1; }
.mutedico { flex: none; margin-left: 6px; font-size: 12px; opacity: .7; }
.pinico { flex: none; margin-left: 6px; font-size: 12px; opacity: .8; }
.badge.muted { background: #4a5b6c; color: #dfe8f1; }

/* round video: no player bar, a click plays, a ring shows the progress */
.cv { position: relative; width: 240px; height: 240px; cursor: pointer; user-select: none; }
.cv video { display: block; width: 240px; height: 240px; border-radius: 50%; object-fit: cover; background: #0004; }
.cv svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); pointer-events: none; opacity: 0; transition: opacity .2s; }
.cv.playing svg { opacity: 1; }
.cv svg circle { fill: none; stroke-width: 4; }
.cv svg .track { stroke: #ffffff22; }
.cv svg .ring { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset .25s linear; }
.cv .play { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 60px; height: 60px; border-radius: 50%; background: #000a; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 24px; padding-left: 4px; }
.cv.playing .play { display: none; }
.cv .pipbtn { position: absolute; right: 2px; top: 2px; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 50%; background: #000b; color: #fff; font-size: 16px; line-height: 30px; text-align: center; cursor: pointer; opacity: 0; transition: opacity .15s; }
.cv:hover .pipbtn, .cv .pipbtn:focus-visible, .cv .pipbtn.on { opacity: 1; }
.cv .pipbtn:hover { background: var(--accent); }
.cv .dur { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); background: #000a; color: #fff; border-radius: 10px; padding: 1px 9px; font-size: 12px; }
.cv .dur:empty { display: none; }
.chat .top .name { flex: 1; min-width: 0; }

/* a round video has no frame: no bubble, the time of sending sits on the picture */
.row .bubble.bare { background: transparent; padding: 0; max-width: none; }
.row .bubble.bare .reply { background: var(--in); padding: 4px 8px; margin: 0 0 4px; }
.bubble .cv .meta { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); margin: 0; padding: 1px 9px; background: #000a; color: #e8f0f8; border-radius: 10px; white-space: nowrap; }

/* a voice message */
.voice { display: flex; align-items: center; gap: 10px; width: 270px; max-width: 100%; padding: 2px 0; }
.vplay { flex: none; width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--accent); color: var(--on-accent); font-size: 14px; line-height: 40px; padding: 0; }
.vplay:hover { filter: brightness(1.1); }
.vwave { flex: 1; min-width: 0; height: 30px; display: flex; align-items: center; gap: 2px; cursor: pointer; }
.vwave span { flex: 1; min-width: 2px; border-radius: 2px; background: #ffffff40; }
.vwave span.on { background: var(--accent); }
.row.out .vwave span.on { background: var(--wave-on); }
.vtime { flex: none; min-width: 34px; text-align: right; font-size: 12px; color: var(--soft); font-variant-numeric: tabular-nums; }

/* group calls */
.hpill { margin-left: auto; flex: none; padding: 6px 14px; border: 0; border-radius: 16px; background: var(--panel); color: var(--text); font-size: 13px; }
.hpill:hover { filter: brightness(1.15); }
.hpill.active { background: var(--ok); color: #06210f; font-weight: 600; }
.hpill:not(.hidden) ~ .hbtn { margin-left: 0; }
#callBar { display: flex; align-items: center; gap: 12px; padding: 7px 16px; background: #1d3a2b; color: #cfeedd; border-bottom: 1px solid var(--line); }
#callBar span { flex: 1; }
#callBar button { border: 0; border-radius: 14px; padding: 4px 14px; background: var(--ok); color: #06210f; font-weight: 600; }
.chat .prev.calling { color: var(--ok); }
#callMini { position: fixed; top: 0; left: 0; right: 0; height: 34px; z-index: 60; display: flex; align-items: center; gap: 10px; padding: 0 14px; background: #1f7a45; color: #fff; }
#callMini .mtext { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#callMini .mdot { width: 9px; height: 9px; border-radius: 50%; background: #fff; animation: pulse 1.6s infinite; }
#callMini button { border: 0; border-radius: 12px; padding: 3px 12px; background: #ffffff30; color: #fff; }
#callMini button:hover { background: #ffffff50; }
#callMini .mleave { background: var(--danger); }
@keyframes pulse { 50% { opacity: .3; } }
body.mini #app { top: 34px; }

#call { position: fixed; inset: 0; z-index: 80; background: #0b1118; display: flex; flex-direction: column; }
.ctop { display: flex; align-items: center; gap: 14px; padding: 10px 16px; background: var(--side); border-bottom: 1px solid var(--line); }
.ctitle { font-weight: 600; font-size: 15px; }
.cmeta { color: var(--muted); font-variant-numeric: tabular-nums; }
.cgrow { flex: 1; }
.cbtn.small { width: auto; height: auto; border-radius: 14px; padding: 4px 12px; font-size: 12px; background: var(--panel); }
.cnote { padding: 6px 16px; background: #7a4a12; color: #fff; text-align: center; font-size: 13px; }
.cnote button { border: 0; border-radius: 12px; padding: 3px 12px; background: #fff3; color: #fff; }
.cstage { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; padding: 10px; }
.cgrid { flex: 1; min-height: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); grid-auto-rows: 1fr; align-content: center; }
.cgrid[data-count="1"] { grid-template-columns: minmax(240px, 720px); justify-content: center; }
.cgrid[data-count="2"] { grid-template-columns: repeat(2, 1fr); }
.cgrid[data-count="3"], .cgrid[data-count="4"] { grid-template-columns: repeat(2, 1fr); }
.cgrid[data-count="5"], .cgrid[data-count="6"] { grid-template-columns: repeat(3, 1fr); }
.cgrid[data-count="7"], .cgrid[data-count="8"], .cgrid[data-count="9"] { grid-template-columns: repeat(3, 1fr); }
.cstage.with-share .cgrid { flex: none; height: 120px; grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 180px; grid-auto-rows: 120px; overflow-x: auto; justify-content: start; align-content: start; }
.cshare { flex: 1; min-height: 0; position: relative; background: #000; border-radius: 12px; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.cshare video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.cshare .slabel { position: absolute; left: 12px; bottom: 10px; padding: 2px 10px; border-radius: 10px; background: #000a; font-size: 12px; }
.smine { text-align: center; padding: 20px; max-width: 420px; }
.smine .muted { margin: 8px 0 14px; }
.smine button { border: 0; border-radius: 8px; padding: 8px 18px; background: var(--accent); color: var(--on-accent); font-weight: 600; }
.tile { position: relative; min-height: 0; background: #17212b; border-radius: 12px; overflow: hidden; display: flex; align-items: center; justify-content: center; outline: 3px solid transparent; transition: outline-color .15s; }
.tile.speaking { outline-color: var(--ok); }
.tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tile video.mirror { transform: scaleX(-1); }
.tava { width: 64px; height: 64px; max-width: 40%; aspect-ratio: 1; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 700; color: #fff; }
.tlabel { position: absolute; left: 8px; bottom: 8px; max-width: calc(100% - 16px); display: flex; gap: 6px; align-items: center; padding: 2px 9px; border-radius: 10px; background: #000a; font-size: 12px; }
.tname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cbar { display: flex; justify-content: center; gap: 12px; padding: 12px; background: var(--side); border-top: 1px solid var(--line); }
.cbtn { width: 48px; height: 48px; border: 0; border-radius: 50%; background: var(--panel); color: var(--text); font-size: 20px; }
.cbtn:hover { filter: brightness(1.2); }
.cbtn.off { background: #4a2a2a; }
.cbtn.on { background: var(--accent); color: var(--on-accent); }
.cbtn.leave { background: var(--danger); color: #fff; transform: rotate(135deg); }
.caudio { display: none; }

.picker { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; max-height: 52vh; overflow-y: auto; padding: 2px; }
.pick { min-width: 0; overflow: hidden; border: 2px solid transparent; border-radius: 10px; background: var(--panel); padding: 6px; text-align: left; color: var(--text); }
.pick.sel { border-color: var(--accent); }
.pick img { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: contain; background: #000; border-radius: 6px; }
.pick .noimg { aspect-ratio: 16 / 10; display: flex; align-items: center; justify-content: center; background: #000; border-radius: 6px; font-size: 28px; }
.pick .pname { margin-top: 5px; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.devs label { display: block; margin-top: 12px; color: var(--muted); font-size: 12px; }
.devs select { display: block; width: 100%; margin-top: 4px; padding: 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text); }

/* host of a group call: the "recording" mark, the buttons on the tiles of the others, the record button */
.crec { color: #fff; background: #d33; border-radius: 10px; padding: 2px 8px; font-size: 12px; font-weight: 600; animation: crecblink 1.6s ease-in-out infinite; }
@keyframes crecblink { 50% { opacity: .55; } }
.cbtn.rec { color: #e5484d; }
.cbtn.rec.on { background: #e5484d; color: #fff; }
.tile { position: relative; }
.tile .tact { position: absolute; top: 6px; right: 6px; display: none; gap: 4px; flex-direction: column; align-items: flex-end; z-index: 3; }
.tile:hover .tact, .tile:focus-within .tact { display: flex; }
.tile .tact button { background: rgba(0, 0, 0, .65); color: #fff; border: 0; border-radius: 8px; padding: 4px 8px; font-size: 12px; cursor: pointer; }
.tile .tact button:hover { background: rgba(200, 40, 40, .9); }
.tile .tact button.hidden { display: none; }

/* 1-to-1 call */
#pcall { position: fixed; inset: 0; z-index: 80; background: #0b1118; display: flex; flex-direction: column; }
body.mini #pcall { top: 34px; }
.pcstage { flex: 1; min-height: 0; position: relative; display: flex; align-items: center; justify-content: center; background: #0b1118; overflow: hidden; }
.pcremote { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.pclocal { position: absolute; right: 16px; bottom: 16px; width: 200px; max-width: 28%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 10px; background: #000; border: 2px solid #ffffff40; transform: scaleX(-1); z-index: 2; }
.pcwho { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 20px; }
.pcwho.pcdim { position: absolute; left: 16px; top: 12px; flex-direction: row; padding: 0; gap: 10px; background: #000a; border-radius: 22px; padding: 4px 14px 4px 4px; }
.pcava { width: 120px; height: 120px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 48px; font-weight: 700; color: #fff; }
.pcdim .pcava { width: 32px; height: 32px; font-size: 15px; }
.pcname { font-size: 22px; font-weight: 600; }
.pcdim .pcname { font-size: 14px; }
.pcstatus { color: var(--muted); font-variant-numeric: tabular-nums; }
.pcdim .pcstatus { font-size: 12px; }
.cbtn.accept { background: var(--ok); color: #06210f; }

/* recording of a voice message and of a video circle */
#composer.rec > :not(#recPanel):not(#sendBtn) { display: none !important; }
#schedBar { flex: none; padding: 6px 18px; font-size: 12px; color: var(--accent); background: var(--side); cursor: pointer; }
#schedBar:hover { text-decoration: underline; }
.sched-text { margin: 4px 0 10px; padding: 8px 10px; border-radius: 8px; background: var(--panel); color: var(--soft, var(--text)); overflow-wrap: anywhere; }
.sched-row { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.sched-row input { padding: 6px 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--panel); color: var(--text); color-scheme: dark; }
.sched-quick { display: flex; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.sched-quick button { padding: 6px 12px; border: 0; border-radius: 8px; background: var(--hover); font-size: 13px; }
.schrow .tbtn.wide { width: auto; padding: 4px 10px; font-size: 12px; margin-left: 6px; }
#sendBtn.holding { background: var(--danger) !important; color: #fff !important; }
#recPanel .rhint { flex: none; color: var(--muted); font-size: 12px; white-space: nowrap; }
#attachMenu { position: fixed; top: auto; right: auto; min-width: 230px; z-index: 40; }
#recPanel { flex: 1; display: flex; align-items: center; gap: 10px; min-height: 40px; min-width: 0; }
#recPanel .rbtn { flex: none; width: auto; height: 36px; padding: 0 16px; border-radius: 18px; background: var(--panel); color: var(--text); font-size: 13px; }
#recPanel .rbtn.go { background: var(--accent); color: var(--on-accent); font-weight: 600; }
#recPanel .rbtn.x { color: var(--danger); }
#recPanel .rdot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: pulse 1.2s infinite; }
#recPanel .rtime { flex: none; font-variant-numeric: tabular-nums; min-width: 44px; }
#recPanel .rfor { flex: none; color: var(--muted); font-size: 12px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rbars { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: flex-end; gap: 2px; height: 32px; overflow: hidden; }
.rbars i { flex: none; width: 3px; min-height: 3px; border-radius: 2px; background: var(--accent); }
#recPanel audio { flex: 1; min-width: 0; height: 34px; }
.rfx { flex: none; max-width: 150px; height: 34px; border-radius: 17px; border: 0; background: var(--panel); color: var(--text); padding: 0 10px; }
#circle { position: fixed; inset: 0; z-index: 70; background: #000d; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; }
body.mini #circle { top: 34px; }
#circle .ctitle2 { font-weight: 600; font-size: 15px; }
#camrec { position: fixed; inset: 0; z-index: 70; background: #000d; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; }
body.mini #camrec { top: 34px; }
#camrec .ctitle2 { font-weight: 600; font-size: 15px; }
#camrec .camview { display: block; max-width: min(760px, 92vw); max-height: 62vh; border-radius: 12px; background: #111; object-fit: contain; }
#camrec .camview.hidden { display: none; }
#camrec video.mirror { transform: scaleX(-1); }
.cring { position: relative; width: 340px; height: 340px; }
.cring video { position: absolute; left: 10px; top: 10px; width: 320px; height: 320px; border-radius: 50%; object-fit: cover; background: #111; }
.cring video.mirror { transform: scaleX(-1); }
.cring svg { position: absolute; inset: 0; width: 340px; height: 340px; transform: rotate(-90deg); pointer-events: none; }
.cring circle { fill: none; stroke-width: 5; }
.cring .ctrack { stroke: #ffffff30; }
.cring .cfill { stroke: var(--danger); stroke-linecap: round; }
.crow { display: flex; align-items: center; gap: 10px; }
.crow .rbtn { height: 38px; padding: 0 18px; border: 0; border-radius: 19px; background: var(--panel); color: var(--text); }
.crow .rbtn.go { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.crow .rbtn.rec { background: var(--danger); color: #fff; }
.crow .rtime { font-variant-numeric: tabular-nums; min-width: 44px; text-align: center; }
.cnote2 { color: var(--muted); font-size: 12px; min-height: 16px; }

/* ---- 0.5.0: text marks, search, pinned message, selection, albums, timers ---- */
.txt b, .cap b { font-weight: 700; }
.txt i, .cap i { font-style: italic; }
.txt code, .cap code { font-family: Consolas, "Cascadia Mono", monospace; background: #0003; padding: 0 4px; border-radius: 4px; font-size: .95em; }
mark { background: #e5c24b; color: #1a1400; border-radius: 3px; padding: 0 1px; }
.row.hit .bubble { box-shadow: 0 0 0 1px #e5c24b88; }
.row.hit.cur .bubble { box-shadow: 0 0 0 2px #e5c24b; }
.row.flash .bubble { animation: pvflash 1.4s ease-out; }
@keyframes pvflash { 0% { box-shadow: 0 0 0 3px var(--accent); } 100% { box-shadow: 0 0 0 0 transparent; } }

#findBtn { margin-left: auto; }
#muteBtn { margin-left: 0; }
#findBar, #pinBar { display: flex; align-items: center; gap: 8px; padding: 6px 16px; background: var(--side); border-bottom: 1px solid var(--line); }
#findBar.hidden, #pinBar.hidden { display: none; }
#findInput { flex: 1; min-width: 0; padding: 7px 12px; border-radius: 16px; border: 0; background: var(--bg); }
#findInput:focus { outline: 1px solid var(--accent); }
#findCount { flex: none; color: var(--muted); font-size: 12px; min-width: 64px; text-align: center; }
#findBar button, #pinBar button { flex: none; width: 30px; height: 30px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 15px; }
#findBar button:hover, #pinBar button:hover { background: var(--panel); color: var(--text); }
#pinBar { cursor: pointer; }
#pinBar .pinText { flex: 1; min-width: 0; border-left: 3px solid var(--accent); padding-left: 8px; overflow: hidden; }
#pinBar b { display: block; color: var(--accent); font-size: 12px; }
#pinBar span { display: block; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* the search results under the chat list */
.found-head { padding: 8px 14px 4px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.found { padding: 7px 14px; cursor: pointer; }
.found:hover { background: var(--hover); }
.found .fh { display: flex; justify-content: space-between; gap: 8px; }
.found .fc { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.found .ft { flex: none; color: var(--muted); font-size: 12px; }
.found .fx { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* several messages chosen */
#selBar { display: flex; align-items: center; gap: 8px; padding: 10px 16px; background: var(--side); border-top: 1px solid var(--line); }
#selBar.hidden { display: none; }
#selCount { flex: 1; font-weight: 600; }
#selBar button { padding: 8px 14px; border: 0; border-radius: 8px; background: var(--panel); color: var(--text); }
#selBar button:hover { filter: brightness(1.15); }
#selBar button.danger { color: var(--danger); }
#selBar button[disabled] { opacity: .4; cursor: default; filter: none; }
.picking .row:not(.picked) .bubble, .picking .row:not(.picked) .tile { cursor: pointer; }
.picking .row { cursor: pointer; position: relative; }
.picking .row::before { content: ''; flex: none; align-self: center; width: 20px; height: 20px; margin: 0 8px 0 0; border: 2px solid #5b7894; border-radius: 50%; box-sizing: border-box; }
.picking .row.out::before { order: 2; margin: 0 0 0 8px; }
.picking .row.picked::before { background: var(--accent) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'><path d='M5 10.5l3.2 3.2L15 6.8' fill='none' stroke='%2306121e' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/></svg>") center/contain no-repeat; border-color: var(--accent); }
.picking .row.picked .bubble { box-shadow: 0 0 0 2px var(--accent); }
.picking .row.album::before { display: none; }
.picking .tile { position: relative; }
.picking .tile::after { content: ''; position: absolute; right: 6px; top: 6px; width: 20px; height: 20px; border: 2px solid #fff; border-radius: 50%; background: #0006; box-sizing: border-box; }
.picking .tile.picked::after { background: var(--accent) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'><path d='M5 10.5l3.2 3.2L15 6.8' fill='none' stroke='%2306121e' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/></svg>") center/contain no-repeat; border-color: var(--accent); }
.picking .tile.picked img { filter: brightness(.7); }

/* an album of photos */
.bubble.album { padding: 3px; width: 360px; max-width: 82%; }
.album-grid { display: flex; flex-direction: column; gap: 2px; border-radius: 10px; overflow: hidden; }
.album-row { display: flex; gap: 2px; }
.tile { flex: 1 1 0; min-width: 0; overflow: hidden; background: #0004; }
.tile img { display: block; width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; }
.bubble.album .meta { padding: 2px 7px 1px; }
.bubble.album .reactions { padding: 0 4px 2px; }

/* voice to text, timers, view limit */
.transcript { margin-top: 4px; padding: 4px 8px; border-left: 3px solid #ffffff44; font-size: 13px; color: var(--soft2); white-space: pre-wrap; }
.transcript:empty { display: none; }
.limited { display: flex; align-items: center; gap: 10px; min-width: 230px; padding: 8px 4px; }
.limited .ico { flex: none; width: 40px; height: 40px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: flex; align-items: center; justify-content: center; font-size: 18px; }
.limited .info { flex: 1; min-width: 0; }
.limited .info b { display: block; }
.limited .info span { color: var(--soft); font-size: 12px; }
.limited button { border: 0; background: #0003; border-radius: 6px; padding: 6px 12px; }
.limited button:hover { background: #0005; }
#timerBtn.armed { color: var(--ok); background: #1d3b2a; width: auto; padding: 0 10px; font-size: 14px; border-radius: 20px; }
.pick { max-height: 46vh; overflow-y: auto; margin-top: 8px; }
.pickrow { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 8px; cursor: pointer; }
.pickrow:hover { background: var(--hover); }
.pickrow .avatar { width: 36px; height: 36px; font-size: 15px; }
.pickrow .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dialog input[type=search], .dialog select { width: 100%; margin-top: 8px; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text); }
.dialog .opt { display: flex; align-items: center; gap: 8px; padding: 6px 2px; cursor: pointer; }
.dialog .lbl { margin-top: 12px; color: var(--muted); font-size: 12px; }
.lbNav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 64px; border: 0; border-radius: 10px; background: #0009; color: #fff; font-size: 34px; line-height: 1; }
.lbNav:hover { background: #000c; }
#lbPrev { left: 16px; }
#lbNext { right: 16px; }
#lbInfo { align-self: center; color: var(--soft); font-size: 13px; margin-right: 6px; }

/* 0.5.1: voice line like on the phone (Aa, speed), music line, the player bar at the top */
.voice { width: 340px; gap: 8px; }
.voice .vtime { min-width: 30px; }
.vaa, .vspeed { flex: none; border: 0; border-radius: 10px; background: #ffffff1c; color: var(--soft2); font-size: 12px; font-weight: 600; padding: 3px 7px; min-width: 32px; }
.vaa { font-style: italic; }
.vaa:hover, .vspeed:hover { background: #ffffff33; }
.vaa.busy, .vaa:disabled { opacity: .4; cursor: default; }
.voice.playing .vspeed { background: var(--accent); color: var(--on-accent); }
.audiofile { min-width: 300px; }
.audiofile .afcap { display: flex; align-items: center; gap: 10px; margin-top: 2px; padding: 0 2px; }
.audiofile .afcap .fname { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.audiofile .afcap .fsize { flex: none; color: var(--soft); font-size: 12px; }
.audiofile .afcap button { flex: none; border: 0; background: #0003; border-radius: 6px; padding: 4px 9px; }
.audiofile .afcap button:hover { background: #0005; }
#miniPlayer { position: relative; flex: none; display: flex; align-items: center; gap: 6px; padding: 6px 12px; background: var(--panel); border-bottom: 1px solid var(--line); }
#miniPlayer.hidden { display: none; }
.mpBtn { flex: none; width: 32px; height: 32px; border: 0; border-radius: 50%; background: transparent; color: var(--text, #e6edf3); font-size: 15px; padding: 0; }
.mpBtn:hover { background: #ffffff1c; }
.mpPlay { background: var(--accent); color: var(--on-accent); }
.mpPlay:hover { background: var(--accent); filter: brightness(1.1); }
.mpInfo { flex: 1; min-width: 0; display: flex; flex-direction: column; margin: 0 6px; cursor: pointer; }
.mpInfo b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mpInfo span { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.mpSpeed { flex: none; border: 0; border-radius: 10px; background: #ffffff1c; color: inherit; font-size: 12px; font-weight: 600; padding: 4px 9px; }
.mpSpeed:hover { background: #ffffff33; }
.mpProg { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: #ffffff1a; }
.mpProg i { display: block; height: 100%; width: 0; background: var(--accent); }

/* ---- people and groups (0.6.0) */
#plus { width: 36px; border: 0; border-radius: 50%; background: transparent; font-size: 24px; line-height: 1; color: var(--muted); }
#plus:hover { background: var(--panel); color: var(--text); }
#plusMenu { right: 10px; min-width: 300px; }
#hAvatar, #hTitle { cursor: pointer; }
#hTitle:hover { text-decoration: underline; }
.avatar.big { width: 84px; height: 84px; font-size: 34px; }
.phead { display: flex; align-items: center; gap: 16px; margin: 6px 0 14px; }
.phead .ptext { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; min-width: 0; }
.pname { font-size: 18px; font-weight: 600; overflow-wrap: anywhere; }
.dialog button:not(.primary):not(.danger):not(.mini) { cursor: pointer; }
.ptext > button, .prow > button, #pgLink { padding: 6px 12px; border: 0; border-radius: 8px; background: var(--panel); color: var(--text); }
.ptext > button:hover, .prow > button:hover, #pgLink:hover { filter: brightness(1.2); }
.prow { display: flex; gap: 8px; align-items: center; }
.prow input { flex: 1; min-width: 0; }
.pfield { display: block; margin: 8px 0; }
.pfield > span { display: block; margin-bottom: 4px; }
.dialog input[type=text], .dialog input[type=search] { width: 100%; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text); }
.dialog input[type=text]:focus, .dialog input[type=search]:focus { outline: 1px solid var(--accent); }
.dialog .err { min-height: 18px; margin-top: 6px; font-size: 13px; color: var(--danger); }
.dialog .pick { max-height: 38vh; }
.dialog .pickrow input[type=checkbox] { flex: none; width: 16px; height: 16px; }
.psect { margin: 14px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.plink { margin: 8px 0; }
.pswitch { display: flex; align-items: center; gap: 10px; padding: 7px 2px; cursor: pointer; }
.pstrip { display: flex; flex-wrap: wrap; gap: 8px; }
.pstrip .avatar { width: 56px; height: 56px; }
.bigcode { margin: 10px 0; padding: 12px; text-align: center; font-size: 26px; letter-spacing: .15em; font-weight: 700; background: var(--bg); border-radius: 10px; user-select: all; }
.tag { margin-left: 8px; padding: 1px 7px; border-radius: 8px; background: var(--hover); color: var(--muted); font-size: 11px; }
.pickrow .mini { flex: none; padding: 4px 9px; border: 0; border-radius: 8px; background: var(--panel); color: var(--text); font-size: 12px; }
.pickrow .mini.danger { color: var(--danger); }
.pickrow .mini:hover { filter: brightness(1.25); }
.dialog .btns { flex-wrap: wrap; }
#mentionBox { position: absolute; left: 70px; bottom: 66px; z-index: 30; width: 280px; max-height: 240px; overflow-y: auto; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 4px; box-shadow: 0 8px 24px #0008; }
#mentionBox .mrow { display: flex; align-items: center; gap: 10px; padding: 5px 8px; border-radius: 8px; cursor: pointer; }
#mentionBox .mrow.on, #mentionBox .mrow:hover { background: var(--hover); }
#mentionBox .avatar { width: 30px; height: 30px; font-size: 13px; }
#mentionBox .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bubble.mentioned { box-shadow: inset 3px 0 0 var(--accent); background: #1d3248; }

/* ---- 0.7.0: emoji, bold/italic bar, Media window */
#mediaBtn, #muteBtn { margin-left: 0; }
.ctx .emojis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0; padding: 4px 6px; }
.ctx .emojis button { width: auto; font-size: 18px; padding: 3px 4px; text-align: center; justify-content: center; }
#emojiPanel { position: absolute; left: 56px; bottom: 66px; z-index: 30; width: 344px; max-height: 300px; overflow-y: auto; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 6px 8px 8px; box-shadow: 0 8px 24px #0008; }
#emojiPanel .ecat { margin: 6px 2px 2px; font-size: 12px; color: var(--muted); }
#emojiPanel .egrid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; }
#emojiPanel .egrid button { border: 0; background: transparent; border-radius: 6px; font-size: 21px; padding: 3px 0; }
#emojiPanel .egrid button:hover { background: var(--hover); }
#fmtBar { position: absolute; left: 100px; bottom: 66px; z-index: 29; display: flex; gap: 2px; padding: 3px; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 4px 14px #0008; }
#fmtBar button { min-width: 34px; padding: 4px 8px; border: 0; border-radius: 6px; background: transparent; color: var(--text); font-size: 14px; }
#fmtBar button:hover { background: var(--hover); }
#fmtBar .f-bold { font-weight: 800; }
#fmtBar .f-italic { font-style: italic; }
#fmtBar .f-code { font-family: Consolas, monospace; }
.dialog.wide { width: 680px; }
.mtabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 10px; }
.mtab { padding: 6px 12px; border: 0; border-radius: 16px; background: var(--panel); color: var(--text); font-size: 13px; }
.mtab.on { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.mbody { min-height: 120px; max-height: 56vh; overflow-y: auto; }
.mgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.mtile { position: relative; aspect-ratio: 1; padding: 0; border: 0; border-radius: 6px; overflow: hidden; background: #000; color: var(--text); cursor: pointer; }
.mtile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mtile .mlock { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 28px; background: var(--panel); }
.mtile .mplay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 26px; color: #fff; text-shadow: 0 1px 6px #000; }
.mtile .mdur { position: absolute; right: 4px; bottom: 4px; padding: 1px 6px; border-radius: 8px; background: #000a; font-size: 11px; }
.mrows { display: flex; flex-direction: column; gap: 2px; }
.mrow2 { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 8px; cursor: pointer; }
.mrow2:hover { background: var(--hover); }
.mrow2 .mico { flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--panel); display: flex; align-items: center; justify-content: center; }
.mrow2 .minfo { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mrow2 .minfo b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mrow2 .minfo .murl { color: var(--accent); font-weight: 400; }
.mrow2 .minfo span { font-size: 12px; color: var(--muted); }
.mrow2 .mini { flex: none; padding: 4px 9px; border: 0; border-radius: 8px; background: var(--panel); color: var(--text); font-size: 12px; }

/* 0.8.0: the picture behind the messages (a setting of this program; the phone has its own) */
#msgs { background: var(--msgbg); }
:root[data-bg="custom"] { --msgbg: linear-gradient(#0000004d, #0000004d), var(--bgimg) center / cover no-repeat; }
:root[data-theme="light"][data-bg="custom"] { --msgbg: linear-gradient(#ffffff40, #ffffff40), var(--bgimg) center / cover no-repeat; }
:root[data-bg="night"] { --msgbg: linear-gradient(160deg, #0f1c2e, #162a45 60%, #1a3558); }
:root[data-bg="dusk"] { --msgbg: linear-gradient(160deg, #1c1530, #3a1f4a 60%, #5a2a55); }
:root[data-bg="forest"] { --msgbg: linear-gradient(160deg, #0f2218, #173a2a 60%, #1f4d38); }
:root[data-bg="sand"] { --msgbg: linear-gradient(160deg, #2a2418, #44391f 60%, #5a4a26); }
:root[data-bg="rose"] { --msgbg: linear-gradient(160deg, #2a1620, #4a2234 60%, #63304a); }
:root[data-bg="slate"] { --msgbg: linear-gradient(160deg, #1a1e24, #262d36 60%, #333c48); }
:root[data-bg="dots"] { --msgbg: radial-gradient(#ffffff14 1.2px, transparent 1.4px) 0 0 / 22px 22px, var(--bg); }
:root[data-bg="grid"] { --msgbg: linear-gradient(#ffffff0d 1px, transparent 1px) 0 0 / 28px 28px, linear-gradient(90deg, #ffffff0d 1px, transparent 1px) 0 0 / 28px 28px, var(--bg); }
:root[data-theme="light"][data-bg="night"] { --msgbg: linear-gradient(160deg, #dbe8f6, #c5daf0 60%, #b3cfea); }
:root[data-theme="light"][data-bg="dusk"] { --msgbg: linear-gradient(160deg, #e8e0f5, #dccdf0 60%, #d0bdea); }
:root[data-theme="light"][data-bg="forest"] { --msgbg: linear-gradient(160deg, #dcf0e3, #c6e6d2 60%, #b2dbc2); }
:root[data-theme="light"][data-bg="sand"] { --msgbg: linear-gradient(160deg, #f3ecd8, #ebdfc0 60%, #e3d2a8); }
:root[data-theme="light"][data-bg="rose"] { --msgbg: linear-gradient(160deg, #f6e3ea, #f0d0dc 60%, #e9bdcf); }
:root[data-theme="light"][data-bg="slate"] { --msgbg: linear-gradient(160deg, #e3e7ec, #d3d9e0 60%, #c3cbd4); }
:root[data-theme="light"][data-bg="dots"] { --msgbg: radial-gradient(#00000018 1.2px, transparent 1.4px) 0 0 / 22px 22px, var(--bg); }
:root[data-theme="light"][data-bg="grid"] { --msgbg: linear-gradient(#0000000f 1px, transparent 1px) 0 0 / 28px 28px, linear-gradient(90deg, #0000000f 1px, transparent 1px) 0 0 / 28px 28px, var(--bg); }
/* the picture is behind the bubbles, so incoming ones get a solid colour of their own */
.bubble { box-shadow: 0 1px 1px #0002; }

/* the call windows, the viewer and the toast stay dark whatever the theme is */
#call, #pcall, #callMini, #lightbox, .toast {
  --bg: #0e1621; --side: #17212b; --panel: #1c2733; --line: #0b121a; --text: #e8eef4; --muted: #7f91a4;
  --in: #182533; --out: #2b5278; --border: #2b3a4a; --hover: #26384a; --chip: #1a2735; --soft: #9db1c5; --soft2: #d4e0ec; --on-accent: #06121e;
  color: var(--text);
}

/* the preferences windows (0.8.0) */
.swatches { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.sw { width: 54px; height: 54px; border-radius: 10px; border: 2px solid transparent; padding: 0; position: relative; display: flex; align-items: flex-end; justify-content: center; font-size: 10px; color: #fff; text-shadow: 0 1px 2px #000a; overflow: hidden; }
.sw.on { border-color: var(--accent); }
.sw.round { width: 34px; height: 34px; border-radius: 50%; }
.sw.theme { width: 92px; height: 56px; align-items: flex-end; padding-bottom: 3px; }
.prefs-h { margin: 14px 0 0; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.prefs-h:first-of-type { margin-top: 0; }
.prow2 { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.prow2 label { flex: 1; color: var(--text); }
.prow2 select { flex: 1.4; margin-top: 0 !important; }
.sess { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--border); }
.sess:last-child { border-bottom: 0; }
.sess .sdot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.sess .sdot.on { background: var(--ok); }
.sess .sinfo { flex: 1; min-width: 0; }
.sess .sinfo b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sess .sinfo span { color: var(--muted); font-size: 12px; }
.sess button { flex: none; padding: 4px 10px; border-radius: 8px; border: 0; background: var(--hover); }
.sess button.danger { background: var(--danger); color: #fff; }
.slist { max-height: 340px; overflow-y: auto; margin-top: 8px; }

/* the photo editor (0.9.0): its own layer over the sending window */
#peditor { z-index: 130; }
.pe-box { width: min(920px, 96vw); max-height: 94vh; display: flex; flex-direction: column; background: var(--side); color: var(--text); border-radius: 14px; padding: 16px 18px; }
.pe-box h2 { margin: 0 0 10px; font-size: 17px; }
.pe-tools, .pe-pal, .pe-cropbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.pe-tools button, .pe-cropbar button, .pe-size { padding: 6px 12px; border-radius: 8px; border: 0; background: var(--hover); }
.pe-tools button.on, .pe-size.on { background: var(--accent); color: var(--on-accent); }
.pe-tools button:disabled { opacity: .4; cursor: default; }
.pe-color { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--border); padding: 0; }
.pe-color.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.pe-stage { flex: none; height: 56vh; display: flex; align-items: center; justify-content: center; background: #000; border-radius: 10px; overflow: hidden; }
.pe-canvas { max-width: 100%; max-height: 100%; display: block; touch-action: none; }
.pe-box .btns { display: flex; justify-content: flex-end; gap: 10px; margin-top: 12px; }
.pe-box .btns button { padding: 8px 18px; border-radius: 8px; border: 0; background: var(--hover); }
.pe-box .btns button.primary { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.stedit { flex: none; padding: 4px 10px; border-radius: 8px; border: 0; background: var(--hover); font-size: 12px; }

/* the player window (0.9.0) */
.lhead { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.lhead .ltitle { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lhead .lback, .lacts button, .dialog .btns button.lback { padding: 5px 12px; border-radius: 8px; border: 0; background: var(--hover); }
.lacts { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 6px; }
.lacts button { padding: 6px 14px; border-radius: 8px; border: 0; background: var(--hover); }
.lacts button.primary { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.lacts button.danger { background: var(--danger); color: #fff; }
.lacts button:disabled { opacity: .45; cursor: default; }
.tlist { max-height: 46vh; overflow-y: auto; margin-top: 4px; }
.trow { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 10px; cursor: pointer; }
.trow:hover { background: var(--hover); }
.trow.now { background: var(--hover); }
.trow.now .tinfo b { color: var(--accent); }
.tico { flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: flex; align-items: center; justify-content: center; font-size: 12px; }
.tinfo { flex: 1; min-width: 0; }
.tinfo b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tinfo span { color: var(--muted); font-size: 12px; }
.tbtn { flex: none; width: 28px; height: 28px; border-radius: 8px; border: 0; background: transparent; color: var(--soft); font-size: 15px; }
.tbtn:hover { background: var(--border); color: var(--text); }
.lrow { cursor: pointer; }
.qrow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 8px 0; }
.qrow .lbl { margin: 0; }
.qrow .stedit { min-width: 44px; font-weight: 600; }
.mpSleep { flex: none; width: 32px; height: 32px; border: 0; border-radius: 50%; background: transparent; font-size: 15px; padding: 0; }
.mpSleep:hover { background: #ffffff1c; }
.mpSleep.on { background: var(--accent); color: var(--on-accent); }
#updBar { flex: none; padding: 10px 12px; background: var(--panel); border-top: 1px solid var(--line); font-size: 13px; }
#updBar .ut { font-weight: 600; margin-bottom: 6px; }
#updBar .um { color: var(--muted); font-size: 12px; }
#updBar .ub { display: flex; gap: 8px; }
#updBar button { padding: 6px 12px; border: 0; border-radius: 8px; background: var(--hover); }
#updBar button.primary { background: var(--accent); color: var(--on-accent); font-weight: 600; }
#updBar button[disabled] { opacity: .6; }

/* 0.16.0: the line "Непрочитанные сообщения", a click on the date of a day, the size of the text in chats */
.unreadline { align-self: stretch; margin: 10px 0 6px; padding: 3px 12px; text-align: center; background: var(--chip); color: var(--accent); font-size: 12px; font-weight: 600; border-radius: 12px; scroll-margin-top: 40px; }
.sep.link { cursor: pointer; }
.sep.link:hover { background: var(--hover); color: var(--text); }
.sep { scroll-margin-top: 8px; }
.sep.flash { animation: pvflash 1.4s ease-out; }
#jumpDate { display: block; width: 100%; margin-top: 6px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--panel); color: var(--text); color-scheme: dark; font-size: 15px; }
:root[data-theme="light"] #jumpDate { color-scheme: light; }
.bubble { font-size: calc(14px * var(--ts, 1)); }
.bubble .who { font-size: calc(12px * var(--ts, 1)); }
.bubble .meta { font-size: calc(11px * var(--ts, 1)); }
.bubble .reply { font-size: calc(13px * var(--ts, 1)); }
.bubble .reply b { font-size: calc(12px * var(--ts, 1)); }
.bubble .file .fsize, .bubble .fail-actions { font-size: calc(12px * var(--ts, 1)); }
#input { font-size: calc(14px * var(--ts, 1)); }
.size-row { display: flex; align-items: center; gap: 10px; margin: 4px 0 2px; }
.size-row input[type=range] { flex: 1; accent-color: var(--accent); }
.size-row .size-out { width: 44px; text-align: right; color: var(--muted); }
.size-sample { margin: 6px 0 2px; padding: 8px 12px; border-radius: 12px; background: var(--in); font-size: calc(14px * var(--ts, 1)); }
.size-row button { padding: 6px 12px; border: 0; border-radius: 8px; background: var(--hover); color: var(--text); }

/* 0.17.0: the header of a chat (name and status, then the search, the call and the three dots), the menu of the dots, the profile panel */
#chathead { gap: 4px; padding: 8px 12px 8px 20px; }
#chathead .htext { flex: 1; min-width: 0; }
#chathead #hTitle, #chathead #hSub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#chathead .hbtn { margin-left: 0; flex: none; font-size: 18px; color: var(--text); }
#chathead .hbtn.active { background: var(--ok); color: #06210f; opacity: 1; }
#moreBtn { font-size: 22px; font-weight: 700; line-height: 1; }
.ctx.hmenu { min-width: 250px; padding: 6px; border-radius: 12px; }
.ctx.hmenu .hitem { display: flex; align-items: center; gap: 14px; padding: 9px 12px; border-radius: 8px; }
.ctx.hmenu .hico { width: 22px; text-align: center; opacity: .85; flex: none; }
.ctx.hmenu .hlab { flex: 1; }
.ctx.hmenu .hchev { opacity: .6; font-size: 18px; line-height: 1; }
.ctx.hmenu .hsep { height: 1px; margin: 5px 4px; background: var(--line); }
#ctxSub.hmenu { min-width: 220px; }

#profile { position: absolute; top: 0; right: 0; bottom: 0; width: 380px; max-width: 100%; z-index: 40; overflow-y: auto; background: var(--side); border-left: 1px solid var(--line); box-shadow: -10px 0 28px #0007; padding-bottom: 20px; }
#profile .pclose { position: absolute; top: 12px; right: 14px; width: 34px; height: 34px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 18px; }
#profile .pclose:hover { background: var(--hover); color: var(--text); }
.pfhead { text-align: center; padding: 30px 20px 6px; }
.pfhead .avatar.big { width: 104px; height: 104px; font-size: 40px; margin: 0 auto; }
.pfname { margin-top: 12px; font-weight: 700; font-size: 17px; overflow-wrap: anywhere; }
.pfsub { margin-top: 2px; color: var(--muted); font-size: 13px; }
.pfsub.online, .pfsub.typing { color: var(--accent); }
.pfact { display: flex; gap: 8px; padding: 16px 16px 8px; }
.pfbtn { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 4px; border: 0; border-radius: 12px; background: var(--panel); color: var(--text); font-size: 12px; }
.pfbtn:hover:not([disabled]) { background: var(--hover); }
.pfbtn[disabled] { opacity: .4; }
.pfbtn .i { font-size: 20px; line-height: 1; }
.pfsect { margin: 16px 20px 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.pfstrip { margin: 4px 20px; }
.pfmembers { display: flex; flex-direction: column; }
.pfmember { display: flex; align-items: center; gap: 12px; padding: 7px 20px; }
.pfmember .avatar { width: 38px; height: 38px; font-size: 15px; }
.pfmember .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pfmanage { display: block; margin: 8px 20px 0; padding: 8px 14px; border: 0; border-radius: 8px; background: var(--panel); color: var(--text); }
.pfmanage:hover { background: var(--hover); }
.pfrow { display: flex; align-items: center; gap: 22px; width: 100%; padding: 13px 24px; border: 0; background: transparent; color: var(--text); text-align: left; font-size: 14px; }
.pfrow:hover { background: var(--hover); }
.pfrow .ico { width: 22px; text-align: center; opacity: .8; flex: none; }
.pfempty { padding: 12px 24px; color: var(--muted); font-size: 13px; }

.bg-row { display: flex; gap: 8px; margin-top: 8px; }
.bg-row button { padding: 6px 12px; border: 0; border-radius: 8px; background: var(--hover); color: var(--text); cursor: pointer; }
.bg-row .hidden { display: none; }

.sndbox { margin-top: 10px; }
.sndrow { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.sndrow input { accent-color: var(--accent); }

/* 0.21.0: the tag of a bot (a service account) by its name */
.bottag { display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 6px; background: var(--accent); color: var(--on-accent); font-size: 10px; font-weight: 700; letter-spacing: .5px; line-height: 14px; flex-shrink: 0; align-self: center; vertical-align: middle; }
.chat .top.hasbot .name { flex: 0 1 auto; }
.chat .top.hasbot .time { margin-left: auto; }
.pfdesc { margin-top: 6px; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; text-align: center; }

/* 0.21.0: the administrator's panel */
.adm-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.adm-line { display: block; width: 100%; text-align: left; padding: 10px 12px; border: 0; border-radius: 8px; background: var(--panel); color: var(--text); }
.adm-line:hover { background: var(--hover); }
.adm-line.danger { color: var(--danger); }
.adm-card { padding: 10px 12px; border-radius: 8px; background: var(--panel); }
.adm-head { margin-bottom: 4px; }
.adm-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.adm-row { display: flex; gap: 8px; margin-top: 8px; }
.adm-row .adm-line { width: auto; padding: 5px 12px; background: var(--bg); }
.adm-p { margin: 6px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.adm-pre { white-space: pre-wrap; overflow-wrap: anywhere; margin: 4px 0; }
.adm-quote { padding: 6px 10px; border-left: 3px solid var(--accent); background: var(--panel); border-radius: 4px; }
.dialog[data-admin] input[type=text], .dialog[data-admin] input[type=password] { width: 100%; margin-top: 8px; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text); }
.dialog[data-admin] select { width: 100%; margin-top: 8px; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text); }

/* 0.22.0: the tabs of the list (the folders of the phone) */
#folderTabs { flex: none; display: flex; gap: 4px; padding: 6px 8px; overflow-x: auto; border-bottom: 1px solid var(--line); scrollbar-width: thin; }
#folderTabs .ftab { flex: none; display: flex; align-items: center; gap: 6px; padding: 5px 12px; border: 0; border-radius: 14px; background: transparent; color: var(--muted); font-size: 13px; cursor: pointer; max-width: 160px; }
#folderTabs .ftab:hover { background: var(--hover); }
#folderTabs .ftab.on { background: var(--accent); color: var(--on-accent); font-weight: 600; }
#folderTabs .fname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#folderTabs .fcount { min-width: 16px; padding: 0 5px; border-radius: 8px; background: var(--hover); color: inherit; font-size: 11px; line-height: 16px; text-align: center; }
#folderTabs .ftab.on .fcount { background: rgba(255,255,255,.25); }
.sync-state { margin: 8px 0; padding: 8px 10px; border-radius: 8px; background: var(--hover); font-size: 13px; }
.sync-state.bad { color: var(--danger); }
.sync-info p { margin: 4px 0; }
.sync-info p.bad { color: var(--danger); }
.dialog #syncKeyIn { width: 100%; margin-top: 8px; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text); }
.dialog #syncKeyIn:focus { outline: 1px solid var(--accent); }

/* 0.23.0: folders are made here too */
.sync-h { margin: 14px 0 6px; font-size: 14px; }
.sync-folders { display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow-y: auto; }
.sync-frow { display: flex; align-items: center; gap: 8px; }
.sync-frow .sync-fname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sync-frow button { padding: 4px 10px; border: 0; border-radius: 8px; background: var(--hover); color: var(--text); font-size: 12px; cursor: pointer; }
.sync-frow button.danger { background: var(--danger); color: #fff; }
.sync-add { display: flex; gap: 8px; margin-top: 8px; }
.sync-add input { flex: 1; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text); }
.sync-add button { padding: 6px 14px; border: 0; border-radius: 8px; background: var(--accent); color: var(--on-accent); font-weight: 600; cursor: pointer; }
.dialog #syncAskName { width: 100%; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text); }

/* 0.26.0: my name and photo above the chats */
#meBar { box-sizing: border-box; height: 49px; flex: none; display: flex; align-items: center; gap: 10px; padding: 8px 12px; cursor: pointer; border-bottom: 1px solid var(--line); }
#meBar:empty { display: none; }
#meBar:hover { background: var(--panel); }
#meBar .avatar { width: 32px; height: 32px; font-size: 14px; flex: none; }
#meBar .meName { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* the voice effect that is on is marked on the button of the voice message / circle */
#sendBtn[data-fx] { position: relative; }
#sendBtn[data-fx]::after { content: '\2726'; position: absolute; top: -2px; right: -2px; font-size: 11px; line-height: 1; color: #f5b83d; }
.fxlist { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; max-height: 50vh; overflow: auto; }
.fxrow { display: flex; align-items: center; gap: 8px; cursor: pointer; }
#meBar:not(:empty) ~ .menu { top: 101px; max-height: calc(100vh - 111px); }       /* the menus hang under the row with the buttons, which is lower now */
