@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');
:root{font-family:Inter,ui-sans-serif,system-ui,sans-serif;color-scheme:light;--bg:#f5f6fa;--surface:#fff;--surface2:#f0f1f7;--text:#202235;--muted:#85889b;--line:#e9eaf1;--accent:#635bdb;--accent-soft:#eeedff;--mine:#e8e6ff;--theirs:#fff;--shadow:0 18px 55px #25254a12}
:root[data-theme="dark"]{color-scheme:dark;--bg:#14151d;--surface:#1d1f2a;--surface2:#272a38;--text:#f1f1f7;--muted:#a0a2b3;--line:#303342;--accent:#9b94ff;--accent-soft:#302e50;--mine:#39345e;--theirs:#252836;--shadow:0 18px 55px #0004}
*{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--text);font-size:14px}button,input,textarea{font:inherit}button{cursor:pointer;border:0;color:inherit}input,textarea{color:var(--text)}.hidden{display:none!important}.muted{color:var(--muted)}.tiny{font-size:11px}.center{text-align:center}.primary,.secondary{border-radius:14px;padding:12px 17px;font-weight:700}.primary{background:var(--accent);color:white}.secondary{background:var(--surface2)}.full{width:100%;margin-top:8px}.text-btn{background:transparent;color:var(--accent);font-weight:700;padding:7px}.icon-btn{width:38px;height:38px;border-radius:13px;background:var(--surface2);font-size:18px;display:grid;place-items:center}.auth-shell{min-height:100dvh;display:grid;place-items:center;padding:22px}.auth-card{width:min(100%,410px);background:var(--surface);padding:30px;border:1px solid var(--line);border-radius:26px;box-shadow:var(--shadow)}.brand{display:flex;align-items:center;gap:12px;margin-bottom:28px}.brand b{font-size:20px;letter-spacing:-.5px}.brand small{display:block;color:var(--muted);margin-top:3px}.brand-mark{width:42px;height:42px;border-radius:15px;background:var(--accent);color:#fff;display:grid;place-items:center;font-weight:800;font-size:21px}.auth-tabs{display:flex;padding:4px;border-radius:13px;background:var(--surface2);margin-bottom:22px}.tab{flex:1;padding:10px;border-radius:10px;background:transparent;color:var(--muted);font-weight:700}.tab.active{background:var(--surface);color:var(--text);box-shadow:0 2px 8px #0000000b}label{display:grid;gap:8px;font-weight:600;margin:13px 0}label input,.search-wrap input,.composer input,.modal textarea{width:100%;border:1px solid var(--line);background:var(--surface2);border-radius:13px;padding:13px;outline:none}input:focus,textarea:focus{border-color:var(--accent)!important}.app-shell{height:100dvh;display:grid;grid-template-columns:360px minmax(0,1fr);padding:18px;gap:16px;max-width:1600px;margin:auto}.sidebar,.conversation{background:var(--surface);border:1px solid var(--line);border-radius:24px;min-height:0;overflow:hidden;box-shadow:var(--shadow)}.sidebar{display:flex;flex-direction:column}.side-header,.room-header{height:70px;display:flex;align-items:center;padding:0 20px;border-bottom:1px solid var(--line);gap:12px}.compact{margin:0;gap:9px}.compact .brand-mark{width:34px;height:34px;border-radius:12px;font-size:17px}.compact b{font-size:16px}.header-actions{margin-left:auto;display:flex;gap:8px}.me-strip{display:flex;align-items:center;gap:11px;padding:16px 20px}.avatar{width:42px;height:42px;border-radius:50%;display:grid;place-items:center;flex:none;background:var(--accent-soft);color:var(--accent);font-weight:800;background-size:cover;background-position:center}.me-info,.peer-info{display:grid;gap:4px;min-width:0}.me-info small,.peer-info small{font-size:11px;color:var(--muted)}.me-strip .text-btn{margin-left:auto}.search-wrap{margin:0 16px 14px;background:var(--surface2);border-radius:14px;display:flex;align-items:center;padding-left:12px;color:var(--muted)}.search-wrap input{background:transparent;border:0}.search-results{max-height:190px;overflow:auto;padding:0 12px}.stories-section,.chats-section{padding:8px 16px}.section-heading{display:flex;align-items:center;justify-content:space-between;padding:6px 3px 12px}.stories-row{display:flex;gap:15px;overflow:auto;padding:2px 0 12px}.story-person{width:58px;flex:none;text-align:center;font-size:11px;color:var(--muted);cursor:pointer}.story-ring{width:54px;height:54px;border-radius:50%;padding:3px;margin:0 auto 6px;background:linear-gradient(135deg,#8b78ff,#f18ab5)}.story-ring.seen{background:var(--line)}.story-ring .avatar{width:100%;height:100%;border:2px solid var(--surface)}.chats-section{border-top:1px solid var(--line);padding-top:14px;flex:1;min-height:0;display:flex;flex-direction:column}.chat-list{overflow:auto}.chat-item,.user-result{display:flex;align-items:center;gap:11px;padding:11px 8px;border-radius:15px;cursor:pointer}.chat-item:hover,.chat-item.active,.user-result:hover{background:var(--surface2)}.chat-meta{flex:1;min-width:0}.chat-meta-top{display:flex;justify-content:space-between;gap:8px}.chat-meta b{font-size:13px}.chat-preview{display:block;color:var(--muted);font-size:11px;margin-top:5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.chat-time{font-size:10px;color:var(--muted)}.unread{background:var(--accent);color:white;border-radius:20px;min-width:19px;height:19px;display:grid;place-items:center;font-size:10px}.side-footer{padding:13px 20px;border-top:1px solid var(--line);display:flex;justify-content:space-between;font-size:10px;color:var(--muted)}#connectionState{color:#27a879}.conversation{position:relative}.welcome{height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:25px}.welcome h2{margin:17px 0 7px}.welcome p{color:var(--muted);max-width:300px;line-height:1.7}.welcome-icon{width:76px;height:76px;border-radius:26px;background:var(--accent-soft);color:var(--accent);display:grid;place-items:center;font-size:34px}.room{height:100%;display:flex;flex-direction:column}.room-header{height:72px;flex:none}.room-header .avatar{width:40px;height:40px}.peer-info{flex:1}.back-btn{display:none}.messages{flex:1;overflow:auto;padding:22px clamp(14px,5vw,70px);display:flex;flex-direction:column;gap:10px;background-color:var(--chat-wallpaper,var(--bg));background-image:var(--chat-wallpaper-image,none);background-size:cover;background-position:center}.day-divider{text-align:center;margin:9px auto;background:var(--surface);color:var(--muted);font-size:10px;padding:7px 12px;border-radius:20px}.bubble{max-width:min(76%,520px);padding:10px 12px;border-radius:17px;background:var(--theirs);box-shadow:0 2px 8px #0000000a;align-self:flex-start;overflow-wrap:anywhere;line-height:1.5}.bubble.mine{align-self:flex-end;background:var(--mine);border-bottom-right-radius:5px}.bubble:not(.mine){border-bottom-left-radius:5px}.bubble .time{font-size:9px;color:var(--muted);text-align:right;margin-top:5px}.receipt{color:var(--accent);font-weight:700}.bubble img,.bubble video{max-width:100%;max-height:300px;border-radius:12px;display:block}.bubble audio{max-width:230px}.composer-area{padding:12px 18px 14px;border-top:1px solid var(--line);background:var(--surface)}.composer{display:flex;align-items:center;gap:8px}.composer input{flex:1;min-width:0;background:var(--surface2);border:0}.send-btn{width:42px;height:42px;border-radius:14px;background:var(--accent);color:white;font-size:19px}.composer-note{display:block;text-align:center;color:var(--muted);font-size:10px;margin-top:7px}.media-preview{padding:8px 0;display:flex;align-items:center;gap:10px}.media-preview img,.media-preview video{width:65px;height:55px;object-fit:cover;border-radius:10px}.wallpaper-panel{position:absolute;z-index:3;right:18px;top:62px;background:var(--surface);border:1px solid var(--line);box-shadow:var(--shadow);border-radius:18px;padding:15px;width:min(290px,90%)}.wall-options{display:grid;grid-template-columns:repeat(4,1fr);gap:9px;margin:14px 0}.wall-swatch{height:43px;border-radius:12px;border:2px solid var(--line)}.upload-wall{display:block;padding:10px;border-radius:12px;background:var(--surface2);text-align:center;color:var(--accent);cursor:pointer}.upload-wall input{display:none}.empty-state{text-align:center;padding:25px;color:var(--muted);font-size:12px}.modal{border:0;padding:0;border-radius:22px;background:transparent;width:min(92%,420px);color:var(--text)}.modal::backdrop{background:#11182788;backdrop-filter:blur(3px)}.modal-card{background:var(--surface);padding:20px;border-radius:22px;box-shadow:var(--shadow)}.modal-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:15px}.modal textarea{resize:vertical}.modal-actions{display:flex;gap:8px;justify-content:flex-end;margin:14px 0}.story-viewer{border:0;padding:0;background:#101018;color:white;width:min(94vw,430px);height:min(85dvh,760px);border-radius:24px;overflow:hidden}.story-viewer::backdrop{background:#000c}.story-viewer img,.story-viewer video{width:100%;height:100%;object-fit:contain}.story-close{position:absolute;right:14px;top:12px;background:#0008;color:white;border-radius:50%;width:35px;height:35px;font-size:22px;z-index:2}.story-caption{position:absolute;bottom:20px;left:18px;right:18px;text-align:center;text-shadow:0 1px 5px #000}.toast{position:fixed;z-index:20;bottom:22px;left:50%;transform:translate(-50%,20px);opacity:0;pointer-events:none;background:#222538;color:white;padding:12px 17px;border-radius:13px;transition:.2s;max-width:90%;text-align:center}.toast.show{opacity:1;transform:translate(-50%,0)}
@media(max-width:760px){.app-shell{display:block;padding:0;height:100dvh}.sidebar,.conversation{border:0;border-radius:0;height:100dvh;box-shadow:none}.conversation{display:none}.app-shell.room-open .sidebar{display:none}.app-shell.room-open .conversation{display:block}.back-btn{display:grid}.side-header{padding:0 16px}.messages{padding:18px 13px}.bubble{max-width:86%}.composer-area{padding:10px 10px calc(10px + env(safe-area-inset-bottom))}.room-header{padding:0 10px}.wallpaper-panel{right:10px}.auth-card{padding:24px}}
