/* ===== Nyxo Messenger — dark / purple ===== */
:root {
  --bg: #07060b;
  --bg2: #0c0a13;
  --panel: #110e1a;
  --panel2: #171324;
  --raise: #1e1930;
  --line: rgba(167, 139, 250, .12);
  --line2: rgba(167, 139, 250, .22);
  --text: #f3f0fa;
  --muted: #9a92b0;
  --dim: #6b6382;
  --accent: #a855f7;
  --accent2: #7c3aed;
  --accent-soft: rgba(168, 85, 247, .16);
  --grad: linear-gradient(135deg, #c084fc 0%, #a855f7 40%, #7c3aed 100%);
  --glow: 0 10px 40px -10px rgba(168, 85, 247, .55);
  --ok: #22c55e; --away: #f59e0b; --busy: #ef4444; --off: #4b4560;
  --danger: #f43f5e;
  --r: 14px; --r-lg: 20px;
  --top: 56px;
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--text); font: 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased; overflow: hidden;
  background-image: radial-gradient(1200px 600px at 85% -10%, rgba(124, 58, 237, .18), transparent 60%), radial-gradient(900px 500px at -10% 110%, rgba(168, 85, 247, .10), transparent 60%);
}
[hidden] { display: none !important; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: #c4b5fd; }
::selection { background: rgba(168, 85, 247, .45); }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(167, 139, 250, .18); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: rgba(167, 139, 250, .32); }
::-webkit-scrollbar-track { background: transparent; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.accent-text { color: #c4b5fd; }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- inputs & buttons ---------- */
input, textarea, select {
  width: 100%; background: var(--bg2); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px; outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus { border-color: rgba(168, 85, 247, .6); box-shadow: 0 0 0 3px rgba(168, 85, 247, .18); }
textarea { resize: none; }
label { display: grid; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 12px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line2); background: var(--raise); padding: 9px 16px; border-radius: 12px; font-weight: 600;
  transition: transform .1s, background .15s, box-shadow .15s, filter .15s;
}
.btn:hover { background: #262040; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.grad { background: var(--grad); border-color: transparent; color: #fff; box-shadow: var(--glow); }
.btn.grad:hover { filter: brightness(1.1); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: rgba(255, 255, 255, .05); }
.btn.danger { background: var(--danger); border-color: transparent; color: #fff; }
.btn.danger-ghost { background: transparent; color: #fda4af; border-color: rgba(244, 63, 94, .35); }
.btn.small { padding: 6px 11px; font-size: 12.5px; border-radius: 10px; }
.btn.big { padding: 13px 18px; font-size: 15px; border-radius: 14px; }
.btn.wide { width: 100%; }
.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
  background: transparent; border: 0; color: var(--muted); transition: background .15s, color .15s;
}
.icon-btn:hover { background: rgba(255, 255, 255, .06); color: var(--text); }
.icon-btn.accent { background: var(--accent-soft); color: #d8b4fe; }
.icon-btn.accent:hover { background: rgba(168, 85, 247, .28); }
.form-error { color: #fda4af; background: rgba(244, 63, 94, .1); border: 1px solid rgba(244, 63, 94, .25); padding: 9px 12px; border-radius: 10px; margin: 0 0 12px; font-size: 13px; }

/* ---------- avatars & status ---------- */
.av { position: relative; width: 36px; height: 36px; flex: none; }
.av .pic { width: 100%; height: 100%; border-radius: 50%; background-size: cover; background-position: center; display: grid; place-items: center; font-weight: 700; color: #fff; font-size: 15px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08); }
.av.sm { width: 28px; height: 28px; } .av.sm .pic { font-size: 12px; }
.av.lg { width: 46px; height: 46px; } .av.lg .pic { font-size: 18px; }
.av.xl { width: 84px; height: 84px; } .av.xl .pic { font-size: 32px; }
.av .st { position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border-radius: 50%; border: 2.5px solid var(--panel); background: var(--off); }
.av.lg .st { width: 14px; height: 14px; } .av.xl .st { width: 20px; height: 20px; border-width: 3.5px; right: 2px; bottom: 2px; }
.s-online { background: var(--ok) !important; box-shadow: 0 0 8px rgba(34, 197, 94, .6); }
.s-away { background: var(--away) !important; }
.s-busy { background: var(--busy) !important; }
.s-offline, .s-invisible { background: var(--off) !important; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: none; }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--grad); color: #fff; font-size: 11px; font-weight: 800; display: inline-grid; place-items: center; box-shadow: 0 0 12px rgba(168, 85, 247, .5); }

/* ---------- auth ---------- */
#auth { position: fixed; inset: 0; display: grid; place-items: center; padding: 20px; overflow: auto; }
.auth-glow { position: fixed; width: 620px; height: 620px; border-radius: 50%; background: radial-gradient(circle, rgba(168, 85, 247, .35), transparent 65%); filter: blur(20px); top: 50%; left: 50%; transform: translate(-50%, -62%); pointer-events: none; animation: breathe 6s ease-in-out infinite; }
@keyframes breathe { 50% { transform: translate(-50%, -62%) scale(1.08); opacity: .8; } }
.auth-card { position: relative; width: min(400px, 100%); text-align: center; background: rgba(17, 14, 26, .72); backdrop-filter: blur(22px); border: 1px solid var(--line); border-radius: 28px; padding: 30px 28px 26px; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .7); }
.auth-logo { width: 116px; height: 116px; margin: -6px auto 2px; display: block; filter: drop-shadow(0 18px 30px rgba(168, 85, 247, .55)); animation: float 5s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-6px) rotate(-2deg); } }
.wordmark { margin: 0; font-size: 38px; font-weight: 800; letter-spacing: -1.5px; line-height: 1; }
.wordmark span { display: block; font-size: 11.5px; letter-spacing: 5px; text-transform: uppercase; font-weight: 700; color: #c4b5fd; margin-top: 6px; }
.tagline { color: var(--muted); margin: 10px 0 20px; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--bg2); border: 1px solid var(--line); border-radius: 14px; padding: 4px; margin-bottom: 18px; }
.auth-tabs button { border: 0; background: transparent; padding: 9px; border-radius: 10px; font-weight: 700; color: var(--muted); }
.auth-tabs button.active { background: var(--raise); color: var(--text); box-shadow: 0 2px 10px rgba(0, 0, 0, .3); }
#auth-form { text-align: left; }
#auth-submit { width: 100%; margin-top: 4px; }
.dl-app { display: inline-block; margin-top: 16px; font-size: 13px; font-weight: 600; text-decoration: none; }

/* ---------- app shell ---------- */
#app { position: fixed; inset: 0; display: flex; flex-direction: column; }
.topbar { height: var(--top); flex: none; display: flex; align-items: center; gap: 18px; padding: 0 16px; border-bottom: 1px solid var(--line); background: rgba(8, 6, 13, .7); backdrop-filter: blur(16px); position: relative; z-index: 20; }
.is-desktop .topbar { -webkit-app-region: drag; padding-right: 150px; }
.is-desktop .topbar button, .is-desktop .topbar input { -webkit-app-region: no-drag; }
.brand { display: flex; align-items: center; gap: 9px; font-size: 20px; letter-spacing: -.6px; }
.brand img { filter: drop-shadow(0 4px 12px rgba(168, 85, 247, .5)); }
.tabs { display: flex; gap: 4px; background: var(--bg2); border: 1px solid var(--line); padding: 4px; border-radius: 13px; }
.tabs button { border: 0; background: transparent; padding: 7px 14px; border-radius: 9px; color: var(--muted); font-weight: 700; display: flex; align-items: center; gap: 8px; }
.tabs button.active { background: var(--raise); color: var(--text); }
.tabs button:hover:not(.active) { color: var(--text); }
.live-pill { background: rgba(239, 68, 68, .16); color: #fca5a5; font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 20px; }
.top-right { margin-left: auto; display: flex; gap: 6px; }
.only-mobile { display: none; }
.layout { flex: 1; display: flex; min-height: 0; }

/* ---------- buddy list ---------- */
#buddy { width: 310px; flex: none; display: flex; flex-direction: column; border-right: 1px solid var(--line); background: rgba(12, 10, 19, .75); min-height: 0; }
#me-card { display: flex; gap: 12px; align-items: center; padding: 16px 14px 14px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, rgba(168, 85, 247, .12), transparent); }
#me-card .av.clickable { cursor: pointer; }
#me-card .av.clickable:hover .pic { box-shadow: 0 0 0 2px var(--accent); }
.me-text { flex: 1; min-width: 0; }
.me-row { display: flex; align-items: center; gap: 8px; }
.me-name { font-size: 15.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-status { border: 1px solid var(--line); background: var(--bg2); border-radius: 20px; padding: 2px 9px; display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.me-status:hover { border-color: var(--line2); color: var(--text); }
.caret { font-size: 10px; opacity: .7; }
.me-msg { margin-top: 6px; padding: 5px 8px; font-size: 12.5px; background: transparent; border-color: transparent; color: #cbc3e0; font-style: italic; }
.me-msg:hover { border-color: var(--line); }
.me-msg:focus { background: var(--bg2); font-style: normal; }
.buddy-tools { display: flex; gap: 8px; padding: 12px 12px 6px; }
.search input { padding: 8px 12px; border-radius: 11px; font-size: 13px; }
.search { flex: 1; }
#buddy-list { flex: 1; overflow-y: auto; padding: 4px 8px 10px; }
#btn-add-big { margin: 8px 12px 12px; width: calc(100% - 24px); }
.grp { margin-top: 6px; }
.grp-head { width: 100%; display: flex; align-items: center; gap: 7px; border: 0; background: transparent; padding: 7px 8px; color: var(--dim); font-size: 11px; text-transform: uppercase; letter-spacing: 1.2px; font-weight: 800; }
.grp-head .cnt { margin-left: auto; font-weight: 700; }
.grp.closed .caret { transform: rotate(-90deg); }
.grp-head .caret { transition: transform .15s; }
.buddy { display: flex; align-items: center; gap: 11px; padding: 8px; border-radius: 13px; cursor: pointer; position: relative; transition: background .12s; outline: none; }
.buddy:hover, .buddy:focus-visible { background: rgba(167, 139, 250, .08); }
.buddy.off { opacity: .55; }
.buddy.off:hover { opacity: .85; }
.buddy.has-unread { background: rgba(168, 85, 247, .1); }
.b-text { flex: 1; min-width: 0; display: grid; cursor: pointer; }
.b-text b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; display: flex; align-items: center; gap: 5px; }
.b-text small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.b-text small.msg { color: #b9addb; font-style: italic; }
.buddy .more { opacity: 0; width: 28px; height: 28px; }
.buddy:hover .more { opacity: 1; }
.buddy.req { background: rgba(168, 85, 247, .08); border: 1px solid var(--line); margin-bottom: 4px; cursor: default; }
.req-btns { display: flex; gap: 4px; }
.req-btns .btn.ghost { padding: 5px; width: 30px; }
.req-btns svg { width: 16px; height: 16px; }
.buddy.pending { cursor: default; opacity: .75; }
.buddy-empty { text-align: center; padding: 34px 18px; color: var(--muted); }
.buddy-empty .big { width: 58px; height: 58px; margin: 0 auto 12px; border-radius: 18px; background: var(--accent-soft); color: #d8b4fe; display: grid; place-items: center; }
.buddy-empty .big svg { width: 28px; height: 28px; }
.buddy-empty b { color: var(--text); }

/* ---------- main area ---------- */
#main { flex: 1; min-width: 0; min-height: 0; position: relative; }
.view { position: absolute; inset: 0; overflow-y: auto; padding: 26px 30px 40px; }
.view-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; margin-bottom: 18px; }
.view-head h2 { margin: 0; font-size: 26px; letter-spacing: -.6px; }
.view-head p { margin: 4px 0 0; }
.hero { display: flex; gap: 24px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 26px; border-radius: var(--r-lg); background: linear-gradient(135deg, rgba(168, 85, 247, .2), rgba(17, 14, 26, .6) 60%); border: 1px solid var(--line); position: relative; overflow: hidden; }
.hero::after { content: ''; position: absolute; width: 300px; height: 300px; right: -80px; top: -120px; border-radius: 50%; background: radial-gradient(circle, rgba(192, 132, 252, .35), transparent 70%); pointer-events: none; }
.hero h1 { margin: 0; font-size: 30px; letter-spacing: -1px; }
.hero p { margin: 6px 0 0; }
.hero-cards { display: flex; gap: 12px; position: relative; z-index: 1; flex-wrap: wrap; }
.stat-card { text-align: left; width: 190px; border: 1px solid var(--line2); background: rgba(12, 10, 19, .65); backdrop-filter: blur(10px); border-radius: 16px; padding: 14px; display: grid; gap: 3px; transition: transform .15s, border-color .15s; }
.stat-card:hover { transform: translateY(-2px); border-color: rgba(168, 85, 247, .5); }
.stat-card small { color: var(--muted); }
.sc-ico { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; background: var(--grad); color: #fff; margin-bottom: 6px; }
.stat-card.live .sc-ico { background: linear-gradient(135deg, #fb7185, #e11d48); }
.sec-h { margin: 26px 0 12px; font-size: 13px; text-transform: uppercase; letter-spacing: 1.4px; color: var(--dim); font-weight: 800; }
.online-strip { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 6px; }
.os-item { border: 0; background: transparent; display: grid; justify-items: center; gap: 6px; width: 72px; flex: none; }
.os-item span { font-size: 12px; max-width: 72px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.os-item:hover span { color: var(--text); }
.os-item .av .pic { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px rgba(168, 85, 247, .55); }
.convo-list { display: grid; gap: 6px; max-width: 820px; }
.convo { display: flex; align-items: center; gap: 12px; text-align: left; border: 1px solid transparent; background: var(--panel); border-radius: 16px; padding: 11px 14px; transition: border-color .15s, background .15s; }
.convo:hover { border-color: var(--line2); background: var(--panel2); }
.convo.unread { border-color: rgba(168, 85, 247, .4); }
.cv-text { flex: 1; min-width: 0; }
.cv-top { display: flex; justify-content: space-between; gap: 10px; }
.cv-top time { color: var(--dim); font-size: 12px; flex: none; }
.cv-prev { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.convo.unread .cv-prev { color: var(--text); font-weight: 600; }
.cv-prev .you { color: var(--dim); }
.empty-card { padding: 26px; border: 1px dashed var(--line2); border-radius: 16px; text-align: center; }
.empty-card p { margin: 6px 0 0; }

/* ---------- rooms list ---------- */
.room-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.room-card { border: 1px solid var(--line); background: var(--panel); border-radius: 18px; overflow: hidden; cursor: pointer; transition: transform .15s, border-color .15s, box-shadow .15s; outline: none; }
.room-card:hover, .room-card:focus-visible { transform: translateY(-3px); border-color: rgba(168, 85, 247, .45); box-shadow: var(--glow); }
.rc-art { height: 128px; position: relative; display: grid; place-items: center; overflow: hidden; }
.rc-art::after { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at 30% 20%, rgba(255, 255, 255, .25), transparent 50%), linear-gradient(transparent 55%, rgba(0, 0, 0, .45)); }
.rc-letter { font-size: 64px; font-weight: 800; color: rgba(255, 255, 255, .9); text-shadow: 0 10px 30px rgba(0, 0, 0, .35); letter-spacing: -2px; }
.rc-art .pill-live { position: absolute; left: 10px; top: 10px; z-index: 1; }
.rc-admin { position: absolute; right: 8px; top: 8px; z-index: 2; display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.room-card:hover .rc-admin { opacity: 1; }
.rc-admin .icon-btn { background: rgba(0, 0, 0, .45); color: #fff; width: 30px; height: 30px; }
.rc-body { padding: 13px 15px 15px; display: grid; gap: 3px; }
.rc-body b { font-size: 16px; }
.rc-body small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rc-meta { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-top: 6px; }
.rc-meta svg { width: 15px; height: 15px; }
.rc-cam { color: #fb7185; margin-left: 6px; display: inline-flex; }
.pill-live { background: #e11d48; color: #fff; font-size: 10.5px; font-weight: 800; letter-spacing: .6px; padding: 3px 8px; border-radius: 7px; box-shadow: 0 0 16px rgba(225, 29, 72, .55); }

/* ---------- inside a room ---------- */
#view-room { padding: 0; overflow: hidden; }
.room-layout { position: absolute; inset: 0; display: flex; }
#callbox { flex: 1; min-width: 0; display: flex; flex-direction: column; background: #050409; }
.room-bar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.room-bar .icon-btn { font-size: 26px; line-height: 1; }
.room-title { display: grid; min-width: 0; }
.room-title b { font-size: 16px; }
.room-title small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-stats { margin-left: auto; display: flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 700; font-size: 13px; }
.room-stats svg { width: 17px; height: 17px; }
#stage-wrap { flex: 1; position: relative; min-height: 0; padding: 12px; }
#stage { position: absolute; inset: 12px; display: flex; flex-wrap: wrap; align-content: center; justify-content: center; gap: 10px; }
#stage.spotlight { flex-direction: row; }
#stage.spotlight .tile.pinned { flex-basis: 100%; max-width: 100%; margin: 0 auto; }
.tile { position: relative; border-radius: 16px; overflow: hidden; background: radial-gradient(circle at 50% 40%, #241b38, #0d0a15); border: 1px solid var(--line); transition: box-shadow .2s, border-color .2s; }
.tile video { width: 100%; height: 100%; object-fit: cover; display: block; background: #000; }
.tile.local video { transform: scaleX(-1); }
.tile-av { position: absolute; inset: 0; display: grid; place-items: center; }
.tile.small .tile-av .av { width: 48px; height: 48px; }
.tile.speaking { border-color: rgba(168, 85, 247, .9); box-shadow: 0 0 0 2px rgba(168, 85, 247, .6), 0 0 30px rgba(168, 85, 247, .4); }
.tile .tl { position: absolute; left: 10px; top: 10px; display: flex; gap: 6px; align-items: center; }
.netq { display: inline-flex; padding: 3px 5px; border-radius: 6px; background: rgba(0, 0, 0, .45); color: #fff; }
.netq rect { fill: rgba(255, 255, 255, .25); }
.netq rect.on { fill: #4ade80; }
.netq.q-poor rect.on { fill: #fbbf24; }
.netq.q-lost rect.on { fill: #f87171; }
.tile .foot { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; padding: 26px 10px 9px; background: linear-gradient(transparent, rgba(0, 0, 0, .7)); }
.tile .nm { font-weight: 700; font-size: 13px; display: flex; gap: 5px; align-items: center; min-width: 0; text-shadow: 0 1px 3px rgba(0, 0, 0, .6); }
.tile .nm span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crown { color: #fbbf24; display: inline-flex; }
.crown svg { width: 14px; height: 14px; }
.tile .ctl { display: flex; gap: 4px; }
.tbtn { width: 30px; height: 30px; border-radius: 9px; border: 0; display: grid; place-items: center; background: rgba(0, 0, 0, .5); color: #fff; }
.tbtn svg { width: 16px; height: 16px; }
.tbtn.off { color: #fda4af; }
.tbtn.talk { color: #d8b4fe; }
.tbtn.spk.off { background: rgba(244, 63, 94, .5); }
button.tbtn:hover { background: rgba(168, 85, 247, .6); }
.tile.small .foot { padding: 14px 6px 5px; }
.tile.small .tbtn { width: 24px; height: 24px; }
.tile.small .nm { font-size: 11px; }
.react { position: absolute; bottom: 18%; font-size: 40px; pointer-events: none; animation: rise 2.6s ease-out forwards; z-index: 5; }
@keyframes rise { 0% { transform: translateY(0) scale(.6); opacity: 0; } 15% { opacity: 1; transform: translateY(-10px) scale(1.1); } 100% { transform: translateY(-160px) scale(1); opacity: 0; } }
#call-empty { position: absolute; inset: 12px; display: grid; place-items: center; }
.room-empty { text-align: center; max-width: 420px; padding: 20px; }
.room-empty .big { width: 84px; height: 84px; margin: 0 auto 16px; border-radius: 26px; background: var(--grad); color: #fff; display: grid; place-items: center; box-shadow: var(--glow); }
.room-empty .big svg { width: 40px; height: 40px; }
.room-empty h2 { margin: 0 0 6px; }
.room-empty p { color: var(--muted); margin: 0 0 18px; }
.room-empty .row { justify-content: center; }
#call-status { position: absolute; left: 50%; top: 20px; transform: translateX(-50%); background: rgba(17, 14, 26, .9); border: 1px solid var(--line2); padding: 8px 16px; border-radius: 20px; font-weight: 600; z-index: 6; }
#call-controls { display: flex; justify-content: center; align-items: center; gap: 10px; padding: 12px; border-top: 1px solid var(--line); flex-wrap: wrap; min-height: 72px; }
.rbtn { position: relative; width: 48px; height: 48px; border-radius: 16px; border: 1px solid var(--line2); background: var(--panel2); color: var(--text); display: grid; place-items: center; transition: background .15s, transform .1s; }
.rbtn:hover { background: var(--raise); }
.rbtn:active { transform: scale(.94); }
.rbtn:disabled { opacity: .45; cursor: default; }
.rbtn.on { background: var(--accent-soft); color: #e9d5ff; border-color: rgba(168, 85, 247, .45); }
.rbtn.golive { width: auto; padding: 0 18px; background: var(--grad); border-color: transparent; color: #fff; box-shadow: var(--glow); grid-auto-flow: column; gap: 8px; }
.rbtn.golive .tip { position: static; opacity: 1; transform: none; background: none; padding: 0; font-weight: 800; font-size: 14px; pointer-events: auto; }
.rbtn.live { background: rgba(225, 29, 72, .18); border-color: rgba(225, 29, 72, .5); color: #fecdd3; }
.rbtn.end { background: #e11d48; border-color: transparent; color: #fff; }
.rbtn .tip { position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%) translateY(4px); background: #000; color: #fff; font-size: 11.5px; font-weight: 600; padding: 4px 8px; border-radius: 7px; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s; }
.rbtn:hover .tip { opacity: 1; transform: translateX(-50%); }
.locked-note { display: inline-flex; gap: 6px; align-items: center; color: #fcd34d; font-size: 12.5px; font-weight: 700; }
#callbox:fullscreen { background: #000; }
#callbox:fullscreen .room-bar { display: none; }

#room-side { width: 340px; flex: none; display: flex; flex-direction: column; border-left: 1px solid var(--line); background: var(--bg2); min-height: 0; }
.side-tabs { display: grid; grid-template-columns: 1fr 1fr; padding: 8px; gap: 4px; border-bottom: 1px solid var(--line); }
.side-tabs button { border: 0; background: transparent; padding: 8px; border-radius: 10px; font-weight: 700; color: var(--muted); }
.side-tabs button.active { background: var(--raise); color: var(--text); }
.side-pane { flex: 1; min-height: 0; display: flex; flex-direction: column; }
#room-users { overflow-y: auto; padding: 8px; display: block; }
#room-msgs { flex: 1; overflow-y: auto; padding: 12px 12px 6px; display: flex; flex-direction: column; gap: 10px; }
.sys { text-align: center; font-size: 12px; color: var(--dim); }
.rmsg { display: flex; gap: 9px; }
.rm-body { min-width: 0; flex: 1; }
.rm-top { display: flex; align-items: center; gap: 6px; }
.rm-name { border: 0; background: none; padding: 0; font-weight: 700; color: #c4b5fd; font-size: 13px; }
.rm-name:hover { text-decoration: underline; }
.rm-name.admin { color: #fcd34d; }
.rm-top time { font-size: 11px; color: var(--dim); margin-left: auto; }
.rm-text { font-size: 13.5px; word-wrap: break-word; overflow-wrap: anywhere; color: #e4def2; }
.rmsg.mine .rm-name { color: #f0abfc; }
#room-composer { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); }
#room-composer input { border-radius: 12px; }
.send { width: 42px; flex: none; border: 0; border-radius: 12px; background: var(--grad); color: #fff; display: grid; place-items: center; box-shadow: var(--glow); }
.ru { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 11px; cursor: pointer; }
.ru:hover { background: rgba(167, 139, 250, .08); }
.ru-cam { color: #fb7185; display: inline-flex; }
.ru-cam svg { width: 17px; height: 17px; }

/* ---------- popovers ---------- */
.pop { position: fixed; z-index: 3000; min-width: 210px; max-width: 300px; background: rgba(23, 19, 36, .97); backdrop-filter: blur(16px); border: 1px solid var(--line2); border-radius: 14px; padding: 6px; box-shadow: 0 20px 50px -10px rgba(0, 0, 0, .7); animation: pop .12s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(4px) scale(.98); } }
.pop .item { width: 100%; display: flex; align-items: center; gap: 10px; border: 0; background: transparent; padding: 8px 10px; border-radius: 9px; text-align: left; font-weight: 600; font-size: 13.5px; }
.pop .item:hover { background: rgba(168, 85, 247, .16); }
.pop .item.danger { color: #fda4af; }
.pop .item .ii { display: inline-flex; color: var(--muted); }
.pop .item .ii svg { width: 17px; height: 17px; }
.pop .item .chk { margin-left: auto; color: var(--accent); display: inline-flex; }
.pop .item .chk svg { width: 16px; height: 16px; }
.pop .sep { height: 1px; background: var(--line); margin: 5px 4px; }
.pop h5 { margin: 6px 8px; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--dim); }
.pop label { margin: 4px 8px 10px; }
.pop.settings { width: 290px; max-width: 290px; }
.pop.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); width: 312px; max-width: 312px; gap: 2px; }
.pop.emoji-grid.small { width: 290px; }
.pop.emoji-grid button { border: 0; background: transparent; font-size: 21px; padding: 5px 0; border-radius: 8px; }
.pop.emoji-grid button:hover { background: rgba(168, 85, 247, .2); transform: scale(1.15); }

/* ---------- modals ---------- */
#modal-root { position: relative; z-index: 2500; }
.modal-back { position: fixed; inset: 0; background: rgba(3, 2, 6, .65); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 16px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(460px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line2); border-radius: 22px; box-shadow: 0 40px 90px -20px rgba(0, 0, 0, .8); animation: up .18s ease-out; overflow: hidden; }
@keyframes up { from { transform: translateY(12px) scale(.98); opacity: 0; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 8px; }
.modal-head h3 { margin: 0; font-size: 18px; }
.modal-body { padding: 8px 18px 14px; overflow-y: auto; }
.modal-body p { margin: 0 0 10px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.profile-modal .modal-body { padding-top: 0; }
.profile { position: relative; }
.profile-cover { height: 90px; margin: 0 -18px; background: radial-gradient(circle at 20% 0%, rgba(255, 255, 255, .25), transparent 50%), var(--grad); }
.profile-modal .profile-top { margin-top: -42px; }
.profile-modal .profile-top .av .pic { box-shadow: 0 0 0 4px var(--panel); }
.profile-top { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 14px; }
.profile-top h2 { margin: 0; font-size: 21px; display: flex; align-items: center; gap: 8px; }
.handle { color: var(--muted); font-size: 13px; }
.role-badge { font-size: 10.5px; background: rgba(251, 191, 36, .16); color: #fcd34d; padding: 2px 7px; border-radius: 6px; font-weight: 800; }
.p-status { margin: 0 0 14px; padding: 10px 14px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 12px 12px 0; font-style: italic; color: #e9d5ff; }
.modal h4 { margin: 12px 0 6px; font-size: 11.5px; text-transform: uppercase; letter-spacing: 1px; color: var(--dim); }
.p-bio { white-space: pre-wrap; color: #ddd6ee; }
.av-edit .av { cursor: default; }
.pw-box { margin-top: 4px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.pw-box summary { cursor: pointer; font-weight: 700; color: var(--muted); }
.pw-box input { margin: 8px 0; }
.search-results { display: grid; gap: 4px; max-height: 320px; overflow-y: auto; margin-top: 4px; }
.res-row { display: flex; align-items: center; gap: 10px; padding: 7px; border-radius: 12px; }
.res-row:hover { background: rgba(167, 139, 250, .07); }
.golive-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.golive-opt { border: 1px solid var(--line2); background: var(--bg2); border-radius: 18px; padding: 18px 14px; display: grid; justify-items: center; gap: 6px; text-align: center; transition: border-color .15s, transform .15s; }
.golive-opt:hover { border-color: var(--accent); transform: translateY(-2px); }
.golive-opt .gi { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--grad); color: #fff; box-shadow: var(--glow); }
.golive-opt.audio .gi { background: linear-gradient(135deg, #818cf8, #4f46e5); }
.golive-opt small { color: var(--muted); }

/* ---------- private chat windows ---------- */
#windows { position: fixed; inset: 0; pointer-events: none; z-index: 1000; }
.cwin { position: absolute; pointer-events: auto; display: flex; flex-direction: column; min-width: 300px; min-height: 340px; resize: both; overflow: hidden; background: rgba(15, 12, 23, .96); backdrop-filter: blur(20px); border: 1px solid var(--line2); border-radius: 20px; box-shadow: 0 30px 70px -18px rgba(0, 0, 0, .85); animation: up .18s ease-out; }
.cwin.top { border-color: rgba(168, 85, 247, .45); box-shadow: 0 30px 70px -18px rgba(0, 0, 0, .85), 0 0 0 1px rgba(168, 85, 247, .2), 0 0 50px -10px rgba(168, 85, 247, .35); }
.cw-head { display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 13px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, rgba(168, 85, 247, .14), transparent); cursor: grab; user-select: none; touch-action: none; }
body.dragging, body.dragging * { cursor: grabbing !important; user-select: none; }
.cw-who { flex: 1; min-width: 0; display: grid; cursor: pointer; }
.cw-who b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cw-who small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cw-btns { display: flex; }
.cw-btns .icon-btn { width: 30px; height: 30px; }
.cw-btns svg { width: 18px; height: 18px; }
.cw-body { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
.cw-msgs { flex: 1; overflow-y: auto; padding: 12px 12px 4px; display: flex; flex-direction: column; }
.chat-start { display: grid; justify-items: center; gap: 4px; text-align: center; padding: 18px 10px 14px; }
.chat-start small { color: var(--muted); }
.day { text-align: center; margin: 12px 0 8px; }
.day span { font-size: 11px; font-weight: 700; color: var(--dim); background: var(--bg2); border: 1px solid var(--line); padding: 3px 10px; border-radius: 20px; text-transform: capitalize; }
.mrow { display: flex; align-items: flex-end; gap: 7px; margin-top: 8px; }
.mrow.cont { margin-top: 2px; }
.mrow.mine { justify-content: flex-end; }
.av-sp { width: 28px; flex: none; }
.mcol { display: flex; flex-direction: column; max-width: 76%; }
.mrow.mine .mcol { align-items: flex-end; }
.bubble { padding: 8px 12px; border-radius: 18px; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.4; }
.mrow.theirs .bubble { background: var(--raise); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.mrow.theirs.cont .bubble { border-top-left-radius: 6px; }
.mrow.theirs.more .bubble { border-bottom-left-radius: 6px; }
.mrow.theirs:not(.more) .bubble { border-bottom-left-radius: 18px; }
.mrow.theirs:not(.more):not(.cont) .bubble { border-bottom-left-radius: 6px; }
.mrow.mine .bubble { background: var(--grad); color: #fff; border-bottom-right-radius: 6px; box-shadow: 0 6px 20px -8px rgba(168, 85, 247, .7); }
.mrow.mine.cont .bubble { border-top-right-radius: 6px; }
.mrow.mine .bubble a { color: #fff; }
.bubble.emoji-only { background: none !important; border: 0 !important; box-shadow: none !important; font-size: 36px; padding: 0 2px; line-height: 1.15; }
.bubble.img { padding: 3px; background: var(--raise) !important; }
.bubble.img img { display: block; max-width: 240px; max-height: 260px; border-radius: 15px; cursor: zoom-in; }
.mt { font-size: 10.5px; color: var(--dim); margin: 3px 6px 0; }
.receipt { font-size: 10.5px; color: var(--dim); margin: 1px 6px 0; }
.receipt.read { color: #c4b5fd; }
.sys.buzz-line { margin: 10px auto; display: flex; align-items: center; gap: 6px; color: #fcd34d; font-weight: 700; background: rgba(251, 191, 36, .1); padding: 5px 12px; border-radius: 20px; }
.sys.buzz-line svg { width: 16px; height: 16px; }
.sys.buzz-line time { color: var(--dim); font-weight: 500; }
.cw-typing { min-height: 22px; padding: 0 14px 4px; font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 7px; }
.dots { display: inline-flex; gap: 3px; }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: #c4b5fd; animation: blink 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 60%, 100% { opacity: .25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
.cw-notice { display: flex; align-items: center; gap: 10px; padding: 8px 12px; font-size: 12.5px; color: #fcd34d; background: rgba(251, 191, 36, .08); border-top: 1px solid var(--line); }
.cw-compose { display: flex; align-items: flex-end; gap: 4px; padding: 8px; border-top: 1px solid var(--line); }
.cw-compose.disabled { opacity: .45; pointer-events: none; }
.cw-compose textarea { flex: 1; min-height: 40px; max-height: 140px; padding: 9px 12px; border-radius: 14px; }
.cw-tool { width: 34px; height: 40px; border: 0; background: transparent; color: var(--muted); border-radius: 10px; display: grid; place-items: center; flex: none; }
.cw-tool:hover { color: #e9d5ff; background: rgba(168, 85, 247, .14); }
.cw-tool.buzz:hover { color: #fcd34d; background: rgba(251, 191, 36, .12); }
.cw-send { width: 42px; height: 40px; flex: none; border: 0; border-radius: 13px; background: var(--grad); color: #fff; display: grid; place-items: center; box-shadow: var(--glow); }
.cw-send:hover { filter: brightness(1.1); }
.shake { animation: shake .6s cubic-bezier(.36, .07, .19, .97); }
@keyframes shake { 10%, 90% { transform: translate(-2px, 1px); } 20%, 80% { transform: translate(5px, -2px); } 30%, 50%, 70% { transform: translate(-9px, 3px); } 40%, 60% { transform: translate(9px, -3px); } }

#dock { position: fixed; left: 324px; bottom: 12px; display: flex; gap: 8px; z-index: 1100; flex-wrap: wrap-reverse; max-width: calc(100vw - 340px); }
.dock-chip { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 7px; border-radius: 30px; background: rgba(23, 19, 36, .95); border: 1px solid var(--line2); box-shadow: 0 10px 30px -8px rgba(0, 0, 0, .7); font-weight: 700; font-size: 13px; }
.dock-chip:hover { border-color: rgba(168, 85, 247, .5); }
.dock-chip.unread { border-color: var(--accent); animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 4px rgba(168, 85, 247, .25); } }
.dock-chip .x { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; color: var(--muted); }
.dock-chip .x:hover { background: rgba(255, 255, 255, .1); color: var(--text); }
.dock-chip .x svg { width: 14px; height: 14px; }

/* popup window mode (Windows app chat window) */
.is-popup body { background: var(--panel); }
.is-popup #windows { position: fixed; inset: 0; }
.is-popup .cwin { position: absolute; inset: 0; width: auto !important; height: auto !important; border-radius: 0; border: 0; resize: none; box-shadow: none; animation: none; }
.is-popup .cw-head { -webkit-app-region: drag; cursor: default; padding-right: 150px; min-height: 52px; }
.is-popup .cw-head button, .is-popup .cw-who { -webkit-app-region: no-drag; }
.is-popup #dock { display: none; }

/* ---------- toasts / misc ---------- */
#toasts { position: fixed; left: 50%; top: 70px; transform: translateX(-50%); display: grid; gap: 8px; z-index: 4000; width: min(420px, calc(100% - 24px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; background: rgba(23, 19, 36, .97); border: 1px solid var(--line2); padding: 11px 14px; border-radius: 14px; box-shadow: 0 20px 40px -10px rgba(0, 0, 0, .7); animation: up .2s ease-out; font-weight: 600; }
.toast span { flex: 1; }
.toast.err { border-color: rgba(244, 63, 94, .45); color: #fecdd3; }
.toast button { border: 0; background: var(--grad); color: #fff; font-weight: 700; padding: 6px 12px; border-radius: 9px; }
.lightbox { position: fixed; inset: 0; z-index: 5000; background: rgba(0, 0, 0, .88); display: grid; place-items: center; cursor: zoom-out; padding: 20px; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 12px; }
#call-audio-unlock { position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%); z-index: 3500; border: 0; background: var(--grad); color: #fff; font-weight: 800; padding: 12px 20px; border-radius: 30px; box-shadow: var(--glow); }

/* ---------- responsive ---------- */
@media (max-width: 1100px) { #room-side { width: 290px; } }
@media (max-width: 960px) {
  .room-layout { flex-direction: column; }
  #callbox { flex: none; height: 58%; }
  #room-side { width: auto; flex: 1; border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 760px) {
  :root { --top: 54px; }
  .only-mobile { display: inline-grid; }
  .brand b { display: none; }
  .tabs button { padding: 7px 10px; font-size: 13px; }
  #buddy { position: fixed; top: var(--top); bottom: 0; left: 0; width: min(330px, 88vw); z-index: 30; transform: translateX(-105%); transition: transform .22s ease; box-shadow: 20px 0 60px rgba(0, 0, 0, .6); background: var(--bg2); }
  #app.buddy-open #buddy { transform: none; }
  .view { padding: 18px 14px 30px; }
  .hero { padding: 18px; }
  .hero h1 { font-size: 23px; }
  .stat-card { width: 100%; }
  .hero-cards { width: 100%; }
  #callbox { height: 52%; }
  #call-controls { gap: 6px; padding: 8px; min-height: 0; }
  .rbtn { width: 42px; height: 42px; border-radius: 13px; }
  .rbtn .tip { display: none; }
  .rbtn.golive .tip { display: inline; }
  .cwin { left: 0 !important; top: 0 !important; width: 100% !important; height: 100% !important; border-radius: 0; resize: none; }
  #dock { left: 10px; right: 10px; max-width: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
