:root{--bg:#0b141a;--panel:#111b21;--header:#202c33;--bubble-me:#005c4b;--bubble-other:#202c33;--text:#e9edef;--text-dim:#8696a0;--accent:#00a884;--reply-bar:#06cf9c;--danger:#f15c6d;--radius:12px}:root[data-theme=light]{--bg:#eae6df;--panel:#fff;--header:#f0f2f5;--bubble-me:#d9fdd3;--bubble-other:#fff;--text:#111b21;--text-dim:#667781;--accent:#00a884;--reply-bar:#1da57a;--danger:#e0344a}*{box-sizing:border-box;margin:0;padding:0;-webkit-tap-highlight-color:transparent}body,html{height:100%;width:100%;max-width:100%;overflow-x:hidden;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif;background:var(--bg);color:var(--text);overscroll-behavior:none}.hidden{display:none!important}.gate{position:fixed;inset:0;display:flex;align-items:center;justify-content:center;background:var(--bg);padding:20px;z-index:50}.gate-card{background:var(--panel);padding:32px 24px;border-radius:var(--radius);width:100%;max-width:360px;text-align:center;box-shadow:0 10px 40px rgba(0,0,0,.4)}.gate-card h1{font-size:28px;margin-bottom:8px}.gate-card p{color:var(--text-dim);margin-bottom:20px;font-size:14px}.gate-card input{width:100%;padding:12px 14px;border-radius:8px;border:none;background:var(--header);color:var(--text);font-size:16px;margin-bottom:14px}.gate-card input:focus{outline:2px solid var(--accent)}.gate-card button{width:100%;padding:12px;border:none;border-radius:8px;background:var(--accent);color:#fff;font-size:16px;font-weight:600;cursor:pointer}.gate-card button:active{opacity:.85}.pin-error{color:var(--danger);font-size:13px;margin-top:12px;min-height:16px}.badge{display:inline-block;min-width:18px;height:18px;padding:0 5px;background:var(--danger);color:#fff;border-radius:9px;font-size:11px;font-weight:700;line-height:18px;text-align:center;vertical-align:middle;margin-left:6px}.app{display:flex;flex-direction:column;height:100dvh;width:100%;max-width:800px;margin:0 auto;background:var(--bg);overflow-x:hidden;position:relative}.scroll-btn{position:absolute;right:14px;bottom:78px;z-index:20;width:42px;height:42px;border-radius:50%;border:none;cursor:pointer;background:var(--panel);color:var(--text);display:flex;align-items:center;justify-content:center;box-shadow:0 2px 10px rgba(0,0,0,.45)}.scroll-btn:active{opacity:.8}.scroll-badge{position:absolute;top:-4px;right:-4px;min-width:18px;height:18px;padding:0 5px;background:var(--accent);color:#fff;border-radius:9px;font-size:11px;font-weight:700;line-height:18px;text-align:center}.header{flex:0 0 auto;background:var(--header);padding:12px 16px;display:flex;align-items:center;justify-content:space-between;box-shadow:0 1px 3px rgba(0,0,0,.3);z-index:10}.header-left{display:flex;flex-direction:column;min-width:0}.header-title{font-size:17px;font-weight:600}.header-sub{display:flex;align-items:center;gap:8px;color:var(--text-dim);font-size:13px}.peer-status{font-size:12px;color:var(--text-dim);margin-top:1px}.peer-status.online,.peer-status.typing{color:var(--reply-bar)}.peer-status.typing{font-style:italic}.last-seen{font-size:11px;color:var(--text-dim);margin-top:1px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.change-name-btn{background:none;border:none;cursor:pointer;font-size:14px;color:var(--text)}.me-name-btn{cursor:pointer;border-bottom:1px dashed;padding-bottom:1px}.messages{flex:1 1 auto;overflow-y:auto;overflow-x:hidden;padding:14px 12px;display:flex;flex-direction:column;gap:6px;background:var(--bg)}.loading{text-align:center;padding:20px;font-size:14px}.load-more,.loading{color:var(--text-dim)}.load-more{align-self:center;margin:6px auto 8px;flex:0 0 auto;background:var(--header);border:none;border-radius:16px;padding:6px 16px;font-size:13px;cursor:pointer}.load-more:disabled{opacity:.6;cursor:default}.restore-bar{flex:0 0 auto;background:var(--header);display:flex;align-items:center;gap:8px;padding:8px 10px;flex-wrap:wrap}.restore-label{color:var(--text-dim);font-size:13px}.restore-bar input{border:none;border-radius:8px;background:var(--panel);color:var(--text);padding:6px 10px;font-size:14px}.restore-bar button{border:none;border-radius:14px;padding:6px 12px;font-size:13px;cursor:pointer;background:var(--accent);color:#fff}.restore-bar button.context-cancel{background:none;color:var(--text-dim);font-size:18px}.msg-row{display:flex;max-width:100%}.msg-row.me{justify-content:flex-end}.msg-row.other{justify-content:flex-start}.bubble{max-width:78%;padding:7px 10px 5px;border-radius:var(--radius);position:relative;word-wrap:break-word;overflow-wrap:anywhere;font-size:15px;line-height:1.35;cursor:default;box-shadow:0 1px .5px rgba(0,0,0,.13)}@media (hover:none){.bubble{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}}.me .bubble{background:var(--bubble-me);border-bottom-right-radius:3px}.other .bubble{background:var(--bubble-other);border-bottom-left-radius:3px}.bubble-content{white-space:pre-wrap}.bubble img.msg-img{max-width:240px;max-height:280px;width:auto;height:auto;object-fit:cover;border-radius:8px;margin-bottom:4px;cursor:pointer;display:block}.reply-quote{border-left:3px solid var(--reply-bar);background:rgba(0,0,0,.18);border-radius:6px;padding:4px 8px;margin-bottom:4px;font-size:13px;cursor:pointer}.reply-quote .q-name{color:var(--reply-bar);font-weight:600;display:block}.reply-quote .q-text{color:var(--text-dim);display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:220px}.meta{font-size:11px;color:var(--text-dim);margin-top:2px;text-align:right}.me .meta{color:rgba(233,237,239,.6)}.meta .edited{font-style:italic;margin-right:4px}.meta .status{margin-left:2px;letter-spacing:-1px}.meta .status.read{color:#53bdeb}.bubble.deleted .bubble-content{font-style:italic;color:var(--text-dim)}.actions{position:absolute;bottom:calc(100% + 6px);display:flex;gap:4px;z-index:5;background:var(--panel);padding:5px;border-radius:16px;box-shadow:0 2px 10px rgba(0,0,0,.45)}.me .actions{right:0}.other .actions{left:0}.actions button{background:var(--header);border:none;color:var(--text);width:30px;height:30px;border-radius:50%;cursor:pointer;font-size:14px}.context-bar,.image-preview{flex:0 0 auto;background:var(--header);display:flex;align-items:center;gap:10px;padding:8px 14px;border-top:1px solid hsla(0,0%,100%,.06)}.context-info{flex:1 1;min-width:0}.context-label{display:block;color:var(--reply-bar);font-size:12px;font-weight:600}.context-text{display:block;color:var(--text-dim);font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.context-cancel{background:none;border:none;color:var(--text-dim);font-size:18px;cursor:pointer;padding:0 4px}.image-preview img{height:56px;border-radius:6px}.composer{background:var(--header);align-items:flex-end;gap:8px;padding:8px 10px calc(8px + env(safe-area-inset-bottom))}.attach-btn,.composer{flex:0 0 auto;display:flex}.attach-btn{width:40px;height:40px;border-radius:50%;align-items:center;justify-content:center;font-size:18px;cursor:pointer}.attach-btn,.msg-input{background:var(--panel)}.msg-input{flex:1 1 auto;resize:none;border:none;border-radius:20px;color:var(--text);padding:10px 14px;font-size:15px;max-height:120px;line-height:1.3;font-family:inherit}.msg-input:focus{outline:none}.send-btn{flex:0 0 auto;width:44px;height:44px;border-radius:50%;border:none;background:var(--accent);color:#fff;font-size:18px;cursor:pointer}.send-btn:active{opacity:.85}.lightbox{position:fixed;inset:0;background:rgba(0,0,0,.92);display:flex;align-items:center;justify-content:center;z-index:100;padding:20px}.lightbox img{max-width:100%;max-height:100%;border-radius:8px}.lightbox-nav{position:absolute;top:50%;transform:translateY(-50%);background:rgba(0,0,0,.5);color:#fff;border:none;font-size:30px;line-height:1;padding:10px 16px;border-radius:8px;cursor:pointer}.lightbox-nav.prev{left:8px}.lightbox-nav.next{right:8px}.lightbox-nav:disabled{opacity:.2;cursor:default}.lightbox-count{position:absolute;top:14px;left:50%;transform:translateX(-50%);color:hsla(0,0%,100%,.75);font-size:13px}.messages::-webkit-scrollbar{width:6px}.messages::-webkit-scrollbar-thumb{background:hsla(0,0%,100%,.12);border-radius:3px}:root[data-theme=light] .messages::-webkit-scrollbar-thumb{background:rgba(0,0,0,.2)}.toast{position:fixed;bottom:80px;left:50%;transform:translateX(-50%);background:var(--danger);color:#fff;padding:10px 18px;border-radius:20px;font-size:14px;z-index:200;box-shadow:0 4px 16px rgba(0,0,0,.4)}.conn-warn{flex:0 0 auto;background:#7a3b00;color:#ffd9a8;text-align:center;font-size:12px;padding:4px}.disguise{position:fixed;inset:0;z-index:300;background:var(--bg);display:flex;align-items:center;justify-content:center;cursor:pointer}.disguise span{font-size:46px;opacity:.15}.actions{flex-wrap:wrap;max-width:86vw}.react-btn{font-size:16px}.star-mark{color:#f4c430;margin-right:4px;font-size:11px}.starred-title{flex:1 1;font-size:14px;font-weight:600;color:var(--text)}.unstar-btn{background:none;border:none;color:#f4c430;cursor:pointer;font-size:15px;padding:0 2px;margin-left:8px;line-height:1}.reactions{display:flex;gap:4px;flex-wrap:wrap;margin-top:3px}.reaction{border-radius:10px;padding:1px 6px;font-size:12px;line-height:17px}.reaction,.search-bar{background:var(--header)}.search-bar{flex:0 0 auto;display:flex;align-items:center;gap:8px;padding:8px 10px}.search-bar input{flex:1 1;border:none;border-radius:20px;background:var(--panel);color:var(--text);padding:9px 14px;font-size:15px}.search-bar input:focus{outline:none}.search-results{flex:1 1 auto;overflow-y:auto;overflow-x:hidden;background:var(--bg);padding:4px 0}.search-empty{text-align:center;color:var(--text-dim);padding:24px;font-size:14px}.search-note{padding:8px 14px;color:var(--text-dim);font-size:12px;line-height:1.4}.search-item,.search-note{border-bottom:1px solid hsla(0,0%,100%,.05)}.search-item{padding:10px 14px;cursor:pointer}.search-item:active{background:var(--header)}.search-item-top{display:flex;justify-content:space-between;color:var(--reply-bar);font-size:12px;font-weight:600;margin-bottom:2px}.search-item-top span:last-child{color:var(--text-dim);font-weight:400}.search-item-text{color:var(--text);font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.gallery-date{padding:12px 14px 6px;color:var(--text-dim);font-size:12px;font-weight:600}.gallery-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(96px,1fr));grid-gap:3px;gap:3px;padding:0 3px 8px}.gallery-cell{position:relative;aspect-ratio:1/1;overflow:hidden;border-radius:6px;background:var(--header);cursor:pointer}.gallery-cell img{width:100%;height:100%;object-fit:cover;display:block}.gallery-cell:active img{opacity:.65}.gallery-jump{position:absolute;right:3px;bottom:3px;background:rgba(0,0,0,.55);color:#fff;border-radius:5px;font-size:12px;line-height:1;padding:4px 5px}.bubble.flash{animation:flash 1.2s ease}@keyframes flash{0%,to{box-shadow:0 1px .5px rgba(0,0,0,.13)}30%{box-shadow:0 0 0 3px rgba(6,207,156,.6)}}