:root{--p:#6C4CEB;--s:#3978FF;--a:#A78BFA;--bg:#F5F6FB;--card:#fff;--tx:#161833;--mu:#6b7090;--bd:#e4e6f2;--me:linear-gradient(135deg,#6C4CEB,#4d6bff);--them:#fff;--r:20px;--sh:0 8px 30px #6C4CEB1f;color-scheme:light}
[data-theme=dark]{--bg:#0d0e2b;--card:#171843;--tx:#f1f2ff;--mu:#9b9dc9;--bd:#26285c;--them:#1e2050;--sh:0 8px 30px #0006;color-scheme:dark}
*{box-sizing:border-box;margin:0}
html,body{height:100%}
body{font:15px/1.45 'Plus Jakarta Sans',system-ui,sans-serif;background:var(--bg);color:var(--tx);-webkit-font-smoothing:antialiased}
button,input,textarea{font:inherit;color:inherit}
button{cursor:pointer;border:0;background:none}
:focus-visible{outline:2px solid var(--a);outline-offset:2px}
[hidden]{display:none!important}
svg{fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;flex:none}
.logo{width:56px;height:56px;object-fit:contain}.logo.sm{width:34px;height:34px}
.btn{background:var(--me);color:#fff;border-radius:16px;padding:13px 22px;font-weight:700;box-shadow:0 6px 18px #6C4CEB44}
.btn:disabled{opacity:.6;cursor:wait}
.link{color:var(--a);font-size:14px;font-weight:600;margin-top:10px}
.err{color:#ff5d73;min-height:20px;font-size:13px}
label{display:flex;flex-direction:column;gap:6px;font-size:13px;font-weight:600}
input,textarea{background:var(--bg);border:1px solid var(--bd);border-radius:14px;padding:12px 14px;width:100%}
input:focus,textarea:focus{border-color:var(--p);outline:0}
/* auth */
#auth{min-height:100%;display:grid;place-items:center;padding:20px;background:radial-gradient(800px 500px at 15% -10%,#6C4CEB55,transparent),radial-gradient(700px 500px at 100% 110%,#3978FF40,transparent),var(--bg)}
.auth-card{width:100%;max-width:410px;background:var(--card);border:1px solid var(--bd);border-radius:30px;padding:34px 28px;display:flex;flex-direction:column;align-items:center;text-align:center;box-shadow:var(--sh)}
.auth-card h1{font-size:30px;font-weight:800;margin-top:8px}.tag{color:var(--mu);margin-bottom:22px;font-size:14px}
.auth-card form{width:100%;display:flex;flex-direction:column;gap:12px;text-align:left}
.seg{display:flex;background:var(--bg);border-radius:16px;padding:4px;margin-bottom:18px;width:100%}
.seg button{flex:1;padding:10px;border-radius:12px;font-weight:700;color:var(--mu)}
.seg .on{background:var(--me);color:#fff}
/* layout */
#app{display:grid;grid-template-columns:88px 390px 1fr;height:100dvh}
#nav{display:flex;flex-direction:column;align-items:center;padding:20px 0;gap:8px;background:var(--bg);border-right:1px solid var(--bd)}
#nav .logo{margin-bottom:14px}
#nav button{position:relative;width:66px;padding:9px 0;border-radius:16px;display:flex;flex-direction:column;align-items:center;gap:3px;font-size:11px;font-weight:600;color:var(--mu)}
#nav button svg{width:23px;height:23px}
#nav button.on{color:var(--a)}
#nav button.on span{border-bottom:2px solid var(--p);padding-bottom:1px}
#nav .fab{width:54px;height:54px;border-radius:50%;background:var(--me);color:#fff;justify-content:center;margin:6px 0;box-shadow:0 8px 22px #6C4CEB77}
#nav .fab svg{width:26px;height:26px}
.nb{position:absolute;top:2px;right:10px;background:#ff4d6d;color:#fff;font:700 10px/1 inherit;border-radius:99px;padding:3px 5px}
#list{background:var(--bg);border-right:1px solid var(--bd);overflow-y:auto;padding:18px 16px}
#list h2{font-size:24px;font-weight:800;margin:0 4px 14px}
.top{display:flex;align-items:center;gap:10px;margin:0 4px 12px}.top h2{margin:0!important;flex:1}
.top button{width:40px;height:40px;border-radius:50%;background:var(--card);font-size:17px}
.field{margin-bottom:12px}.field input{border-radius:99px;background:var(--card);padding:13px 18px}
.pills{display:flex;gap:8px;margin-bottom:12px;overflow-x:auto}
.pills button{padding:8px 16px;border-radius:99px;background:var(--card);color:var(--mu);font-weight:600;font-size:13px;flex:none}
.pills .on{background:var(--me);color:#fff}
.gh{font-size:19px;font-weight:800;color:var(--tx);margin:22px 4px 10px;text-transform:none;letter-spacing:0}
/* home */
.htop{display:flex;align-items:center;gap:10px;margin-bottom:16px}
.htop b{flex:1;font-size:24px;font-weight:800}
.htop button{position:relative;width:42px;height:42px;border-radius:50%;background:var(--card);display:grid;place-items:center}
.htop svg{width:20px;height:20px}.htop i{position:absolute;top:8px;right:9px;width:9px;height:9px;border-radius:50%;background:#ff4d6d;border:2px solid var(--card)}
.hero{display:flex;justify-content:space-between;align-items:center;padding:24px 22px;border-radius:26px;margin-bottom:14px;color:#fff;background:radial-gradient(300px 140px at 85% 120%,#8b6bff,transparent),linear-gradient(120deg,#3b2bbd,#6C4CEB 60%,#4d6bff);box-shadow:var(--sh)}
.hero h1{font-size:25px;font-weight:800}.hero p{opacity:.85}
.hero .av{width:74px;height:74px;border:3px solid #ffffffaa}
.qa{display:grid;grid-template-columns:repeat(4,1fr);gap:6px;padding:14px 8px;border-radius:24px;background:var(--card);border:1px solid var(--bd)}
.qa button{display:flex;flex-direction:column;align-items:center;gap:7px;font-size:12px;font-weight:600}
.qa span{width:52px;height:52px;border-radius:50%;display:grid;place-items:center;font-size:21px;background:#6C4CEB2e}
/* rows */
.row{display:flex;gap:12px;align-items:center;width:100%;text-align:left;padding:11px 10px;border-radius:18px;cursor:pointer}
.row:hover,.row.on{background:var(--card)}
.row .mid{flex:1;min-width:0}.row b{display:block;font-weight:700}
.row small{display:block;color:var(--mu);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.row .meta{font-size:12px;color:var(--mu);text-align:right}
.badge{background:var(--p);color:#fff;border-radius:99px;min-width:22px;padding:2px 7px;font-size:12px;font-weight:700;display:inline-block;margin-top:4px}
.gcard{background:var(--card);border:1px solid var(--bd);margin-bottom:8px;border-radius:18px}
.chev{color:var(--mu);font-size:24px}
.pin{font-size:12px;opacity:.2;margin-left:4px}.pin.on,.row:hover .pin{opacity:1}
.av{width:50px;height:50px;border-radius:50%;object-fit:cover;flex:none;display:grid;place-items:center;background:var(--me);color:#fff;font-weight:800;font-size:19px}
.av.lg{width:96px;height:96px;font-size:36px}.av.xl{width:110px;height:110px;font-size:40px;border:4px solid var(--bg)}
.av.ring{box-shadow:0 0 0 3px var(--bg),0 0 0 5px var(--p)}
.pw{position:relative;display:inline-flex;flex:none}.pw i{position:absolute;right:1px;bottom:1px;width:13px;height:13px;border-radius:50%;background:#22c55e;border:2px solid var(--bg)}
.empty{height:100%;display:grid;place-content:center;justify-items:center;text-align:center;color:var(--mu);padding:30px;gap:6px}
.empty h2{color:var(--tx)}#list .empty{height:auto;padding:40px 10px}
.vf{width:16px;height:16px;vertical-align:-3px;margin-left:4px;stroke:none}
/* chat */
#chat{min-width:0;height:100dvh;background:var(--bg)}
#chat-view{display:flex;flex-direction:column;height:100%}
#chat header{display:flex;align-items:center;gap:8px;padding:12px 16px;background:var(--bg);border-bottom:1px solid var(--bd)}
#back{display:none;width:40px;height:40px;place-items:center}#back svg{width:24px;height:24px}
#chat-head{flex:1;display:flex;gap:12px;align-items:center;min-width:0}#chat-head>div{flex:1;min-width:0}
#chat-head b{font-size:17px;font-weight:700}#chat-head small{display:block;color:var(--mu);font-size:13px}
#chat-head small.on1,.typ{color:#22c55e!important;font-weight:600}
.cb{width:42px;height:42px;border-radius:50%;display:grid;place-items:center;color:var(--a)}.cb svg{width:22px;height:22px}.cb:hover{background:var(--card)}.cb.v{color:#8b6bff}
#msgs{flex:1;overflow-y:auto;padding:18px;display:flex;flex-direction:column;gap:8px;background:linear-gradient(var(--wall,transparent),var(--wall,transparent)),var(--bg)}
.day{align-self:center;background:var(--card);color:var(--mu);font-size:12.5px;font-weight:600;padding:6px 18px;border-radius:99px;margin:8px 0}
.m{max-width:min(76%,520px);padding:11px 16px;border-radius:22px 22px 22px 6px;background:var(--them);align-self:flex-start;word-wrap:break-word;white-space:pre-wrap;cursor:pointer;font-size:16px}
.m.me{align-self:flex-end;background:var(--me);color:#fff;border-radius:22px 22px 6px 22px}
.m img{max-width:100%;width:100%;max-width:320px;border-radius:16px;display:block;margin-bottom:4px;cursor:zoom-in}
.m time{display:flex;gap:4px;justify-content:flex-end;align-items:center;font-size:11.5px;opacity:.75;margin-top:2px}.tk{width:16px;height:16px}
.sn{display:block;font-size:12px;color:var(--a);margin-bottom:2px}.m.me .sn{color:#fff}
.rq{border-left:3px solid var(--a);background:#0003;border-radius:8px;padding:4px 8px;margin-bottom:5px;font-size:13px;max-width:260px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.rq b{display:block}
.rx{display:flex;gap:4px;flex-wrap:wrap;margin-top:6px}.rx span{background:var(--card);color:var(--tx);border:1px solid var(--bd);border-radius:99px;padding:0 8px;font-size:12px}.rx .on{border-color:var(--p)}
.vn{display:flex;align-items:center;gap:8px;min-width:200px}.vn i{flex:1;height:18px;background:repeating-linear-gradient(90deg,currentColor 0 2px,transparent 2px 5px);opacity:.5}
.vn button{border-radius:99px;font-weight:700}.vn .pl{width:36px;height:36px;background:var(--p);color:#fff}.m.me .vn .pl{background:#fff;color:var(--p)}.vn .sp{padding:2px 8px;background:#0002;font-size:12px}
#rbar{display:flex;align-items:center;gap:8px;margin:0 14px;padding:8px 14px;background:var(--card);border-left:4px solid var(--p);border-radius:12px;font-size:13px}#rbar span{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#emo{display:flex;gap:2px;flex-wrap:wrap;margin:0 14px 6px;padding:8px;background:var(--card);border-radius:18px}#emo button{font-size:22px;padding:5px 8px;border-radius:12px}#emo button:hover{background:var(--bg)}
#composer{display:flex;align-items:center;gap:10px;padding:12px 14px calc(12px + env(safe-area-inset-bottom));background:var(--bg);border-top:1px solid var(--bd)}
.plus,.send{width:46px;height:46px;border-radius:50%;background:var(--me);color:#fff;display:grid;place-items:center;flex:none;cursor:pointer;box-shadow:0 6px 16px #6C4CEB55}
.plus svg,.send svg{width:22px;height:22px}
.inp{flex:1;display:flex;align-items:center;background:var(--card);border:1px solid var(--bd);border-radius:99px;padding:0 6px 0 6px}
.inp input{border:0;background:transparent;padding:13px 12px}
.ib{width:40px;height:40px;border-radius:50%;display:grid;place-items:center;color:var(--mu);flex:none}.ib svg{width:22px;height:22px}
#mic.rec{background:#ef4444;color:#fff;animation:pu 1s infinite}@keyframes pu{50%{box-shadow:0 0 0 8px #ef444433}}
#pop{position:fixed;z-index:20;background:var(--card);border:1px solid var(--bd);border-radius:18px;box-shadow:0 12px 32px #0005;padding:6px;display:flex;flex-direction:column;min-width:190px}
#pop button{text-align:left;padding:10px 12px;border-radius:12px}#pop button:hover{background:var(--bg)}
#pop .emo{display:flex;justify-content:space-between;padding:2px 2px 6px;border-bottom:1px solid var(--bd);margin-bottom:4px}#pop .emo button{font-size:20px;padding:6px 7px;border-radius:50%}#pop .emo .on{background:#6C4CEB33}
.danger{color:#ff5d73!important}
#lb{position:fixed;inset:0;z-index:30;background:#000d;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:16px;padding:20px}#lb img{max-width:92vw;max-height:78vh;border-radius:14px}
/* profile */
.pcov{height:150px;margin:-18px -16px 0;background:radial-gradient(260px 120px at 80% 10%,#8b6bff,transparent),radial-gradient(240px 140px at 10% 100%,#3978ff99,transparent),linear-gradient(120deg,#2a1d8f,#6C4CEB);border-radius:0 0 40px 40px}
.pp{margin-top:-56px;display:flex;flex-direction:column;align-items:center;text-align:center;gap:2px}
.pav{position:relative}.cam{position:absolute;right:2px;bottom:4px;width:36px;height:36px;border-radius:50%;background:var(--bg);display:grid;place-items:center;cursor:pointer;border:2px solid var(--card)}.cam svg{width:18px;height:18px}
.pp h2{margin:10px 0 0!important;font-size:24px!important}.pp small{color:var(--mu);font-size:15px}
.onl{display:inline-flex;align-items:center;gap:7px;margin-top:4px;font-weight:600}.onl i{width:11px;height:11px;border-radius:50%;background:#22c55e}
.bio{display:flex;align-items:center;gap:14px;width:100%;margin:16px 0 4px;padding:15px 16px;background:var(--card);border:1px solid var(--bd);border-radius:20px;text-align:left}.bio svg{width:20px;height:20px;color:var(--a)}
.stats{display:grid;grid-template-columns:repeat(3,1fr);margin:14px 0}
.stats div{display:flex;flex-direction:column;align-items:center;gap:2px;padding:6px;border-right:1px solid var(--bd)}.stats div:last-child{border:0}
.stats svg{width:24px;height:24px;color:#8b6bff}.stats b{font-size:17px}.stats span{font-size:12.5px;color:var(--mu)}
.grp{background:var(--card);border:1px solid var(--bd);border-radius:22px;padding:4px 6px}
.set{display:flex;align-items:center;gap:14px;width:100%;padding:13px 10px;text-align:left;cursor:pointer;flex-direction:row;font-size:15px;font-weight:500}
.set+.set{border-top:1px solid var(--bd)}
.set .mid{flex:1;min-width:0}.set b{display:block;font-weight:600}.set small{color:var(--mu);font-size:12.5px;font-weight:400}
.si{width:30px;height:30px;color:#b3b6df;display:grid;place-items:center;flex:none}.si svg{width:24px;height:24px}
.sw{appearance:none;width:52px;height:30px;border-radius:99px;background:var(--bd);position:relative;cursor:pointer;flex:none;transition:.2s;padding:0;border:0}
.sw::after{content:'';position:absolute;top:3px;left:3px;width:24px;height:24px;border-radius:50%;background:#fff;transition:.2s}
.sw:checked{background:var(--p)}.sw:checked::after{left:25px}
.logout{display:flex;align-items:center;justify-content:center;gap:10px;width:100%;margin-top:18px;padding:16px;border-radius:20px;background:linear-gradient(135deg,#b3204f,#d63a6a);color:#fff;font-weight:700;font-size:16px}.logout svg{width:22px;height:22px}
.sh{display:flex;align-items:center;gap:8px;margin-bottom:12px}.sh h2{margin:0!important;font-size:21px!important}.sh button{font-size:22px;width:40px;height:40px;border-radius:50%}.sh button:hover{background:var(--card)}
.prof{text-align:center;display:flex;flex-direction:column;align-items:center;gap:12px;margin-bottom:12px}.prof .av{border:0}
.stack{display:flex;flex-direction:column;gap:12px}
.wl{display:flex;gap:12px;flex-wrap:wrap;padding:4px}.wl button{width:46px;height:46px;border-radius:50%;border:2px solid var(--bd)}.wl .on{border-color:var(--p);box-shadow:0 0 0 3px #6C4CEB44}
/* stories */
.sbtn{display:block;margin:0 4px 8px;text-align:center;cursor:pointer}
#sv{position:fixed;inset:0;z-index:60;background:#05061ee8;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:14px;color:#fff;cursor:pointer}
#sv header{position:absolute;top:16px;left:16px;right:16px;display:flex;gap:12px;align-items:center}#sv header b{flex:1}#sv header button{color:#fff;font-size:20px}
#sv img{max-width:92vw;max-height:72vh;border-radius:22px}
#sv p{font-size:26px;font-weight:800;max-width:84vw;text-align:center;padding:44px 34px;border-radius:28px;background:var(--me)}
.cap{max-width:min(92vw,520px);text-align:center;font-size:17px;line-height:1.4;padding:12px 18px;border-radius:18px;background:#0008;backdrop-filter:blur(6px)}
.vw{position:absolute;bottom:26px;background:#ffffff22;border-radius:99px;padding:8px 18px;color:#fff}
.vl{position:absolute;inset:auto 0 0 0;background:var(--card);color:var(--tx);border-radius:26px 26px 0 0;padding:20px;max-height:60vh;overflow:auto;cursor:default}
#sc{position:fixed;inset:0;z-index:65;background:#05061ecc;display:grid;place-items:center;padding:18px;backdrop-filter:blur(4px)}
.scb{width:100%;max-width:420px;background:var(--card);border:1px solid var(--bd);border-radius:26px;padding:20px;display:flex;flex-direction:column;gap:12px}
.scb h3{font-size:18px}.scb img{width:100%;max-height:46vh;object-fit:cover;border-radius:18px}.scb textarea{resize:none;height:92px}
.scr{display:flex;justify-content:flex-end;align-items:center;gap:14px}.scr .link{margin:0;color:var(--mu)}
/* call screen */
#call-ui{position:fixed;inset:0;z-index:80;display:grid;place-items:center;color:#fff;background:radial-gradient(500px 400px at 50% 25%,#5b3fe0,transparent),linear-gradient(180deg,#1a1478,#0d0e2b 75%)}
#call-ui .cin{display:flex;flex-direction:column;align-items:center;gap:8px;width:100%;padding:24px;min-height:min(640px,100%);justify-content:space-between;text-align:center}
#call-ui small{opacity:.75;font-weight:600;letter-spacing:.04em}#call-ui h2{font-size:30px;font-weight:800}.ct{font-size:18px;opacity:.85;font-variant-numeric:tabular-nums}
.cav{margin:26px 0;position:relative;border-radius:50%}.cav .av{width:170px;height:170px;font-size:64px;border:5px solid #ffffff55}
.cav.pulse::before,.cav.pulse::after{content:'';position:absolute;inset:-6px;border-radius:50%;border:2px solid #a78bfa;animation:rp 2s infinite}.cav.pulse::after{animation-delay:1s}
@keyframes rp{to{transform:scale(1.5);opacity:0}}
.cbt{display:flex;gap:26px;align-items:flex-start;justify-content:center;margin-bottom:24px}
.cbt button{display:flex;flex-direction:column;align-items:center;gap:8px;font-size:13px;font-weight:600}
.cbt button svg{width:64px;height:64px;padding:19px;border-radius:50%;background:#ffffff26}
.cbt .act svg{background:#fff;color:#1a1478}.cbt .acc svg{background:#22c55e}.cbt .endb svg{background:#ef4444;transform:rotate(135deg)}
#toast{position:fixed;left:50%;bottom:96px;transform:translate(-50%,20px);background:#26285c;color:#fff;padding:11px 20px;border-radius:99px;opacity:0;pointer-events:none;transition:.25s;z-index:99;font-weight:600}#toast.show{opacity:1;transform:translate(-50%,0)}
/* admin */
#adm{position:fixed;inset:0;z-index:90;background:#000b;display:grid;place-items:center;padding:16px}
.abox{background:var(--card);border-radius:24px;padding:22px;width:100%;max-width:380px;display:flex;flex-direction:column;gap:10px;max-height:90vh;overflow:auto}.abox.wide{max-width:620px}
.ah{display:flex;gap:10px;align-items:center}.ah h2{flex:1}.ar{display:flex;justify-content:space-between;align-items:center;gap:10px;padding:10px 0;border-top:1px solid var(--bd)}.ar small{display:block;color:var(--mu)}.vt{color:#1d9bf0;font-size:12px}.btn.off{background:var(--bd);box-shadow:none}.ar .btn{padding:8px 14px;font-size:13px}
/* responsive */
@media(max-width:1000px){#app{grid-template-columns:88px 320px 1fr}}
@media(max-width:760px){
 #app{grid-template-columns:1fr;grid-template-rows:1fr auto}
 #list,#chat{grid-row:1;grid-column:1}
 #nav{grid-row:2;order:2;flex-direction:row;justify-content:space-around;padding:8px 6px calc(8px + env(safe-area-inset-bottom));border-right:0;border-top:1px solid var(--bd);background:var(--card)}
 #nav .logo{display:none}#nav button{flex:1;width:auto}#nav .fab{flex:none;width:56px;margin:-26px 0 0}
 #chat{display:none}
 #app.chat-open #chat{display:block;grid-row:1/3;z-index:3}#app.chat-open #list{display:none}
 #back{display:grid}.m{max-width:86%}
}
@media(prefers-reduced-motion:reduce){*{transition:none!important;animation:none!important}}
/* v2 */
.logo{border-radius:22%}
.av.gi{background:linear-gradient(135deg,#6C4CEB,#a78bfa)}.av.gi.space{background:linear-gradient(135deg,#0ea5e9,#6C4CEB)}.av.gi svg{width:52%;height:52%}
#sheet{position:fixed;inset:0;z-index:70;background:#05061ecc;display:grid;place-items:end center;backdrop-filter:blur(4px)}
.shb{position:relative;width:100%;max-width:460px;max-height:88vh;overflow:auto;background:var(--card);border-radius:28px 28px 0 0;padding:28px 20px 30px}
@media(min-width:760px){#sheet{place-items:center}.shb{border-radius:28px}}
.shx{position:absolute;top:14px;right:14px;width:36px;height:36px;border-radius:50%;background:var(--bg)}
.pv{display:flex;flex-direction:column;align-items:center;text-align:center;gap:4px}.pv h2{margin-top:8px;font-size:23px}.pv small,.pv .st{color:var(--mu)}.pv p{margin:8px 0;max-width:90%}
.pa{display:flex;gap:10px;margin:8px 0}.btn.alt{background:var(--bg);box-shadow:none;color:var(--tx);border:1px solid var(--bd)}
.addm{display:flex;gap:8px;margin:14px 0 0}.addm .btn{padding:10px 18px}
.ml .row{padding:8px 4px}.tag2{font-size:11px;font-weight:700;color:var(--a);border:1px solid var(--p);border-radius:99px;padding:2px 9px}.rm{width:30px;height:30px;border-radius:50%;background:var(--bg);color:#ff5d73}
#ann{position:fixed;top:0;left:0;right:0;z-index:55;display:flex;gap:10px;align-items:center;justify-content:center;padding:10px 16px;background:var(--me);color:#fff;font-weight:600}#ann button{color:#fff}
#composer.blk .plus,#composer.blk .send{opacity:.4;pointer-events:none}
.instb{margin-top:14px;width:100%}
/* ===== v3 design layer ===== */
:root{--g1:linear-gradient(135deg,#7c5cff,#4d6bff);--soft:#6C4CEB1f}
svg{stroke-width:1.9}
body{background:radial-gradient(700px 400px at 0 0,#6C4CEB12,transparent),var(--bg)}
/* nav */
#nav button.on{color:var(--a);background:var(--soft)}#nav button.on span{border:0}
#nav button.on svg{fill:currentColor;fill-opacity:.2}
#nav .fab{background:var(--g1);border-radius:20px;transform:rotate(0)}
/* lists + rows */
.row{padding:12px;border:1px solid transparent}.row:hover,.row.on{background:var(--card);border-color:var(--bd);box-shadow:0 6px 18px #6C4CEB14}
.av{width:52px;height:52px;border-radius:20px}.av.lg{width:96px;height:96px;border-radius:32px}.av.xl{width:110px;height:110px;border-radius:36px}.pw i{border-radius:50%}
.row .av,.pw .av{border-radius:18px}
.av.ring{border-radius:50%}
.badge{background:var(--g1);box-shadow:0 4px 10px #6C4CEB55}
.pin svg{width:15px;height:15px}.pin{vertical-align:middle}
.top button,.htop button{background:var(--card);border:1px solid var(--bd);border-radius:16px;display:grid;place-items:center}.top button svg{width:20px;height:20px}
.field input{border-radius:20px;box-shadow:0 4px 14px #6C4CEB0d}.pills button{border:1px solid var(--bd)}.pills .on{border-color:transparent;background:var(--g1)}
.hero{border-radius:30px;position:relative;overflow:hidden}.hero::before{content:'';position:absolute;width:180px;height:180px;border-radius:50%;right:-40px;top:-70px;background:#ffffff14}
.hero>*{position:relative}
.qa{border-radius:28px;box-shadow:var(--sh)}
.qa span{width:54px;height:54px;border-radius:19px;color:#fff;background:linear-gradient(135deg,#6C4CEB,#8b6bff);box-shadow:0 8px 16px #6C4CEB40}.qa span svg{width:24px;height:24px}
.qa button:nth-child(2) span{background:linear-gradient(135deg,#0ea5e9,#3978ff)}.qa button:nth-child(3) span{background:linear-gradient(135deg,#10b981,#34d399)}.qa button:nth-child(4) span{background:linear-gradient(135deg,#f59e0b,#fb7185)}
.gcard{border-radius:22px}
/* profile settings */
.si{width:38px;height:38px;border-radius:13px;color:#fff;background:var(--g1)}.si svg{width:20px;height:20px}
.grp .set:nth-child(2) .si{background:linear-gradient(135deg,#f59e0b,#fb7185)}.grp .set:nth-child(3) .si{background:linear-gradient(135deg,#10b981,#34d399)}.grp .set:nth-child(4) .si{background:linear-gradient(135deg,#0ea5e9,#3978ff)}.grp .set:nth-child(5) .si{background:linear-gradient(135deg,#475569,#1e1b4b)}
.grp{border-radius:26px;padding:6px 10px}.stats{background:var(--card);border:1px solid var(--bd);border-radius:24px;padding:12px 0}
.logout{border-radius:22px}.bio{border-radius:22px}
/* chat */
#chat header{padding:calc(10px + env(safe-area-inset-top)) 12px 10px;background:color-mix(in srgb,var(--card) 90%,transparent);backdrop-filter:blur(14px);border-bottom:1px solid var(--bd);box-shadow:0 8px 22px #0000000d}
#chat-head{cursor:pointer}#chat-head .av{width:44px;height:44px;border-radius:16px}
#back{background:var(--soft);border-radius:14px;color:var(--a)}
.cb{background:var(--soft);border-radius:15px;color:var(--a);width:40px;height:40px}.cb.v{color:#fff;background:var(--g1)}.cb svg{width:20px;height:20px}
#msgs{padding:16px 14px;background:radial-gradient(circle at 15% 8%,#6C4CEB18,transparent 40%),radial-gradient(circle at 90% 85%,#3978FF14,transparent 40%),linear-gradient(var(--wall,transparent),var(--wall,transparent)),var(--bg)}
.m{border:1px solid var(--bd);box-shadow:0 3px 10px #0000000d;border-radius:20px 20px 20px 6px}.m.me{border:0;box-shadow:0 8px 18px #6C4CEB40;border-radius:20px 20px 6px 20px}
.day{border:1px solid var(--bd)}
#composer{margin:0 10px calc(10px + env(safe-area-inset-bottom));padding:8px;border:1px solid var(--bd);border-radius:34px;background:var(--card);box-shadow:var(--sh)}
.plus{background:var(--soft);color:var(--p);box-shadow:none;border-radius:50%}.send{background:var(--g1)}
.inp{background:var(--bg);border:0}.inp input{background:transparent;border:0}
/* full-page info */
#info{position:fixed;inset:0;z-index:50;background:var(--bg);overflow-y:auto}
@media(min-width:761px){#info{left:auto;width:min(440px,100%);border-left:1px solid var(--bd);box-shadow:-20px 0 50px #0003}}
.ipg{padding:0 16px calc(40px + env(safe-area-inset-bottom));position:relative}
.ibk{position:absolute;z-index:2;top:calc(14px + env(safe-area-inset-top));left:14px;width:42px;height:42px;border-radius:15px;background:#ffffff26;color:#fff;backdrop-filter:blur(8px);display:grid;place-items:center}.ibk svg{width:22px;height:22px}
.icov{height:180px;margin:0 -16px;border-radius:0 0 46px 46px;background:radial-gradient(260px 120px at 80% 10%,#8b6bff,transparent),radial-gradient(240px 140px at 10% 100%,#3978ff99,transparent),linear-gradient(120deg,#2a1d8f,#6C4CEB)}
.ihd{margin-top:-64px;display:flex;flex-direction:column;align-items:center;text-align:center;gap:3px;position:relative}
.ihd .av.xl{width:126px;height:126px;font-size:46px;border:5px solid var(--bg);border-radius:42px;box-shadow:var(--sh)}
.ihd h2{font-size:24px;margin-top:10px;display:flex;align-items:center;gap:8px}.ihd small,.st{color:var(--mu)}
.ied{width:30px;height:30px;border-radius:10px;background:var(--soft);color:var(--a);display:grid;place-items:center}.ied svg{width:15px;height:15px}
.iact{display:flex;justify-content:center;gap:10px;margin:20px 0;flex-wrap:wrap}
.ia{display:flex;flex-direction:column;align-items:center;gap:8px;min-width:80px;padding:14px 10px;border-radius:22px;background:var(--card);border:1px solid var(--bd);font-size:12.5px;font-weight:600}
.ia span{width:42px;height:42px;border-radius:15px;display:grid;place-items:center;background:var(--soft);color:var(--a)}.ia svg{width:21px;height:21px}
.ia.danger{color:#ff5d73}.ia.danger span{background:#ff5d7322;color:#ff5d73}
.icard{background:var(--card);border:1px solid var(--bd);border-radius:26px;padding:16px;margin-bottom:14px}.icard[data-a]{cursor:pointer}
.icard h4{font-size:13px;font-weight:700;color:var(--a);margin-bottom:8px;display:flex;justify-content:space-between;align-items:center}.icard h4 svg{width:16px;height:16px}
.icard p{white-space:pre-wrap}
.irow{display:flex;align-items:center;gap:14px;width:100%;padding:8px 2px;text-align:left}.irow+.irow{border-top:1px solid var(--bd)}
.irow .ii{width:38px;height:38px;border-radius:13px;display:grid;place-items:center;background:var(--soft);color:var(--a)}.irow .ii svg{width:20px;height:20px}
.irow.danger{color:#ff5d73}.irow.danger .ii{background:#ff5d7322;color:#ff5d73}
.icard .row{padding:8px 2px}.icard .row:hover{background:var(--bg);box-shadow:none}.rm{border-radius:10px}
/* calls: audio + video */
#call-ui{display:block;overflow:hidden}#cc{position:relative;z-index:2;height:100%}
#call-ui .cin{height:100%;min-height:0;padding:calc(40px + env(safe-area-inset-top)) 24px calc(24px + env(safe-area-inset-bottom))}
#rv{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;background:#000;display:none}.vid.on #rv{display:block}
#lv{position:absolute;z-index:3;top:calc(16px + env(safe-area-inset-top));right:14px;width:104px;height:150px;object-fit:cover;border-radius:22px;border:2px solid #fff6;box-shadow:0 10px 26px #0006;display:none;transform:scaleX(-1);background:#111}.vid #lv{display:block}
.vid.on .cav{display:none}.vid.on .cin{justify-content:space-between}.vid.on .ctop{align-self:flex-start;text-align:left;text-shadow:0 1px 10px #000a}
.cbt{flex-wrap:wrap;gap:18px}.cbt button svg{border-radius:24px;backdrop-filter:blur(10px)}.vid.on .cbt{background:#0006;backdrop-filter:blur(14px);padding:14px 18px;border-radius:32px}
.cbt .endb svg{transform:rotate(135deg)}
/* mobile: full-screen chat, nav hidden, floating tab bar */
@media(max-width:760px){
 #app.chat-open{grid-template-rows:1fr}
 #app.chat-open #nav{display:none}
 #app.chat-open #chat{display:block;position:fixed;inset:0;z-index:40;height:100dvh}
 #list{padding-top:calc(18px + env(safe-area-inset-top))}
 #nav{margin:0 12px calc(10px + env(safe-area-inset-bottom));padding:8px 10px;border:1px solid var(--bd);border-radius:30px;box-shadow:var(--sh);background:var(--card)}
 #nav .fab{margin:-30px 0 0;border-radius:22px}
 .m{max-width:84%}
}
/* ===== v3.1 polish ===== */
.vn .pl,.vn .sp{display:grid;place-items:center}.vn .pl svg{width:16px;height:16px}.vn .pl{border-radius:50%}
.chev{display:grid;place-items:center}.chev svg{width:18px;height:18px}
.rm svg,#rx svg{width:15px;height:15px}.rm{display:grid;place-items:center}#rx{width:30px;height:30px;border-radius:10px;background:var(--bg);display:grid;place-items:center}
#rbar{border-radius:18px;box-shadow:0 6px 16px #0000000d}
#ann svg{width:18px;height:18px}#ann span{display:flex;gap:8px;align-items:center}#ann button{display:grid;place-items:center}#ann button svg{width:16px;height:16px}
.sh button{display:grid;place-items:center;background:var(--soft);color:var(--a);border-radius:14px}.sh button svg{width:20px;height:20px}
/* stories */
#sv{background:radial-gradient(500px 400px at 50% 0,#5b3fe055,transparent),#05061ef2;backdrop-filter:blur(8px)}
#sv header{padding-top:env(safe-area-inset-top)}#sv header button{width:38px;height:38px;border-radius:14px;background:#ffffff22;display:grid;place-items:center}#sv header svg{width:18px;height:18px}
#sv header span{background:#ffffff22;border-radius:99px;padding:3px 10px;font-size:12px;font-weight:700}
#sv img{border-radius:30px;box-shadow:0 20px 50px #0008}
#sv p{border-radius:34px;box-shadow:0 20px 50px #6C4CEB66}
.vw{display:flex;gap:8px;align-items:center;backdrop-filter:blur(8px)}.vw svg{width:18px;height:18px}
.vl{border-radius:30px 30px 0 0}.scb{border-radius:30px}
.sbtn{border-radius:20px;padding:13px}
/* auth */
.auth-card{border-radius:36px;position:relative;overflow:hidden}
.auth-card::before{content:'';position:absolute;inset:0 0 auto 0;height:140px;background:radial-gradient(240px 120px at 80% 0,#8b6bff44,transparent),radial-gradient(200px 120px at 0 0,#3978ff33,transparent);pointer-events:none}
.auth-card>*{position:relative}.auth-card .logo{width:72px;height:72px;border-radius:24px;box-shadow:0 12px 28px #6C4CEB55}
.auth-card h1{background:var(--g1);-webkit-background-clip:text;background-clip:text;color:transparent}
.seg{border-radius:20px}.seg button{border-radius:16px}.seg .on{box-shadow:0 6px 14px #6C4CEB55}
input,textarea{border-radius:16px}.btn{border-radius:18px}.btn.instb{background:var(--soft);color:var(--a);box-shadow:none;border:1px solid var(--bd)}
/* empty states, popups, toast */
.empty{border-radius:28px}.empty .logo{width:84px;height:84px;border-radius:28px;box-shadow:0 14px 30px #6C4CEB44;margin-bottom:8px}
#list .empty{background:var(--card);border:1px dashed var(--bd);margin-top:10px}
#pop{border-radius:22px;padding:8px;box-shadow:0 18px 44px #0006}#pop button{border-radius:14px;font-weight:600}
#toast{background:var(--card);color:var(--tx);border:1px solid var(--bd);box-shadow:0 14px 36px #0005;border-radius:20px}
.shb{border-radius:32px 32px 0 0}.tag2{background:var(--soft);border-color:transparent}
.gh{display:flex;align-items:center;gap:8px}.gh::before{content:'';width:5px;height:18px;border-radius:4px;background:var(--g1)}
.htop b{background:var(--g1);-webkit-background-clip:text;background-clip:text;color:transparent}
::-webkit-scrollbar{width:8px}::-webkit-scrollbar-thumb{background:var(--bd);border-radius:8px}
/* ===== v3.2 motion + finishing ===== */
@keyframes up{from{opacity:0;transform:translateY(8px) scale(.98)}to{opacity:1;transform:none}}
@keyframes slide{from{transform:translateX(100%)}to{transform:none}}
@keyframes pop{from{opacity:0;transform:scale(.9)}to{opacity:1;transform:none}}
.m{animation:up .22s ease-out}.row{animation:up .25s ease-out backwards}.hero,.qa,.icard,.ia{animation:up .3s ease-out backwards}
#info:not([hidden]){animation:slide .26s cubic-bezier(.2,.8,.2,1)}
#pop:not([hidden]){animation:pop .15s ease-out;transform-origin:top right}.shb{animation:up .25s ease-out}
.btn,.send,.plus,.cb,.ia,.qa button,.set,.row{transition:transform .15s,box-shadow .2s,background .2s}
.btn:active,.send:active,.plus:active,.cb:active,.ia:active,.qa button:active{transform:scale(.93)}
.row:active{transform:scale(.985)}
.send{box-shadow:0 8px 20px #6C4CEB66}.send:hover{box-shadow:0 10px 26px #6C4CEB88}
.inp:focus-within{box-shadow:0 0 0 2px #6C4CEB66}
.typ::after{content:'';display:inline-block;width:18px;height:6px;margin-left:5px;background:radial-gradient(circle,currentColor 2px,transparent 2.5px) 0 0/6px 6px;animation:dots 1s steps(4) infinite}
@keyframes dots{to{width:0}}
.pw i{box-shadow:0 0 0 2px var(--bg),0 0 8px #22c55e88}
.m.me time svg{stroke:#bfe7ff}
.rx span{border-radius:12px;box-shadow:0 2px 6px #0000001a}
.ihd .av.xl,.pp .av.xl{box-shadow:0 14px 34px #6C4CEB55}
[data-theme=light] .m{box-shadow:0 3px 10px #6C4CEB10}
[data-theme=light] #chat header{background:color-mix(in srgb,#fff 88%,transparent)}
/* v3.3 fixes: menus/lightbox were hidden behind the full-screen chat on phones */
#pop{z-index:80}#lb{z-index:75}#sheet{z-index:70}
#chat{overscroll-behavior:contain}#msgs{overscroll-behavior:contain;-webkit-overflow-scrolling:touch}


/* Call reliability: use the real mobile viewport and keep remote/local media visible. */
#call-ui { height: 100vh; height: 100dvh; min-height: 100%; }
#call-ui .cin { min-height: 100dvh; }
#rv { height: 100%; width: 100%; object-fit: cover; }
#lv { max-width: 30vw; max-height: 28vh; }
#ra { position: fixed; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
@media (max-width: 600px) {
  #call-ui .cin { padding-left: 18px; padding-right: 18px; }
  #lv { width: 92px; height: 132px; top: calc(12px + env(safe-area-inset-top)); right: 10px; }
  #call-ui .cbt { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
}
