:root {
  --bg:           #0e1621;
  --bg-chat:      #0b1620;
  --panel:        #17212b;
  --panel-2:      #1d2b39;
  --sidebar-bg:   #131c26;
  --accent:       #5288c1;
  --accent-2:     #6ab3f3;
  --bubble-out:   #2b5278;
  --bubble-in:    #182533;
  --text:         #e9eef2;
  --text-dim:     #8a9bab;
  --text-faint:   #6a7c8c;
  --danger:       #e0586a;
  --ok:           #54b06a;
  --radius:       16px;
  --shadow:       0 10px 40px rgba(0,0,0,.45);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  background: #06090d;
  color: var(--text);
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", system-ui, sans-serif;
  overscroll-behavior: none;
}

#app {
  position: relative;
  width: 100%;
  max-width: 440px;
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  background: var(--bg);
  overflow: hidden;
  box-shadow: var(--shadow);
}
@media (min-width: 480px) {
  body { display: flex; align-items: center; justify-content: center; padding: 18px; }
  #app { height: 92vh; max-height: 920px; border-radius: 28px; border: 1px solid #1c2630; }
}

.screen { position: absolute; inset: 0; display: flex; flex-direction: column; }
.hidden { display: none !important; }

.logo-mark {
  width: 60px; height: 60px; border-radius: 20px;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  display: grid; place-items: center;
  font-weight: 800; font-size: 32px; color: #fff;
  box-shadow: 0 8px 24px rgba(82,136,193,.45);
}
.logo-mark.small { width: 34px; height: 34px; border-radius: 11px; font-size: 18px; box-shadow: none; }

#auth { align-items: center; justify-content: center; padding: 24px; }
.auth-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(900px 500px at 80% -10%, rgba(106,179,243,.20), transparent 60%),
    radial-gradient(700px 500px at -10% 110%, rgba(82,136,193,.18), transparent 55%),
    var(--bg);
  z-index: 0;
}
.auth-card {
  position: relative; z-index: 1;
  width: 100%; max-width: 360px;
  background: rgba(23,33,43,.72);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 24px;
  padding: 28px 22px;
  box-shadow: var(--shadow);
  animation: rise .5s cubic-bezier(.2,.8,.2,1);
}
@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

.auth-logo { text-align: center; margin-bottom: 22px; }
.auth-logo .logo-mark { margin: 0 auto 12px; }
.auth-logo h1 { font-size: 26px; letter-spacing: .5px; }
.auth-sub { color: var(--text-dim); font-size: 13px; margin-top: 4px; }

.auth-tabs { display: flex; background: rgba(0,0,0,.25); border-radius: 12px; padding: 4px; margin-bottom: 18px; }
.auth-tab {
  flex: 1; padding: 10px; border: 0; border-radius: 9px;
  background: transparent; color: var(--text-dim);
  font-size: 14px; font-weight: 600; cursor: pointer; transition: .2s;
}
.auth-tab.active { background: var(--accent); color: #fff; box-shadow: 0 4px 14px rgba(82,136,193,.4); }

.field { display: block; margin-bottom: 14px; }
.field-label { display: block; font-size: 12px; color: var(--text-dim); margin: 0 0 6px 4px; }
.field input, .pwd-wrap input {
  width: 100%; padding: 13px 14px;
  background: rgba(0,0,0,.28); border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px; color: var(--text); font-size: 15px;
  transition: border .2s, box-shadow .2s;
}
.field input:focus, .pwd-wrap input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(82,136,193,.18);
}
.pwd-wrap { position: relative; }
.pwd-wrap input { padding-right: 44px; }
.pwd-toggle {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: none; border: 0; font-size: 17px; cursor: pointer; opacity: .6; padding: 6px;
}
.pwd-hint { font-size: 12px; color: var(--text-faint); margin: -6px 2px 12px; line-height: 1.4; }
.pwd-hint b { color: var(--accent-2); }
.auth-error { color: var(--danger); font-size: 13px; min-height: 18px; margin-bottom: 8px; text-align: center; }

.btn-primary {
  width: 100%; padding: 14px; border: 0; border-radius: 13px;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: #fff; font-size: 15px; font-weight: 700; cursor: pointer;
  box-shadow: 0 8px 22px rgba(82,136,193,.4);
  transition: transform .12s, filter .2s;
}
.btn-primary:active { transform: scale(.98); filter: brightness(1.08); }

.topbar {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; background: var(--panel);
  border-bottom: 1px solid rgba(0,0,0,.3);
  min-height: 58px; z-index: 5; box-shadow: 0 2px 10px rgba(0,0,0,.2);
}
.icon-btn {
  background: none; border: 0; color: var(--text); cursor: pointer;
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; transition: background .15s; flex-shrink: 0;
}
.icon-btn:active { background: rgba(255,255,255,.08); }
.icon-btn.tiny { width: 26px; height: 26px; color: var(--text-dim); }
.header-ava {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; overflow: hidden;
  display: grid; place-items: center; font-weight: 700; color: #fff; font-size: 17px;
  background: linear-gradient(135deg,#3a536b,#26384a);
}
.header-ava img { width: 100%; height: 100%; object-fit: cover; }
.topbar-title { flex: 1; min-width: 0; }
.chat-title { font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-status { font-size: 12px; color: var(--accent-2); }

.messages {
  flex: 1; overflow-y: auto; padding: 14px 12px 6px;
  background: radial-gradient(1200px 600px at 50% 0%, rgba(82,136,193,.06), transparent 60%), var(--bg-chat);
  display: flex; flex-direction: column; gap: 3px;
}
.messages::-webkit-scrollbar { width: 6px; }
.messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 4px; }

.row { display: flex; align-items: flex-end; gap: 8px; max-width: 100%; margin-top: 8px; position: relative; will-change: transform; }
.row.out { flex-direction: row-reverse; }

.row-ava {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; font-size: 14px; cursor: pointer;
  background: linear-gradient(135deg,#3a536b,#26384a); color: #cfe0ee; overflow: hidden;
}
.row-ava img { width: 100%; height: 100%; object-fit: cover; }

.bubble {
  max-width: 76%; padding: 7px 11px 6px;
  border-radius: 16px; position: relative;
  font-size: 14.5px; line-height: 1.35; word-wrap: break-word; overflow-wrap: anywhere;
  animation: pop .18s ease;
}
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }
.row.in  .bubble { background: var(--bubble-in);  border-bottom-left-radius: 5px; }
.row.out .bubble { background: var(--bubble-out); border-bottom-right-radius: 5px; }

.bubble-name {
  font-size: 12.5px; font-weight: 700; margin-bottom: 2px;
  color: var(--accent-2); cursor: pointer; display: flex; align-items: center; gap: 4px;
}
.bubble-text { white-space: pre-wrap; }
.bubble-time { font-size: 10.5px; color: var(--text-faint); text-align: right; margin-top: 2px; }
.row.out .bubble-time { color: rgba(255,255,255,.55); }

.badge-inline {
  display: inline-grid; place-items: center;
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 9px; font-weight: 900;
}

.bubble-media { display: block; max-width: 240px; width: 100%; border-radius: 12px; margin: 2px 0; cursor: pointer; }
video.bubble-media { cursor: default; }
.bubble-audio { display: block; height: 40px; margin: 2px 0; max-width: 240px; }

.reply-quote {
  border-left: 3px solid var(--accent-2); padding: 2px 8px; margin-bottom: 4px;
  background: rgba(255,255,255,.06); border-radius: 6px; cursor: pointer;
  display: flex; flex-direction: column; max-width: 240px;
}
.reply-quote-name { font-size: 12px; font-weight: 700; color: var(--accent-2); }
.reply-quote-text { font-size: 12.5px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.reply-btn {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: var(--panel-2); color: var(--text-dim); border: 0; cursor: pointer;
  font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 14px;
  opacity: 0; transition: opacity .15s; white-space: nowrap;
}
.row.in  .reply-btn { right: 8px; }
.row.out .reply-btn { left: 8px; }
.row:hover .reply-btn { opacity: 1; }
@media (hover: none) { .reply-btn { display: none; } }

.empty-hint { text-align: center; color: var(--text-faint); font-size: 13px; margin: auto; padding: 30px; }

.reply-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; background: var(--panel); border-top: 1px solid rgba(0,0,0,.3);
}
.reply-bar-line { width: 3px; align-self: stretch; background: var(--accent-2); border-radius: 3px; }
.reply-bar-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.reply-bar-name { font-size: 13px; font-weight: 700; color: var(--accent-2); }
.reply-bar-text { font-size: 13px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.composer {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 8px; background: var(--panel); border-top: 1px solid rgba(0,0,0,.3);
}
.composer input#msg-input {
  flex: 1; padding: 12px 14px; border-radius: 22px;
  background: var(--panel-2); border: 1px solid transparent; color: var(--text); font-size: 15px; min-width: 0;
}
.composer input#msg-input:focus { outline: none; border-color: rgba(82,136,193,.5); }
.round-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer; flex-shrink: 0;
  display: grid; place-items: center; transition: transform .12s, background .15s;
}
.round-btn.ghost { background: transparent; color: var(--text-dim); }
.round-btn.ghost:active { background: rgba(255,255,255,.07); }
.round-btn.send-btn {
  background: linear-gradient(135deg, var(--accent-2), var(--accent)); color: #fff;
  box-shadow: 0 4px 14px rgba(82,136,193,.45);
}
.round-btn:active { transform: scale(.9); }
#mic-btn.recording { background: var(--danger); color: #fff; animation: pulse 1s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(224,88,106,.5); } 50% { box-shadow: 0 0 0 8px rgba(224,88,106,0); } }

.overlay { position: absolute; inset: 0; background: rgba(0,0,0,.5); z-index: 18; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.sidebar {
  position: absolute; top: 0; left: 0; bottom: 0; width: 82%; max-width: 320px;
  background: var(--sidebar-bg); z-index: 19;
  transform: translateX(-104%); transition: transform .26s cubic-bezier(.2,.8,.2,1);
  display: flex; flex-direction: column; box-shadow: 8px 0 40px rgba(0,0,0,.5);
}
.sidebar.open { transform: none; }
.sidebar-head {
  display: flex; align-items: center; gap: 12px;
  padding: 22px 18px; background: linear-gradient(135deg, rgba(82,136,193,.22), transparent);
  border-bottom: 1px solid rgba(255,255,255,.05);
}
.sidebar-brand { font-size: 20px; font-weight: 700; letter-spacing: .5px; }
.sidebar-section-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: 1px;
  color: var(--text-faint); padding: 16px 18px 8px;
}
.server-list { flex: 1; overflow-y: auto; padding: 0 10px; }
.server-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 12px; cursor: pointer;
  color: var(--text); transition: background .15s; margin-bottom: 2px;
}
.server-item:active { background: rgba(255,255,255,.05); }
.server-item.active { background: var(--accent); }
.server-icon {
  width: 42px; height: 42px; border-radius: 13px; flex-shrink: 0; overflow: hidden;
  display: grid; place-items: center; font-weight: 700; font-size: 17px; color: #fff;
  background: linear-gradient(135deg,#3a536b,#26384a);
}
.server-icon img { width: 100%; height: 100%; object-fit: cover; }
.server-item.active .server-icon { background: rgba(255,255,255,.22); }
.server-name { font-size: 15px; font-weight: 600; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.server-edit { width: 32px; height: 32px; color: var(--text-dim); }
.server-item.active .server-edit { color: #fff; }

.add-server {
  margin: 6px 14px; padding: 11px; border-radius: 11px; cursor: pointer;
  background: rgba(82,136,193,.15); color: var(--accent-2);
  border: 1px dashed rgba(82,136,193,.4); font-size: 14px; font-weight: 600;
}

.sidebar-foot { border-top: 1px solid rgba(255,255,255,.06); padding: 10px; }
.profile-mini {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 10px; border: 0; border-radius: 13px; cursor: pointer;
  background: transparent; color: var(--text); transition: background .15s;
}
.profile-mini:active { background: rgba(255,255,255,.06); }
.profile-mini-info { display: flex; flex-direction: column; align-items: flex-start; }
.profile-mini-name { font-size: 15px; font-weight: 600; }
.profile-mini-sub { font-size: 12px; color: var(--text-dim); }

.ava { border-radius: 50%; display: grid; place-items: center; overflow: hidden; background: linear-gradient(135deg,#3a536b,#26384a); color: #cfe0ee; font-weight: 600; }
.ava img { width: 100%; height: 100%; object-fit: cover; }
.ava.small { width: 42px; height: 42px; font-size: 18px; flex-shrink: 0; }
.ava.big   { width: 110px; height: 110px; font-size: 48px; }

.profile-body { flex: 1; overflow-y: auto; padding: 22px 18px 30px; }
.profile-top { text-align: center; margin-bottom: 24px; }
.ava-wrap { position: relative; width: 110px; margin: 0 auto 14px; }
.change-ava {
  position: absolute; right: -2px; bottom: -2px;
  width: 36px; height: 36px; border-radius: 50%; border: 3px solid var(--bg);
  background: var(--accent); cursor: pointer; font-size: 15px;
}
.profile-name-row { display: flex; align-items: center; justify-content: center; gap: 6px; }
.profile-name-row h2 { font-size: 24px; }
.badge {
  display: inline-grid; place-items: center;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 13px; font-weight: 900;
  box-shadow: 0 2px 8px rgba(82,136,193,.5);
}
.profile-username { color: var(--text-dim); font-size: 15px; margin-top: 4px; }

.profile-card { background: var(--panel); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; border: 1px solid rgba(255,255,255,.04); }
.profile-card-label { font-size: 12px; color: var(--accent-2); margin-bottom: 6px; font-weight: 600; }
.profile-desc { font-size: 15px; line-height: 1.4; min-height: 21px; cursor: pointer; }
.profile-desc.placeholder { color: var(--text-faint); font-style: italic; }
.profile-desc-edit textarea {
  width: 100%; min-height: 70px; resize: vertical;
  background: rgba(0,0,0,.25); border: 1px solid rgba(255,255,255,.1);
  border-radius: 10px; padding: 10px; color: var(--text); font-size: 14px; font-family: inherit;
}
.desc-actions { display: flex; gap: 8px; margin-top: 8px; }

.btn-small { padding: 9px 18px; border: 0; border-radius: 10px; cursor: pointer; background: var(--accent); color: #fff; font-size: 14px; font-weight: 600; }
.btn-small.ghost { background: rgba(255,255,255,.08); color: var(--text-dim); }

.btn-logout { width: 100%; padding: 13px; border: 0; border-radius: 12px; cursor: pointer; background: rgba(224,88,106,.12); color: var(--danger); font-size: 15px; font-weight: 600; margin-top: 8px; }

.modal { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.55); display: grid; place-items: center; padding: 24px; animation: fade .2s; }
.modal-box { width: 100%; max-width: 340px; background: var(--panel); border-radius: 20px; padding: 22px; box-shadow: var(--shadow); animation: rise .25s; }
.modal-box h3 { font-size: 18px; margin-bottom: 8px; }
.modal-text { color: var(--text-dim); font-size: 14px; line-height: 1.4; margin-bottom: 14px; }
.modal-input { width: 100%; padding: 12px 14px; border-radius: 11px; background: rgba(0,0,0,.28); border: 1px solid rgba(255,255,255,.1); color: var(--text); font-size: 15px; margin-bottom: 10px; }
.modal-input:focus { outline: none; border-color: var(--accent); }
.modal-error { color: var(--danger); font-size: 13px; min-height: 16px; margin-bottom: 8px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }
.srv-ava-row { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }

.toast { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%); background: #222e3a; color: #fff; padding: 11px 20px; border-radius: 12px; font-size: 14px; z-index: 60; box-shadow: var(--shadow); animation: rise .25s; max-width: 80%; text-align: center; }

#header-ava, #chat-title { cursor: pointer; }
.messages { overflow-x: hidden; }
.row { overflow: visible; }
.bubble-wrap { position: relative; max-width: 76%; display: flex; }
.bubble { max-width: 100%; }
.reply-btn {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: var(--panel-2); color: var(--text-dim); border: 0; cursor: pointer;
  font-size: 12px; font-weight: 600; padding: 5px 11px; border-radius: 14px;
  opacity: 0; pointer-events: none; transition: opacity .15s; white-space: nowrap; z-index: 2;
}
.row.in  .reply-btn { left: calc(100% + 8px); }
.row.out .reply-btn { right: calc(100% + 8px); }
.row:hover .reply-btn { opacity: 1; pointer-events: auto; }
@media (hover: none) { .reply-btn { display: none; } }

.join-bar { padding: 12px; background: var(--panel); border-top: 1px solid rgba(0,0,0,.3); }
.join-btn {
  width: 100%; padding: 14px; border: 0; border-radius: 14px;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: #fff; font-size: 16px; font-weight: 700; cursor: pointer;
  box-shadow: 0 6px 18px rgba(82,136,193,.4); transition: transform .12s;
}
.join-btn:active { transform: scale(.98); }

.voice { display: flex; align-items: center; gap: 10px; min-width: 190px; padding: 2px 0; color: var(--accent-2); }
.row.out .voice { color: #cfe0ff; }
.voice-play {
  width: 38px; height: 38px; border-radius: 50%; border: 0; cursor: pointer; flex-shrink: 0;
  background: var(--accent-2); color: #fff; display: grid; place-items: center;
}
.row.out .voice-play { background: #fff; color: var(--bubble-out); }
.voice-wave { display: flex; align-items: center; gap: 2px; height: 28px; flex: 1; cursor: pointer; }
.voice-bar { width: 3px; border-radius: 2px; background: currentColor; opacity: .32; height: 30%; }
.voice-bar.played { opacity: 1; }
.voice-time { font-size: 11px; color: var(--text-faint); flex-shrink: 0; min-width: 30px; }
.row.out .voice-time { color: rgba(255,255,255,.6); }

.sound-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sound-sub { font-size: 12px; color: var(--text-faint); margin-top: 2px; }
.switch { position: relative; display: inline-block; width: 46px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; inset: 0; background: rgba(255,255,255,.15); border-radius: 26px; transition: .2s; cursor: pointer; }
.slider:before { content: ""; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider:before { transform: translateX(20px); }

.sp-name { font-size: 24px; margin-top: 12px; }
#sp-ava { margin: 0 auto; }
.sp-action { margin-top: 16px; padding: 11px 28px; border: 0; border-radius: 12px; background: var(--accent); color: #fff; font-weight: 600; cursor: pointer; font-size: 15px; }
.sp-action.leave { background: rgba(224,88,106,.14); color: var(--danger); }
.sp-members { display: flex; flex-direction: column; gap: 2px; }
.sp-empty { color: var(--text-faint); font-size: 14px; padding: 4px; }
.sp-member { display: flex; align-items: center; gap: 11px; padding: 8px 4px; cursor: pointer; border-radius: 10px; }
.sp-member:active { background: rgba(255,255,255,.05); }
.sp-member .ava { width: 40px; height: 40px; font-size: 16px; }
.sp-member-name { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 5px; }
.sp-member-user { font-size: 12px; color: var(--text-dim); }

.crop-stage { position: relative; width: 260px; height: 260px; max-width: 100%; margin: 0 auto 14px; border-radius: 14px; overflow: hidden; background: #000; touch-action: none; }
.crop-img { position: absolute; left: 0; top: 0; transform-origin: 0 0; user-select: none; -webkit-user-drag: none; pointer-events: none; max-width: none; }
.crop-ring { position: absolute; inset: 0; box-shadow: 0 0 0 9999px rgba(0,0,0,.45); border-radius: 50%; pointer-events: none; border: 2px solid rgba(255,255,255,.65); }
.crop-zoom { width: 100%; margin-bottom: 14px; accent-color: var(--accent); }

.lightbox { position: fixed; inset: 0; z-index: 70; background: rgba(0,0,0,.92); display: flex; align-items: center; justify-content: center; animation: fade .2s; }
.lightbox-img { max-width: 96%; max-height: 88%; border-radius: 8px; }
.lightbox-close { position: absolute; top: 16px; right: 16px; width: 44px; height: 44px; border-radius: 50%; background: rgba(255,255,255,.14); color: #fff; border: 0; cursor: pointer; display: grid; place-items: center; }

/* ===== v1.0 additions ===== */
.deleted-banner { background: rgba(224,88,106,.16); border: 1px solid rgba(224,88,106,.5); color: #ffb3bd; padding: 11px 13px; border-radius: 12px; font-size: 13px; line-height: 1.4; margin-bottom: 16px; }

.search-bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--panel); border-bottom: 1px solid rgba(0,0,0,.3); }
.search-bar input { flex: 1; padding: 10px 14px; border-radius: 20px; background: var(--panel-2); border: 1px solid transparent; color: var(--text); font-size: 14px; }
.search-bar input:focus { outline: none; border-color: rgba(82,136,193,.5); }
.search-count { font-size: 12px; color: var(--text-dim); white-space: nowrap; }
.msg-highlight { background: rgba(106,179,243,.28) !important; transition: background 1.2s; }
mark { background: var(--accent-2); color: #04121f; border-radius: 3px; padding: 0 1px; }

.empty-state { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 30px; background: var(--bg-chat); }
.empty-ill { font-size: 64px; opacity: .55; margin-bottom: 14px; }
.empty-title { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.empty-sub { font-size: 14px; color: var(--text-dim); max-width: 240px; }

/* online dot */
.row-ava, .ava, .header-ava, .sp-member .ava, .adm-ava { position: relative; }
.online-dot { position: absolute; left: -1px; bottom: -1px; width: 11px; height: 11px; border-radius: 50%; background: #4bd16a; border: 2px solid var(--bg-chat); box-shadow: 0 0 6px rgba(75,209,106,.6); }
.ava.big .online-dot { width: 22px; height: 22px; left: 4px; bottom: 4px; border-width: 3px; }
.sp-member .online-dot, .adm-ava .online-dot { border-color: var(--panel); }

/* badges by role */
.badge.admin, .badge-inline.admin { background: #e0586a; box-shadow: 0 2px 8px rgba(224,88,106,.5); }
.badge.mod, .badge-inline.mod { background: var(--accent); }
.badge.verified, .badge-inline.verified { background: var(--accent); }
.badge { cursor: pointer; }

/* frozen */
.frost { font-size: 18px; }
.frozen-name { color: var(--text-faint) !important; }
.bubble-name.frozen-name { color: var(--text-faint) !important; }

/* system message */
.sys-msg { align-self: center; background: rgba(0,0,0,.32); color: var(--text-dim); font-size: 12.5px; padding: 5px 13px; border-radius: 14px; margin: 8px auto; max-width: 80%; text-align: center; }

/* settings / version */
.dev-select { width: 100%; padding: 11px 12px; border-radius: 11px; background: rgba(0,0,0,.28); border: 1px solid rgba(255,255,255,.1); color: var(--text); font-size: 14px; }
.settings-version { text-align: center; color: var(--text-faint); font-size: 13px; margin-top: 26px; padding: 10px; cursor: default; user-select: none; }

/* admin screen */
.adm-big-btn { width: 100%; padding: 13px; border: 0; border-radius: 12px; background: var(--panel); color: var(--text); font-size: 15px; font-weight: 600; cursor: pointer; margin-bottom: 16px; border: 1px solid rgba(255,255,255,.05); }
.adm-users { display: flex; flex-direction: column; gap: 2px; max-height: 360px; overflow-y: auto; }
.adm-user { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-radius: 10px; }
.adm-user:active { background: rgba(255,255,255,.05); }
.adm-ava { width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0; overflow: hidden; display: grid; place-items: center; background: linear-gradient(135deg,#3a536b,#26384a); color: #cfe0ee; font-weight: 600; }
.adm-ava img { width: 100%; height: 100%; object-fit: cover; }
.adm-user-info { flex: 1; min-width: 0; }
.adm-user-name { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 5px; }
.adm-user-sub { font-size: 12px; color: var(--text-dim); }
.role-tag { font-size: 10px; padding: 1px 6px; border-radius: 6px; font-weight: 700; }
.role-tag.admin { background: rgba(224,88,106,.2); color: #ff95a2; }
.role-tag.moderator { background: rgba(82,136,193,.22); color: var(--accent-2); }
.adm-user-act { background: var(--panel-2); border: 0; color: var(--text-dim); width: 32px; height: 32px; border-radius: 8px; cursor: pointer; font-size: 16px; }

/* stats */
.stats-periods { display: flex; gap: 6px; margin-bottom: 16px; }
.stat-period { flex: 1; padding: 9px; border: 0; border-radius: 10px; background: var(--panel); color: var(--text-dim); font-size: 13px; font-weight: 600; cursor: pointer; }
.stat-period.active { background: var(--accent); color: #fff; }
.stats-cards { display: grid; grid-template-columns: repeat(4,1fr); gap: 8px; margin-bottom: 16px; }
.stat-box { background: var(--panel); border-radius: 12px; padding: 12px 6px; text-align: center; }
.stat-num { font-size: 22px; font-weight: 800; color: var(--accent-2); }
.stat-lbl { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.stat-canvas { width: 100%; height: auto; display: block; }

/* context menu */
.ctx-menu { position: fixed; z-index: 80; background: var(--panel); border-radius: 14px; box-shadow: var(--shadow); padding: 6px; min-width: 180px; animation: rise .15s; border: 1px solid rgba(255,255,255,.06); }
.ctx-item { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 9px; cursor: pointer; font-size: 14px; color: var(--text); }
.ctx-item:active, .ctx-item:hover { background: rgba(255,255,255,.06); }
.ctx-item.danger { color: var(--danger); }

/* restrict modal */
.restrict-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.restrict-act { padding: 11px; border: 0; border-radius: 11px; background: var(--panel-2); color: var(--text); font-size: 13px; font-weight: 600; cursor: pointer; }
.restrict-act.active { background: var(--accent); color: #fff; }
.restrict-durs, .restrict-servers { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 14px; }
.restrict-dur { padding: 7px 12px; border: 0; border-radius: 9px; background: var(--panel-2); color: var(--text-dim); font-size: 13px; cursor: pointer; }
.restrict-dur.active { background: var(--accent); color: #fff; }
.restrict-srv { padding: 7px 12px; border: 1px solid rgba(255,255,255,.12); border-radius: 9px; background: transparent; color: var(--text-dim); font-size: 13px; cursor: pointer; }
.restrict-srv.active { background: rgba(82,136,193,.25); color: var(--accent-2); border-color: var(--accent); }
.restrict-open-btn { width: 100%; padding: 13px; border: 0; border-radius: 12px; background: rgba(224,88,106,.12); color: var(--danger); font-size: 15px; font-weight: 600; margin-bottom: 10px; cursor: pointer; }

/* server admin buttons */
.sp-admin-btn { width: 100%; padding: 11px; border: 0; border-radius: 10px; background: var(--panel-2); color: var(--text); font-size: 14px; font-weight: 600; cursor: pointer; margin-bottom: 8px; }
.sp-admin-btn.danger { background: rgba(224,88,106,.12); color: var(--danger); }
.sp-admin-btn:last-child { margin-bottom: 0; }

/* slow mode */
.srv-slow { margin-bottom: 14px; }
.srv-slow-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.srv-slow-val { font-size: 13px; color: var(--accent-2); font-weight: 600; }

/* edited mark */
.edited-mark { font-size: 10px; color: var(--text-faint); font-style: italic; margin-right: 4px; }
.row.out .edited-mark { color: rgba(255,255,255,.5); }

/* bot chat item */
.server-item.bot .server-icon { background: linear-gradient(135deg,#7a5cff,#5288c1); }

/* ===== v1.1 additions ===== */
/* online dot on edge of avatar */
.online-dot { left: -2px; bottom: -2px; }
.row-ava .online-dot, .adm-ava .online-dot, .sp-member .ava .online-dot { width: 12px; height: 12px; left: -2px; bottom: -2px; }
.header-ava .online-dot { width: 13px; height: 13px; }

/* role plaque (instead of checkmark) */
.role-plaque { display: inline-block; font-size: 10px; font-weight: 800; padding: 1px 7px; border-radius: 7px; vertical-align: middle; letter-spacing: .2px; }
.role-plaque.admin { background: #e0586a; color: #fff; }
.role-plaque.mod { background: var(--accent); color: #fff; }
.profile-name-row .role-plaque { font-size: 12px; padding: 2px 9px; }

/* scroll-down button */
.scroll-down { position: absolute; right: 14px; bottom: 84px; width: 46px; height: 46px; border-radius: 50%; background: var(--panel); color: var(--text); border: 1px solid rgba(255,255,255,.08); cursor: pointer; display: grid; place-items: center; box-shadow: 0 4px 16px rgba(0,0,0,.4); z-index: 6; transition: opacity .25s, transform .25s; }
.scroll-down.hidden { display: grid !important; opacity: 0; transform: translateY(20px) scale(.7); pointer-events: none; }
.scroll-down-badge { position: absolute; top: -6px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }

/* unread badge on sidebar */
.server-unread { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 11px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; flex-shrink: 0; }
.server-item.active .server-unread { background: rgba(255,255,255,.3); }

/* profile meta */
.profile-meta { display: flex; flex-direction: column; gap: 8px; }
.meta-row { display: flex; justify-content: space-between; align-items: center; }
.meta-k { color: var(--text-dim); font-size: 14px; }
.meta-v { font-weight: 600; font-size: 14px; }

/* devices */
.devices-list { display: flex; flex-direction: column; gap: 8px; }
.device-card { background: var(--panel); border-radius: 14px; padding: 14px; display: flex; gap: 12px; align-items: flex-start; border: 1px solid rgba(255,255,255,.04); }
.device-card.current { border-color: rgba(82,136,193,.5); }
.device-ico { font-size: 26px; }
.device-info { flex: 1; min-width: 0; }
.device-name { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.device-cur-tag { font-size: 10px; background: rgba(82,136,193,.25); color: var(--accent-2); padding: 1px 7px; border-radius: 7px; font-weight: 700; }
.device-on { width: 8px; height: 8px; border-radius: 50%; background: #4bd16a; display: inline-block; }
.device-sub { font-size: 12.5px; color: var(--text-dim); margin-top: 3px; line-height: 1.5; }
.device-kick { background: rgba(224,88,106,.14); color: var(--danger); border: 0; border-radius: 9px; padding: 7px 12px; font-size: 12px; font-weight: 600; cursor: pointer; margin-top: 8px; }
.device-kick:disabled { opacity: .4; cursor: default; }

/* server admin actions in edit modal */
.srv-admin-actions { display: flex; gap: 8px; margin-bottom: 12px; }
.srv-admin-actions .sp-admin-btn { margin-bottom: 0; }

/* media editor */
.media-box { max-width: 380px; }
.media-preview-wrap { position: relative; width: 100%; background: #000; border-radius: 12px; overflow: hidden; margin-bottom: 12px; display: flex; align-items: center; justify-content: center; max-height: 50vh; }
.media-canvas { max-width: 100%; max-height: 50vh; touch-action: none; display: block; }
.media-video { max-width: 100%; max-height: 50vh; display: block; }
.media-tools { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.mtool { background: var(--panel-2); border: 0; border-radius: 9px; width: 38px; height: 38px; font-size: 17px; cursor: pointer; color: var(--text); }
.mtool.active { background: var(--accent); }
.mtool-colors { display: flex; gap: 6px; margin-left: auto; }
.mcolor { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; }
.mcolor.active { border-color: #fff; }

/* composer recording bar */
.rec-bar { display: flex; align-items: center; gap: 10px; flex: 1; color: var(--danger); font-size: 14px; font-weight: 600; }
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--danger); animation: pulse 1s infinite; }

/* ===== v1.2 fixes ===== */
/* online dot must not be clipped by avatar overflow */
.row-ava, .ava, .header-ava, .adm-ava { overflow: visible; }
.row-ava > img, .ava > img, .header-ava > img, .adm-ava > img { border-radius: 50%; }
.online-dot { left: -3px; bottom: -3px; z-index: 3; }
.ava.big .online-dot { left: 2px; bottom: 6px; }

/* date separator */
.date-sep { align-self: center; background: rgba(0,0,0,.4); color: #cdd8e2; font-size: 12px; font-weight: 600; padding: 4px 14px; border-radius: 14px; margin: 12px auto 6px; backdrop-filter: blur(4px); }

/* logs */
.logs-list { display: flex; flex-direction: column; gap: 6px; max-height: 180px; overflow-y: auto; margin-bottom: 12px; }
.log-row { font-size: 13px; color: var(--text-dim); line-height: 1.4; padding: 6px 10px; background: rgba(0,0,0,.2); border-radius: 9px; }
.log-actor { color: var(--accent-2); font-weight: 600; }
.log-time { color: var(--text-faint); font-size: 11px; }
.logs-empty { color: var(--text-faint); font-size: 13px; padding: 4px; }
.logs-head { display: flex; align-items: center; gap: 6px; margin: 4px 0 8px; }
.logs-head .profile-card-label { margin: 0; }

.readers-list { max-height: 320px; overflow-y: auto; margin-bottom: 12px; }

/* ===== v1.3 additions ===== */
.verif-icon { width: 22px; height: 22px; object-fit: contain; }
.profile-name-row .verif-icon { width: 26px; height: 26px; }
.bubble-name .verif-icon { width: 14px; height: 14px; }

/* brush sizes */
.mtool-sizes { display: flex; gap: 4px; }
.msize { background: var(--panel-2); border: 0; border-radius: 9px; width: 34px; height: 38px; cursor: pointer; display: grid; place-items: center; }
.msize.active { background: var(--accent); }
.msize span { display: block; background: #fff; border-radius: 50%; }

/* reactions */
.reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.reaction-pill { display: inline-flex; align-items: center; gap: 3px; background: rgba(255,255,255,.08); border: 1px solid transparent; border-radius: 13px; padding: 1px 7px 1px 5px; font-size: 13px; cursor: pointer; line-height: 1.6; }
.reaction-pill.mine { background: rgba(82,136,193,.32); border-color: var(--accent); }
.reaction-pill .rc-count { font-size: 12px; font-weight: 600; color: var(--text-dim); }
.reaction-pill.mine .rc-count { color: var(--accent-2); }
.row.out .reaction-pill { background: rgba(255,255,255,.14); }
.row.out .reaction-pill.mine { background: rgba(255,255,255,.28); }

/* reaction picker in ctx menu */
.ctx-reactions { display: flex; gap: 4px; padding: 6px; border-bottom: 1px solid rgba(255,255,255,.06); margin-bottom: 4px; }
.ctx-react { font-size: 22px; background: none; border: 0; cursor: pointer; border-radius: 8px; width: 38px; height: 38px; transition: transform .1s, background .15s; }
.ctx-react:hover { background: rgba(255,255,255,.08); transform: scale(1.2); }

/* call screen */
#call { background: #0a0f15; }
.call-top { text-align: center; padding: 18px 16px 10px; }
.call-title { font-size: 18px; font-weight: 700; }
.call-sub { font-size: 13px; color: var(--accent-2); margin-top: 2px; }
.call-grid { flex: 1; display: grid; gap: 8px; padding: 8px 12px; overflow-y: auto; grid-template-columns: 1fr 1fr; align-content: start; }
.call-grid.single { grid-template-columns: 1fr; }
.call-tile { position: relative; background: linear-gradient(135deg,#1c2a38,#11202d); border-radius: 16px; overflow: hidden; aspect-ratio: 3/4; display: flex; align-items: center; justify-content: center; }
.call-tile.speaking { box-shadow: inset 0 0 0 3px #4bd16a; }
.call-tile video { width: 100%; height: 100%; object-fit: cover; }
.call-tile-ava { width: 76px; height: 76px; border-radius: 50%; overflow: hidden; background: linear-gradient(135deg,#3a536b,#26384a); display: grid; place-items: center; font-size: 30px; color: #cfe0ee; }
.call-tile-ava img { width: 100%; height: 100%; object-fit: cover; }
.call-tile-name { position: absolute; left: 8px; bottom: 8px; font-size: 13px; font-weight: 600; text-shadow: 0 1px 4px rgba(0,0,0,.8); display: flex; align-items: center; gap: 5px; }
.call-tile-muted { position: absolute; right: 8px; bottom: 8px; font-size: 15px; opacity: .85; }
.call-controls { display: flex; align-items: center; justify-content: center; gap: 22px; padding: 18px 16px 26px; }
.call-ctl { width: 54px; height: 54px; border-radius: 50%; border: 0; cursor: pointer; background: rgba(255,255,255,.12); color: #fff; display: grid; place-items: center; transition: transform .1s; }
.call-ctl:active { transform: scale(.92); }
.call-ctl.primary { width: 64px; height: 64px; background: var(--accent); }
.call-ctl.primary.off { background: #fff; color: var(--bubble-out); }
.call-ctl.danger { background: var(--danger); }
.call-ctl.video-on { background: var(--accent); }

/* ===== v1.4 fixes ===== */
/* bot profile avatar centering + verif alignment */
#bot-profile .ava.big, #sp-ava { margin: 0 auto; }
.profile-name-row { line-height: 1; }
.verif-icon { display: inline-block; vertical-align: middle; }
.profile-name-row .verif-icon { width: 24px; height: 24px; margin-left: 2px; }
.server-name .verif-icon { width: 15px; height: 15px; margin-left: 4px; vertical-align: -2px; }
.chat-title .verif-icon { width: 16px; height: 16px; margin-left: 4px; vertical-align: -2px; }

/* call top with minimize */
.call-top { display: flex; align-items: center; gap: 8px; padding: 14px 12px 8px; text-align: left; }
.call-min { color: #fff; }
.call-titles { flex: 1; }

/* call mini floating bar */
.call-mini { position: fixed; top: 10px; left: 50%; transform: translateX(-50%); z-index: 55; display: flex; align-items: center; gap: 8px; background: var(--accent); color: #fff; padding: 8px 14px; border-radius: 20px; box-shadow: var(--shadow); cursor: pointer; font-size: 13px; font-weight: 600; animation: rise .25s; max-width: 92%; }
.call-mini-dot { width: 9px; height: 9px; border-radius: 50%; background: #4bd16a; box-shadow: 0 0 8px #4bd16a; animation: pulse 1.2s infinite; }
.call-mini-open { background: rgba(255,255,255,.25); padding: 2px 8px; border-radius: 10px; font-size: 12px; }

/* voice call: centered circular avatars */
.call-grid.voice { display: flex; flex-wrap: wrap; align-items: center; align-content: center; justify-content: center; gap: 18px; }
.call-grid.voice .call-tile { aspect-ratio: auto; background: none; border-radius: 50%; width: auto; height: auto; flex-direction: column; gap: 10px; }
.call-grid.voice .call-tile-ava { width: 96px; height: 96px; transition: box-shadow .12s; }
.call-grid.voice .call-tile.speaking .call-tile-ava { box-shadow: 0 0 0 4px #4bd16a, 0 0 18px rgba(75,209,106,.7); }
.call-grid.voice .call-tile-name { position: static; text-align: center; justify-content: center; }
.call-grid.voice .call-tile-muted { position: static; }
.call-more { width: 96px; height: 96px; border-radius: 50%; background: rgba(255,255,255,.1); display: grid; place-items: center; font-size: 24px; font-weight: 700; color: var(--text-dim); }
.call-tile.speaking { box-shadow: inset 0 0 0 3px #4bd16a; }

/* ===== v1.5 fixes ===== */
/* favorites/bot composer inputs same as main composer */
.composer input#fav-input {
  flex: 1; padding: 12px 16px; border-radius: 22px;
  background: var(--panel-2); border: 1px solid transparent; color: var(--text); font-size: 15px; min-width: 0;
}
.composer input#fav-input:focus { outline: none; border-color: rgba(82,136,193,.5); }

/* centered notice */
.center-notice {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(.9);
  background: rgba(20,28,38,.96); color: #fff; padding: 16px 26px; border-radius: 16px;
  font-size: 15px; font-weight: 600; z-index: 90; box-shadow: var(--shadow);
  border: 1px solid rgba(255,255,255,.08); opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; text-align: center; max-width: 80%;
}
.center-notice.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }

/* restrict status */
.restrict-status { margin-bottom: 12px; }
.rs-item { background: rgba(224,88,106,.12); color: #ffb3bd; font-size: 13px; padding: 7px 11px; border-radius: 9px; margin-bottom: 5px; }
.rs-clean { color: var(--ok); font-size: 13px; }
.rs-load { color: var(--text-faint); font-size: 13px; }
.restrict-act.act-disabled { opacity: .35; cursor: not-allowed; }

/* ===== v1.6: premium / market / plaques ===== */
.plaque-ic { width: 13px; height: 13px; object-fit: contain; vertical-align: -2px; margin-right: 2px; }
.role-plaque { display: inline-flex; align-items: center; gap: 1px; }
.role-plaque.premium { background: #111418; color: #f3d27a; border: 1px solid rgba(243,210,122,.4); }
.profile-name-row .plaque-ic { width: 16px; height: 16px; }
.profile-plaques { display: inline-flex; gap: 5px; align-items: center; }
.nick { font-weight: inherit; }

/* sidebar header icons */
.sidebar-head { position: relative; }
.sidebar-hicon { color: var(--text-dim); margin-left: 0; }
.sidebar-head .sidebar-brand { flex: 1; }

/* market / premium card */
.premium-card { background: linear-gradient(160deg, #1c2230, #141a24); border: 1px solid rgba(243,210,122,.25); border-radius: 18px; padding: 20px; box-shadow: var(--shadow); }
.premium-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.premium-big { width: 56px; height: 56px; object-fit: contain; filter: drop-shadow(0 4px 10px rgba(243,210,122,.4)); }
.premium-title { font-size: 24px; font-weight: 800; color: #f3d27a; }
.premium-sub { font-size: 13px; color: var(--text-dim); }
.premium-perks { list-style: none; margin: 0 0 18px; padding: 0; }
.premium-perks li { font-size: 14px; padding: 7px 0 7px 26px; position: relative; color: var(--text); border-bottom: 1px solid rgba(255,255,255,.05); }
.premium-perks li:before { content: "✦"; position: absolute; left: 4px; color: #f3d27a; }
.premium-buy { width: 100%; padding: 14px; border: 0; border-radius: 13px; cursor: pointer; font-size: 15px; font-weight: 800; color: #1a1408; background: linear-gradient(135deg, #f7e08a, #e0b94e); box-shadow: 0 8px 22px rgba(224,185,78,.35); }
.premium-have { text-align: center; color: var(--ok); font-size: 14px; margin-top: 12px; font-weight: 600; }
.vip-locked-txt { font-size: 15px; color: var(--text); margin-bottom: 14px; text-align: center; }

/* vip panel */
.vip-preview { font-size: 22px; font-weight: 700; display: flex; align-items: center; gap: 8px; min-height: 32px; }
.vip-colors { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.vip-color { width: 32px; height: 32px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; }
.vip-color.active { border-color: #fff; transform: scale(1.1); }
.vip-custom { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-dim); }
.vip-custom input[type=color] { width: 40px; height: 30px; border: 0; background: none; cursor: pointer; }
.vip-fonts { display: flex; flex-direction: column; gap: 6px; }
.vip-font { text-align: left; padding: 11px 14px; border-radius: 11px; background: var(--panel-2); border: 1px solid transparent; color: var(--text); cursor: pointer; font-size: 18px; }
.vip-font.active { border-color: var(--accent); background: rgba(82,136,193,.18); }
