:root {
  --bg-rail: #121214;
  --bg-sidebar: #222327;
  --bg-base: #29292d;
  --bg-input: #1c1c20;
  --bg-floating: #17181b;
  --bg-card: #1f2024;
  --bg-hover: #34343a;
  --bg-active: #3d3d4466;
  --text-normal: #dcdee2;
  --text-muted: #96989f;
  --text-faint: #7f828a;
  --header: #f4f4f6;
  --blurple: #5865f2;
  --blurple-hover: #4752c4;
  --green: #23a55a;
  --yellow: #f0b232;
  --red: #f23f43;
  --link: #00a8fc;
  --divider: #3a3b40;
  --radius: 8px;
  --ease: cubic-bezier(.25, .8, .35, 1);
  font-size: 16px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: "gg sans", "Noto Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  background: var(--bg-base);
  color: var(--text-normal);
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #17181b; border-radius: 4px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #101114; background-clip: padding-box; border: 2px solid transparent; }
::-webkit-scrollbar-track { background: transparent; }

.auth-screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 100; }
.auth-bg { position: absolute; inset: 0; background: radial-gradient(circle at 20% 15%, #3b448f 0%, #22264f 40%, #121214 100%); }
.auth-card {
  position: relative; width: 480px; max-width: calc(100vw - 32px);
  background: var(--bg-sidebar); border-radius: 12px; padding: 32px;
  box-shadow: 0 8px 40px rgba(0,0,0,.45);
  text-align: center;
  animation: pop-in .25s var(--ease);
}
.auth-card h1 { color: var(--header); font-size: 24px; margin-bottom: 8px; }
.auth-sub { color: var(--text-muted); margin-bottom: 20px; }
.auth-card form { text-align: left; display: flex; flex-direction: column; }
.auth-card label {
  color: #b0b3ba; font-size: 12px; font-weight: 700; text-transform: uppercase;
  margin: 16px 0 8px; letter-spacing: .02em;
}
.auth-card label:first-child { margin-top: 0; }
.req { color: var(--red); }
.auth-card input {
  background: var(--bg-input); border: 1px solid transparent; border-radius: 6px;
  padding: 10px; color: var(--text-normal); font-size: 16px; outline: none;
  transition: border-color .15s var(--ease);
}
.auth-card input:focus { border-color: var(--blurple); }
.auth-link { color: var(--link); font-size: 14px; }
.auth-link.small { margin-top: 4px; }
.auth-error { color: var(--red); font-size: 13px; margin-top: 8px; min-height: 16px; }
.btn-primary {
  background: var(--blurple); color: #fff; font-weight: 500; font-size: 16px;
  padding: 11px; border-radius: 6px; margin-top: 12px;
  transition: background .18s var(--ease), transform .1s var(--ease);
}
.btn-primary:hover { background: var(--blurple-hover); }
.btn-primary:active { transform: scale(.98); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.auth-alt { margin-top: 12px; font-size: 14px; color: var(--text-faint); }

.app { display: flex; height: 100vh; }

.guild-rail {
  width: 72px; background: var(--bg-rail); padding: 12px 0;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  overflow-y: auto; flex-shrink: 0;
}
.guild-rail::-webkit-scrollbar { display: none; }
.rail-item {
  position: relative; width: 48px; height: 48px; border-radius: 50%;
  background: var(--bg-sidebar); color: var(--text-normal);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: border-radius .2s var(--ease), background .2s var(--ease), color .2s var(--ease);
  font-weight: 600; font-size: 16px; flex-shrink: 0; user-select: none;
}
.rail-item:hover, .rail-item.active { border-radius: 16px; }
.rail-item.home:hover, .rail-item.home.active { background: var(--blurple); color: #fff; }
.rail-item.guild { color: var(--header); }
.rail-item.guild:hover, .rail-item.guild.active { color: #fff; }
.rail-item.action { color: var(--green); }
.rail-item.action:hover { background: var(--green); color: #fff; border-radius: 16px; }
.rail-pill {
  position: absolute; left: -16px; top: 50%; transform: translateY(-50%);
  width: 8px; height: 0; background: #fff; border-radius: 0 4px 4px 0;
  transition: height .2s var(--ease);
}
.rail-item:hover .rail-pill { height: 20px; }
.rail-item.active .rail-pill { height: 40px; }
.rail-item.unread .rail-pill { height: 8px; }
.rail-sep { width: 32px; height: 2px; background: var(--bg-hover); border-radius: 1px; flex-shrink: 0; }
.rail-item[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute; left: 62px; top: 50%; transform: translateY(-50%);
  background: var(--bg-floating); color: var(--header); font-size: 14px; font-weight: 600;
  padding: 8px 12px; border-radius: 8px; white-space: nowrap; z-index: 50;
  box-shadow: 0 8px 24px rgba(0,0,0,.5); pointer-events: none;
  animation: fade-in .12s var(--ease);
}

.sidebar { width: 240px; background: var(--bg-sidebar); display: flex; flex-direction: column; flex-shrink: 0; }
.sidebar-header {
  height: 48px; padding: 0 16px; display: flex; align-items: center;
  box-shadow: 0 1px 0 rgba(0,0,0,.3); font-weight: 600; color: var(--header);
  cursor: pointer; justify-content: space-between; flex-shrink: 0; position: relative;
  transition: background .15s var(--ease);
}
.sidebar-header:hover { background: var(--bg-active); }
.sidebar-header .search-fake {
  width: 100%; background: var(--bg-input); color: var(--text-muted);
  font-size: 13px; padding: 6px 8px; border-radius: 6px; text-align: left; cursor: pointer;
}
.sidebar-scroll { flex: 1; overflow-y: auto; padding: 8px; }

.side-btn {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 8px 10px; border-radius: var(--radius); color: var(--text-muted);
  font-size: 15px; font-weight: 500; margin-bottom: 2px;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.side-btn:hover { background: var(--bg-active); color: var(--text-normal); }
.side-btn.active { background: var(--bg-active); color: var(--header); }
.side-label {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 8px 4px; color: var(--text-faint);
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .02em;
  transition: color .15s var(--ease);
}
.side-label:hover { color: var(--text-normal); }
.side-label .add-btn { cursor: pointer; font-size: 18px; line-height: 1; transition: color .15s var(--ease); }
.side-label .add-btn:hover { color: var(--header); }

.channel-item {
  display: flex; align-items: center; gap: 6px; padding: 6px 8px;
  border-radius: var(--radius); color: var(--text-faint); font-size: 15px; font-weight: 500;
  cursor: pointer; margin-bottom: 1px; position: relative;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.channel-item:hover { background: var(--bg-active); color: var(--text-normal); }
.channel-item.active { background: var(--bg-active); color: var(--header); }
.channel-item.unread { color: var(--header); font-weight: 600; }
.channel-item.unread::before {
  content: ''; position: absolute; left: -8px; top: 50%; transform: translateY(-50%);
  width: 4px; height: 8px; background: #fff; border-radius: 0 4px 4px 0;
}
.channel-item .ch-icon { flex-shrink: 0; color: var(--text-faint); display: flex; }
.voice-users { padding-left: 30px; }
.voice-user {
  display: flex; align-items: center; gap: 8px; padding: 3px 8px;
  border-radius: var(--radius); color: var(--text-muted); font-size: 14px; cursor: pointer;
  transition: background .15s var(--ease);
}
.voice-user:hover { background: var(--bg-active); color: var(--text-normal); }
.voice-user .mini-flags { margin-left: auto; display: flex; gap: 4px; color: var(--text-faint); align-items: center; }

.dm-item {
  display: flex; align-items: center; gap: 12px; padding: 6px 8px;
  border-radius: var(--radius); cursor: pointer; margin-bottom: 2px; color: var(--text-muted);
  position: relative;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.dm-item:hover { background: var(--bg-active); color: var(--text-normal); }
.dm-item.active { background: var(--bg-active); color: var(--header); }
.dm-item.unread { color: var(--header); font-weight: 600; }
.dm-item .dm-name { font-size: 15px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.dm-item .dm-close {
  opacity: 0; color: var(--text-faint); font-size: 16px; line-height: 1; padding: 2px 4px;
  transition: opacity .12s var(--ease), color .12s var(--ease);
}
.dm-item:hover .dm-close { opacity: 1; }
.dm-item .dm-close:hover { color: var(--header); }
.unread-dot { width: 8px; height: 8px; background: var(--red); border-radius: 50%; flex-shrink: 0; }

.avatar {
  position: relative; width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 600; font-size: 13px; flex-shrink: 0; user-select: none;
  background-size: cover; background-position: center;
}
.avatar.sm { width: 24px; height: 24px; font-size: 11px; }
.avatar.lg { width: 40px; height: 40px; font-size: 16px; }
.avatar.xl { width: 80px; height: 80px; font-size: 28px; }
.avatar .status-dot {
  position: absolute; bottom: -2px; right: -2px; width: 12px; height: 12px;
  border-radius: 50%; border: 3px solid var(--bg-sidebar);
}
.avatar.xl .status-dot { width: 20px; height: 20px; border-width: 5px; bottom: 0; right: 0; }
.status-online { background: var(--green); }
.status-idle { background: var(--yellow); }
.status-dnd { background: var(--red); }
.status-offline { background: #7f828a; }

.user-panel {
  height: 52px; background: #1a1b1e; padding: 0 8px;
  display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
}
.user-panel-info {
  display: flex; align-items: center; gap: 8px; padding: 4px;
  border-radius: var(--radius); cursor: pointer; min-width: 0; flex: 1;
  transition: background .15s var(--ease);
}
.user-panel-info:hover { background: var(--bg-active); }
.user-panel-name { min-width: 0; }
.user-panel-name .u-name {
  color: var(--header); font-size: 14px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-panel-name .u-sub { color: var(--text-muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-panel-actions { display: flex; }
.icon-btn {
  width: 32px; height: 32px; border-radius: 6px; color: #aeb1b8;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.icon-btn:hover { background: var(--bg-active); color: var(--text-normal); }
.icon-btn.danger-on { color: var(--red); position: relative; }
.icon-btn.danger-on::after {
  content: ''; position: absolute; width: 2px; height: 24px; background: var(--red);
  transform: rotate(45deg); border-radius: 1px;
}
.voice-panel { background: #1a1b1e; border-bottom: 1px solid var(--bg-rail); padding: 8px; flex-shrink: 0; }
.voice-panel-info { display: flex; align-items: center; justify-content: space-between; }
.voice-status { color: var(--green); font-size: 14px; font-weight: 600; }
.voice-where { color: var(--text-muted); font-size: 12px; }
.voice-panel-actions { display: flex; gap: 8px; margin-top: 8px; }
.voice-action {
  flex: 1; background: var(--bg-hover); border-radius: 6px; height: 32px;
  display: flex; align-items: center; justify-content: center; color: var(--text-normal);
  transition: background .15s var(--ease);
}
.voice-action:hover { background: #45454d; }
.voice-action.on { background: #fff; color: #000; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.main-header {
  height: 48px; padding: 0 16px; display: flex; align-items: center; gap: 8px;
  box-shadow: 0 1px 0 rgba(0,0,0,.3); flex-shrink: 0; z-index: 2;
}
.main-header .hdr-icon { color: var(--text-faint); display: flex; }
.main-header .hdr-title { color: var(--header); font-weight: 600; font-size: 16px; white-space: nowrap; }
.main-header .hdr-topic {
  color: var(--text-muted); font-size: 14px; border-left: 1px solid var(--divider);
  padding-left: 8px; margin-left: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.main-header .hdr-tabs { display: flex; gap: 8px; margin-left: 8px; align-items: center; }
.hdr-tab {
  padding: 2px 8px; border-radius: 6px; color: var(--text-muted); font-size: 15px; font-weight: 500;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.hdr-tab:hover { background: var(--bg-hover); color: var(--text-normal); }
.hdr-tab.active { background: var(--bg-active); color: var(--header); }
.hdr-tab.add-friend-tab { background: var(--green); color: #fff; }
.hdr-tab.add-friend-tab.active { background: none; color: var(--green); }
.hdr-spacer { flex: 1; }

.main-body { flex: 1; display: flex; min-height: 0; }
.main-content { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.member-list { width: 240px; background: var(--bg-sidebar); overflow-y: auto; padding: 8px; flex-shrink: 0; }
.member-group {
  color: var(--text-faint); font-size: 11px; font-weight: 700; text-transform: uppercase;
  padding: 16px 8px 4px; letter-spacing: .02em;
}
.member-item {
  display: flex; align-items: center; gap: 12px; padding: 5px 8px;
  border-radius: var(--radius); cursor: pointer;
  transition: background .15s var(--ease), opacity .15s var(--ease);
}
.member-item:hover { background: var(--bg-active); }
.member-item.offline { opacity: .4; }
.member-item.offline:hover { opacity: 1; }
.member-name { font-size: 15px; font-weight: 500; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-sub { font-size: 12px; color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.chat-scroll { flex: 1; overflow-y: auto; padding-bottom: 16px; }
.chat-welcome { padding: 32px 16px 16px; }
.chat-welcome .big-icon {
  width: 68px; height: 68px; border-radius: 50%; background: var(--bg-hover);
  display: flex; align-items: center; justify-content: center; color: var(--header); margin-bottom: 12px;
}
.chat-welcome h2 { color: var(--header); font-size: 28px; margin-bottom: 4px; }
.chat-welcome p { color: var(--text-muted); font-size: 15px; }

.day-divider {
  display: flex; align-items: center; gap: 8px; margin: 20px 16px 4px;
  color: var(--text-faint); font-size: 12px; font-weight: 600;
}
.day-divider::before, .day-divider::after { content: ''; flex: 1; height: 1px; background: var(--divider); }

.msg-group { position: relative; display: flex; gap: 16px; padding: 2px 48px 2px 16px; margin-top: 16px; }
.msg-group:hover { background: rgba(0,0,0,.08); }
.msg-group.compact { margin-top: 0; }
.msg-group.compact > .avatar { visibility: hidden; height: 0; }
.msg-body { min-width: 0; flex: 1; }
.msg-meta { display: flex; align-items: baseline; gap: 8px; }
.msg-author { color: var(--header); font-weight: 600; font-size: 15px; cursor: pointer; }
.msg-author:hover { text-decoration: underline; }
.msg-time { color: var(--text-faint); font-size: 11px; }
.msg-content { color: var(--text-normal); font-size: 15px; line-height: 1.4; word-wrap: break-word; white-space: pre-wrap; }
.msg-edited { color: var(--text-faint); font-size: 10px; margin-left: 4px; user-select: none; }
.msg-reply {
  display: flex; align-items: center; gap: 6px; margin-bottom: 2px;
  color: var(--text-muted); font-size: 13px; cursor: pointer; min-width: 0;
}
.msg-reply:hover { color: var(--text-normal); }
.msg-reply .reply-spine {
  width: 24px; height: 10px; border-left: 2px solid var(--divider); border-top: 2px solid var(--divider);
  border-radius: 6px 0 0 0; margin: 8px 0 0 20px; flex-shrink: 0;
}
.msg-reply .reply-author { color: var(--header); font-weight: 600; flex-shrink: 0; }
.msg-reply .reply-snippet { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-highlight { animation: msg-flash 1.5s var(--ease); }
@keyframes msg-flash { 0%, 40% { background: rgba(88,101,242,.18); } 100% { background: transparent; } }

.msg-actions {
  position: absolute; top: -14px; right: 24px; display: none; gap: 0;
  background: var(--bg-card); border: 1px solid var(--divider); border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,.35); overflow: hidden;
}
.msg-group:hover .msg-actions { display: flex; }
.msg-actions button {
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 15px;
  transition: background .12s var(--ease), color .12s var(--ease);
}
.msg-actions button:hover { background: var(--bg-hover); color: var(--text-normal); }
.msg-actions button.danger:hover { color: var(--red); }

.reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.reaction {
  display: flex; align-items: center; gap: 6px; padding: 2px 8px;
  background: var(--bg-input); border: 1px solid transparent; border-radius: 10px;
  font-size: 14px; cursor: pointer; user-select: none;
  transition: border-color .12s var(--ease), background .12s var(--ease);
}
.reaction .rx-count { color: var(--text-muted); font-size: 13px; font-weight: 600; }
.reaction:hover { border-color: var(--text-faint); }
.reaction.me { background: rgba(88,101,242,.18); border-color: var(--blurple); }
.reaction.me .rx-count { color: #c0c7ff; }

.msg-edit-box { width: 100%; }
.msg-edit-box textarea {
  width: 100%; background: var(--bg-input); border: none; border-radius: 8px;
  padding: 8px 12px; color: var(--text-normal); font-size: 15px; outline: none; resize: none;
}
.msg-edit-hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.msg-edit-hint b { color: var(--link); cursor: pointer; }

.chat-input-wrap { padding: 0 16px 24px; flex-shrink: 0; position: relative; }
.reply-bar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg-card); border-radius: 8px 8px 0 0; padding: 8px 14px;
  color: var(--text-muted); font-size: 13px;
}
.reply-bar b { color: var(--header); }
.reply-bar .reply-cancel { color: var(--text-faint); font-size: 15px; padding: 0 4px; }
.reply-bar .reply-cancel:hover { color: var(--header); }
.reply-bar + .chat-input { border-radius: 0 0 8px 8px; }
.chat-input {
  width: 100%; background: var(--bg-input); border: none; border-radius: 8px;
  padding: 12px 16px; color: var(--text-normal); font-size: 15px; outline: none;
  resize: none; max-height: 144px; line-height: 1.4;
}
.chat-input::placeholder { color: var(--text-faint); }
.typing-bar {
  position: absolute; bottom: 4px; left: 16px; font-size: 13px; color: var(--text-normal);
  height: 20px; display: flex; align-items: center; gap: 4px;
}
.typing-dots span {
  display: inline-block; width: 5px; height: 5px; margin-right: 2px; border-radius: 50%;
  background: var(--text-normal); animation: typing-bounce 1.2s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: .15s; }
.typing-dots span:nth-child(3) { animation-delay: .3s; }
@keyframes typing-bounce { 0%, 60%, 100% { transform: none; } 30% { transform: translateY(-4px); } }

.friends-page { flex: 1; overflow-y: auto; padding: 16px 24px; }
.friends-search {
  width: 100%; background: var(--bg-input); border: none; border-radius: 6px;
  padding: 8px 12px; color: var(--text-normal); font-size: 15px; outline: none; margin-bottom: 16px;
}
.friends-count {
  color: var(--text-faint); font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .02em; padding-bottom: 8px; border-bottom: 1px solid var(--divider); margin-bottom: 8px;
}
.friend-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 8px;
  border-top: 1px solid var(--divider); border-radius: var(--radius); cursor: pointer; margin: 0 -8px;
  transition: background .15s var(--ease);
}
.friend-row:hover { background: var(--bg-active); border-top-color: transparent; }
.friend-row .fr-info { flex: 1; min-width: 0; }
.friend-row .fr-name { color: var(--header); font-size: 15px; font-weight: 600; }
.friend-row .fr-name .fr-tag { color: var(--text-muted); font-weight: 400; display: none; }
.friend-row:hover .fr-tag { display: inline; }
.friend-row .fr-sub { color: var(--text-muted); font-size: 13px; }
.friend-row .fr-actions { display: flex; gap: 8px; }
.fr-action {
  width: 36px; height: 36px; border-radius: 50%; background: var(--bg-input);
  color: var(--text-muted); display: flex; align-items: center; justify-content: center;
  transition: color .15s var(--ease), background .15s var(--ease);
}
.fr-action:hover { color: var(--text-normal); }
.fr-action.accept:hover { color: var(--green); }
.fr-action.decline:hover, .fr-action.remove:hover { color: var(--red); }

.add-friend-box h2 { color: var(--header); font-size: 16px; text-transform: uppercase; margin-bottom: 8px; }
.add-friend-box p { color: var(--text-muted); font-size: 14px; margin-bottom: 16px; }
.add-friend-input-wrap {
  display: flex; background: var(--bg-input); border-radius: 8px; padding: 8px 12px;
  border: 1px solid transparent; transition: border-color .15s var(--ease);
}
.add-friend-input-wrap:focus-within { border-color: var(--blurple); }
.add-friend-input-wrap input {
  flex: 1; background: none; border: none; outline: none; color: var(--text-normal); font-size: 15px;
}
.add-friend-input-wrap .btn-primary { margin: 0; padding: 8px 16px; font-size: 14px; border-radius: 4px; }
.add-friend-msg { margin-top: 8px; font-size: 14px; }
.add-friend-msg.ok { color: var(--green); }
.add-friend-msg.err { color: var(--red); }

.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; flex: 1; color: var(--text-muted); padding: 40px; text-align: center; }
.empty-state .wumpus { font-size: 64px; margin-bottom: 16px; }

.voice-view { flex: 1; background: #000; display: flex; flex-direction: column; min-height: 0; }
.video-grid {
  flex: 1; display: flex; flex-wrap: wrap; gap: 12px; padding: 16px; min-height: 0;
  align-items: center; justify-content: center; align-content: center; overflow-y: auto;
}
.video-tile {
  position: relative; background: var(--bg-card); border-radius: 12px; overflow: hidden;
  aspect-ratio: 16 / 9; display: flex; align-items: center; justify-content: center;
  max-height: 100%; cursor: pointer;
  width: min(calc((100% - (var(--tcols, 1) - 1) * 12px) / var(--tcols, 1) * var(--tscale, 1) - 1px), calc(720px * var(--tscale, 1)));
  min-width: 160px; flex-shrink: 0;
  transition: box-shadow .15s var(--ease);
}
.voice-view { position: relative; }
.voice-view > .video-grid { padding-top: 56px; }
.voice-view .voice-toolbar { padding: 8px 16px 28px; }
.mute-badge {
  position: absolute; bottom: 8px; left: 8px; width: 28px; height: 28px; border-radius: 8px;
  background: rgba(0,0,0,.65); color: #fff; display: flex; align-items: center; justify-content: center;
  z-index: 2; pointer-events: none;
}
.video-tile:has(.mute-badge) .tile-name { left: 44px; }
.voice-tool.zoom { width: 40px; height: 40px; font-size: 20px; font-weight: 700; align-self: center; background: transparent; color: var(--text-muted); }
.voice-tool.zoom:hover { background: var(--bg-hover); color: #fff; }
.video-tile video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.video-tile video.mirror { transform: scaleX(-1); }
.video-tile.avatar-only video { display: none; }
.video-tile.speaking { box-shadow: 0 0 0 2px var(--green); }
.video-tile .tile-name {
  position: absolute; left: 8px; bottom: 8px; background: rgba(0,0,0,.6);
  color: #fff; font-size: 13px; font-weight: 500; padding: 4px 8px; border-radius: 6px;
  display: flex; align-items: center; gap: 6px; pointer-events: none; z-index: 2;
  opacity: 0; transition: opacity .15s var(--ease);
}
.video-tile:hover .tile-name { opacity: 1; }
.live-badge {
  position: absolute; top: 8px; left: 8px; background: var(--red); color: #fff;
  font-size: 11px; font-weight: 800; letter-spacing: .5px; padding: 2px 8px;
  border-radius: 6px; pointer-events: none; z-index: 2;
}
.video-tile .tile-actions {
  position: absolute; top: 8px; right: 8px; display: flex; gap: 6px;
  opacity: 0; transition: opacity .15s var(--ease); z-index: 3;
}
.video-tile:hover .tile-actions, .video-tile:fullscreen .tile-actions { opacity: 1; }
.tile-act {
  width: 32px; height: 32px; border-radius: 8px; background: rgba(0,0,0,.65);
  color: #fff; display: flex; align-items: center; justify-content: center;
  transition: background .15s var(--ease);
}
.tile-act:hover { background: rgba(0,0,0,.9); }
.watch-hint {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.45); color: #fff; font-size: 15px; font-weight: 600;
  opacity: 0; transition: opacity .15s var(--ease); pointer-events: none; z-index: 1;
}
.video-tile.screen:hover .watch-hint { opacity: 1; }
.video-tile:fullscreen { border-radius: 0; width: 100%; aspect-ratio: auto; }
.video-tile:fullscreen .watch-hint { display: none; }

.call-stage { flex: 1; position: relative; display: flex; min-height: 0; min-width: 0; }
.stage-main { flex: 1; min-height: 0; min-width: 0; display: flex; }
.stage-main .video-tile {
  width: 100%; height: 100%; aspect-ratio: auto; min-width: 0; max-height: none;
  border-radius: 0; cursor: default; background: #000;
}
.stage-chevron {
  position: absolute; left: 12px; bottom: 90px; z-index: 6;
  display: flex; align-items: center; gap: 5px;
  background: rgba(0,0,0,.65); color: #fff; border-radius: 8px; padding: 7px 10px;
  opacity: 0; transition: opacity .18s var(--ease), background .15s var(--ease);
}
.stage-chevron:hover { background: rgba(0,0,0,.9); }
.chev-count { font-size: 12px; font-weight: 700; }
.stage-strip {
  position: absolute; left: 0; right: 0; bottom: 88px; z-index: 5;
  display: flex; gap: 8px; justify-content: center;
  overflow-x: auto; padding: 4px 60px;
}
.stage-strip .video-tile { width: 150px; min-width: 150px; aspect-ratio: 16 / 9; border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,.5); }
.stage-strip .video-tile .tile-name { font-size: 11px; padding: 2px 6px; left: 4px; bottom: 4px; }
.stage-strip .video-tile .live-badge { font-size: 9px; padding: 1px 5px; top: 4px; left: 4px; }
.stage-strip .video-tile .tile-actions { display: none; }
.stage-strip .video-tile .mute-badge { width: 20px; height: 20px; bottom: 4px; left: 4px; border-radius: 5px; }
.stage-strip .avatar-only .avatar.xl { width: 44px; height: 44px; font-size: 16px; }

.focused .voice-toolbar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 7;
  background: linear-gradient(transparent, rgba(0,0,0,.8));
  padding: 28px 16px 18px; margin: 0;
  opacity: 0; pointer-events: none; transition: opacity .18s var(--ease);
}
.focused.controls-visible .voice-toolbar { opacity: 1; pointer-events: auto; }
.focused .stage-tile .tile-name, .focused .stage-tile .tile-actions,
.focused .stage-strip, .focused .stage-chevron { opacity: 0; pointer-events: none; transition: opacity .18s var(--ease); }
.focused.controls-visible .stage-tile .tile-name, .focused.controls-visible .stage-tile .tile-actions,
.focused.controls-visible .stage-strip, .focused.controls-visible .stage-chevron { opacity: 1; pointer-events: auto; }
.focused .stage-tile .tile-name { font-size: 14px; left: 12px; bottom: 84px; }
.focused .stage-tile .tile-actions { top: auto; right: 12px; bottom: 84px; }
.stage-tile video { object-fit: contain; }
.voice-toolbar { display: flex; justify-content: center; gap: 16px; padding: 16px; flex-shrink: 0; }
.voice-tool {
  width: 56px; height: 56px; border-radius: 50%; background: var(--bg-sidebar);
  color: #fff; display: flex; align-items: center; justify-content: center;
  transition: background .18s var(--ease), transform .1s var(--ease);
}
.voice-tool:hover { background: var(--bg-hover); }
.voice-tool:active { transform: scale(.94); }
.voice-tool.off { background: #fff; color: #000; }
.voice-tool.hangup { background: var(--red); }
.voice-tool.hangup:hover { background: #d83a3e; }

.dm-call {
  background: #0c0c0e; border-bottom: 1px solid var(--bg-rail);
  display: flex; flex-direction: column; max-height: 55%; min-height: 220px; flex-shrink: 0;
}
.dm-call.focused { height: 62vh; max-height: 82%; }
.dm-call .video-grid { padding: 12px; }
.dm-call .video-tile { aspect-ratio: 16 / 9; }
.dm-call .call-stage { min-height: 180px; }
.dm-call.focused .voice-toolbar .voice-tool { width: 46px; height: 46px; }
.dm-call .stage-strip { bottom: 74px; }
.dm-call .stage-chevron { bottom: 76px; }
.dm-call.focused .stage-tile .tile-name { bottom: 72px; }
.dm-call.focused .stage-tile .tile-actions { bottom: 72px; }
.dm-call-status { text-align: center; color: var(--text-muted); font-size: 14px; padding-top: 10px; }
.dm-call .voice-toolbar { padding: 10px 16px 14px; gap: 12px; }
.dm-call .voice-tool { width: 44px; height: 44px; }

.call-modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.75); z-index: 260;
  display: flex; align-items: center; justify-content: center; animation: fade-in .15s var(--ease);
}
.call-card {
  background: var(--bg-floating); border-radius: 16px; padding: 40px 48px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  box-shadow: 0 16px 60px rgba(0,0,0,.6); animation: pop-in .2s var(--ease);
}
.call-card .avatar.xl { animation: call-pulse 1.6s infinite; }
@keyframes call-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(88,101,242,.5); }
  50% { box-shadow: 0 0 0 16px rgba(88,101,242,0); }
}
.call-card .call-name { color: var(--header); font-size: 22px; font-weight: 700; margin-top: 8px; }
.call-card .call-sub { color: var(--text-muted); font-size: 14px; }
.call-card .call-actions { display: flex; gap: 24px; margin-top: 20px; }
.call-btn {
  width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center;
  justify-content: center; color: #fff; transition: transform .12s var(--ease), filter .15s var(--ease);
}
.call-btn:hover { filter: brightness(1.15); }
.call-btn:active { transform: scale(.92); }
.call-btn.accept { background: var(--green); }
.call-btn.decline { background: var(--red); }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.75); z-index: 200;
  display: flex; align-items: center; justify-content: center;
  animation: fade-in .15s var(--ease);
}
@keyframes fade-in { from { opacity: 0; } }
.modal {
  background: var(--bg-sidebar); border-radius: 12px; width: 440px; max-width: calc(100vw - 32px);
  max-height: calc(100vh - 64px); overflow-y: auto; animation: pop-in .2s var(--ease);
}
@keyframes pop-in { from { transform: scale(.95); opacity: 0; } }
.modal-header { padding: 24px 24px 0; text-align: center; }
.modal-header h2 { color: var(--header); font-size: 24px; }
.modal-header p { color: var(--text-muted); font-size: 15px; margin-top: 8px; }
.modal-body { padding: 24px; }
.modal-body label {
  display: block; color: #b0b3ba; font-size: 12px; font-weight: 700;
  text-transform: uppercase; margin: 16px 0 8px;
}
.modal-body label:first-child { margin-top: 0; }
.modal-body input[type=text], .modal-body textarea, .modal-body select {
  width: 100%; background: var(--bg-input); border: 1px solid transparent; border-radius: 6px;
  padding: 10px; color: var(--text-normal); font-size: 15px; outline: none;
  transition: border-color .15s var(--ease);
}
.modal-body input[type=text]:focus, .modal-body textarea:focus { border-color: var(--blurple); }
.modal-body textarea { resize: vertical; min-height: 80px; }
.modal-footer {
  padding: 16px 24px; background: var(--bg-card); display: flex;
  justify-content: flex-end; gap: 12px; border-radius: 0 0 12px 12px;
}
.btn-text { color: var(--text-normal); font-size: 14px; padding: 10px 16px; }
.btn-text:hover { text-decoration: underline; }
.btn-danger { background: var(--red); color: #fff; font-weight: 500; padding: 10px 16px; border-radius: 6px; font-size: 14px; transition: background .15s var(--ease); }
.btn-danger:hover { background: #d83a3e; }
.modal .btn-primary { padding: 10px 24px; font-size: 14px; margin: 0; }
.modal-error { color: var(--red); font-size: 13px; margin-top: 8px; }
.type-pick { display: flex; flex-direction: column; gap: 8px; }
.type-pick .type-opt {
  display: flex; align-items: center; gap: 12px; background: var(--bg-card);
  padding: 12px; border-radius: 8px; cursor: pointer; border: 1px solid transparent;
  transition: background .15s var(--ease), border-color .15s var(--ease);
}
.type-pick .type-opt.sel { background: var(--bg-hover); border-color: var(--text-faint); }
.type-opt .t-name { color: var(--header); font-weight: 500; }
.type-opt .t-desc { color: var(--text-muted); font-size: 13px; }
.invite-code-box {
  display: flex; background: var(--bg-input); border-radius: 6px; padding: 4px 4px 4px 12px;
  align-items: center; gap: 8px;
}
.invite-code-box code { flex: 1; color: var(--text-normal); font-size: 15px; overflow: hidden; text-overflow: ellipsis; }
.invite-code-box .btn-primary { flex-shrink: 0; padding: 6px 16px; }

.settings-screen {
  position: fixed; inset: 0; background: var(--bg-base); z-index: 150;
  display: flex; animation: fade-in .15s var(--ease);
}
.settings-nav {
  width: 220px; background: var(--bg-sidebar); padding: 60px 8px 60px 20px;
  overflow-y: auto; flex-shrink: 0; margin-left: auto;
}
.settings-nav-inner { width: 192px; margin-left: auto; }
.settings-nav .side-label { padding-left: 10px; }
.settings-content-wrap { display: flex; flex: 1; min-width: 0; overflow: hidden; }
.settings-content { width: 740px; max-width: calc(100% - 80px); padding: 60px 40px; overflow-y: auto; position: relative; }
.settings-content h2 { color: var(--header); font-size: 20px; margin-bottom: 20px; }
.settings-close-col { padding-top: 60px; flex-shrink: 0; }
.settings-close {
  width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--text-faint);
  color: var(--text-faint); display: flex; align-items: center; justify-content: center; font-size: 18px;
  transition: color .15s var(--ease), border-color .15s var(--ease);
}
.settings-esc { text-align: center; color: var(--text-faint); font-size: 11px; font-weight: 700; margin-top: 6px; }
.settings-close:hover { color: var(--header); border-color: var(--header); }
.settings-card { background: var(--bg-card); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.settings-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.settings-row .s-label { color: var(--text-faint); font-size: 12px; font-weight: 700; text-transform: uppercase; }
.settings-row .s-value { color: var(--header); font-size: 15px; }
.field-label { display: block; color: #b0b3ba; font-size: 12px; font-weight: 700; text-transform: uppercase; margin: 16px 0 8px; }
.settings-card input[type=text], .settings-card textarea {
  width: 100%; background: var(--bg-input); border: 1px solid transparent; border-radius: 6px;
  padding: 10px; color: var(--text-normal); font-size: 15px; outline: none;
  transition: border-color .15s var(--ease);
}
.settings-card input[type=text]:focus, .settings-card textarea:focus { border-color: var(--blurple); }
.color-row { display: flex; gap: 12px; align-items: center; }
.color-row input[type=color] { width: 60px; height: 36px; border: none; background: none; cursor: pointer; }

.popout-backdrop { position: fixed; inset: 0; z-index: 180; }
.profile-card {
  position: fixed; width: 340px; background: var(--bg-floating); border-radius: 12px;
  overflow: hidden; z-index: 190; box-shadow: 0 12px 40px rgba(0,0,0,.55);
  animation: pop-in .18s var(--ease);
}
.profile-banner { height: 60px; }
.profile-card .avatar.xl { margin: -40px 0 0 16px; border: 6px solid var(--bg-floating); }
.profile-inner { background: var(--bg-card); margin: 12px 16px 16px; border-radius: 10px; padding: 12px; }
.profile-inner .p-name { color: var(--header); font-size: 20px; font-weight: 700; }
.profile-inner .p-tag { color: var(--text-normal); font-size: 14px; }
.profile-inner .p-custom { color: var(--text-normal); font-size: 14px; margin-top: 6px; }
.profile-divider { height: 1px; background: var(--divider); margin: 12px 0; }
.profile-inner .p-section { color: var(--header); font-size: 12px; font-weight: 700; text-transform: uppercase; margin-bottom: 6px; }
.profile-inner .p-body { color: var(--text-normal); font-size: 14px; white-space: pre-wrap; word-wrap: break-word; }
.profile-actions { display: flex; gap: 8px; margin-top: 12px; }
.profile-actions .btn-primary { flex: 1; padding: 8px; font-size: 14px; }
.profile-actions .btn-danger { flex: 1; padding: 8px; font-size: 14px; }

.status-menu {
  position: fixed; width: 220px; background: var(--bg-floating); border-radius: 10px;
  padding: 8px; z-index: 190; box-shadow: 0 8px 24px rgba(0,0,0,.5);
  animation: pop-in .15s var(--ease);
}
.status-opt { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 6px; cursor: pointer; font-size: 14px; color: var(--text-normal); transition: background .12s var(--ease); }
.status-opt:hover { background: var(--blurple); color: #fff; }
.status-opt .dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

#toast-root { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--bg-floating); color: var(--text-normal); padding: 10px 16px; border-radius: 10px;
  font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.45); animation: pop-in .18s var(--ease);
}
.toast.err { border-left: 3px solid var(--red); }
.toast.ok { border-left: 3px solid var(--green); }

.ctx-menu {
  position: fixed; background: var(--bg-floating); border-radius: 10px; padding: 6px; z-index: 250;
  min-width: 190px; box-shadow: 0 12px 32px rgba(0,0,0,.55);
  animation: pop-in .12s var(--ease);
}
.ctx-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px; border-radius: 6px; font-size: 14px; color: var(--text-normal); cursor: pointer;
  transition: background .1s var(--ease), color .1s var(--ease);
}
.ctx-item:hover { background: var(--blurple); color: #fff; }
.ctx-item.danger { color: var(--red); }
.ctx-item.danger:hover { background: var(--red); color: #fff; }
.ctx-sep { height: 1px; background: var(--divider); margin: 4px 6px; }
.ctx-emoji-row { display: flex; gap: 2px; padding: 4px; }
.ctx-emoji-row button {
  width: 32px; height: 32px; border-radius: 6px; font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  transition: background .1s var(--ease), transform .1s var(--ease);
}
.ctx-emoji-row button:hover { background: var(--bg-hover); transform: scale(1.15); }

.emoji-pop {
  position: fixed; background: var(--bg-floating); border-radius: 10px; padding: 8px; z-index: 255;
  display: flex; gap: 4px; box-shadow: 0 12px 32px rgba(0,0,0,.55); animation: pop-in .12s var(--ease);
}
.emoji-pop button {
  width: 36px; height: 36px; border-radius: 8px; font-size: 20px;
  display: flex; align-items: center; justify-content: center;
  transition: background .1s var(--ease), transform .1s var(--ease);
}
.emoji-pop button:hover { background: var(--bg-hover); transform: scale(1.15); }

.md-link { color: var(--link); text-decoration: none; }
.md-link:hover { text-decoration: underline; }
.md-code {
  background: var(--bg-input); border-radius: 4px; padding: 2px 5px;
  font-family: ui-monospace, 'Cascadia Code', Consolas, Menlo, monospace; font-size: .85em;
}
.md-codeblock {
  position: relative; background: var(--bg-input); border: 1px solid var(--divider);
  border-radius: 8px; margin: 6px 0; max-width: 640px; overflow: hidden;
}
.md-codeblock pre { margin: 0; padding: 10px 12px; overflow-x: auto; }
.md-codeblock code {
  font-family: ui-monospace, 'Cascadia Code', Consolas, Menlo, monospace;
  font-size: 13px; line-height: 1.45; color: var(--text-normal); white-space: pre;
}
.cb-lang {
  padding: 5px 12px 0; color: var(--text-faint); font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px;
}
.cb-copy {
  position: absolute; top: 6px; right: 6px; padding: 3px 9px; border-radius: 5px;
  background: var(--bg-hover); color: var(--text-muted); font-size: 11px; font-weight: 600;
  opacity: 0; transition: opacity .15s var(--ease);
}
.md-codeblock:hover .cb-copy { opacity: 1; }
.cb-copy:hover { color: #fff; }
.tok-kw { color: #c586c0; }
.tok-str { color: #ce9178; }
.tok-num { color: #b5cea8; }
.tok-com { color: #6a9955; font-style: italic; }
.md-h1, .md-h2, .md-h3 { color: var(--header); font-weight: 800; margin: 8px 0 4px; line-height: 1.25; }
.md-h1 { font-size: 24px; }
.md-h2 { font-size: 20px; }
.md-h3 { font-size: 17px; }
.md-small { color: var(--text-faint); font-size: 12px; }
.md-quote {
  border-left: 4px solid var(--divider); padding: 2px 10px; margin: 2px 0;
  color: var(--text-muted);
}
.md-spoiler {
  background: #060607; color: transparent; border-radius: 4px; padding: 0 3px; cursor: pointer;
  user-select: none;
}
.md-spoiler.revealed { background: rgba(255,255,255,.08); color: inherit; cursor: text; user-select: auto; }
.md-mention {
  background: color-mix(in srgb, var(--blurple) 25%, transparent); color: #c9cdfb;
  border-radius: 4px; padding: 0 3px; font-weight: 500; cursor: pointer;
}
.md-mention:hover { background: var(--blurple); color: #fff; }
.msg-group.mentions-me { background: rgba(240,178,50,.07); box-shadow: inset 2px 0 0 var(--yellow); }

.msg-attachments, .msg-embeds { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; align-items: flex-start; }
.attach-img, .embed-img {
  max-width: min(420px, 100%); max-height: 320px; border-radius: 8px; cursor: pointer;
  display: block; object-fit: contain;
}
.attach-video { max-width: min(480px, 100%); max-height: 340px; border-radius: 8px; background: #000; }
.attach-audio { width: min(400px, 100%); }
.attach-file {
  display: flex; align-items: center; gap: 10px; background: var(--bg-card);
  border: 1px solid var(--divider); border-radius: 8px; padding: 10px 14px;
  max-width: 420px; text-decoration: none;
}
.attach-file:hover { border-color: var(--text-faint); }
.af-icon { font-size: 24px; }
.af-info { display: flex; flex-direction: column; min-width: 0; }
.af-name { color: var(--link); font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.af-size { color: var(--text-faint); font-size: 12px; }
.af-dl { color: var(--text-muted); font-size: 18px; margin-left: auto; }
.embed-card {
  background: var(--bg-card); border-left: 4px solid var(--divider); border-radius: 6px;
  padding: 10px 14px; max-width: 460px; display: flex; flex-direction: column; gap: 4px;
}
.embed-site { color: var(--text-faint); font-size: 12px; }
.embed-title { color: var(--link); font-size: 15px; font-weight: 600; text-decoration: none; }
.embed-title:hover { text-decoration: underline; }
.embed-desc { color: var(--text-muted); font-size: 13px; line-height: 1.4; max-height: 74px; overflow: hidden; }
.embed-thumb { max-width: 100%; max-height: 220px; border-radius: 6px; margin-top: 6px; cursor: pointer; object-fit: contain; align-self: flex-start; }

.lightbox {
  position: fixed; inset: 0; z-index: 300; background: rgba(0,0,0,.85);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  animation: fade-in .12s var(--ease); cursor: zoom-out;
}
.lightbox img { max-width: 90vw; max-height: 84vh; border-radius: 4px; object-fit: contain; }
.lightbox-orig { color: #d8d9dc; font-size: 13px; opacity: .8; }
.lightbox-orig:hover { opacity: 1; text-decoration: underline; }

.chat-input-row { display: flex; align-items: flex-start; background: var(--bg-input); border-radius: 8px; }
.chat-input-row .chat-input { background: transparent; flex: 1; }
.chat-attach {
  color: var(--text-muted); padding: 10px 4px 10px 14px; flex-shrink: 0;
  display: flex; align-items: center; transition: color .15s var(--ease);
}
.chat-attach:hover { color: var(--header); }
.chat-input-wrap.drag-over .chat-input-row { outline: 2px dashed var(--blurple); outline-offset: 2px; }
.attach-chips { display: flex; gap: 10px; flex-wrap: wrap; padding: 10px 2px; }
.attach-chip {
  display: flex; align-items: center; gap: 8px; background: var(--bg-card);
  border: 1px solid var(--divider); border-radius: 8px; padding: 8px 10px; max-width: 220px;
}
.attach-chip img { width: 36px; height: 36px; object-fit: cover; border-radius: 4px; }
.attach-chip.uploading { opacity: .6; }
.chip-name { color: var(--text-normal); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-x { color: var(--text-muted); font-size: 13px; padding: 2px; }
.chip-x:hover { color: var(--red); }
.chip-spin {
  width: 14px; height: 14px; border: 2px solid var(--divider); border-top-color: var(--blurple);
  border-radius: 50%; animation: spin .8s linear infinite; flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

#rail-dms:not(:empty) { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.rail-item.dm-ping { position: relative; background: transparent !important; }
.rail-item.dm-ping .avatar { width: 48px; height: 48px; border-radius: 50%; font-size: 18px; }
.rail-item.dm-ping:hover .avatar { border-radius: 16px; }
.ping-badge {
  position: absolute; bottom: -2px; right: -2px; min-width: 20px; height: 20px;
  background: var(--red); color: #fff; font-size: 11px; font-weight: 800;
  border-radius: 10px; display: flex; align-items: center; justify-content: center;
  padding: 0 5px; border: 3px solid var(--bg-rail); box-sizing: border-box;
}
.ping-badge.inline { position: static; border: none; height: 18px; min-width: 18px; flex-shrink: 0; }

.qs-hint { color: var(--text-faint); font-size: 12px; margin: 8px 2px; }
.qs-list { max-height: 340px; overflow-y: auto; margin-top: 4px; }
.qs-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; cursor: pointer;
}
.qs-item.sel { background: var(--bg-hover); }
.qs-label { color: var(--header); font-size: 15px; font-weight: 500; }
.qs-sub { color: var(--text-faint); font-size: 12px; margin-left: auto; }
.qs-guild {
  width: 28px; height: 28px; border-radius: 50%; color: #fff; font-weight: 700; font-size: 13px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.qs-guild.xl { width: 64px; height: 64px; font-size: 26px; }
.qs-ch { color: var(--text-muted); display: flex; width: 28px; justify-content: center; flex-shrink: 0; }
.qs-empty { color: var(--text-muted); text-align: center; padding: 20px; }
#qs-input {
  width: 100%; background: var(--bg-input); border: none; border-radius: 6px;
  padding: 12px 14px; color: var(--text-normal); font-size: 16px; outline: none;
}

.settings-sep { height: 1px; background: var(--divider); margin: 8px 10px; }
.settings-nav .side-btn { width: 100%; text-align: left; }
.pref-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 0; border-bottom: 1px solid var(--divider);
}
.pref-row:last-child { border-bottom: none; }
.pref-label { color: var(--header); font-size: 15px; font-weight: 500; }
.pref-desc { color: var(--text-muted); font-size: 13px; margin-top: 2px; }
.field-hint { text-transform: none; font-weight: 400; color: var(--text-faint); letter-spacing: 0; }
.tgl {
  width: 42px; height: 26px; border-radius: 13px; background: #6d6f78; position: relative;
  flex-shrink: 0; transition: background .18s var(--ease); cursor: pointer;
}
.tgl .tgl-knob {
  position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; transition: left .18s var(--ease);
}
.tgl.on { background: var(--green); }
.tgl.on .tgl-knob { left: 19px; }
.theme-pick { display: flex; gap: 12px; }
.theme-opt {
  display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 8px;
  border: 2px solid var(--divider); cursor: pointer; color: var(--text-normal); font-size: 14px; font-weight: 500;
}
.theme-opt.sel { border-color: var(--blurple); }
.theme-opt span { width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--divider); }
.theme-opt.dark span { background: #29292d; }
.theme-opt.light span { background: #ffffff; }
.account-card { background: var(--bg-card); border-radius: 12px; overflow: hidden; margin-bottom: 16px; }
.account-banner { height: 90px; }
.account-head { display: flex; align-items: center; gap: 14px; padding: 0 16px; margin-top: -28px; }
.account-head .avatar.xl { border: 6px solid var(--bg-card); box-sizing: content-box; }
.account-name { color: var(--header); font-size: 20px; font-weight: 700; margin-top: 24px; }
.account-tag { color: var(--text-muted); font-size: 14px; font-weight: 400; }
.account-fields { padding: 20px 16px 8px; }
.account-fields .s-label { display: block; margin-bottom: 2px; }
.profile-editor { display: flex; gap: 24px; align-items: flex-start; }
.profile-editor-fields { flex: 1; min-width: 0; background: var(--bg-card); border-radius: 12px; padding: 16px; }
.profile-editor-fields input[type=text], .profile-editor-fields textarea {
  width: 100%; background: var(--bg-input); border: 1px solid transparent; border-radius: 6px;
  padding: 10px; color: var(--text-normal); font-size: 15px; outline: none;
}
.profile-editor-fields input[type=text]:focus, .profile-editor-fields textarea:focus { border-color: var(--blurple); }
.profile-preview { width: 320px; flex-shrink: 0; position: sticky; top: 0; }
.profile-card.preview { width: 100%; box-shadow: 0 8px 24px rgba(0,0,0,.35); }
.danger-card { border: 1px solid rgba(242,63,67,.4); }
.mic-meter { height: 10px; background: var(--bg-input); border-radius: 5px; overflow: hidden; margin-top: 10px; }
.mic-meter-fill { height: 100%; width: 0%; background: var(--green); transition: width .08s linear; border-radius: 5px; }
.crop-wrap { display: flex; justify-content: center; }
#crop-canvas { border-radius: 8px; cursor: grab; touch-action: none; }
#crop-canvas:active { cursor: grabbing; }

.dm-call { position: relative; }
.dm-call-grip {
  position: absolute; left: 0; right: 0; bottom: -4px; height: 8px; cursor: ns-resize; z-index: 5;
}
.dm-call-grip:hover, .dm-call-grip:active { background: color-mix(in srgb, var(--blurple) 55%, transparent); }

.compact-mode .msg-group { padding-top: 1px; padding-bottom: 1px; }
.compact-mode .msg-group:not(.compact) { margin-top: 8px; }
.compact-mode .msg-group .avatar.lg { width: 28px; height: 28px; font-size: 12px; }
.compact-mode .msg-content { font-size: 14px; }

.light-theme {
  --bg-rail: #e3e5e8;
  --bg-sidebar: #f2f3f5;
  --bg-base: #ffffff;
  --bg-input: #ebedef;
  --bg-floating: #ffffff;
  --bg-card: #f2f3f5;
  --bg-hover: #e0e1e5;
  --bg-active: #d4d7dc80;
  --text-normal: #313338;
  --text-muted: #5c5e66;
  --text-faint: #80848e;
  --header: #060607;
  --divider: #d7d9dc;
}
.light-theme .voice-view { background: #ebedef; }
.light-theme .video-tile video { background: #1c1c20; }
.light-theme .md-spoiler { background: #c4c9ce; }
.light-theme .md-spoiler.revealed { background: rgba(0,0,0,.07); }
.light-theme .msg-group.mentions-me { background: rgba(240,178,50,.12); }
.light-theme .tok-kw { color: #a626a4; }
.light-theme .tok-str { color: #986801; }
.light-theme .tok-num { color: #0184bc; }
.light-theme .tok-com { color: #7a8a66; }
.light-theme .md-mention { color: var(--blurple); }

.chat-input.ed-input {
  min-height: 44px; max-height: 40vh; overflow-y: auto; white-space: pre-wrap;
  word-break: break-word; cursor: text;
}
.ed-input:empty::before { content: attr(data-placeholder); color: var(--text-faint); pointer-events: none; }
.ed-line { white-space: pre-wrap; }
.ed-syn { color: var(--text-faint); opacity: .85; }
.ed-line.ed-h1 { font-size: 24px; font-weight: 800; color: var(--header); }
.ed-line.ed-h2 { font-size: 20px; font-weight: 800; color: var(--header); }
.ed-line.ed-h3 { font-size: 17px; font-weight: 800; color: var(--header); }
.ed-line.ed-sm { font-size: 12px; color: var(--text-faint); }
.ed-line.ed-quo { border-left: 4px solid var(--divider); padding-left: 8px; color: var(--text-muted); }
.ed-line.ed-fence, .ed-line.ed-codeline {
  font-family: ui-monospace, 'Cascadia Code', Consolas, Menlo, monospace; font-size: 13px;
  background: color-mix(in srgb, var(--bg-rail) 55%, transparent);
}
.ed-line.ed-fence { color: var(--text-faint); }
.ed-mono {
  font-family: ui-monospace, 'Cascadia Code', Consolas, Menlo, monospace; font-size: .9em;
  background: color-mix(in srgb, var(--bg-rail) 55%, transparent); border-radius: 3px;
}
.ed-link { color: var(--link); text-decoration: underline; }
.ed-spoil { background: rgba(255,255,255,.09); border-radius: 3px; }
.ed-mention {
  background: color-mix(in srgb, var(--blurple) 25%, transparent); color: #c9cdfb;
  border-radius: 4px; font-weight: 500;
}
.light-theme .ed-mention { color: var(--blurple); }
.light-theme .ed-spoil { background: rgba(0,0,0,.09); }

.ac-pop {
  background: var(--bg-floating); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.45);
  margin-bottom: 8px; padding: 8px; max-height: 320px; overflow-y: auto;
}
.ac-head {
  color: var(--text-faint); font-size: 11px; font-weight: 700; text-transform: uppercase;
  padding: 4px 8px 8px; letter-spacing: .02em;
}
.ac-head b { color: var(--text-muted); text-transform: none; }
.ac-item {
  display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 6px; cursor: pointer;
}
.ac-item.sel { background: var(--bg-hover); }
.ac-name { color: var(--header); font-size: 14px; font-weight: 500; }
.ac-sub { color: var(--text-faint); font-size: 12px; margin-left: auto; }
.ac-emoji { font-size: 20px; width: 28px; text-align: center; }

.char-count {
  align-self: flex-end; padding: 12px 14px 12px 4px; font-size: 12px; font-weight: 600;
  color: var(--text-muted); flex-shrink: 0;
}
.char-count.over { color: var(--red); }
