:root{--bg: #0e0e10;--surface: #18181b;--surface-2: #232328;--text: #ececef;--muted: #8a8a93;--me: #2a6df4;--them: #2c2c33;--border: #2a2a30;--danger: #f04747;--ok: #3ba55c;--safe-top: env(safe-area-inset-top, 0px);--safe-bottom: env(safe-area-inset-bottom, 0px)}*{box-sizing:border-box}html,body,#app{margin:0}html{height:100%;overflow:hidden;background:var(--surface)}body{background:var(--bg);color:var(--text);font:16px/1.4 -apple-system,BlinkMacSystemFont,Segoe UI,system-ui,sans-serif;-webkit-font-smoothing:antialiased;overscroll-behavior:none;height:100%;overflow:hidden}#app{position:fixed;top:var(--vvt, 0);left:0;right:0;height:var(--vvh, 100dvh);background:var(--bg)}button{font:inherit;color:inherit;cursor:pointer}input,textarea{font:inherit;color:inherit}.screen{display:flex;flex-direction:column;height:100%}.login{display:flex;flex-direction:column;justify-content:center;max-width:360px;margin:0 auto;padding:24px;height:100%}.login h1{font-size:24px;margin:0 0 16px}.login label{display:block;margin:12px 0 6px;color:var(--muted);font-size:13px}.login input{width:100%;padding:12px 14px;border-radius:10px;background:var(--surface);border:1px solid var(--border);outline:none}.login input:focus{border-color:var(--me)}.login button{margin-top:16px;padding:12px;border-radius:10px;border:0;background:var(--me);color:#fff;font-weight:600}.login button:disabled{opacity:.5}.login .err{color:var(--danger);font-size:13px;margin-top:12px;min-height:1em}.chat-header{display:flex;align-items:center;gap:8px;padding:calc(var(--safe-top) + 10px) 16px 10px;background:var(--surface);border-bottom:1px solid var(--border);position:sticky;top:0;z-index:2}.chat-header .name{font-weight:600;display:inline-flex;align-items:center;gap:8px}.presence{width:8px;height:8px;border-radius:50%;background:var(--muted);box-shadow:0 0 0 2px var(--surface)}.presence.present{background:var(--ok)}.chat-header .status{margin-left:auto;font-size:12px;color:var(--muted);display:flex;align-items:center;gap:6px}.dot{width:8px;height:8px;border-radius:50%;background:var(--muted)}.dot.connected{background:var(--ok)}.dot.connecting{background:#d3a23b}.dot.offline{background:var(--danger)}.chat-header .signout{background:transparent;border:1px solid var(--border);color:var(--muted);padding:6px 10px;border-radius:8px;font-size:12px}.messages{flex:1;overflow-y:auto;padding:12px;display:flex;flex-direction:column;gap:6px;-webkit-overflow-scrolling:touch;overflow-anchor:none}.bubble{max-width:78%;padding:8px 12px;border-radius:16px;word-wrap:break-word;white-space:pre-wrap}.bubble.me{background:var(--me);align-self:flex-end;border-bottom-right-radius:4px}.bubble.them{background:var(--them);align-self:flex-start;border-bottom-left-radius:4px}.meta{font-size:11px;color:var(--muted);margin:0 6px 6px;align-self:flex-end}.bubble.them+.meta,.meta.them{align-self:flex-start}.bubble.pending{opacity:.7}.bubble.failed{background:#5a2a2a}.bubble.typing{display:inline-flex;gap:4px;padding:10px 14px;align-items:center}.bubble.typing span{width:6px;height:6px;border-radius:50%;background:var(--muted);animation:typing 1.2s infinite ease-in-out}.bubble.typing span:nth-child(2){animation-delay:.15s}.bubble.typing span:nth-child(3){animation-delay:.3s}@keyframes typing{0%,60%,to{opacity:.3;transform:translateY(0)}30%{opacity:1;transform:translateY(-2px)}}.pending-meta{display:flex;gap:10px;align-items:center;flex-wrap:wrap}.meta button.link{background:transparent;border:0;padding:0;color:var(--me);font:inherit;font-size:11px;cursor:pointer}.meta button.link.muted{color:var(--muted)}.composer{display:flex;gap:8px;padding:8px 8px calc(var(--safe-bottom) + 8px);background:var(--surface);border-top:1px solid var(--border);position:relative}:root.kb-open .composer{padding-bottom:8px}.composer textarea{flex:1;resize:none;min-height:40px;max-height:120px;padding:10px 12px;border-radius:18px;background:var(--surface-2);border:1px solid var(--border);outline:none}.composer textarea:focus{border-color:var(--me)}.composer button{border:0;background:var(--me);color:#fff;padding:0 16px;border-radius:18px;font-weight:600}.composer button:disabled{opacity:.4}.banner{margin:8px 12px;padding:10px 12px;border-radius:10px;background:var(--surface-2);border:1px solid var(--border);font-size:13px;color:var(--muted);display:flex;gap:8px;align-items:center}.banner button{margin-left:auto;background:var(--me);color:#fff;border:0;padding:6px 10px;border-radius:8px;font-size:12px}.banner.dismiss button{background:transparent;color:var(--muted);border:1px solid var(--border)}.load-older{align-self:center;font-size:12px;color:var(--muted);padding:6px 0 4px;min-height:18px}.catching-up{align-self:center;display:inline-flex;align-items:center;gap:8px;font-size:12px;color:var(--muted);padding:4px 10px;margin-top:4px;border:1px solid var(--border);border-radius:999px;background:var(--surface-2)}.catching-up .spinner{width:10px;height:10px;border-radius:50%;border:2px solid var(--border);border-top-color:var(--muted);animation:spin .8s linear infinite}@keyframes spin{to{transform:rotate(360deg)}}.bubble-wrap{position:relative;display:flex;flex-direction:column;max-width:78%}.bubble-wrap.me{align-self:flex-end;align-items:flex-end}.bubble-wrap.them{align-self:flex-start;align-items:flex-start}.bubble-wrap .bubble{max-width:100%;user-select:text}.reactions{display:flex;gap:4px;flex-wrap:wrap;margin:-8px 6px 4px;position:relative;z-index:1}.reaction-chip{display:inline-flex;align-items:center;gap:3px;padding:2px 8px;border-radius:999px;background:var(--surface-2);border:1px solid var(--border);font-size:13px;line-height:1;font-family:"Apple Color Emoji","Segoe UI Emoji","Noto Color Emoji",-apple-system,system-ui,sans-serif;cursor:pointer}.reaction-chip.mine{border-color:var(--me)}.reaction-chip .r-count{font-size:11px;color:var(--muted);font-family:inherit}.reaction-chip.mine .r-count{color:var(--text)}.reaction-picker{position:absolute;bottom:calc(100% + 4px);display:flex;gap:4px;padding:4px;background:var(--surface-2);border:1px solid var(--border);border-radius:999px;box-shadow:0 6px 20px #0000004d;z-index:3}.bubble-wrap.me .reaction-picker{right:0}.bubble-wrap.them .reaction-picker{left:0}.reaction-picker .r-pick{width:36px;height:36px;display:inline-flex;align-items:center;justify-content:center;background:transparent;border:0;border-radius:999px;font-size:22px;line-height:1;font-family:"Apple Color Emoji","Segoe UI Emoji","Noto Color Emoji",-apple-system,system-ui,sans-serif;cursor:pointer}.reaction-picker .r-pick:hover,.reaction-picker .r-pick.active{background:var(--surface)}.reaction-picker .r-pick.active{box-shadow:inset 0 0 0 2px var(--me)}.icon-btn{background:transparent;border:1px solid var(--border);color:var(--text);padding:4px 8px;border-radius:8px;font-size:14px;line-height:1}.icon-btn:active{background:var(--surface-2)}.bubble.has-image{padding:0;overflow:hidden;width:min(86%,420px)}.bubble.has-image .image-frame,.bubble.has-image>.chat-image{display:block;width:100%;height:auto;border-radius:inherit}.bubble.has-image .caption{padding:6px 12px 8px;white-space:pre-wrap;word-wrap:break-word}.bubble.has-image .image-frame .chat-image{cursor:zoom-in}.image-frame{position:relative;overflow:hidden;background:#15151a;min-height:120px}.image-frame .chat-image{display:block;width:100%;height:100%;object-fit:contain;position:relative;z-index:0}.image-frame.cover{width:100%;height:100%;min-height:0}.image-frame.cover .chat-image{object-fit:cover}.image-frame.contain{max-width:100%;max-height:80dvh;background:transparent;min-height:0}.image-frame.contain .chat-image{cursor:default}.image-placeholder{position:absolute;inset:0;z-index:1;display:flex;align-items:center;justify-content:center;background:#1a1a20;pointer-events:none}.image-placeholder-icon{width:36px;height:36px;fill:#ffffff38;animation:img-icon-pulse 1.8s ease-in-out infinite}.image-frame.cover .image-placeholder-icon{width:24px;height:24px}.image-frame.contain .image-placeholder-icon{width:48px;height:48px}@keyframes img-icon-pulse{0%,to{opacity:.45}50%{opacity:.95}}.image-retry{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);z-index:2;display:inline-flex;align-items:center;gap:6px;padding:8px 14px;background:#000000a6;color:var(--text);border:1px solid rgba(255,255,255,.14);border-radius:999px;font:inherit;font-size:13px;font-weight:500;line-height:1;cursor:pointer;backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px)}.image-retry:active{background:#000000d1}.image-retry[disabled]{cursor:default;opacity:.85}.image-retry-icon{width:14px;height:14px;fill:currentColor}.image-retry-spinner{width:14px;height:14px;border:2px solid rgba(255,255,255,.22);border-top-color:currentColor;border-radius:50%;animation:img-spin .8s linear infinite}@keyframes img-spin{to{transform:rotate(360deg)}}.image-progress{position:absolute;bottom:12px;left:50%;transform:translate(-50%);font-size:12px;font-weight:500;color:#ffffffd9;background:#0000006b;padding:2px 8px;border-radius:999px;font-variant-numeric:tabular-nums;pointer-events:none}.file-hidden{display:none}.composer .file-btn{background:transparent;color:var(--text);padding:0 12px;border:1px solid var(--border);border-radius:18px;font-size:18px;line-height:1;font-weight:400}.composer .file-btn:active{background:var(--surface-2)}.composer .emoji-btn{display:none;background:transparent;color:var(--text);padding:0 12px;border:1px solid var(--border);border-radius:18px;font-size:18px;line-height:1;font-weight:400}@media (hover: hover) and (pointer: fine){.composer .emoji-btn{display:inline-flex;align-items:center}}.composer .emoji-btn:hover{background:var(--surface-2)}.composer .emoji-btn.active{border-color:var(--me)}.emoji-palette{position:absolute;bottom:calc(100% + 6px);left:8px;width:304px;max-height:280px;overflow-y:auto;padding:6px;background:var(--surface-2);border:1px solid var(--border);border-radius:12px;box-shadow:0 6px 20px #0006;display:grid;grid-template-columns:repeat(8,1fr);gap:2px;z-index:5}.emoji-cell{background:transparent;border:0;padding:4px;border-radius:6px;font-size:22px;line-height:1;font-family:"Apple Color Emoji","Segoe UI Emoji","Noto Color Emoji",-apple-system,system-ui,sans-serif;cursor:pointer}.emoji-cell:hover{background:var(--surface)}.image-chip{display:flex;align-items:center;gap:10px;margin:0 8px;padding:8px 10px;background:var(--surface-2);border:1px solid var(--border);border-radius:10px}.image-chip img{width:56px;height:56px;object-fit:cover;border-radius:8px;display:block}.image-chip-meta{font-size:12px;color:var(--muted)}.image-chip-error{color:var(--danger);font-size:13px}.image-chip-remove{margin-left:auto;background:transparent;border:1px solid var(--border);color:var(--muted);width:28px;height:28px;border-radius:50%;display:inline-flex;align-items:center;justify-content:center;font-size:14px;line-height:1}.overlay{position:fixed;inset:0;z-index:100;background:#000000eb;display:flex;flex-direction:column;color:var(--text)}.overlay-header{display:flex;align-items:center;justify-content:space-between;padding:calc(var(--safe-top) + 12px) 16px 12px;background:#0006}.overlay-title{font-weight:600;font-size:16px}.overlay-close{background:transparent;border:1px solid rgba(255,255,255,.2);color:var(--text);width:36px;height:36px;border-radius:50%;display:inline-flex;align-items:center;justify-content:center;font-size:18px;line-height:1}.overlay-empty{margin:auto;color:var(--muted);font-size:14px}.gallery-grid{flex:1;overflow-y:auto;display:grid;grid-template-columns:repeat(3,1fr);gap:2px;padding:2px 2px calc(var(--safe-bottom) + 2px)}.gallery-cell{aspect-ratio:1;background:var(--surface-2);border:0;padding:0;overflow:hidden;cursor:pointer}.gallery-cell:active{opacity:.85}.gallery-cell .image-frame,.gallery-cell .chat-image{width:100%;height:100%}.lightbox{display:flex;flex-direction:column;touch-action:pan-y}.lightbox-header{display:flex;align-items:center;justify-content:space-between;padding:calc(var(--safe-top) + 12px) 16px 12px}.lightbox-stage{flex:1;display:flex;align-items:center;justify-content:center;padding:0 16px calc(var(--safe-bottom) + 16px);transition:transform 60ms ease-out}.lightbox-nav{position:absolute;top:50%;transform:translateY(-50%);width:44px;height:44px;border-radius:50%;background:#ffffff1a;color:var(--text);border:0;font-size:24px;line-height:1;display:inline-flex;align-items:center;justify-content:center}.lightbox-nav.prev{left:8px}.lightbox-nav.next{right:8px}
