:root{color-scheme:dark;font:15px system-ui,-apple-system,"Segoe UI",sans-serif;--panel:#17212b;--canvas:#0e1621;--field:#242f3d;--accent:#5288c1;--muted:#8da2b7;--line:#101a24}
*{box-sizing:border-box}body{margin:0;background:var(--canvas);color:#fff}button,input,textarea{font:inherit}button{border:0;background:none;color:#a6bfd7;cursor:pointer;border-radius:8px;padding:12px;display:inline-flex;align-items:center;justify-content:center;gap:8px}button:hover{background:#ffffff0b}button:disabled{opacity:.5;cursor:default}input,textarea{color:white;background:var(--field);border:1px solid transparent;border-radius:12px;padding:13px;outline:none;min-width:0}input:focus,textarea:focus{border-color:var(--accent)}button:focus-visible{outline:2px solid var(--accent)}[hidden]{display:none!important}.sprite{position:absolute;width:0;height:0;overflow:hidden}.icon{width:22px;height:22px;flex-shrink:0;fill:none;stroke:currentColor;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round;pointer-events:none}.icon.solid{fill:currentColor;stroke:none}.primary,.send{background:var(--accent);color:white}.primary:hover,.send:hover{background:#6599ca}.link{color:#7bb7ee}.danger{color:#ff8792}.login{min-height:100dvh;display:grid;place-items:center;padding:24px}.card{width:min(100%,360px);text-align:center}.brand{width:88px;height:88px;border-radius:50%;margin:12px}.card h1{font-size:30px;font-weight:600;margin-bottom:8px}.card p,small{color:var(--muted)}.card label{text-align:left;display:block;font-size:13px;color:var(--muted);margin:22px 0}.card input{display:block;width:100%;margin-top:7px}.card button{display:block;width:100%;margin:12px 0}.card small{display:block;margin:24px}#auth-error{color:#ff8792;min-height:24px}.apps{margin:0 0 6px}.apps a{color:#7bb7ee;font-size:13px;text-decoration:none}
#app{height:100dvh;display:grid;grid-template-columns:clamp(280px,32vw,420px) 1fr}.dialogs{background:var(--panel);display:flex;flex-direction:column;border-right:1px solid var(--line);min-height:0}header{height:64px;display:flex;align-items:center;padding:8px 12px;gap:8px;background:var(--panel);flex-shrink:0}.dialogs header input{border-radius:24px;flex:1;padding:10px 14px}#chat-list{flex:1;overflow:auto}.chat-row{width:100%;height:76px;border-radius:0;display:flex;gap:12px;align-items:center;padding:10px 14px;text-align:left;color:white}.chat-row.active{background:#2b5278}.avatar{border-radius:50%;width:48px;height:48px;display:grid;place-items:center;flex-shrink:0;font-weight:600;color:white;overflow:hidden}.avatar-img{width:100%;height:100%;object-fit:cover;display:block}.header-avatar{width:38px;height:38px;font-size:14px;margin-right:2px}#peer-heading{cursor:pointer}.person{display:flex;gap:12px;align-items:center;width:100%;text-align:left}.person-avatar{width:40px;height:40px;font-size:14px}.person-copy{min-width:0}.person-copy strong,.person-copy small{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.person-copy small{color:var(--muted);font-size:12px}.typing-preview{color:#7fd3ff!important}.chat-copy{min-width:0;flex:1}.chat-copy strong,.chat-copy small{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;margin:5px 0}.chat-copy small{font-size:14px;color:#95adc2}.chat-row time{font-size:12px;color:#93aec5}.badge{display:block;background:var(--accent);color:white;border-radius:20px;text-align:center;padding:2px 6px;margin-top:8px}footer{min-height:52px;padding:12px 20px;display:flex;justify-content:space-between;align-items:center;color:var(--muted)}
.conversation{display:flex;flex-direction:column;min-width:0;min-height:0}.peer-heading{flex:1;min-width:0}.peer-heading strong,.peer-heading small{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.peer-heading small{margin-top:4px;color:#75b5ed}#back{display:none}#empty{flex:1;display:grid;place-items:center;color:var(--muted)}#messages{flex:1;overflow:auto;padding:16px 24px;overscroll-behavior:contain}.message{display:flex;align-items:flex-end;gap:8px;width:100%;margin:5px 0;min-width:0}.message.mine{flex-direction:row-reverse}.bubble{max-width:min(76%,540px);width:fit-content;border-radius:16px 16px 16px 6px;padding:9px 12px 6px;background:#182533;white-space:pre-wrap;overflow-wrap:anywhere;position:relative;cursor:default}.message.mine .bubble{margin-left:auto;background:#2b5278;border-radius:16px 16px 6px 16px}.message.joined .bubble{border-top-left-radius:6px}.message.mine.joined .bubble{border-top-right-radius:6px}.message.deleted{color:var(--muted)}.message .deleted-text{font-style:italic;color:var(--muted);margin:0}.bubble .text{margin:0}.meta{display:flex;align-items:center;justify-content:flex-end;gap:5px;margin-top:3px}.message time{display:block;text-align:right;font-size:11px;color:#9eb8cc}.ticks{display:inline-flex;color:#9eb8cc;margin-left:2px}.ticks .icon{width:15px;height:15px;stroke-width:2.4}.ticks.read{color:#7fd3ff}.quote{border-left:3px solid #78bdf5;padding:3px 8px;margin-bottom:8px;color:#b5cfe3;font-size:13px;max-height:64px;overflow:hidden}.message img.sticker{display:block;max-width:100%;max-height:300px;object-fit:contain;min-width:90px;border-radius:10px}.bubble-avatar{width:30px;height:30px;font-size:12px;margin-bottom:2px}.photo img{display:block;max-width:100%;max-height:320px;min-width:120px;border-radius:10px;object-fit:cover}.file{display:flex;align-items:center;gap:10px;background:#0f1a24;border-radius:12px;padding:10px 12px;margin:2px 0 4px;text-decoration:none;color:inherit;min-width:200px;max-width:320px}.message.mine .file{background:#24415f}.file-icon{width:26px;height:26px;color:#8fb8dd}.file-copy{min-width:0;flex:1}.file-copy strong{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:14px}.file-copy small{color:#9eb8cc;font-size:12px}.file-arrow{width:18px;height:18px;color:#9eb8cc}.day{width:fit-content;margin:18px auto;background:#1d2733;border-radius:18px;padding:5px 14px;font-size:12px;color:#b8cce0}#drop-hint{position:fixed;inset:0;background:#0e1621d9;border:3px dashed var(--accent);display:grid;place-items:center;color:#9ec9ff;font-size:18px;z-index:8;pointer-events:none}#compose{display:flex;gap:8px;padding:10px 16px calc(10px + env(safe-area-inset-bottom));background:var(--panel);align-items:flex-end}#compose textarea{resize:none;flex:1;border-radius:24px;max-height:140px;padding:13px 18px;line-height:22px}#attach,#media,#emoji{padding:9px;flex-shrink:0;align-self:flex-end}.send{border-radius:50%;width:48px;height:48px;flex-shrink:0;padding:0}.send .icon{width:21px;height:21px;margin-right:-2px}#context{display:flex;justify-content:space-between;align-items:center;background:var(--panel);border-top:1px solid var(--line);padding:8px 24px;color:#7eb9ec;font-size:13px}#context button{padding:6px}
dialog{border:1px solid #304355;border-radius:16px;background:var(--panel);color:white;padding:22px;width:min(560px,calc(100% - 24px));max-height:90dvh;overflow:auto;box-shadow:0 12px 80px #0008}dialog::backdrop{background:#0008}dialog>button{display:block;width:100%;text-align:left}dialog h2{margin-top:0;font-size:22px}dialog input{width:100%;margin-bottom:14px}dialog small{display:block;font-size:12px;line-height:1.6;margin:20px 10px}.menu-cover{display:flex;align-items:center;gap:16px;background:#2b5278;margin:-22px -22px 14px;padding:24px}.menu-cover img{width:56px;height:56px;border-radius:50%}#people-results button{display:block;width:100%;text-align:left}.tabs{display:flex;gap:12px}#media-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;margin:16px 0}#media-grid button{padding:4px;background:var(--field)}#media-grid img{width:100%;height:110px;object-fit:contain}.upload{display:block;background:var(--accent);border-radius:10px;padding:12px;cursor:pointer}.upload input{margin:8px 0 0;background:none;border:0;padding:0}dialog p{color:var(--muted);font-size:13px}#search-results{max-height:55dvh;overflow:auto}#search-results button{display:block;width:100%;text-align:left;background:var(--field);margin:8px 0;white-space:pre-wrap;overflow-wrap:anywhere}
#call{padding:0;width:min(900px,100%);height:min(680px,95dvh);background:#0e1621;overflow:hidden}#remote-video{width:100%;height:100%;object-fit:contain;background:radial-gradient(#29435f,#0e1621)}#local-video{position:absolute;right:20px;bottom:110px;width:160px;max-width:28%;border-radius:12px;transform:scaleX(-1)}.call-heading{position:absolute;top:20px;left:24px;text-shadow:0 2px 8px #000}.call-controls{position:absolute;bottom:24px;left:0;right:0;display:flex;justify-content:center;gap:10px}.call-controls button{border-radius:28px;background:#25384a;color:white}.call-controls .danger{background:#d95161}#toast{position:fixed;bottom:90px;left:50%;transform:translateX(-50%);background:#263c52;padding:14px 22px;border-radius:12px;max-width:90%;z-index:10;box-shadow:0 6px 20px #0008}
#emoji-panel{display:grid;grid-template-columns:repeat(9,1fr);gap:2px;max-height:220px;overflow:auto;background:var(--panel);border-top:1px solid var(--line);padding:8px}
.emoji{font-size:22px;padding:4px;line-height:1.1;border-radius:8px}
.emoji:hover{background:#ffffff14}
#profile-card{padding:0;overflow:hidden}
.profile-body{padding:28px 22px 20px;text-align:center}
.profile-avatar{width:96px;height:96px;font-size:30px;margin:0 auto 14px}
.profile-body h2{margin:0 0 6px}
.profile-body p{margin:0 0 4px;color:#7bb7ee}
.profile-body small{color:var(--muted)}
#profile-card>button{border-radius:0}
#peer-avatar:empty{display:none}
#actions button{justify-content:flex-start;text-align:left}
#recovery-code{display:block;background:var(--field);border-radius:12px;padding:14px;margin:12px 0 18px;font:600 18px ui-monospace,SFMono-Regular,Consolas,monospace;letter-spacing:.12em;text-align:center;user-select:all}
#copy-recovery{margin-bottom:8px}
dialog form label{display:block;text-align:left;font-size:13px;color:var(--muted);margin:16px 0}
dialog form input{margin-top:7px}
#recover-error,#delete-error{color:#ff8792;min-height:22px;margin-top:10px}
dialog .danger{background:#d95161;color:#fff}
dialog .danger:hover{background:#e26372}
::-webkit-scrollbar{width:6px}::-webkit-scrollbar-thumb{background:#5e789155;border-radius:5px}
@media(max-width:700px){#app{display:block}.dialogs,.conversation{height:100dvh}.conversation{display:none}.chat-open .dialogs{display:none}.chat-open .conversation{display:flex}#back{display:block}#messages{padding:12px}.bubble{max-width:86%}header{padding-top:calc(8px + env(safe-area-inset-top));height:calc(64px + env(safe-area-inset-top))}#compose{padding-left:6px;padding-right:8px;gap:4px}#attach,#media,#emoji{padding:6px}.chat-header>button{padding:10px}#call{height:95dvh}.call-controls{gap:4px}.call-controls button{padding:14px}.card h1{font-size:28px}}

.notfound{max-width:440px;text-align:center}
.notfound img{width:72px;height:72px;border-radius:50%}
.notfound h1{font-size:56px;margin:16px 0 4px}
.notfound p{color:var(--muted);line-height:1.7}
.notfound a{display:inline-block;margin-top:18px}
