:root {
  --text: #f2f7f4;
  --text-muted: #a9bbb4;
  --text-dim: #82918c;
  --accent: #2dd4bf;
  --accent-2: #fb7185;
  --glass: rgba(27, 35, 32, 0.96);
  --border: rgba(210, 232, 224, 0.14);
  --bubble-them: #27322e;
  --bubble-me: #0f766e;
  --danger: #fb7185;
  --ok: #34d399;
  --warn: #f59e0b;
  --pad-app: 20px;
  --radius-lg: 8px;
  --radius-md: 8px;
  --avatar-msg: 44px;
  --avatar-me: 44px;
  --avatar-list: 44px;
  --font-base: 14.5px;
  --font-meta: 11px;
  --maxw: 1120px;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  color: var(--text); overflow: hidden;
  -webkit-font-smoothing: antialiased;
  background: #111513;
  user-select: none; -webkit-user-select: none;
}
input, textarea, .bubble .content, .pm-bubble { user-select: text; -webkit-user-select: text; }

.bg { position: fixed; inset: 0; z-index: -2; background-size: cover; background-position: center; filter: saturate(1.1); }
.bg-fallback { position: fixed; inset: 0; z-index: -3; background: #111513; }
.bg-overlay { position: fixed; inset: 0; z-index: -1;
  background: rgba(5, 9, 7, .12); }

.app { display: none; flex-direction: column; height: 100vh; height: 100dvh; max-width: var(--maxw); margin: 0 auto; padding: var(--pad-app); gap: 12px; }

.header { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--glass); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: 0 8px 32px rgba(0,0,0,.3); }
.me-avatar { width: var(--avatar-me); height: var(--avatar-me); border-radius: 50%; overflow: hidden; flex-shrink: 0; border: 2px solid rgba(255,255,255,.25); box-shadow: 0 4px 12px rgba(236,72,153,.35); background: #ffe4f0; cursor: pointer; transition: transform .2s; }
.me-avatar:hover { transform: scale(1.06) rotate(-4deg); }
.me-avatar img { width: 100%; height: 100%; display: block; }
.title-wrap { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.title { font-size: 17px; font-weight: 700; margin: 0; color: var(--text); letter-spacing: 0; }
.me-line { display: flex; align-items: center; gap: 6px; margin-top: 2px; flex-wrap: wrap; }
.me-name { font-size: 12.5px; color: var(--text-muted); font-weight: 500; }
.me-loc { font-size: 11px; color: var(--text-dim); }
.edit-btn { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.15); color: var(--text-muted); border-radius: 8px; padding: 2px 7px; cursor: pointer; font-size: 11px; display: inline-flex; align-items: center; gap: 3px; transition: all .15s; }
.edit-btn:hover { background: rgba(255,255,255,.15); color: var(--text); }
.edit-btn svg { width: 11px; height: 11px; }

.header-actions { display: flex; gap: 6px; align-items: center; }
.mute-btn { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.15); color: var(--text-muted); border-radius: 10px; width: 34px; height: 34px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all .15s; }
.mute-btn:hover { background: rgba(255,255,255,.16); color: #fff; }
.mute-btn.muted { color: var(--warn); border-color: rgba(245,158,11,.3); }
.mute-btn svg { width: 16px; height: 16px; }
.online { font-size: 12px; color: var(--text); display: flex; align-items: center; gap: 6px; padding: 7px 12px; background: rgba(34,197,94,.15); border: 1px solid rgba(34,197,94,.3); border-radius: 999px; font-weight: 500; white-space: nowrap; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px rgba(34,197,94,.25); animation: pulse 2s infinite; }
@keyframes pulse { 0%,100%{box-shadow:0 0 0 3px rgba(34,197,94,.25);} 50%{box-shadow:0 0 0 5px rgba(34,197,94,.15);} }

.main-layout { flex: 1; min-height: 0; display: grid; grid-template-columns: 154px minmax(0, 1fr); gap: 12px; }
.user-rail { display: flex; flex-direction: column; align-items: stretch; gap: 8px; padding: 12px 10px; background: var(--glass); border: 1px solid var(--border); border-radius: var(--radius-md); overflow-x: hidden; overflow-y: auto; scrollbar-width: thin; min-width: 0; }
.user-rail::-webkit-scrollbar { width: 4px; }
.user-rail::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 2px; }
.user-rail-label { font-size: 11px; color: var(--text-dim); white-space: nowrap; padding: 2px 4px 7px; border-bottom: 1px solid rgba(255,255,255,.1); }
.u-chip { flex-shrink: 0; display: flex; flex-direction: row; align-items: center; gap: 8px; cursor: pointer; width: 100%; min-width: 0; transition: background .15s; padding: 5px; border-radius: 8px; }
.u-chip:hover { background: rgba(255,255,255,.08); }
.u-chip .u-avatar { width: var(--avatar-list); height: var(--avatar-list); border-radius: 50%; overflow: hidden; border: 2px solid rgba(255,255,255,.22); background: #ffe4f0; position: relative; box-shadow: 0 2px 8px rgba(0,0,0,.2); }
.u-chip .u-avatar img { width: 100%; height: 100%; display: block; }
.u-chip .u-avatar::after { content: ''; position: absolute; right: -1px; bottom: -1px; width: 10px; height: 10px; border-radius: 50%; background: var(--ok); border: 2px solid rgba(30,16,50,1); }
.u-chip.busy .u-avatar::after { background: var(--warn); }
.u-chip.busy .u-name { color: var(--warn); }
.u-chip .u-name { font-size: 11px; color: var(--text-muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.u-chip.me { pointer-events: none; opacity: .8; }
.u-chip.me .u-name { color: var(--accent); font-weight: 600; }

.chat-area { flex: 1; display: flex; flex-direction: column; min-height: 0; background: var(--glass); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; box-shadow: 0 8px 32px rgba(0,0,0,.3); position: relative; }
.messages { flex: 1; overflow-y: auto; padding: 20px; scroll-behavior: smooth; }
.messages.loading-history { visibility: hidden; scroll-behavior: auto; }
.messages.loading-history .msg { animation: none; }
.messages::-webkit-scrollbar { width: 6px; }
.messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 3px; }

.msg { display: flex; align-items: flex-start; margin-bottom: 16px; animation: slideIn .35s cubic-bezier(.16,1,.3,1); }
@keyframes slideIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.avatar { width: var(--avatar-msg); height: var(--avatar-msg); border-radius: 50%; overflow: hidden; flex-shrink: 0; background: #ffe4f0; border: 2px solid rgba(255,255,255,.25); box-shadow: 0 2px 8px rgba(0,0,0,.25); position: relative; transition: filter .2s; }
.avatar img { width: 100%; height: 100%; display: block; object-fit: cover; object-position: center top; }
.me-avatar img, .u-avatar img, .g-avatar img, .modal-avatar img, .pm-avatar img, .confirm-avatar img { object-fit: cover; object-position: center top; }
.msg.them .avatar { cursor: pointer; transition: transform .15s, box-shadow .2s; }
.msg.them .avatar:hover { transform: scale(1.08); box-shadow: 0 4px 16px rgba(236,72,153,.5); border-color: rgba(255,255,255,.5); }
.msg.them .avatar::after { content: '私聊'; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.7); color: #fff; font-size: 11px; font-weight: 600; opacity: 0; transition: opacity .15s; border-radius: 50%; pointer-events: none; }
.msg.them .avatar:hover::after { opacity: 1; }
.msg.them.offline .avatar { cursor: default; filter: grayscale(1) brightness(.35); }
.msg.them.offline .avatar:hover { transform: none; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.msg.them.offline .avatar::after { display: none; }
.msg.them.busy .avatar::after { content: '私聊中'; background: rgba(245,158,11,.85); color: #fff; font-size: 10.5px; }
.msg.them.busy .avatar:hover { border-color: rgba(245,158,11,.5); box-shadow: 0 4px 16px rgba(245,158,11,.35); }

.bubble { padding: 10px 14px; border-radius: 18px; max-width: min(70%, 560px); word-break: break-word; box-shadow: 0 2px 12px rgba(0,0,0,.15); border: 1px solid rgba(255,255,255,.1); }
.meta { font-size: var(--font-meta); color: var(--text-dim); margin-bottom: 4px; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.meta strong { font-weight: 600; font-size: 12.5px; color: var(--text); }
.meta .loc { opacity: .85; }
.meta .time { margin-left: auto; font-variant-numeric: tabular-nums; }
.content { font-size: var(--font-base); line-height: 1.6; white-space: pre-wrap; }
.msg.them .bubble { background: var(--bubble-them); margin-left: 10px; border-top-left-radius: 4px; }
.msg.me { flex-direction: row-reverse; }
.msg.me .bubble { background: var(--bubble-me); margin-right: 10px; border-top-right-radius: 4px; border-color: rgba(255,255,255,.2); color: #fff; }
.msg.me .meta { justify-content: flex-end; color: rgba(255,255,255,.85); flex-direction: row-reverse; }
.msg.me .meta strong { color: #fff; }
.msg.me .meta .time { margin-left: 0; margin-right: auto; }

.system { text-align: center; font-size: 12px; color: var(--text-muted); margin: 14px auto; padding: 5px 14px; max-width: fit-content; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); border-radius: 999px; }

/* Composer */
.composer { padding: 12px; border-top: 1px solid var(--border); background: rgba(255,255,255,.04); padding-bottom: calc(12px + env(safe-area-inset-bottom)); position: relative; }
.composer-row { display: flex; gap: 8px; align-items: flex-end; background: rgba(255,255,255,.08); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 6px 6px 6px 14px; transition: border-color .2s, box-shadow .2s; }
.composer-row:focus-within { border-color: rgba(236,72,153,.5); box-shadow: 0 0 0 3px rgba(236,72,153,.15); }
textarea { flex: 1; resize: none; border: none; outline: none; background: transparent; color: var(--text); font: inherit; font-size: var(--font-base); line-height: 1.5; padding: 8px 0; max-height: 140px; min-height: 24px; }
textarea::placeholder { color: var(--text-dim); }
.icon-btn { background: transparent; border: 1px solid rgba(255,255,255,.15); border-radius: 10px; width: 38px; height: 38px; cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--text-muted); flex-shrink: 0; transition: all .15s; }
.icon-btn:hover { background: rgba(255,255,255,.08); color: #fff; }
@keyframes recPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(236,72,153,.5); } 50% { box-shadow: 0 0 0 8px rgba(236,72,153,0); } }
.icon-btn svg { width: 18px; height: 18px; }

.send { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; border: none; border-radius: 12px; width: 40px; height: 40px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: transform .15s, box-shadow .2s; box-shadow: 0 3px 12px rgba(236,72,153,.4); flex-shrink: 0; }
.send:hover { transform: translateY(-2px) scale(1.05); }
.send svg { width: 18px; height: 18px; }

/* Login modal */
.overlay { position: fixed; inset: 0; background: rgba(10,10,20,.6); display: none; align-items: center; justify-content: center; z-index: 200; animation: fadeIn .3s ease; }
.overlay.show { display: flex; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal { background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.2); border-radius: 24px; padding: 30px 28px; width: 400px; max-width: 94vw; box-shadow: 0 20px 60px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.2); animation: popIn .4s cubic-bezier(.16,1,.3,1); }
@keyframes popIn { from { opacity: 0; transform: scale(.92); } to { opacity: 1; transform: scale(1); } }
.modal h2 { margin: 0 0 6px; font-size: 22px; text-align: center; font-weight: 700; background: linear-gradient(135deg, #fff, #fbcfe8); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; letter-spacing: 2px; }
.modal p { margin: 0 0 18px; color: var(--text-muted); font-size: 13px; text-align: center; line-height: 1.6; }
.gender-row { display: flex; gap: 14px; justify-content: center; margin-bottom: 16px; }
.g-choice { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 8px; border-radius: 16px; cursor: pointer; border: 2px solid rgba(255,255,255,.1); background: rgba(255,255,255,.04); transition: all .2s; }
.g-choice:hover { background: rgba(255,255,255,.08); }
.g-choice.selected { border-color: rgba(236,72,153,.7); background: rgba(236,72,153,.12); box-shadow: 0 4px 16px rgba(236,72,153,.25); }
.g-avatar { width: 72px; height: 72px; border-radius: 50%; overflow: hidden; background: #ffe4f0; border: 2px solid rgba(255,255,255,.25); }
.g-avatar img { width: 100%; height: 100%; display: block; }
.g-choice .g-label { font-size: 14px; font-weight: 600; color: var(--text-muted); }
.g-choice.selected .g-label { color: var(--text); }
.g-choice.female.selected { border-color: rgba(244,114,182,.8); background: rgba(244,114,182,.12); }
.g-choice.male.selected { border-color: rgba(96,165,250,.8); background: rgba(96,165,250,.12); }
.modal input { width: 100%; padding: 13px 16px; border-radius: 12px; border: 1px solid rgba(255,255,255,.2); background: rgba(255,255,255,.08); color: var(--text); font-size: 15px; outline: none; transition: border-color .2s, background .2s; }
.modal input:focus { border-color: rgba(236,72,153,.6); background: rgba(255,255,255,.12); }
.modal input.error { border-color: var(--danger); animation: shake .3s; }
@keyframes shake { 0%,100%{transform:translateX(0);} 25%{transform:translateX(-4px);} 75%{transform:translateX(4px);} }
.modal-actions { display: flex; gap: 10px; margin-top: 14px; }
.modal button { flex: 1; padding: 13px; border-radius: 12px; border: none; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; font-size: 15px; font-weight: 700; cursor: pointer; transition: transform .15s, filter .2s; box-shadow: 0 6px 20px rgba(236,72,153,.4); letter-spacing: 1px; }
.modal button:hover { transform: translateY(-2px); filter: brightness(1.08); }
.modal button:disabled { opacity: .4; cursor: not-allowed; transform: none; filter: none; }
.modal button.secondary { background: rgba(255,255,255,.1); box-shadow: none; border: 1px solid rgba(255,255,255,.2); flex: 0 0 auto; padding: 13px 18px; }
.modal button.secondary:hover { background: rgba(255,255,255,.18); filter: none; }

/* Confirm popup */
.confirm-wrap { position: fixed; left: 50%; top: 28%; transform: translateX(-50%); z-index: 180; pointer-events: none; }
.confirm { pointer-events: auto; background: rgba(22, 18, 38, 0.92); border: 1px solid rgba(255,255,255,.2); border-radius: 18px; padding: 22px 24px; width: 320px; max-width: 92vw; box-shadow: 0 16px 48px rgba(0,0,0,.55); animation: popIn .35s cubic-bezier(.16,1,.3,1); }
.confirm-avatar { width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 50%; overflow: hidden; border: 2px solid rgba(255,255,255,.28); background: #ffe4f0; }
.confirm-avatar img { width: 100%; height: 100%; display: block; }
.confirm h3 { margin: 0 0 4px; font-size: 16px; font-weight: 700; text-align: center; color: var(--text); }
.confirm-sub { font-size: 12.5px; color: var(--text-muted); text-align: center; margin-bottom: 18px; line-height: 1.55; white-space: pre-line; }
.confirm-actions { display: flex; gap: 8px; }
.confirm button { flex: 1; padding: 10px; border-radius: 10px; border: none; cursor: pointer; font-size: 13.5px; font-weight: 600; transition: filter .15s; }
.confirm .ok { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; box-shadow: 0 4px 14px rgba(236,72,153,.35); }
.confirm .ok.call { background: linear-gradient(135deg, var(--ok), #16a34a); box-shadow: 0 4px 14px rgba(34,197,94,.35); }
.confirm .ok:hover { filter: brightness(1.1); }
.confirm .cancel { background: rgba(255,255,255,.1); color: var(--text-muted); border: 1px solid rgba(255,255,255,.15); }
.confirm .cancel:hover { background: rgba(255,255,255,.18); color: var(--text); }

/* PM windows */
.pm-stack { position: fixed; right: 16px; bottom: 16px; z-index: 80; display: flex; flex-direction: column-reverse; gap: 12px; pointer-events: none; max-height: calc(100vh - 32px); }
.pm-window { pointer-events: auto; width: 340px; max-width: calc(100vw - 32px); background: rgba(22, 18, 38, 0.86); border: 1px solid rgba(255,255,255,.18); border-radius: 18px; box-shadow: 0 12px 40px rgba(0,0,0,.5); overflow: hidden; display: flex; flex-direction: column; max-height: 520px; animation: popIn .35s cubic-bezier(.16,1,.3,1); position: relative; transition: width .25s, max-height .25s; }
.pm-window.enlarged { width: 580px; max-height: 760px; }
@media (max-width: 640px) { .pm-window.enlarged { width: 100%; max-height: 88vh; } }

/* Image message bubble */
.msg-image { margin-top: 2px; cursor: zoom-in; border-radius: 10px; overflow: hidden; display: inline-block; max-width: 260px; }
.msg-image img { display: block; max-width: 100%; max-height: 260px; object-fit: contain; }
.file-message { display:flex; align-items:center; gap:10px; color:inherit; text-decoration:none; min-width:220px; max-width:360px; padding:4px 0; }
.file-message svg { width:28px; height:28px; flex:0 0 auto; color:var(--accent); }
.file-message-info { min-width:0; display:grid; gap:2px; }
.file-message-name { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-weight:650; }
.file-message-meta { color:var(--text-dim); font-size:11px; }
.pm-msg.image .pm-bubble { padding: 4px; background: rgba(255,255,255,.08) !important; }
.pm-msg.image .pm-bubble img { display: block; max-width: 220px; max-height: 220px; border-radius: 8px; cursor: zoom-in; }

/* Lightbox */
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.92); display: flex; align-items: center; justify-content: center; z-index: 400; cursor: zoom-out; animation: fadeIn .2s ease; }
.lightbox img { max-width: 96vw; max-height: 96vh; object-fit: contain; border-radius: 6px; box-shadow: 0 16px 60px rgba(0,0,0,.8); }

/* Message actions / reply / reactions */
.msg-actions { display: flex; gap: 6px; margin-top: 4px; flex-wrap: wrap; }
.msg-action { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); border-radius: 999px; padding: 2px 9px; font-size: 11.5px; color: var(--text-muted); cursor: pointer; display: inline-flex; align-items: center; gap: 3px; transition: all .15s; line-height: 1.6; }
.msg-action:hover { background: rgba(255,255,255,.15); color: var(--text); }
.msg-action.active-like { background: rgba(236,72,153,.25); color: #fff; border-color: rgba(236,72,153,.5); }
.msg-action.active-dislike { background: rgba(245,158,11,.25); color: #fff; border-color: rgba(245,158,11,.5); }
.msg-action svg { width: 11px; height: 11px; }
.msg-action .count { font-variant-numeric: tabular-nums; font-weight: 600; }
.msg.me .msg-actions { justify-content: flex-end; }
.reply-quote { border-left: 3px solid rgba(236,72,153,.6); padding: 4px 8px; margin-bottom: 6px; background: rgba(255,255,255,.08); border-radius: 4px; font-size: 12px; color: var(--text-muted); line-height: 1.4; max-width: 100%; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.reply-quote strong { color: var(--text); font-weight: 600; display: block; font-size: 11.5px; margin-bottom: 2px; opacity: .9; }
.reply-quote .preview { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .85; }
.msg.me .reply-quote { background: rgba(255,255,255,.2); border-left-color: rgba(255,255,255,.7); color: rgba(255,255,255,.9); }
.msg.me .reply-quote strong { color: #fff; }

/* Reply composer preview bar */
.reply-bar { display: none; background: rgba(236,72,153,.12); border: 1px solid rgba(236,72,153,.3); border-radius: 12px; padding: 8px 10px; margin-bottom: 8px; font-size: 12.5px; color: var(--text-muted); align-items: center; gap: 8px; }
.reply-bar.show { display: flex; }
.reply-bar .reply-content { flex: 1; overflow: hidden; }
.reply-bar strong { color: var(--text); font-weight: 600; margin-right: 6px; }
.reply-bar .reply-text { opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: inline-block; max-width: 100%; vertical-align: bottom; }
.reply-bar .close-reply { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 4px; border-radius: 6px; display: flex; }
.reply-bar .close-reply:hover { background: rgba(255,255,255,.1); color: #fff; }
.reply-bar .close-reply svg { width: 14px; height: 14px; }

/* Image button in composer */
.img-btn { background: transparent; border: 1px solid rgba(255,255,255,.15); border-radius: 10px; width: 38px; height: 38px; cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--text-muted); flex-shrink: 0; transition: all .15s; }
.img-btn:hover { background: rgba(255,255,255,.08); color: #fff; }
.img-btn svg { width: 18px; height: 18px; }
.pm-img-btn { background: transparent; border: none; border-radius: 9px; width: 30px; height: 30px; cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--text-muted); flex-shrink: 0; }
.pm-img-btn:hover { background: rgba(255,255,255,.1); color: #fff; }
.pm-img-btn svg { width: 14px; height: 14px; }
.pm-header { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: linear-gradient(135deg, rgba(236,72,153,.15), rgba(139,92,246,.15)); border-bottom: 1px solid rgba(255,255,255,.12); }
.pm-avatar { width: 36px; height: 36px; border-radius: 50%; overflow: hidden; border: 2px solid rgba(255,255,255,.25); flex-shrink: 0; background: #ffe4f0; }
.pm-avatar img { width: 100%; height: 100%; display: block; }
.pm-title-wrap { flex: 1; min-width: 0; }
.pm-nick { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pm-loc { font-size: 11px; color: var(--text-dim); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pm-icon-btn { background: rgba(255,255,255,.08); color: var(--text-muted); border: 1px solid rgba(255,255,255,.12); border-radius: 8px; width: 30px; height: 30px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all .15s; flex-shrink: 0; }
.pm-icon-btn:hover { background: rgba(255,255,255,.16); color: #fff; }
.pm-icon-btn.call:hover { background: rgba(34,197,94,.25); color: #fff; border-color: rgba(34,197,94,.4); }
.pm-icon-btn.close:hover { background: rgba(239,68,68,.25); color: #fff; border-color: rgba(239,68,68,.4); }
.pm-icon-btn svg { width: 14px; height: 14px; }

.pm-body { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.pm-state-msg { text-align: center; padding: 22px 12px 14px; font-size: 13px; color: var(--text-muted); line-height: 1.6; }
.pm-state-msg strong { color: var(--text); display: block; font-size: 14px; margin-bottom: 4px; }
.pm-state-msg .spin { display: inline-block; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.2); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; margin-right: 6px; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.pm-actions { display: flex; gap: 8px; padding: 0 14px 14px; }
.pm-btn { flex: 1; padding: 9px 12px; border-radius: 10px; border: none; font-size: 13px; font-weight: 600; cursor: pointer; transition: filter .15s, transform .1s; }
.pm-btn.accept { background: linear-gradient(135deg, var(--ok), #16a34a); color: #fff; box-shadow: 0 3px 12px rgba(34,197,94,.35); }
.pm-btn.accept:hover { transform: translateY(-1px); filter: brightness(1.1); }
.pm-btn.decline { background: rgba(255,255,255,.1); color: var(--text-muted); border: 1px solid rgba(255,255,255,.15); }
.pm-btn.decline:hover { background: rgba(239,68,68,.2); color: #fff; border-color: rgba(239,68,68,.4); }

.pm-messages { flex: 1; overflow-y: auto; padding: 10px 14px; min-height: 120px; }
.pm-messages::-webkit-scrollbar { width: 4px; }
.pm-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border-radius: 2px; }
.pm-msg { display: flex; margin-bottom: 8px; }
.pm-msg.mine { justify-content: flex-end; }
.pm-msg .pm-bubble { max-width: 75%; padding: 7px 11px; border-radius: 14px; font-size: 13px; line-height: 1.5; word-break: break-word; white-space: pre-wrap; }
.pm-msg.mine .pm-bubble { background: var(--bubble-me); color: #fff; border-top-right-radius: 4px; }
.pm-msg.theirs .pm-bubble { background: rgba(255,255,255,.12); border-top-left-radius: 4px; }
.pm-bubble .file-message { min-width:180px; max-width:250px; }
.pm-divider { text-align: center; font-size: 10.5px; color: var(--text-dim); margin: 8px 0; opacity: .7; }

.pm-composer-outer { padding: 0 12px 12px; position: relative; }
.pm-composer { display: flex; gap: 4px; align-items: flex-end; background: rgba(255,255,255,.06); border: 1px solid var(--border); border-radius: 12px; padding: 4px 4px 4px 12px; }
.pm-composer:focus-within { border-color: rgba(236,72,153,.5); }
.pm-input { flex: 1; resize: none; border: none; outline: none; background: transparent; color: var(--text); font: inherit; font-size: 13px; line-height: 1.5; padding: 6px 0; max-height: 80px; min-height: 20px; }
.pm-send { border: none; border-radius: 6px; width: 30px; height: 30px; cursor: pointer; display: flex; align-items: center; justify-content: center; color: #fff; flex-shrink: 0; transition: filter .15s; }
.pm-send svg { width: 14px; height: 14px; }
.pm-send { background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.pm-send:hover { filter: brightness(1.1); }

.toast { position: fixed; left: 50%; top: 18px; transform: translateX(-50%); background: rgba(0,0,0,.82); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 13px; z-index: 300; border: 1px solid rgba(255,255,255,.15); box-shadow: 0 8px 24px rgba(0,0,0,.4); animation: toastIn .3s ease, toastOut .3s ease 2.7s forwards; max-width: 90vw; text-align: center; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, -10px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes toastOut { to { opacity: 0; transform: translate(-50%, -10px); } }
.credit { position: fixed; bottom: 10px; left: 14px; z-index: 2; font-size: 11px; color: rgba(255,255,255,.4); user-select: none; }

/* Opaque work surfaces reduce GPU cost while keeping the interface crisp. */
*, *::before, *::after { letter-spacing: 0; }
.header, .user-rail, .chat-area, .msg.them .bubble, .system, .overlay, .modal, .confirm, .pm-window, .lightbox {
 
 
}
.header, .chat-area { box-shadow: 0 8px 24px rgba(0,0,0,.22); }
.user-rail { box-shadow: none; }
.me-avatar { box-shadow: none; border-color: rgba(255,255,255,.38); }
.online { border-radius: 6px; background: rgba(52,211,153,.11); }
.mute-btn, .composer-row, .pm-composer, .icon-btn, .img-btn { border-radius: 6px; }
.send, .pm-send { background: var(--accent-2); border-radius: 6px; box-shadow: 0 3px 12px rgba(251,113,133,.24); }
.send:hover { transform: translateY(-1px); }
.composer-row:focus-within, .pm-composer:focus-within { border-color: rgba(45,212,191,.52); box-shadow: 0 0 0 3px rgba(45,212,191,.1); }
.upload-progress { padding:0 4px 10px; }
.upload-progress-line { display:flex; justify-content:space-between; gap:12px; color:var(--text-muted); font-size:11px; }
.upload-progress-line span:first-child { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.upload-progress-track { height:4px; margin-top:6px; background:rgba(255,255,255,.1); border-radius:2px; overflow:hidden; }
.upload-progress-track span { display:block; height:100%; width:0; background:var(--accent); transition:width .18s ease; }
.msg { animation-duration: .18s; }
.bubble { border-radius: 8px; }
.system, .toast { border-radius: 6px; }
.pm-header { background: #202a26; }
.pm-btn.accept { background: #0f766e; box-shadow: none; }
.modal h2 { color: var(--text); background: none; -webkit-text-fill-color: currentColor; }

@media (max-width: 900px) { :root { --pad-app: 14px; --avatar-msg: 40px; --avatar-me: 42px; --avatar-list: 40px; --font-base: 14px; --radius-lg: 8px; } .bubble { max-width: 75%; } .messages { padding: 16px; } .pm-window { width: 320px; } .u-chip { width: 52px; } .u-chip .u-name { max-width: 52px; font-size: 10.5px; } }
@media (max-width: 640px) { :root { --pad-app: 8px; --avatar-msg: 36px; --avatar-me: 40px; --avatar-list: 38px; --font-base: 14px; --radius-lg: 8px; --radius-md: 8px; } .app { gap:8px; } .header { padding:10px 12px; gap:10px; flex-wrap:wrap; } .title-wrap { flex:1 1 calc(100% - 130px); } .online { order:3; margin-left:auto; padding:6px 10px; font-size:11.5px; } .header-actions { order:4; } .main-layout { grid-template-columns:58px minmax(0,1fr); gap:8px; } .user-rail { padding:8px 5px; overflow-x:hidden; overflow-y:auto; } .user-rail-label { padding:2px 0 6px; text-align:center; font-size:10px; } .u-chip { width:48px; flex-direction:column; gap:2px; padding:3px 0; } .u-chip .u-name { max-width:48px; font-size:10px; text-align:center; } .messages { padding:12px 10px; } .bubble { max-width:86%; padding:9px 10px; } .modal { padding:26px 20px; border-radius:8px; } .g-avatar { width:62px; height:62px; } .pm-stack { right:8px; bottom:8px; left:8px; gap:8px; } .pm-window { width:100%; max-height:420px; } .credit { display:none; } }
@media (min-width: 1400px) { :root { --maxw: 1080px; --avatar-msg: 46px; --font-base: 15px; } .bubble { max-width: 65%; } .pm-window { width: 360px; } }
