:root {
  --bg-deep: #0c0c10;
  --bg-primary: #111116;
  --bg-secondary: #16161d;
  --bg-tertiary: #1c1c25;
  --bg-hover: rgba(255,255,255,0.05);
  --bg-active: rgba(255,255,255,0.10);
  --brand-color: #7c5cfc;
  --brand-gradient: linear-gradient(135deg, #7c5cfc, #a855f7);
  --brand-hover: #6d4fe0;
  --accent-danger: #ef4444;
  --accent-green: #22c55e;
  --text-normal: #d1d5db;
  --text-muted: #6b7280;
  --text-header: #f3f4f6;
  --glass-bg: rgba(22, 22, 29, 0.75);
  --glass-border: rgba(255, 255, 255, 0.06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Outfit', sans-serif; background: var(--bg-deep); color: var(--text-normal); overflow: hidden; height: 100vh; display: flex; flex-direction: column; -webkit-font-smoothing: antialiased; }

/* Titlebar */
.titlebar { height: 32px; background: var(--bg-deep); display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--glass-border); font-size: 13px; font-weight: 500; color: var(--text-muted); user-select: none; }
.titlebar .title { padding-left: 16px; letter-spacing: 0.5px; }
.window-controls { display: flex; height: 100%; }
.window-controls button { background: none; border: none; color: var(--text-muted); width: 44px; cursor: pointer; transition: 0.2s; font-size: 14px;}
.window-controls button:hover { background: var(--bg-hover); color: var(--text-header); }
#win-close:hover { background: var(--accent-danger); color: white; }

/* Global App Layout */
.app-container { display: flex; flex: 1; overflow: hidden; height: calc(100vh - 32px); }
.main-content { flex: 1; display: flex; overflow: hidden; background: var(--bg-deep); border-radius: 20px 0 0 0; }

/* Server Nav */
.servers-nav { width: 72px; background: var(--bg-deep); padding: 16px 0; display: flex; flex-direction: column; align-items: center; gap: 12px; z-index: 10; border-right: 1px solid var(--glass-border); }
.server-icon { width: 48px; height: 48px; background: var(--bg-tertiary); border-radius: 24px; display: flex; justify-content: center; align-items: center; cursor: pointer; transition: 0.4s cubic-bezier(0.4, 0, 0.2, 1); color: var(--text-muted); position: relative; border: 1px solid rgba(255,255,255,0.02); }
.server-icon svg { width: 24px; height: 24px; }
.server-icon:hover { border-radius: 14px; background: var(--brand-color); color: white; box-shadow: 0 8px 16px rgba(99, 102, 241, 0.2); }
.server-icon.active { border-radius: 14px; background: var(--brand-gradient); color: white; box-shadow: 0 8px 16px rgba(99, 102, 241, 0.3); }
.server-icon::before { content: ''; position: absolute; left: -16px; top: 20px; width: 4px; height: 8px; background: white; border-radius: 0 4px 4px 0; opacity: 0; transition: 0.3s; }
.server-icon:hover::before { opacity: 0.5; top: 12px; height: 24px; }
.server-icon.active::before { opacity: 1; top: 8px; height: 32px; }
.separator { width: 32px; height: 2px; background: var(--glass-border); border-radius: 1px; }

/* Channels Sidebar */
.channels-sidebar { width: 260px; min-width: 200px; max-width: 500px; overflow-y: hidden; overflow-x: hidden; background: var(--bg-primary); display: flex; flex-direction: column; border-right: 1px solid var(--glass-border); z-index: 2; position: relative; }
.server-header { height: 60px; padding: 0 20px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--glass-border); cursor: pointer; transition: 0.2s; }
.server-header:hover { background: var(--bg-hover); }
.server-header h2 { font-size: 16px; font-weight: 600; color: var(--text-header); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: 0.2px; }
.ping-badge { font-size: 11px; background: rgba(255,255,255,0.05); color: var(--text-muted); padding: 4px 8px; border-radius: 12px; font-weight: 500; font-family: monospace; border: 1px solid rgba(255,255,255,0.05); }

.channels-scroll { flex: 1; overflow-y: auto; padding: 16px 12px; }
.category { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin: 16px 0 6px 8px; }
.channel-item { display: flex; align-items: center; padding: 8px 10px; margin-bottom: 2px; border-radius: 8px; cursor: pointer; color: var(--text-muted); font-size: 14.5px; transition: background-color 0.15s, color 0.15s; font-weight: 500; }
.channel-item:hover { background: var(--bg-hover); color: var(--text-normal); }
.channel-item.active { background: rgba(124, 92, 252, 0.12); color: var(--text-header); box-shadow: inset 3px 0 0 var(--brand-color); }
.channel-item .icon { font-size: 16px; margin-right: 8px; opacity: 0.7; }

.vc-users-list { display: flex; flex-direction: column; gap: 2px; }
.vc-u { display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 34px; font-size: 13px; color: var(--text-muted); cursor: pointer; border-radius: 6px; }
.vc-u:hover { background: var(--bg-hover); color: var(--text-normal); }
.vc-u .av { width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0; }

/* User Controls */
.user-controls { height: 64px; background: var(--bg-secondary); padding: 0 8px 0 14px; display: flex; align-items: center; border-top: 1px solid var(--glass-border); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-gradient); margin-right: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.3); position: relative; flex-shrink: 0; }
.avatar::after { content:''; position: absolute; bottom: -1px; right: -1px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent-green); border: 2.5px solid var(--bg-secondary); }
.user-info { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.user-info .username { font-size: 14px; font-weight: 600; color: var(--text-header); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.2; }
.user-info .status { font-size: 11px; color: var(--text-muted); font-weight: 400; margin-top: 2px; }
.control-btns { display: flex; gap: 2px; }
.control-btns button { width: 32px; height: 32px; border-radius: 8px; background: transparent; border: none; color: var(--text-normal); cursor: pointer; transition: 0.2s; display: flex; align-items: center; justify-content: center; font-size: 16px; }
.control-btns button:hover { background: var(--bg-hover); }
.control-btns button.muted { color: var(--accent-danger); position: relative; }
.control-btns button.muted::after { content: ''; position: absolute; width: 24px; height: 2px; background: var(--accent-danger); transform: rotate(45deg); border-radius: 1px; }

/* Chat Area */
.chat-area { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.chat-header { height: 60px; padding: 0 24px; border-bottom: 1px solid var(--glass-border); display: flex; align-items: center; gap: 12px; }
.chat-header .hash { font-size: 22px; color: var(--text-muted); margin-right: 10px; font-weight: 300; }
.chat-header h3 { font-size: 16px; font-weight: 600; }
.spacer { flex: 1; }
.icon-action { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 18px; padding: 8px; border-radius: 8px; transition: 0.2s; }
.icon-action:hover { background: var(--bg-hover); color: var(--text-normal); }

.messages-container { flex: 1; overflow-y: auto; padding: 20px 24px; display: flex; flex-direction: column; gap: 4px; }
.message { display: flex; flex-direction: column; font-size: 14.5px; line-height: 1.5; padding: 8px 12px; border-radius: 8px; transition: background 0.1s; }
.message:hover { background: rgba(255,255,255,0.02); }
.msg-body { display: flex; gap: 16px; width: 100%; }

/* Voice user status icons */
.vc-u-status { display: flex; gap: 4px; align-items: center; margin-left: auto; }
.status-icon {
  font-size: 11px;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  opacity: 0.65;
  user-select: none;
}
.status-icon.muted, .status-icon.deafened {
  color: var(--accent-danger);
}
.status-icon.muted::after, .status-icon.deafened::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 1.5px;
  background: var(--accent-danger);
  transform: rotate(45deg);
  border-radius: 1px;
  box-shadow: 0 0 2px rgba(0,0,0,0.5);
}
.message.system { color: var(--text-muted); font-size: 12px; justify-content: center; margin: 12px 0; display: flex; align-items: center; gap: 10px; padding: 4px; }
.message.system:hover { background: transparent; }
.message.system::before, .message.system::after { content:''; height: 1px; flex: 1; background: var(--glass-border); max-width: 50px; }
.message .avatar { flex-shrink: 0; width: 40px; height: 40px; border-radius: 50%; }
.message .avatar::after { display: none; }
.msg-content { display: flex; flex-direction: column; }
.msg-content .msg-header { margin-bottom: 4px; display: flex; align-items: baseline; gap: 6px; }
.msg-content .name { font-weight: 600; color: var(--text-header); font-size: 15px; }
.msg-content .time { font-size: 11px; color: var(--text-muted); }

/* Message Actions — hidden until hover */
.msg-actions { opacity: 0; transition: opacity 0.12s ease; margin-left: auto; display: flex; gap: 4px; }
.message:hover .msg-actions { opacity: 1; }
.msg-actions button { padding: 2px 6px; border-radius: 4px; }
.msg-actions button:hover { background: rgba(255,255,255,0.08); }

/* Reply indicator (Discord-style) */
.msg-reply { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-muted); margin-bottom: 4px; margin-left: 56px; cursor: pointer; padding: 3px 8px; border-radius: 4px; transition: background 0.1s; position: relative; }
.msg-reply:hover { background: rgba(255,255,255,0.04); color: var(--text-normal); }
.msg-reply::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--brand-color); border-radius: 2px; }
.reply-avatar { width: 16px; height: 16px; border-radius: 50%; flex-shrink: 0; }
.reply-name { font-weight: 600; color: var(--brand-color); font-size: 12px; }
.reply-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 350px; font-size: 12px; }

/* Message highlight animation (when scrolled to via reply) */
.message.highlight { animation: msg-highlight 2s ease-out; }
@keyframes msg-highlight {
  0% { background: rgba(124,92,252,0.2); }
  100% { background: transparent; }
}

/* Speaking name highlight (white like Discord) */
.vc-u.is-speaking { color: var(--text-header); }
.vc-u.is-speaking .av { box-shadow: 0 0 0 2px var(--accent-green); }

/* File links in chat */
.file-link { color: var(--brand-color); text-decoration: none; font-size: 13px; display: inline-flex; align-items: center; gap: 4px; padding: 6px 10px; background: rgba(124,92,252,0.08); border-radius: 6px; border: 1px solid rgba(124,92,252,0.15); margin-top: 4px; }
.file-link:hover { background: rgba(124,92,252,0.15); text-decoration: none; }
.msg-files { margin-top: 6px; }
.msg-files img { display: block; border-radius: 8px; }
.msg-av { flex-shrink: 0; }
.msg-av::after { display: none; }

/* File Transfer Styling */
.file-preview { display: flex; flex-wrap: wrap; gap: 8px; }
.file-item { display: flex; align-items: center; background: rgba(124,92,252,0.08); border: 1px solid rgba(124,92,252,0.2); padding: 6px 10px; border-radius: 8px; gap: 8px; }
.file-item .icon { font-size: 16px; }
.file-item .filename { font-size: 12px; color: var(--text-normal); max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.chat-input-wrapper { margin: 0 20px 24px; background: var(--bg-secondary); border: 1px solid var(--glass-border); border-radius: 16px; padding: 8px 16px; display: flex; align-items: center; transition: 0.2s; }
.chat-input-wrapper:focus-within { border-color: rgba(99, 102, 241, 0.5); box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.1); }
.chat-input-wrapper input { flex: 1; background: transparent; border: none; outline: none; color: var(--text-normal); font-size: 15px; padding: 8px 0; font-family: inherit; }
.chat-input-wrapper input:disabled { opacity: 0.5; }
#btn-attach { background: var(--bg-hover); border: none; color: var(--text-normal); cursor: pointer; width: 28px; height: 28px; border-radius: 50%; font-size: 18px; display: flex; align-items: center; justify-content: center; margin-right: 12px; transition: 0.2s; }
#btn-attach:hover { background: var(--text-normal); color: var(--bg-secondary); }

/* Users Sidebar */
.users-sidebar { position: relative; width: 260px; min-width: 200px; max-width: 400px; overflow-x: hidden; overflow-y: hidden; background: var(--bg-primary); border-left: 1px solid var(--glass-border); padding: 20px 12px; display: flex; flex-direction: column; z-index: 2; direction: rtl; }
.users-sidebar > * { direction: ltr; }
.users-header { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 12px; padding-left: 8px; }

.user-item { padding: 10px; border-radius: 10px; display: flex; flex-direction: column; gap: 10px; background: var(--bg-secondary); border: 1px solid var(--glass-border); margin-bottom: 8px; }
.user-item:hover { background: var(--bg-tertiary); }
.user-row { display: flex; align-items: center; }
.user-row .avatar { width: 32px; height: 32px; border-radius: 50%; margin-right: 12px; }
.user-row .name { font-size: 14px; flex: 1; font-weight: 500; color: var(--text-header); }
.user-row .indicator { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; margin-right: 4px; box-shadow: 0 0 8px #22c55e; }

/* Sliders */
.range-wrapper { display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--text-muted); }
.volume-slider { flex: 1; height: 4px; -webkit-appearance: none; background: var(--bg-deep); border-radius: 2px; outline: none; }
.volume-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--brand-color); cursor: pointer; border: 2px solid var(--bg-secondary); }

/* Glass Modal */
.modal { position: fixed; inset: 32px 0 0 0; background: rgba(0,0,0,0.8); backdrop-filter: blur(4px); display: flex; justify-content: center; align-items: center; z-index: 100; transition: 0.3s; }
.hidden { opacity: 0; pointer-events: none; }
.glass { background: var(--bg-secondary); border: 1px solid var(--glass-border); border-radius: 16px; padding: 32px; width: 440px; box-shadow: 0 24px 48px rgba(0,0,0,0.5); }
.glass h2 { margin-bottom: 24px; font-size: 24px; font-weight: 700; color: white; }
.setting-group { margin-bottom: 20px; display: flex; flex-direction: column; gap: 8px; }
.setting-group label { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.setting-group input[type="text"], .setting-group select { background: var(--bg-deep); border: 1px solid var(--glass-border); border-radius: 8px; padding: 12px; color: white; outline: none; transition: 0.2s; font-family: inherit; font-size: 14px; }
.setting-group input[type="text"]:focus, .setting-group select:focus { border-color: var(--brand-color); }

.modal-actions { display: flex; gap: 12px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--glass-border); flex-shrink: 0; }
.btn-primary { background: var(--brand-gradient); color: white; border: none; padding: 12px; border-radius: 8px; flex: 1; font-weight: 600; cursor: pointer; transition: 0.2s; font-size: 14.5px; }
.btn-primary:hover { opacity: 0.9; box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4); }
.btn-secondary { background: transparent; color: var(--text-normal); border: 1px solid var(--glass-border); padding: 12px; border-radius: 8px; flex: 1; font-weight: 600; cursor: pointer; transition: 0.2s; font-size: 14.5px; }
.btn-secondary:hover { background: var(--bg-hover); }

/* Scrollbars */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.05); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.1); }

/* Toasts */
.toast-container { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 10px; z-index: 1000; pointer-events: none; }
.toast { background: var(--glass-bg); backdrop-filter: blur(12px); border: 1px solid var(--glass-border); padding: 12px 16px; border-radius: 8px; color: var(--text-normal); font-size: 14px; box-shadow: 0 8px 32px rgba(0,0,0,0.5); transform: translateX(120%); transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); min-width: 200px; display: flex; align-items: center; gap: 10px; pointer-events: auto; }
.toast.show { transform: translateX(0); }
.toast.error { border-left: 4px solid var(--accent-danger); }
.toast.success { border-left: 4px solid #22c55e; }

/* New Send Button */
.btn-send { background: transparent; border: none; font-size: 18px; color: var(--brand-color); cursor: pointer; transition: 0.2s; padding: 0 8px; display: flex; align-items: center; justify-content: center;}
.btn-send:hover { color: var(--brand-hover); transform: scale(1.1); }

/* Drag Hover effect */
.drag-over { border: 2px dashed var(--brand-color) !important; background: rgba(99, 102, 241, 0.1) !important; }

/* Video Grid Area */
.video-grid { padding: 8px 24px; display: flex; flex-wrap: wrap; gap: 12px; justify-content: flex-start; transition: min-height 0.3s; background: var(--bg-deep); border-bottom: 1px solid var(--glass-border); }
.video-grid.hidden { padding: 0; border: none; overflow: hidden; opacity: 0; min-height: 0; }

/* Video Wrapper Overlay */
.video-wrapper { position: relative; border-radius: 12px; overflow: hidden; background: black; box-shadow: 0 4px 12px rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; aspect-ratio: 16/9; width: 100%; max-width: 400px; flex-shrink: 0; transition: max-width 0.28s var(--ease-out), box-shadow 0.2s; outline: none; cursor: pointer; }
.video-wrapper video { width: 100%; height: 100%; object-fit: contain; background: #000; pointer-events: none; }
.video-wrapper.screen-share { max-width: 500px; }
.video-wrapper.focused { max-width: 100%; width: 100%; height: auto; max-height: 55vh; aspect-ratio: 16/9; flex: 1 1 100%; box-shadow: 0 8px 32px rgba(0,0,0,0.7); }
.video-controls { position: absolute; inset: 0; background: linear-gradient(0deg, rgba(0,0,0,0.8) 0%, transparent 40%, transparent 70%, rgba(0,0,0,0.5) 100%); opacity: 0; transition: 0.25s ease-in-out; display: flex; flex-direction: column; justify-content: space-between; padding: 12px; pointer-events: none; z-index: 5; }
.video-wrapper.controls-active .video-controls,
.video-wrapper:fullscreen .video-controls,
.video-wrapper.stats-open .video-controls { opacity: 1; pointer-events: auto; }

/* Top controls */
.v-header { display: flex; justify-content: space-between; align-items: center; pointer-events: auto; }
.v-header-left { display: flex; align-items: center; gap: 8px; }
.v-name { color: white; font-size: 13px; font-weight: 500; text-shadow: 0 1px 4px black; }
.v-group { display: flex; gap: 8px; }
.v-btn { background: rgba(0,0,0,0.5); border: 1px solid rgba(255,255,255,0.08); color: white; width: 28px; height: 28px; border-radius: 6px; cursor: pointer; transition: 0.2s; backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; font-size: 14px; }
.v-btn:hover { background: rgba(255,255,255,0.25); transform: scale(1.08); border-color: rgba(255,255,255,0.2); }
.v-btn.active { color: var(--brand-color); background: rgba(124, 92, 252, 0.2); border-color: var(--brand-color); }

/* Live Pulse Badge */
.v-badge-live { background: var(--accent-danger); color: white; font-size: 10px; font-weight: 700; padding: 3px 6px; border-radius: 4px; display: inline-flex; align-items: center; gap: 4px; text-transform: uppercase; letter-spacing: 0.5px; line-height: 1; box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4); }
.v-badge-live::before { content: ''; width: 6px; height: 6px; background: white; border-radius: 50%; display: inline-block; animation: pulse-live 1.5s infinite; }
@keyframes pulse-live {
  0% { transform: scale(0.8); opacity: 0.5; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.8); opacity: 0.5; }
}

/* Custom Bottom Bar */
.v-bottom-bar { display: flex; justify-content: space-between; align-items: center; width: 100%; background: rgba(15, 15, 22, 0.8); padding: 6px 12px; border-radius: 8px; backdrop-filter: blur(8px); border: 1px solid rgba(255, 255, 255, 0.05); pointer-events: auto; }
.v-bottom-group { display: flex; align-items: center; gap: 10px; }

/* Custom Volume Slider */
.v-vol-control { display: flex; align-items: center; gap: 6px; }
.v-vol-slider { width: 0px; opacity: 0; height: 4px; -webkit-appearance: none; background: rgba(255, 255, 255, 0.2); border-radius: 2px; outline: none; transition: width 0.2s ease, opacity 0.2s ease; cursor: pointer; }
.v-vol-control:hover .v-vol-slider,
.v-vol-slider:focus { width: 60px; opacity: 1; }
.v-vol-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 10px; height: 10px; border-radius: 50%; background: var(--brand-color); border: 1px solid white; transition: 0.1s; }
.v-vol-slider::-webkit-slider-thumb:hover { transform: scale(1.2); }
.v-vol-slider::-moz-range-thumb { width: 10px; height: 10px; border-radius: 50%; background: var(--brand-color); border: 1px solid white; transition: 0.1s; cursor: pointer; }
.v-vol-slider::-moz-range-thumb:hover { transform: scale(1.2); }

/* Stats Panel overlay */
.v-stats-panel { position: absolute; top: 48px; left: 12px; background: rgba(10, 10, 15, 0.85); backdrop-filter: blur(10px); border: 1px solid var(--glass-border); padding: 10px 14px; border-radius: 8px; font-family: monospace; font-size: 11px; color: #a3e635; display: flex; flex-direction: column; gap: 4px; z-index: 10; pointer-events: auto; box-shadow: 0 4px 12px rgba(0,0,0,0.5); opacity: 1; transition: opacity 0.2s ease-in-out; }
.v-stats-panel.hidden { opacity: 0; pointer-events: none; }
.v-stats-row { display: flex; justify-content: space-between; gap: 16px; }
.v-stats-val { color: white; }


/* Context Menu */
.context-menu { position: fixed; z-index: 1000; background: rgba(10,10,12,0.95); border: 1px solid var(--glass-border); box-shadow: 0 8px 32px rgba(0,0,0,0.8); border-radius: 12px; min-width: 200px; padding: 8px 0; color: white; transition: opacity 0.1s; pointer-events: auto; backdrop-filter: blur(10px); }
.context-menu.hidden { opacity: 0; pointer-events: none; }
.cx-header { font-size: 11px; text-transform: uppercase; color: var(--text-muted); padding: 4px 16px; margin-bottom: 4px; font-weight: 600; border-bottom: 1px solid rgba(255,255,255,0.05); }
.cx-actions, .cx-section { display: flex; flex-direction: column; }
.cx-section.hidden { display: none; }
.cx-btn { background: transparent; border: none; color: white; padding: 8px 16px; font-size: 14px; text-align: left; cursor: pointer; transition: 0.2s; font-family: inherit; width: 100%; }
.cx-btn:hover { background: rgba(255,255,255,0.1); }
.cx-btn.danger { color: #fb7185; }
.cx-btn.danger:hover { background: rgba(251, 113, 133, 0.12); }
.cx-item { padding: 8px 16px; font-size: 14px; cursor: pointer; transition: 0.2s; }
.cx-item:hover { background: rgba(255,255,255,0.1); }
.cx-item-static:hover { background: transparent; cursor: default; }
.cx-slider { padding: 4px 16px 8px; }
.cx-slider input { width: 100%; cursor: pointer; accent-color: var(--brand-color); }
.cx-check { display: flex; align-items: center; justify-content: space-between; padding: 8px 16px; font-size: 14px; cursor: pointer; transition: 0.2s; }
.cx-check:hover { background: rgba(255,255,255,0.1); }
.cx-check .box { width: 16px; height: 16px; border: 1px solid var(--glass-border); border-radius: 4px; display: flex; align-items: center; justify-content: center; font-size: 10px; color: transparent; background: rgba(0,0,0,0.5); }
.cx-check.active .box { color: var(--brand-color); background: rgba(255,255,255,0.1); border-color: var(--brand-color); }

.server-card { background: rgba(255,255,255,0.03); border: 1px solid var(--glass-border); border-radius: 16px; padding: 20px; transition: 0.2s; display: flex; flex-direction: column; gap: 12px; }
.server-card:hover { transform: translateY(-4px); background: rgba(255,255,255,0.05); }
.server-card .sc-title { font-size: 18px; font-weight: 600; }
.server-card .sc-info { color: var(--text-muted); font-size: 13px; }
.btn-join:hover { filter: brightness(1.2); }
.btn-join { background: var(--brand-color); color: white; border: none; padding: 10px; border-radius: 8px; font-weight: 600; cursor: pointer; transition: 0.2s; margin-top: auto; }

/* Tabbed Settings Modal */
.settings-modal-content {
  width: 760px !important;
  height: 520px !important;
  max-width: 90vw;
  max-height: 90vh;
  padding: 0 !important;
  display: flex !important;
  flex-direction: row !important;
  overflow: hidden;
}
.modal-sidebar {
  width: 220px;
  background: rgba(0, 0, 0, 0.15);
  border-right: 1px solid var(--glass-border);
  padding: 24px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sidebar-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
  padding-left: 12px;
}
.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 8px 12px;
  border-radius: 6px;
  text-align: left;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  transition: background-color 0.15s, color 0.15s;
  font-family: inherit;
  outline: none;
}
.tab-btn:hover {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-normal);
}
.tab-btn.active {
  color: white;
  background: rgba(255, 255, 255, 0.07);
}
.btn-reset-tab {
  background: transparent;
  border: none;
  color: var(--accent-danger);
  padding: 8px 12px;
  border-radius: 6px;
  text-align: left;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  transition: background-color 0.15s, color 0.15s;
  font-family: inherit;
  margin-top: auto;
  outline: none;
}
.btn-reset-tab:hover {
  background: rgba(239, 68, 68, 0.1);
}
.modal-body {
  flex: 1;
  padding: 28px 32px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
}
.tab-content {
  display: none;
  flex-direction: column;
  gap: 16px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 8px;
}
.tab-content.active {
  display: flex;
}
.tab-content h2 {
  margin-bottom: 8px;
  font-size: 20px;
  font-weight: 700;
  color: white;
}

/* Discord-like Input Sensitivity UI */
.sens-meter-container {
  position: relative;
  width: 100%;
  height: 8px;
  background: var(--bg-deep);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 8px;
  margin-bottom: 8px;
}
.sens-meter-bg {
  position: absolute;
  inset: 0;
  background: var(--bg-tertiary);
  border-radius: 4px;
}
.sens-meter-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 0%;
  border-radius: 4px;
  transform-origin: left;
  transition: width 0.05s ease;
  background: #eab308; /* Fallback */
}
.sens-slider-wrapper {
  position: relative;
  width: 100%;
  height: 24px;
  display: flex;
  align-items: center;
  margin-top: 8px;
}
.sens-slider-native {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  -webkit-appearance: none;
  background: transparent;
  pointer-events: auto;
  margin: 0;
  z-index: 15;
}
.sens-slider-native::-webkit-slider-runnable-track {
  background: transparent;
  border: none;
}
.sens-slider-native::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: white;
  border: 1px solid rgba(0,0,0,0.5);
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
  cursor: pointer;
  z-index: 20;
  position: relative;
}
.sens-slider-native::-moz-range-track {
  background: transparent;
  border: none;
}
.sens-slider-native::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: white;
  border: 1px solid rgba(0,0,0,0.5);
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
  cursor: pointer;
  z-index: 20;
}
.sens-meter-marker {
  position: absolute;
  top: -4px;
  bottom: -4px;
  width: 4px;
  background: white;
  border-radius: 2px;
  z-index: 10;
  box-shadow: 0 0 4px rgba(0,0,0,0.5);
  pointer-events: none;
  transition: left 0.05s ease;
}

/* Switch Toggle Styling (Discord-like) */
.switch-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}
.switch-label-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.switch-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-header);
}
.switch-desc {
  font-size: 12px;
  color: var(--text-muted);
}
.switch-wrapper { gap: 16px; }
.switch-btn {
  position: relative;
  display: inline-block !important;
  flex: 0 0 40px;
  width: 40px;
  height: 22px;
  margin: 0 !important;
  padding: 0 !important;
}
.switch-btn input {
  position: absolute;
  opacity: 0;
  width: 0 !important;
  height: 0 !important;
  margin: 0;
}
.switch-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: var(--bg-tertiary);
  transition: .2s;
  border-radius: 34px;
  border: 1px solid var(--glass-border);
}
.switch-slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .2s;
  border-radius: 50%;
}
input:checked + .switch-slider {
  background-color: var(--brand-color);
}
input:checked + .switch-slider:before {
  transform: translateX(18px);
}
#btn-test-mic.active {
  background: rgba(239, 68, 68, 0.15) !important;
  color: var(--accent-danger) !important;
  border-color: rgba(239, 68, 68, 0.3) !important;
}
#btn-test-mic:hover {
  background: rgba(255,255,255,0.06);
}
#btn-test-mic.active:hover {
  background: rgba(239, 68, 68, 0.25) !important;
}

/* ───────────── Built-in chat media viewer (issue #15) ───────────── */
.msg-image-thumb { display: block; max-width: 300px; max-height: 300px; border-radius: 8px; margin-top: 5px; cursor: zoom-in; transition: filter 0.15s; }
.msg-media-thumb-link:hover .msg-image-thumb { filter: brightness(0.85); }

/* Lightbox */
.lightbox-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.9); z-index: 2000; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.lightbox-img { max-width: 92vw; max-height: 92vh; user-select: none; -webkit-user-select: none; cursor: grab; transition: transform 0.05s linear; touch-action: none; }
.lightbox-img.dragging { cursor: grabbing; transition: none; }
.lightbox-close { position: absolute; top: 16px; right: 20px; width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,0.08); border: 1px solid var(--glass-border); color: white; font-size: 18px; cursor: pointer; transition: 0.2s; }
.lightbox-close:hover { background: rgba(255,255,255,0.2); }

/* Inline video/audio players */
.msg-video-player { margin-top: 6px; max-width: 360px; border-radius: 10px; overflow: hidden; background: black; border: 1px solid var(--glass-border); }
.msg-video-player video { display: block; width: 100%; max-height: 260px; background: black; }
.msg-audio-player, .mvp-bar { display: flex; align-items: center; gap: 8px; }
.msg-audio-player { margin-top: 6px; max-width: 340px; background: var(--bg-secondary); border: 1px solid var(--glass-border); border-radius: 10px; padding: 8px 10px; }
.mvp-bar { background: rgba(15,15,22,0.85); padding: 6px 8px; }
.mvp-btn { background: rgba(255,255,255,0.06); border: 1px solid var(--glass-border); color: white; width: 26px; height: 26px; border-radius: 6px; cursor: pointer; font-size: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: 0.15s; }
.mvp-btn:hover { background: rgba(255,255,255,0.15); }
.mvp-seek { flex: 1; min-width: 40px; height: 4px; -webkit-appearance: none; background: rgba(255,255,255,0.2); border-radius: 2px; outline: none; cursor: pointer; accent-color: var(--brand-color); }
.mvp-seek::-webkit-slider-thumb { -webkit-appearance: none; width: 10px; height: 10px; border-radius: 50%; background: var(--brand-color); border: 1px solid white; }
.mvp-vol { width: 50px; height: 4px; -webkit-appearance: none; background: rgba(255,255,255,0.2); border-radius: 2px; outline: none; cursor: pointer; accent-color: var(--brand-color); }
.mvp-time { font-size: 11px; color: var(--text-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.mvp-name { font-size: 11px; color: var(--text-muted); max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* reduced motion: app setting (app.js), not the OS flag */
.reduce-motion .video-controls, .reduce-motion .v-stats-panel, .reduce-motion .lightbox-img, .reduce-motion .v-btn, .reduce-motion .mvp-btn { transition: none !important; }
.reduce-motion .v-badge-live::before { animation: none !important; }



/* ================= Motion ================= */
:root {
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-spring: cubic-bezier(0.34, 1.36, 0.64, 1);
}

/* Speaking ring: soft breathing glow + expanding ripple */
.vc-u .av, .user-row .avatar, #my-avatar { transition: box-shadow 0.18s ease, transform 0.18s var(--ease-spring); }
.vc-u .av.speaking,
.vc-u.is-speaking .av,
.user-row .avatar.speaking,
#my-avatar.speaking {
  box-shadow: 0 0 0 2px var(--accent-green), 0 0 12px 2px rgba(34, 197, 94, 0.55);
  animation: speak-glow 1.2s ease-in-out infinite;
}
.vc-u .av.speaking::before,
.user-row .avatar.speaking::before,
#my-avatar.speaking::before {
  content: ''; position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid var(--accent-green); pointer-events: none;
  animation: speak-ripple 1.2s var(--ease-out) infinite;
}
.vc-u .av { position: relative; }
@keyframes speak-glow {
  0%, 100% { box-shadow: 0 0 0 2px var(--accent-green), 0 0 6px 1px rgba(34, 197, 94, 0.35); }
  50%      { box-shadow: 0 0 0 2px var(--accent-green), 0 0 14px 4px rgba(34, 197, 94, 0.6); }
}
@keyframes speak-ripple {
  from { transform: scale(1); opacity: 0.8; }
  to   { transform: scale(1.6); opacity: 0; }
}
.vc-u.is-speaking .vc-u-name { color: var(--text-header); }

/* Voice list: join / leave */
.vc-u.vc-enter, .user-item.vc-enter { animation: vc-in 0.32s var(--ease-spring) both; }
.vc-u.leaving, .user-item.leaving { animation: vc-out 0.22s ease-in forwards; pointer-events: none; }
@keyframes vc-in {
  from { opacity: 0; transform: translateX(-10px) scale(0.96); }
  to   { opacity: 1; transform: none; }
}
@keyframes vc-out {
  to { opacity: 0; transform: translateX(-10px); max-height: 0; padding-top: 0; padding-bottom: 0; }
}
.vc-u-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: color 0.15s; }
.status-icon { animation: pop-in 0.25s var(--ease-spring) both; }
.status-live {
  font-size: 9px; font-weight: 800; letter-spacing: 0.4px; color: #fff;
  background: var(--accent-danger); border-radius: 4px; padding: 1px 4px;
  animation: pop-in 0.25s var(--ease-spring) both, pulse-live 1.5s infinite 0.25s;
}
@keyframes pop-in { from { opacity: 0; transform: scale(0.85); } to { opacity: 1; transform: scale(1); } }

/* Modals: backdrop fade + panel lift */
.modal { transition: opacity 0.22s ease, backdrop-filter 0.22s ease; }
.modal .modal-content { transition: transform 0.28s var(--ease-spring), opacity 0.2s ease; }
.modal.hidden .modal-content { transform: translateY(14px) scale(0.96); opacity: 0; }
.modal:not(.hidden) .modal-content { transform: none; opacity: 1; }

/* Toasts: spring in */
.toast { transition: transform 0.38s var(--ease-spring), opacity 0.25s ease; opacity: 0; }
.toast.show { opacity: 1; }

/* Video tiles: appear with a zoom-fade */
.video-wrapper { animation: tile-in 0.35s var(--ease-out) both; }
@keyframes tile-in { from { opacity: 0; transform: scale(0.92); } to { opacity: 1; transform: none; } }
.video-grid { transition: opacity 0.25s ease, padding 0.25s ease; }

/* Control buttons: tactile press */
.control-btns button { transition: transform 0.12s var(--ease-spring), color 0.15s, background 0.15s; }
.control-btns button:active { transform: scale(0.88); }
.control-btns button.muted::after { animation: strike 0.2s var(--ease-out) both; }
@keyframes strike { from { width: 0; } to { width: 24px; } }

#btn-disconnect { animation: pop-in 0.3s var(--ease-spring) both; }

/* reduced motion: app setting (app.js), not the OS flag */
.reduce-motion *, .reduce-motion *::before, .reduce-motion *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }

/* Per-user VU meter: a tiny bar next to each voice user's avatar/name */
.vc-u-meter { display: inline-block; width: 28px; height: 4px; border-radius: 2px; background: rgba(255,255,255,0.08); overflow: hidden; flex-shrink: 0; margin: 0 6px; }
.vc-u-meter-fill { display: block; height: 100%; width: 0%; background: #22c55e; transition: width 0.1s linear; }
/* reduced motion: app setting (app.js), not the OS flag */
.reduce-motion .vc-u-meter-fill { transition: none; width: 0% !important; }

/* Attachments: download button, links, edited mark, unread channels */
.msg-attachment { position: relative; display: inline-block; max-width: 100%; vertical-align: top; margin-right: 6px; }
.msg-attachment .att-dl { position: absolute; top: 10px; right: 6px; width: 28px; height: 28px; border-radius: 6px; border: 1px solid var(--glass-border); background: rgba(10,10,15,0.75); color: white; font-size: 14px; cursor: pointer; opacity: 0; transition: opacity 0.15s, background 0.15s; z-index: 2; }
.msg-attachment:hover .att-dl { opacity: 1; }
.msg-attachment .att-dl:hover { background: var(--brand-color); }
.msg-attachment .msg-audio-player { padding-right: 44px; }
.msg-attachment .msg-audio-player + .att-dl { top: 50%; margin-top: -11px; display: flex; align-items: center; justify-content: center; opacity: 1; background: transparent; border-color: transparent; color: var(--text-muted); }
.msg-attachment .msg-audio-player + .att-dl:hover { color: white; background: var(--brand-color); }
.msg-attachment .file-link + .att-dl { display: none; }
.msg-attachment .file-link { cursor: pointer; }
.lightbox-dl { right: 70px; }
.msg-link { color: var(--brand-color); text-decoration: none; word-break: break-all; }
.msg-link:hover { text-decoration: underline; }
.msg-edited { font-size: 11px; opacity: 0.7; }
.channel-item.text.unread { color: var(--text-header); font-weight: 600; position: relative; }
.channel-item.text.unread::before { content: ''; position: absolute; left: -6px; top: 50%; width: 6px; height: 8px; margin-top: -4px; border-radius: 0 4px 4px 0; background: var(--text-header); }

/* ── 0.1.27: chat polish ───────────────────────────────────────── */
.messages-container { gap: 0; padding: 16px 16px 8px; }
.message { position: relative; padding: 6px 12px; margin-top: 10px; border-radius: 6px; }
.message.grouped { margin-top: 0; padding-top: 2px; padding-bottom: 2px; }
.message.system { margin: 16px 0 6px; }
.message:hover { background: rgba(255,255,255,0.025); }
.msg-body { gap: 14px; }
.msg-content { flex: 1; min-width: 0; }
.msg-content .msg-header { margin-bottom: 2px; }
.msg-content .name { cursor: pointer; }
.msg-content .name:hover { text-decoration: underline; }
.msg-gutter { width: 40px; flex-shrink: 0; font-size: 10px; color: var(--text-muted); display: flex; justify-content: flex-end; white-space: nowrap; line-height: 22px; opacity: 0; user-select: none; }
.message.grouped:hover .msg-gutter { opacity: 1; }
.message .text { white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere; color: var(--text-normal); }
.message .text mark, .search-hit .name mark { background: rgba(250, 204, 21, 0.35); color: var(--text-header); border-radius: 3px; padding: 0 1px; }
.msg-edited { font-size: 10.5px; color: var(--text-muted); }
.message.failed { opacity: 0.6; }
.msg-failed-note { font-size: 11.5px; color: var(--accent-danger); margin-top: 2px; }

.msg-actions { position: absolute; top: -14px; right: 14px; margin: 0; display: flex; gap: 2px; padding: 3px; background: var(--bg-tertiary); border: 1px solid rgba(255,255,255,0.08); border-radius: 10px; box-shadow: 0 6px 18px rgba(0,0,0,0.4); opacity: 0; pointer-events: none; transform: translateY(2px); transition: opacity 0.12s, transform 0.12s; z-index: 3; }
.message:hover .msg-actions { opacity: 1; pointer-events: auto; transform: none; }
.msg-actions button { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 14px; min-width: 28px; height: 26px; padding: 0 5px; border-radius: 6px; font-family: inherit; }
.msg-actions button:hover { background: rgba(255,255,255,0.08); color: var(--text-header); }
.msg-actions button.danger:hover { background: rgba(239,68,68,0.15); color: var(--accent-danger); }
.msg-actions .act-more-react { font-size: 12px; }

.msg-reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.reaction { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 8px; border-radius: 12px; border: 1px solid rgba(255,255,255,0.07); background: rgba(255,255,255,0.04); color: var(--text-normal); cursor: pointer; font-size: 13px; font-family: inherit; transition: background 0.12s, border-color 0.12s; }
.reaction:hover { border-color: rgba(255,255,255,0.18); }
.reaction.mine { background: rgba(124,92,252,0.18); border-color: rgba(124,92,252,0.6); }
.reaction-count { font-size: 12px; font-weight: 600; }
.reaction.add { opacity: 0; color: var(--text-muted); padding: 0 9px; }
.message:hover .reaction.add { opacity: 1; }
.reaction-picker { position: fixed; z-index: 2000; display: grid; grid-template-columns: repeat(8, 32px); gap: 2px; padding: 8px; background: var(--bg-tertiary); border: 1px solid rgba(255,255,255,0.08); border-radius: 12px; box-shadow: 0 16px 40px rgba(0,0,0,0.55); animation: pop-in 0.12s ease-out; }
.reaction-picker button { width: 32px; height: 32px; border: none; background: none; border-radius: 8px; font-size: 19px; cursor: pointer; }
.reaction-picker button:hover { background: rgba(255,255,255,0.08); transform: scale(1.12); }
.cx-reactions { display: flex; justify-content: space-between; gap: 2px; padding: 2px 2px 6px; margin-bottom: 4px; border-bottom: 1px solid var(--glass-border); }
.cx-reactions button { flex: 1; height: 30px; border: none; background: rgba(255,255,255,0.04); border-radius: 8px; font-size: 16px; cursor: pointer; }
.cx-reactions button:hover { background: rgba(255,255,255,0.1); }

.msg-reply { margin-left: 54px; }

/* Empty chat / loaders / search */
.chat-empty { margin: auto 0 12px; padding: 24px 12px; }
.chat-empty-title { font-size: 22px; font-weight: 700; color: var(--text-header); margin-bottom: 6px; }
.chat-empty-sub { font-size: 13.5px; color: var(--text-muted); }
.history-loader { text-align: center; font-size: 12px; color: var(--text-muted); padding: 8px 0 4px; }
.search-summary { position: sticky; top: -16px; z-index: 4; margin: -16px -16px 8px; padding: 10px 28px; font-size: 12.5px; color: var(--text-muted); background: rgba(12,12,16,0.92); backdrop-filter: blur(6px); border-bottom: 1px solid var(--glass-border); }
.message.search-hit { cursor: pointer; margin-top: 6px; border: 1px solid transparent; }
.message.search-hit:hover { border-color: rgba(124,92,252,0.35); }

.chat-search { position: relative; display: flex; align-items: center; width: 200px; height: 30px; background: var(--bg-deep); border: 1px solid var(--glass-border); border-radius: 8px; transition: width 0.2s, border-color 0.2s; }
.chat-search:focus-within { width: 280px; border-color: rgba(124,92,252,0.6); }
.chat-search-icon { font-size: 12px; padding: 0 6px 0 9px; opacity: 0.55; }
.chat-search input { flex: 1; min-width: 0; background: none; border: none; outline: none; color: var(--text-normal); font-family: inherit; font-size: 13px; }
.chat-search-clear { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 0 8px; font-size: 12px; }
.chat-search-clear.hidden { display: none; }

/* Composer */
.chat-input-wrapper { flex-direction: column; align-items: stretch; margin: 0 16px 0; padding: 6px 12px; }
.chat-input-row { display: flex; align-items: flex-end; gap: 8px; width: 100%; }
.chat-input-row #btn-attach { margin: 0 4px 6px 0; flex-shrink: 0; }
.chat-input-row .btn-send { height: 36px; flex-shrink: 0; }
#chat-input { flex: 1; resize: none; background: transparent; border: none; outline: none; color: var(--text-normal); font-size: 15px; line-height: 1.45; padding: 8px 0; font-family: inherit; max-height: 220px; overflow-y: hidden; }
#chat-input::placeholder { color: var(--text-muted); }
.reply-context { justify-content: space-between; align-items: center; gap: 8px; background: rgba(124,92,252,0.08); border-left: 3px solid var(--brand-color); padding: 6px 10px; border-radius: 6px; font-size: 12.5px; color: var(--text-muted); margin: 4px 0; }
#reply-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reply-cancel { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 13px; width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0; }
.reply-cancel:hover { background: rgba(239,68,68,0.15); color: var(--accent-danger); }
.file-preview:not(.hidden) { padding: 6px 0 8px; border-bottom: 1px solid var(--glass-border); margin-bottom: 4px; }
.file-preview.hidden { display: none; }
.file-item .filesize { font-size: 11px; color: var(--text-muted); }
.file-remove { background: none; border: none; color: var(--text-muted); cursor: pointer; width: 20px; height: 20px; border-radius: 50%; }
.file-remove:hover { background: rgba(239,68,68,0.15); color: var(--accent-danger); }

.typing-indicator { height: 22px; padding: 2px 30px 0; font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; opacity: 0; transition: opacity 0.15s; overflow: hidden; white-space: nowrap; }
.typing-indicator.active { opacity: 1; }
.typing-indicator b { color: var(--text-normal); font-weight: 600; }
.typing-dots { display: inline-flex; gap: 3px; }
.typing-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--text-muted); animation: typing-bounce 1.2s infinite ease-in-out; }
.typing-dots i:nth-child(2) { animation-delay: 0.15s; }
.typing-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing-bounce { 0%, 60%, 100% { transform: translateY(0); opacity: 0.5; } 30% { transform: translateY(-3px); opacity: 1; } }

.upload-toast { border-left: 4px solid var(--brand-color); }
.upload-body { flex: 1; min-width: 220px; }
.upload-name { font-size: 13px; margin-bottom: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 280px; }
.upload-track { background: rgba(255,255,255,0.1); border-radius: 4px; height: 6px; overflow: hidden; }
.upload-bar { height: 100%; width: 0; background: var(--brand-gradient); border-radius: 4px; transition: width 0.2s; }
.upload-pct { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* Sidebar bits */
.sidebar-empty { padding: 4px 10px; font-size: 12px; color: var(--text-muted); line-height: 1.4; }
.dm-item { gap: 10px; }
.dm-av { width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0; }
.dm-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.unread-badge { background: var(--accent-danger); color: #fff; border-radius: 10px; padding: 0 6px; min-width: 18px; height: 18px; line-height: 18px; font-size: 11px; font-weight: 700; text-align: center; }
.channel-controls { margin-left: auto; display: flex; gap: 2px; opacity: 0; transition: opacity 0.15s; }
.channel-item:hover .channel-controls { opacity: 1; }
.mini-btn { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 12px; width: 22px; height: 22px; border-radius: 6px; }
.mini-btn:hover { background: rgba(255,255,255,0.08); color: var(--text-header); }
.mini-btn.danger:hover { color: var(--accent-danger); background: rgba(239,68,68,0.12); }

/* Shared form controls */
.field, .text-area { width: 100%; background: var(--bg-deep); border: 1px solid var(--glass-border); border-radius: 8px; padding: 10px 12px; color: var(--text-header); outline: none; font-family: inherit; font-size: 14px; transition: border-color 0.15s; }
.field:focus, .text-area:focus { border-color: var(--brand-color); }
.text-area { resize: vertical; min-height: 70px; line-height: 1.45; }
.color-input { width: 64px; height: 36px; padding: 2px; border-radius: 8px; border: 1px solid var(--glass-border); background: var(--bg-deep); cursor: pointer; }
.btn-danger { background: var(--accent-danger); color: #fff; border: none; padding: 10px 16px; border-radius: 8px; font-weight: 600; cursor: pointer; font-family: inherit; transition: 0.15s; }
.btn-danger:hover { filter: brightness(1.1); box-shadow: 0 4px 12px rgba(239,68,68,0.3); }
.chip-btn { display: inline-flex; align-items: center; gap: 6px; background: none; border: 1px solid var(--glass-border); color: var(--text-normal); border-radius: 7px; padding: 4px 10px; cursor: pointer; font-size: 12px; font-family: inherit; transition: 0.15s; white-space: nowrap; }
.chip-btn:hover { background: rgba(255,255,255,0.06); }
.chip-btn:disabled { opacity: 0.5; cursor: default; }
.chip-btn.danger { border-color: rgba(239,68,68,0.5); color: var(--accent-danger); }
.chip-btn.danger:hover { background: rgba(239,68,68,0.12); }
.chip-btn.warn { border-color: rgba(234,179,8,0.5); color: #eab308; }
.chip-btn.warn:hover { background: rgba(234,179,8,0.12); }
.chip-btn.ok { border-color: rgba(34,197,94,0.5); color: var(--accent-green); }
.chip-btn.ok:hover { background: rgba(34,197,94,0.12); }
.empty-state { color: var(--text-muted); font-size: 13px; text-align: center; padding: 24px 0; }
.badge { font-size: 10.5px; padding: 2px 6px; border-radius: 5px; margin-left: 6px; font-weight: 600; }
.badge.green { background: rgba(34,197,94,0.15); color: #22c55e; }
.badge.yellow { background: rgba(234,179,8,0.15); color: #eab308; }

/* Admin panel */
.admin-modal { width: 680px; max-width: calc(100vw - 40px); max-height: 82vh; display: flex; flex-direction: column; }
.admin-modal h2 { margin-bottom: 16px; }
.admin-auth { display: flex; gap: 8px; }
.admin-auth .btn-primary { flex: 0 0 auto; padding: 10px 22px; }
#admin-files-section { flex: 1; min-height: 0; display: flex; flex-direction: column; }
#admin-files-section.hidden { display: none; }
.admin-tabs { display: flex; gap: 4px; margin-bottom: 14px; border-bottom: 1px solid var(--glass-border); padding-bottom: 8px; flex-wrap: wrap; align-items: center; }
.admin-tab { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 6px 12px; border-radius: 7px; font-size: 13px; font-weight: 600; font-family: inherit; }
.admin-tab:hover { background: rgba(255,255,255,0.05); color: var(--text-normal); }
.admin-tab.active { background: rgba(124,92,252,0.15); color: var(--text-header); }
.admin-logout { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 12px; font-family: inherit; }
.admin-logout:hover { color: var(--accent-danger); }
.admin-pane { flex: 1; min-height: 0; overflow-y: auto; padding-right: 4px; }
.admin-list { display: flex; flex-direction: column; gap: 6px; }
.admin-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 12px; background: rgba(255,255,255,0.03); border: 1px solid var(--glass-border); border-radius: 9px; }
.admin-row-info { min-width: 0; }
.admin-row-main { font-size: 13px; color: var(--text-normal); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; }
.admin-row-sub { font-size: 11px; color: var(--text-muted); font-family: ui-monospace, monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.admin-row-btns { display: flex; gap: 4px; flex-shrink: 0; }
.admin-user { display: inline-flex; align-items: center; gap: 8px; }
.admin-user-av { width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0; cursor: pointer; }
.admin-log-row { padding: 6px 10px; background: rgba(255,255,255,0.02); border-radius: 6px; border: 1px solid var(--glass-border); color: var(--text-muted); font-size: 12px; }
.admin-ban-form { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.admin-ban-form .field { flex: 1; min-width: 130px; padding: 8px 10px; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat-card { background: rgba(255,255,255,0.03); border: 1px solid var(--glass-border); border-radius: 10px; padding: 14px; }
.stat-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.4px; }
.stat-value { font-size: 24px; font-weight: 700; color: var(--text-header); }
.stat-value.green { color: var(--accent-green); }
.stat-value.brand { color: var(--brand-color); }
.stat-foot { font-size: 12px; color: var(--text-muted); margin-top: 10px; }

/* Profile card */
.profile-card { position: relative; width: 360px; max-width: calc(100vw - 32px); background: var(--bg-secondary); border: 1px solid rgba(255,255,255,0.07); border-radius: 18px; overflow: hidden; box-shadow: 0 30px 60px rgba(0,0,0,0.6); padding: 0; }
.profile-banner { height: 110px; background: var(--brand-gradient); }
.profile-close { position: absolute; top: 10px; right: 10px; width: 30px; height: 30px; border-radius: 50%; border: none; background: rgba(0,0,0,0.35); color: #fff; cursor: pointer; font-size: 13px; backdrop-filter: blur(4px); }
.profile-close:hover { background: rgba(0,0,0,0.6); }
.profile-avatar-wrap { position: absolute; top: 58px; left: 20px; }
.profile-avatar { width: 96px; height: 96px; border-radius: 50%; border: 6px solid var(--bg-secondary); background-color: var(--bg-tertiary); background-size: cover; background-position: center; }
.profile-presence { position: absolute; right: 4px; bottom: 6px; width: 22px; height: 22px; border-radius: 50%; border: 4px solid var(--bg-secondary); background: var(--text-muted); }
.profile-presence.online { background: var(--accent-green); }
.profile-presence.voice { background: var(--accent-green); box-shadow: 0 0 0 2px rgba(34,197,94,0.35); }
.profile-main { padding: 56px 20px 20px; }
.profile-name { font-size: 22px; font-weight: 700; color: var(--text-header); word-break: break-word; }
.profile-status { font-size: 13px; color: var(--text-muted); margin-top: 2px; min-height: 18px; }
.profile-section { margin-top: 14px; padding: 12px 14px; background: var(--bg-deep); border-radius: 12px; border: 1px solid var(--glass-border); }
.profile-section-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); margin-bottom: 6px; }
.profile-bio { font-size: 13.5px; line-height: 1.5; color: var(--text-normal); white-space: pre-wrap; word-break: break-word; }
.profile-bio.empty { color: var(--text-muted); font-style: italic; }
.profile-id-row { display: flex; align-items: center; gap: 8px; }
.profile-id { flex: 1; min-width: 0; font-family: ui-monospace, monospace; font-size: 11.5px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-copy { background: none; border: 1px solid var(--glass-border); color: var(--text-muted); width: 26px; height: 26px; border-radius: 7px; cursor: pointer; }
.profile-copy:hover { color: var(--text-header); background: rgba(255,255,255,0.06); }
.profile-dm { width: 100%; margin-top: 16px; }

/* Settings: live profile preview */
.profile-edit-preview { position: relative; border-radius: 14px; overflow: hidden; background: var(--bg-deep); border: 1px solid var(--glass-border); margin-bottom: 18px; flex-shrink: 0; min-height: 150px; padding-bottom: 14px; }
.pep-banner { height: 64px; flex-shrink: 0; background-size: cover; background-position: center; }
.pep-avatar { position: absolute; top: 30px; left: 16px; width: 64px; height: 64px; border-radius: 50%; border: 5px solid var(--bg-deep); background-size: cover; background-position: center; }
.pep-name { margin: 36px 16px 0; font-size: 17px; font-weight: 700; color: var(--text-header); }
.pep-bio { margin: 4px 16px 0; font-size: 12.5px; color: var(--text-normal); white-space: pre-wrap; word-break: break-word; }
.pep-bio.empty { color: var(--text-muted); font-style: italic; }

/* ── 0.1.28: icons + visual tune ───────────────────────────────── */
:root {
  color-scheme: dark;
  --bg-elev: #20202a;
  --line: rgba(255, 255, 255, 0.055);
  --line-strong: rgba(255, 255, 255, 0.09);
  --brand-soft: rgba(124, 92, 252, 0.14);
  --brand-ring: rgba(124, 92, 252, 0.55);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-float: 0 1px 0 rgba(255,255,255,0.04) inset, 0 12px 32px -8px rgba(0,0,0,0.6), 0 2px 6px rgba(0,0,0,0.3);
  --shadow-modal: 0 1px 0 rgba(255,255,255,0.05) inset, 0 32px 80px -16px rgba(0,0,0,0.75);
}
body { font-feature-settings: 'ss01', 'cv11'; text-rendering: optimizeLegibility; }
::selection { background: rgba(124, 92, 252, 0.35); color: #fff; }

/* Icons */
.ico { width: 18px; height: 18px; flex-shrink: 0; display: block; pointer-events: none; }
i.ic { display: inline-flex; font-style: normal; line-height: 0; }
.window-controls .ico { width: 15px; height: 15px; }
.window-controls button { display: flex; align-items: center; justify-content: center; }
#win-max .ico { width: 13px; height: 13px; }
.channel-item .icon { display: inline-flex; width: 18px; height: 18px; margin-right: 8px; opacity: 0.6; }
.channel-item .icon .ico { width: 17px; height: 17px; }
.channel-item:hover .icon, .channel-item.active .icon { opacity: 0.9; }
.chat-header .hash { display: inline-flex; margin-right: 2px; opacity: 0.7; }
.chat-header .hash .ico { width: 20px; height: 20px; }
.control-btns button .ico { width: 18px; height: 18px; }
.control-btns .ico-off { display: none; }
.control-btns button.muted .ico-on { display: none; }
.control-btns button.muted .ico-off { display: inline-flex; }
.control-btns button.muted::after { content: none; }
.control-btns button.muted { background: rgba(239, 68, 68, 0.1); }
.icon-action { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; padding: 0; }
.icon-action .ico { width: 19px; height: 19px; }
.icon-action.active { color: var(--brand-color); background: var(--brand-soft); }
.chat-search-icon { display: inline-flex; padding: 0 4px 0 9px; opacity: 0.5; }
.chat-search-icon .ico { width: 14px; height: 14px; }
.chat-search-clear { display: inline-flex; align-items: center; }
.chat-search-clear .ico, .reply-cancel .ico, .file-remove .ico { width: 13px; height: 13px; margin: auto; }
#btn-attach .ico { width: 16px; height: 16px; }
.btn-send .ico { width: 18px; height: 18px; }
.btn-send { width: 36px; padding: 0; border-radius: var(--radius-md); }
.btn-send:hover { transform: none; background: var(--brand-soft); color: #a78bfa; }
.msg-actions button { display: inline-flex; align-items: center; justify-content: center; }
.msg-actions button .ico { width: 16px; height: 16px; }
.mini-btn { display: inline-flex; align-items: center; justify-content: center; }
.mini-btn .ico { width: 13px; height: 13px; }
.file-link .ico, .badge .ico { width: 14px; height: 14px; }
.badge { display: inline-flex; align-items: center; gap: 4px; }
.file-item .icon { display: inline-flex; color: var(--brand-color); }
.file-item .icon .ico { width: 16px; height: 16px; }
.att-dl, .lightbox-close, .mvp-btn, .v-btn, .profile-copy, .profile-close { display: inline-flex; align-items: center; justify-content: center; }
.att-dl .ico { width: 15px; height: 15px; }
.mvp-btn .ico { width: 13px; height: 13px; }
.mvp-btn .ico path[d^="M6 4.6"] { fill: currentColor; }
.lightbox-close .ico { width: 18px; height: 18px; }
.v-btn .ico { width: 15px; height: 15px; }
.profile-copy .ico { width: 14px; height: 14px; }
.profile-close .ico { width: 15px; height: 15px; }
.profile-dm, .admin-tab, #btn-test-mic { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.admin-tab { gap: 6px; }
.admin-tab .ico { width: 15px; height: 15px; opacity: 0.85; }
.glass h2 .ico { width: 22px; height: 22px; color: var(--brand-color); }
.profile-dm .ico, #btn-test-mic .ico { width: 17px; height: 17px; }
.glass h2 { display: flex; align-items: center; gap: 10px; }
.status-icon .ico { width: 13px; height: 13px; }
.status-icon.muted::after, .status-icon.deafened::after { content: none; }
.cx-check .box .ico { width: 11px; height: 11px; stroke-width: 2.5; }
.toast .toast-ico { width: 18px; height: 18px; color: var(--brand-color); }
.toast.error .toast-ico { color: var(--accent-danger); }
.toast.success .toast-ico { color: var(--accent-green); }
#btn-refresh-audio-apps { flex: 0 0 auto; display: inline-flex; align-items: center; }
#btn-refresh-audio-apps .ico { width: 16px; height: 16px; }
#btn-add-voice-channel { display: inline-flex; align-items: center; }
#btn-add-voice-channel .ico { width: 15px; height: 15px; }

/* Surfaces: tone steps instead of hairlines */
.titlebar { border-bottom-color: transparent; }
.servers-nav { border-right-color: transparent; }
.channels-sidebar { border-right-color: var(--line); }
.server-header, .chat-header { border-bottom-color: var(--line); }
.user-controls { border-top-color: transparent; background: #14141b; }
.users-sidebar { border-left-color: var(--line); }
.server-icon:hover, .server-icon.active { box-shadow: 0 6px 16px -4px rgba(124, 92, 252, 0.45); }
.user-item { background: transparent; border-color: transparent; transition: background-color 0.15s; }
.user-item:hover { background: var(--bg-hover); }
.user-row .indicator { box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15); }
.channel-item.active { background: var(--brand-soft); box-shadow: none; }
.chat-input-wrapper { background: var(--bg-tertiary); border-color: var(--line); border-radius: 14px; transition: border-color 0.15s, box-shadow 0.15s; }
.chat-input-wrapper:focus-within { border-color: rgba(124, 92, 252, 0.45); box-shadow: 0 0 0 3px rgba(124, 92, 252, 0.12); }
#btn-attach { transition: background-color 0.15s, color 0.15s, transform 0.12s var(--ease-out); }

/* Modals: one surface, soft shadow, contained scroll */
.modal { background: rgba(6, 6, 9, 0.72); backdrop-filter: blur(6px) saturate(120%); }
.glass { border-color: var(--line-strong); border-radius: var(--radius-lg); box-shadow: var(--shadow-modal); }
.glass h2 { font-size: 21px; letter-spacing: -0.01em; margin-bottom: 20px; }
#modal-screen .modal-content { width: 480px; max-height: calc(100vh - 80px); overflow-y: auto; overscroll-behavior: contain; }
.modal .modal-content { transition: transform 0.24s var(--ease-out), opacity 0.18s ease; }
.modal.hidden .modal-content { transform: translateY(8px) scale(0.97); }
.setting-group label { font-size: 11px; letter-spacing: 0.06em; }
.setting-group input[type="text"], .setting-group select, .field, .text-area, .field-input { background: var(--bg-deep); border: 1px solid var(--line-strong); border-radius: var(--radius-md); color: var(--text-header); transition: border-color 0.15s, box-shadow 0.15s; }
.setting-group input[type="text"]:focus, .setting-group select:focus, .field:focus, .text-area:focus, .field-input:focus { border-color: var(--brand-ring); box-shadow: 0 0 0 3px rgba(124, 92, 252, 0.14); outline: none; }
select { color-scheme: dark; }
select option, select optgroup { background: #1c1c25; color: #e5e7eb; }
select optgroup { color: #8b8fa0; font-weight: 600; }
.setting-group select { appearance: none; -webkit-appearance: none; padding-right: 34px; cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.btn-primary { background: var(--brand-color); box-shadow: 0 1px 0 rgba(255,255,255,0.18) inset, 0 6px 16px -6px rgba(124, 92, 252, 0.6); transition: background-color 0.15s, transform 0.12s var(--ease-out), box-shadow 0.15s; }
.btn-primary:hover { opacity: 1; background: #8a6dfd; box-shadow: 0 1px 0 rgba(255,255,255,0.2) inset, 0 8px 20px -6px rgba(124, 92, 252, 0.7); }
.btn-secondary { border-color: var(--line-strong); transition: background-color 0.15s, transform 0.12s var(--ease-out); }
.modal-actions { border-top-color: var(--line); }

/* Stream modal: presets */
.preset-row { display: flex; gap: 8px; align-items: stretch; }
.preset-row select { flex: 1; min-width: 0; }
.icon-btn-sq { flex: 0 0 44px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-md); border: 1px solid var(--line-strong); background: var(--bg-deep); color: var(--text-muted); cursor: pointer; transition: color 0.15s, background-color 0.15s, border-color 0.15s, transform 0.12s var(--ease-out); }
.icon-btn-sq.hidden { display: none; }
.icon-btn-sq .ico { width: 16px; height: 16px; }
.icon-btn-sq:hover { color: var(--accent-danger); border-color: rgba(239, 68, 68, 0.4); background: rgba(239, 68, 68, 0.08); }
.stream-params { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 12px; padding: 14px; margin-bottom: 10px; border-radius: 14px; background: rgba(255, 255, 255, 0.025); box-shadow: 0 0 0 1px var(--line) inset; }
.stream-params .setting-group { margin-bottom: 0; gap: 6px; }
.stream-params select { padding: 9px 30px 9px 11px; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.codec-hint { display: flex; gap: 8px; font-size: 12.5px; line-height: 1.5; color: var(--text-muted); margin: 0 2px 14px; min-height: 19px; text-wrap: pretty; }
.codec-hint::before { content: ''; flex: 0 0 3px; border-radius: 2px; background: var(--brand-color); opacity: 0.7; }
.codec-hint:empty::before { display: none; }
.preset-save { display: flex; gap: 8px; margin-bottom: 14px; animation: fade-up 0.2s var(--ease-out) both; }
.preset-save.hidden { display: none; }
.preset-save .field-input { flex: 1; min-width: 0; padding: 9px 12px; font-family: inherit; font-size: 13.5px; }
.preset-save .btn-secondary { flex: 0 0 auto; padding: 9px 14px; font-size: 13px; }
@keyframes fade-up { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* Video tiles */
.video-wrapper { border-radius: 14px; box-shadow: 0 0 0 1px rgba(255,255,255,0.05), 0 10px 28px -10px rgba(0,0,0,0.7); }
.video-wrapper.focused { box-shadow: 0 0 0 1px rgba(255,255,255,0.06), 0 18px 48px -12px rgba(0,0,0,0.8); }
.v-btn { border-radius: 8px; width: 30px; height: 30px; background: rgba(12, 12, 16, 0.55); border-color: rgba(255,255,255,0.07); transition: background-color 0.15s, border-color 0.15s, transform 0.12s var(--ease-out); }
.v-btn:hover { transform: none; background: rgba(255,255,255,0.16); }
.v-bottom-bar { border-radius: 10px; background: rgba(12, 12, 16, 0.72); border-color: rgba(255,255,255,0.06); }
.v-stream-info { color: rgba(255,255,255,0.7); font-size: 12px; font-weight: 500; }
.v-quality-select { appearance: none; -webkit-appearance: none; background: rgba(255,255,255,0.06); color: var(--text-normal); border: 1px solid rgba(255,255,255,0.08); border-radius: 7px; font-size: 11.5px; font-family: inherit; padding: 4px 8px; cursor: pointer; }
.v-laser-hint { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: rgba(255,255,255,0.62); white-space: nowrap; }
.v-laser-hint kbd { font-family: inherit; font-size: 10.5px; font-weight: 600; color: #fff; padding: 1px 6px; border-radius: 5px; background: rgba(255,255,255,0.1); box-shadow: 0 1px 0 rgba(255,255,255,0.12) inset, 0 1px 0 rgba(0,0,0,0.5); }
.video-wrapper.laser-aiming .v-laser-hint { color: #fff; }
.video-wrapper.laser-aiming .v-laser-hint kbd { background: var(--brand-color); }
.video-wrapper.laser-aiming { cursor: crosshair; box-shadow: 0 0 0 1.5px rgba(124, 92, 252, 0.7), 0 10px 28px -10px rgba(0,0,0,0.7); }
.laser-layer { position: absolute; pointer-events: none; z-index: 4; }

/* Floating menus */
.context-menu { background: rgba(20, 20, 27, 0.96); border-color: var(--line-strong); box-shadow: var(--shadow-float); border-radius: 12px; padding: 6px; transform-origin: top left; }
.context-menu:not(.hidden) { animation: menu-in 0.14s var(--ease-out); }
@keyframes menu-in { from { opacity: 0; transform: scale(0.97); } to { opacity: 1; transform: none; } }
.cx-btn, .cx-item, .cx-check { border-radius: 7px; padding: 7px 10px; font-size: 13.5px; transition: background-color 0.12s; }
.cx-btn:hover, .cx-item:hover, .cx-check:hover { background: rgba(255,255,255,0.07); }
.cx-header { border-bottom: none; padding: 6px 10px 4px; letter-spacing: 0.06em; }
.cx-check .box { color: transparent; border-radius: 5px; }
.cx-check.active .box { color: #fff; background: var(--brand-color); border-color: var(--brand-color); }
.msg-actions { border-color: var(--line-strong); box-shadow: var(--shadow-float); }
.reaction-picker { box-shadow: var(--shadow-float); transform-origin: bottom right; animation: menu-in 0.14s var(--ease-out); }
.toast { border-radius: 12px; border-color: var(--line-strong); box-shadow: var(--shadow-float); padding: 11px 14px; background: rgba(24, 24, 32, 0.92); }
.toast.error, .toast.success, .upload-toast { border-left-width: 1px; }
.toast.error { border-left-color: var(--line-strong); }
.toast.success { border-left-color: var(--line-strong); }
.profile-card { box-shadow: var(--shadow-modal); border-color: var(--line-strong); }
.profile-section { background: rgba(0,0,0,0.22); border-color: transparent; }
.admin-row, .admin-log-row, .stat-card { border-color: transparent; background: rgba(255,255,255,0.03); }
.stat-value, .ping-badge, .unread-badge, .upload-pct, .v-stats-val { font-variant-numeric: tabular-nums; }

/* Tactile press (Emil: buttons scale to 0.97 on press) */
.btn-primary:active, .btn-secondary:active, .chip-btn:active, .icon-action:active, .icon-btn-sq:active,
.btn-send:active, #btn-attach:active, .v-btn:active, .mvp-btn:active, .mini-btn:active, .profile-copy:active,
.msg-actions button:active, .reaction:active, .admin-tab:active, .btn-danger:active { transform: scale(0.97); }
.icon-action, .mini-btn, .profile-copy, .reaction, .admin-tab, .chip-btn { transition: background-color 0.15s, color 0.15s, border-color 0.15s, transform 0.12s var(--ease-out); }

/* Hover only on real pointers */
@media (hover: none) {
  .server-card:hover { transform: none; }
  .reaction-picker button:hover { transform: none; }
}

/* Keyboard focus */
:focus-visible { outline: 2px solid var(--brand-ring); outline-offset: 2px; }
button:focus:not(:focus-visible), select:focus:not(:focus-visible) { outline: none; }
.chat-search input:focus-visible, #chat-input:focus-visible, .field:focus-visible, .field-input:focus-visible, .setting-group select:focus-visible, .setting-group input:focus-visible { outline: none; }

/* reduced motion: app setting (app.js), not the OS flag */
.reduce-motion .context-menu:not(.hidden), .reduce-motion .reaction-picker, .reduce-motion .preset-save { animation: none !important; }
#btn-disconnect { padding: 0; }
.user-info .status { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.setting-group label:has(input[type="radio"]), .setting-group label:has(input[type="checkbox"]) { text-transform: none; letter-spacing: 0; font-weight: 500; font-size: 13.5px; color: var(--text-normal); }
.message .avatar.msg-av { margin-right: 0; }
.channel-item .channel-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.channel-seats { font-size: 11px; font-variant-numeric: tabular-nums; color: var(--text-muted); padding: 1px 6px; border-radius: 6px; background: rgba(255,255,255,0.05); margin-left: 6px; }
.channel-seats.full { color: var(--accent-danger); background: rgba(239,68,68,0.12); }
.channel-item:has(.channel-controls):hover .channel-seats { display: none; }
.channel-controls { margin-left: 6px; }
.admin-log-actions { display: flex; gap: 6px; margin-bottom: 10px; }
.admin-log-actions .chip-btn { display: inline-flex; align-items: center; gap: 6px; }
.admin-log-actions .ico { width: 14px; height: 14px; }

/* ── 0.1.29: mentions, unread divider, jump button ── */
.mention { color: #c4b5fd; background: rgba(124, 92, 252, 0.16); border-radius: 4px; padding: 0 3px; font-weight: 500; cursor: pointer; transition: background-color 0.15s; }
.mention:hover { background: rgba(124, 92, 252, 0.3); }
.mention.me { color: #fde68a; background: rgba(250, 204, 21, 0.16); }
.message.mentioned { background: rgba(250, 204, 21, 0.06); box-shadow: inset 2px 0 0 #facc15; }
.message.mentioned:hover { background: rgba(250, 204, 21, 0.09); }
.mention-badge { margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent-danger); color: #fff; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }

.chat-input-wrapper { position: relative; }
.mention-popup { position: absolute; left: 0; right: 0; bottom: calc(100% + 8px); background: var(--bg-tertiary); border: 1px solid var(--line-strong, rgba(255,255,255,0.1)); border-radius: 12px; padding: 6px; box-shadow: var(--shadow-float, 0 16px 40px rgba(0,0,0,0.5)); z-index: 50; transform-origin: bottom center; animation: menu-in 0.14s var(--ease-out); }
.mention-head { font-size: 11px; font-weight: 600; letter-spacing: 0.4px; text-transform: uppercase; color: var(--text-muted); padding: 4px 8px 6px; }
.mention-item { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; cursor: pointer; color: var(--text-normal); font-size: 14px; }
.mention-item.active, .mention-item:hover { background: rgba(124, 92, 252, 0.16); color: var(--text-header); }
.mention-av { width: 24px; height: 24px; border-radius: 50%; background-size: cover; background-position: center; flex-shrink: 0; position: relative; }
.mention-av.online::after { content: ''; position: absolute; right: -1px; bottom: -1px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent-green); border: 2px solid var(--bg-tertiary); }
.mention-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.new-divider { display: flex; align-items: center; margin: 14px 0 4px; height: 0; border-top: 1px solid rgba(239, 68, 68, 0.55); position: relative; }
.new-divider span { position: absolute; right: 0; top: -9px; background: var(--accent-danger); color: #fff; font-size: 10.5px; font-weight: 700; letter-spacing: 0.4px; text-transform: uppercase; padding: 1px 6px; border-radius: 4px; }

.jump-new { position: absolute; left: 50%; bottom: calc(100% + 10px); transform: translate(-50%, 8px); opacity: 0; pointer-events: none; display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px 6px 10px; border-radius: 999px; border: 1px solid var(--line-strong, rgba(255,255,255,0.1)); background: var(--bg-tertiary); color: var(--text-header); font: 500 13px/1 inherit; font-family: inherit; cursor: pointer; box-shadow: var(--shadow-float, 0 10px 30px rgba(0,0,0,0.45)); transition: opacity 0.18s var(--ease-out), transform 0.18s var(--ease-out), background-color 0.15s; z-index: 40; }
.jump-new.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.jump-new.has-new { background: var(--brand-color); border-color: transparent; color: #fff; }
.jump-new:hover { filter: brightness(1.1); }
.jump-new:active { transform: translate(-50%, 0) scale(0.97); }
.jump-new .ico { width: 15px; height: 15px; }

/* What's new */
.whatsnew-card { width: min(520px, calc(100vw - 32px)); max-height: min(640px, calc(100vh - 80px)); display: flex; flex-direction: column; padding: 0; overflow: hidden; position: relative; background: var(--bg-secondary); border: 1px solid var(--line-strong, rgba(255,255,255,0.1)); border-radius: 18px; box-shadow: var(--shadow-modal, 0 30px 80px rgba(0,0,0,0.6)); }
.whatsnew-hero { display: flex; align-items: center; gap: 14px; padding: 24px 24px 18px; background: radial-gradient(120% 140% at 0% 0%, rgba(124,92,252,0.28), transparent 60%); border-bottom: 1px solid var(--line, rgba(255,255,255,0.06)); }
.whatsnew-badge { width: 44px; height: 44px; border-radius: 12px; background: var(--brand-gradient); color: #fff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; box-shadow: 0 8px 24px rgba(124,92,252,0.35); }
.whatsnew-badge .ico { width: 22px; height: 22px; }
.whatsnew-kicker { font-size: 12px; color: #c4b5fd; font-weight: 500; }
.whatsnew-hero h2 { font-size: 20px; color: var(--text-header); font-weight: 600; letter-spacing: -0.2px; }
.whatsnew-body { overflow-y: auto; padding: 10px 16px 6px; }
.wn-release { border-radius: 12px; margin-bottom: 6px; }
.wn-release summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 10px 8px; cursor: pointer; border-radius: 10px; color: var(--text-header); }
.wn-release summary::-webkit-details-marker { display: none; }
.wn-release summary:hover { background: var(--bg-hover); }
.wn-ver { font: 600 12px/1 ui-monospace, monospace; background: rgba(124,92,252,0.16); color: #c4b5fd; padding: 4px 7px; border-radius: 6px; }
.wn-rtitle { font-weight: 500; font-size: 14px; flex: 1; }
.wn-chev { width: 16px; height: 16px; color: var(--text-muted); transition: transform 0.18s var(--ease-out); }
.wn-release[open] .wn-chev { transform: rotate(90deg); }
.wn-list { list-style: none; padding: 2px 8px 10px; display: flex; flex-direction: column; gap: 12px; }
.wn-item { display: flex; gap: 12px; align-items: flex-start; }
.wn-ico { width: 30px; height: 30px; border-radius: 9px; background: var(--bg-tertiary); border: 1px solid var(--line, rgba(255,255,255,0.06)); color: #c4b5fd; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.wn-ico .ico { width: 16px; height: 16px; }
.wn-title { font-size: 14px; color: var(--text-header); font-weight: 500; }
.wn-text { font-size: 13px; color: var(--text-muted); line-height: 1.45; margin-top: 2px; }
.whatsnew-foot { padding: 14px 24px 20px; display: flex; border-top: 1px solid var(--line, rgba(255,255,255,0.06)); }

/* ── Expressions: popovers, soundboard, emoji, stickers ── */
.btn-expr { width: 36px; height: 36px; flex-shrink: 0; border: none; background: transparent; color: var(--text-muted); border-radius: var(--radius-md, 8px); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: color 0.15s, background-color 0.15s; }
.btn-expr:hover { color: var(--text-header); background: var(--bg-hover); }
.btn-expr .ico { width: 19px; height: 19px; }
#btn-soundboard.off { opacity: 0.45; }
.xp-pop { position: fixed; z-index: 1500; width: 360px; max-width: calc(100vw - 16px); max-height: min(460px, calc(100vh - 60px)); display: flex; flex-direction: column; background: var(--bg-tertiary); border: 1px solid var(--line-strong, rgba(255,255,255,0.1)); border-radius: 14px; box-shadow: var(--shadow-float, 0 16px 40px rgba(0,0,0,0.55)); animation: menu-in 0.14s var(--ease-out); overflow: hidden; }
.xp-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px 8px; }
.xp-title { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--text-header); font-size: 14px; }
.xp-title .ico { width: 16px; height: 16px; color: #c4b5fd; }
.sb-vol { display: flex; align-items: center; gap: 6px; color: var(--text-muted); }
.sb-vol .ico { width: 15px; height: 15px; }
.sb-vol input { width: 90px; accent-color: var(--brand-color); }
.xp-note { margin: 0 14px 8px; padding: 7px 10px; border-radius: 8px; background: rgba(255,255,255,0.04); color: var(--text-muted); font-size: 12.5px; }
.xp-note.warn { background: rgba(239,68,68,0.1); color: #fca5a5; }
.sb-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 4px 14px 10px; overflow-y: auto; }
.sb-tile { position: relative; overflow: hidden; height: 52px; border-radius: 10px; border: 1px solid var(--line, rgba(255,255,255,0.06)); background: var(--bg-secondary); color: var(--text-normal); cursor: pointer; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; padding: 6px 10px; text-align: left; font-family: inherit; transition: background-color 0.15s, border-color 0.15s, transform 0.12s var(--ease-out); }
.sb-tile:hover { background: rgba(124,92,252,0.14); border-color: rgba(124,92,252,0.35); }
.sb-tile:active { transform: scale(0.97); }
.sb-tile.cooling { opacity: 0.55; cursor: default; }
.sb-name { font-size: 13px; font-weight: 500; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-dur { font-size: 11px; color: var(--text-muted); }
.sb-cool { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--brand-color); transform-origin: left; transform: scaleX(0); }
.sb-add { align-items: center; flex-direction: row; justify-content: center; gap: 6px; color: var(--text-muted); border-style: dashed; font-size: 13px; }
.sb-add .ico { width: 15px; height: 15px; }
.xp-del { position: absolute; top: 4px; right: 4px; width: 18px; height: 18px; border-radius: 6px; border: none; background: rgba(0,0,0,0.45); color: #fff; display: none; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.xp-del .ico { width: 12px; height: 12px; }
.sb-tile:hover .xp-del { display: flex; }
.xp-del:hover { background: var(--accent-danger); }
.xp-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 14px 12px; border-top: 1px solid var(--line, rgba(255,255,255,0.06)); font-size: 12.5px; color: var(--text-muted); }
.xp-check { display: flex; align-items: center; gap: 6px; cursor: pointer; text-transform: none; letter-spacing: 0; }
.xp-check input { accent-color: var(--brand-color); }
.vc-u.sb-flash { animation: sb-flash 1.2s var(--ease-out); }
@keyframes sb-flash { 0% { background: rgba(124,92,252,0.35); } 100% { background: transparent; } }

.xp-tabs { display: flex; gap: 4px; padding: 8px 8px 0; border-bottom: 1px solid var(--line, rgba(255,255,255,0.06)); }
.xp-tab { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 6px; border: none; border-bottom: 2px solid transparent; background: none; color: var(--text-muted); font: 500 13px/1 inherit; font-family: inherit; cursor: pointer; transition: color 0.15s, border-color 0.15s; }
.xp-tab .ico { width: 15px; height: 15px; }
.xp-tab:hover { color: var(--text-normal); }
.xp-tab.active { color: var(--text-header); border-bottom-color: var(--brand-color); }
.xp-body { overflow-y: auto; padding: 6px 10px 12px; min-height: 220px; }
.xp-section { font-size: 11px; font-weight: 600; letter-spacing: 0.4px; text-transform: uppercase; color: var(--text-muted); padding: 10px 4px 6px; }
.xp-empty { color: var(--text-muted); font-size: 13px; text-align: center; padding: 30px 10px 14px; }
.em-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; }
.em-btn { aspect-ratio: 1; border: none; background: none; border-radius: 8px; font-size: 20px; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 4px; transition: background-color 0.12s, transform 0.12s var(--ease-out); }
.em-btn:hover { background: rgba(255,255,255,0.08); transform: scale(1.08); }
.em-btn img { width: 26px; height: 26px; object-fit: contain; }
.em-add { color: var(--text-muted); border: 1px dashed var(--line-strong, rgba(255,255,255,0.12)); }
.em-add .ico { width: 16px; height: 16px; }
.st-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.st-btn { aspect-ratio: 1; border: none; background: rgba(255,255,255,0.02); border-radius: 10px; cursor: pointer; padding: 6px; transition: background-color 0.12s, transform 0.12s var(--ease-out); }
.st-btn:hover { background: rgba(255,255,255,0.08); transform: scale(1.04); }
.st-btn img { width: 100%; height: 100%; object-fit: contain; }
.xp-add-wide { display: flex; align-items: center; gap: 6px; margin: 12px auto 0; }
.xp-add-wide .ico { width: 14px; height: 14px; }

.cemoji { width: 22px; height: 22px; object-fit: contain; vertical-align: -5px; margin: 0 1px; }
.text.jumbo .cemoji { width: 44px; height: 44px; vertical-align: middle; }
.reaction-emoji .cemoji { width: 16px; height: 16px; vertical-align: -3px; margin: 0; }
.reaction-picker button .cemoji { width: 22px; height: 22px; margin: 0; }
.msg-files.sticker .msg-attachment, .msg-files.sticker .msg-attachment * { background: none !important; border: none !important; box-shadow: none !important; }
.msg-files.sticker img { max-width: 160px !important; max-height: 160px !important; border-radius: 8px; }
.msg-files.sticker .att-dl { display: none; }

/* ── Link previews ── */
.msg-embeds { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.msg-embeds:empty { display: none; }
.embed-slot:empty { display: none; }
.embed {
  --embed-color: var(--line-strong);
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 14px;
  max-width: 440px;
  padding: 10px 14px 12px 14px;
  background: var(--bg-secondary, rgba(255,255,255,0.03));
  border: 1px solid var(--line);
  border-left: 3px solid var(--embed-color);
  border-radius: 8px;
  animation: menu-in 180ms var(--ease-out);
}
.embed > * { grid-column: 1; }
.embed-site { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.embed-title { font-weight: 600; color: var(--brand-color); text-decoration: none; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.embed-title:hover { text-decoration: underline; }
.embed-desc { margin-top: 4px; font-size: 13px; line-height: 1.4; color: var(--text-secondary, var(--text-muted)); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.embed-thumb { grid-column: 2; grid-row: 1 / span 3; width: 80px; height: 80px; object-fit: cover; border-radius: 6px; align-self: start; }
.embed.embed-large .embed-thumb { grid-column: 1 / -1; grid-row: auto; width: 100%; height: auto; max-height: 260px; margin-top: 10px; }
.embed-image { padding: 0; border: none; background: none; display: block; }
.embed.embed-image { padding: 0; border: none; background: none; }
.embed-image img, img.embed-image { max-width: 400px; max-height: 300px; border-radius: 8px; cursor: zoom-in; }
.embed-video, .embed-iframe {
  grid-column: 1 / -1;
  margin-top: 10px;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: none;
  border-radius: 6px;
  background: #000 center / cover no-repeat;
}
.embed-video { position: relative; cursor: pointer; padding: 0; }
.embed-play {
  position: absolute; left: 50%; top: 50%;
  width: 56px; height: 56px; margin: -28px 0 0 -28px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: rgba(0,0,0,0.65);
  color: #fff;
  transition: transform 160ms var(--ease-out), background-color 160ms var(--ease-out);
}
.embed-play svg { width: 24px; height: 24px; margin-left: 3px; fill: currentColor; }
.embed-video:hover .embed-play { background: #ff0033; transform: scale(1.06); }
.embed-video:active .embed-play { transform: scale(0.97); }

/* ── GIF tab ── */
.gif-search { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px; margin-bottom: 8px; border-radius: 8px; background: var(--bg-tertiary, rgba(0,0,0,0.25)); border: 1px solid var(--line); color: var(--text-muted); }
.gif-search svg { width: 16px; height: 16px; flex: none; }
.gif-search input { flex: 1; min-width: 0; background: none; border: none; outline: none; color: var(--text-normal, #fff); font: inherit; font-size: 14px; }
.gif-search:focus-within { border-color: var(--brand-color); }
.gif-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; align-items: start; }
.gif-col { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.gif-tile { position: relative; display: block; width: 100%; min-height: 60px; padding: 0; border: none; border-radius: 6px; overflow: hidden; background: var(--line); cursor: pointer; transition: transform 140ms var(--ease-out); }
.gif-tile img { display: block; width: 100%; height: 100%; object-fit: cover; }
.gif-tile:active { transform: scale(0.97); }
.gif-fav { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: rgba(0,0,0,0.6); color: #fff; opacity: 0; transition: opacity 140ms var(--ease-out), color 140ms var(--ease-out); }
.gif-fav svg { width: 14px; height: 14px; }
.gif-tile:hover .gif-fav, .gif-fav.on { opacity: 1; }
.gif-fav.on { color: #f5c542; }
.gif-fav.on svg { fill: currentColor; }
.gif-note { font-size: 12px; }

/* ── Pins ── */
#btn-pins { position: relative; }
.pins-count { position: absolute; top: 3px; right: 2px; min-width: 15px; height: 15px; padding: 0 4px; border-radius: 8px; background: var(--brand-color); color: #fff; font-size: 10px; font-weight: 700; line-height: 15px; text-align: center; pointer-events: none; }
.msg-pinned { display: inline-flex; margin-left: 6px; color: var(--text-muted); vertical-align: -2px; }
.msg-pinned svg { width: 13px; height: 13px; }
.msg-content > .msg-pinned { float: right; }
.msg-actions .btn-pin.on { color: var(--brand-color); }
.pins-pop { width: 400px; }
.pins-list { overflow-y: auto; padding: 0 8px 8px; display: flex; flex-direction: column; gap: 2px; }
.pin-row { position: relative; display: flex; gap: 10px; padding: 8px 32px 8px 8px; border-radius: 8px; cursor: pointer; transition: background-color 120ms var(--ease-out); }
.pin-row:hover { background: rgba(255,255,255,0.04); }
.pin-av { width: 28px; height: 28px; flex: none; }
.pin-av::after { display: none; }
.pin-body { min-width: 0; flex: 1; }
.pin-head { display: flex; gap: 8px; align-items: baseline; }
.pin-name { font-weight: 600; font-size: 13.5px; color: var(--text-header); }
.pin-time { font-size: 11px; color: var(--text-muted); }
.pin-text { font-size: 13.5px; line-height: 1.4; color: var(--text-normal); word-break: break-word; }
.pin-thumb { display: block; margin-top: 6px; max-width: 180px; max-height: 120px; border-radius: 6px; }
.pin-unpin { position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; display: grid; place-items: center; border: none; border-radius: 6px; background: none; color: var(--text-muted); cursor: pointer; opacity: 0; transition: opacity 120ms var(--ease-out); }
.pin-unpin svg { width: 14px; height: 14px; }
.pin-row:hover .pin-unpin { opacity: 1; }
.pin-unpin:hover { background: rgba(239,68,68,0.15); color: #fca5a5; }

/* ── Voice messages ── */
.chat-input-row { position: relative; }
.chat-input-row.has-text .btn-voice { display: none; }
.chat-input-row:not(.has-text) #btn-send { display: none; }
.btn-voice { touch-action: none; }
.btn-voice.recording { color: #fff; background: #ef4444; animation: vm-pulse 1.2s ease-in-out infinite; }
.btn-voice.recording:hover { background: #ef4444; color: #fff; }
@keyframes vm-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.45); } 50% { box-shadow: 0 0 0 6px rgba(239,68,68,0); } }
.vm-rec { position: absolute; inset: 0 84px 0 0; display: none; align-items: center; gap: 12px; padding: 0 12px; border-radius: 10px; background: var(--bg-tertiary); z-index: 2; }
.vm-rec.show { display: flex; animation: menu-in 140ms var(--ease-out); }
.vm-dot { width: 10px; height: 10px; flex: none; border-radius: 50%; background: #ef4444; animation: vm-blink 1s steps(2, start) infinite; }
@keyframes vm-blink { to { opacity: 0.2; } }
.vm-time { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text-header); min-width: 36px; }
.vm-live { flex: none; height: 28px; width: 240px; max-width: 30%; }
.vm-hint { flex: 1; min-width: 0; font-size: 12.5px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: right; }
.vm-rec.cancel { background: rgba(239,68,68,0.14); }
.vm-rec.cancel .vm-hint { color: #fca5a5; }
.msg-files.voice { max-width: 420px; }
.vm-player { display: flex; align-items: center; gap: 10px; width: 100%; max-width: 380px; padding: 8px 12px 8px 8px; border-radius: 22px; background: var(--bg-secondary); border: 1px solid var(--line); }
.vm-play { flex: none; width: 34px; height: 34px; display: grid; place-items: center; border: none; border-radius: 50%; background: var(--brand-color); color: #fff; cursor: pointer; transition: transform 120ms var(--ease-out), background-color 120ms var(--ease-out); }
.vm-play svg { width: 15px; height: 15px; fill: currentColor; }
.vm-play:hover { background: var(--brand-hover, #8b5cf6); }
.vm-play:active { transform: scale(0.97); }
.vm-wave { flex: 1; min-width: 0; height: 30px; display: flex; align-items: center; gap: 2px; cursor: pointer; }
.vm-wave span { flex: 1; min-width: 2px; max-width: 4px; border-radius: 2px; background: var(--line-strong, rgba(255,255,255,0.22)); transition: background-color 120ms linear; }
.vm-wave span.on { background: var(--brand-color); }
.vm-dur { flex: none; min-width: 34px; font-size: 12px; font-variant-numeric: tabular-nums; color: var(--text-muted); }
.vm-speed { flex: none; height: 22px; padding: 0 7px; border: none; border-radius: 11px; background: rgba(255,255,255,0.06); color: var(--text-muted); font-size: 11px; font-weight: 700; cursor: pointer; }
.vm-speed:hover { color: var(--text-header); }
/* Toasts sit above the chat input so they never cover its buttons. */
.toast-container { bottom: 96px; }

/* ── Profile 2.0 ── */
.p2-card { position: fixed; z-index: 1600; width: 300px; max-width: calc(100vw - 16px); background: var(--bg-secondary); border: 1px solid var(--line-strong); border-radius: 14px; box-shadow: var(--shadow-float); overflow: hidden; animation: menu-in 140ms var(--ease-out); }
.p2-banner { height: 90px; background-size: cover !important; background-position: center !important; }
.p2-av-wrap { position: relative; width: 76px; height: 76px; margin: -38px 0 0 14px; }
.p2-av { width: 76px; height: 76px; border-radius: 50%; border: 5px solid var(--bg-secondary); background-color: var(--bg-tertiary); box-sizing: border-box; }
.p2-av-wrap .profile-presence { position: absolute; right: 2px; bottom: 2px; }
.p2-body { padding: 6px 14px 14px; display: flex; flex-direction: column; gap: 8px; }
.p2-name { font-size: 18px; font-weight: 700; color: var(--text-header); line-height: 1.2; word-break: break-word; }
.p2-status { font-size: 12.5px; color: var(--text-muted); margin-top: -6px; }
.p2-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.p2-badges:empty { display: none; }
.p2-badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 11px; font-size: 11.5px; font-weight: 600; background: rgba(255,255,255,0.06); color: var(--text-normal); }
.p2-badge svg { width: 12px; height: 12px; }
.p2-badge.b-admin { background: rgba(239,68,68,0.14); color: #fca5a5; }
.p2-badge.b-old { background: rgba(245,197,66,0.14); color: #fcd34d; }
.p2-badge.b-stream { background: rgba(124,92,252,0.16); color: #c4b5fd; }
.p2-bio { font-size: 13px; line-height: 1.45; color: var(--text-normal); white-space: pre-wrap; word-break: break-word; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.p2-stats { display: flex; flex-direction: column; gap: 4px; padding-top: 8px; border-top: 1px solid var(--line); }
.p2-stats:empty { display: none; }
.p2-stat { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-muted); }
.p2-stat svg { width: 14px; height: 14px; flex: none; }
.p2-stat b { color: var(--text-normal); font-weight: 600; }
.p2-skel { height: 14px; border-radius: 4px; background: rgba(255,255,255,0.05); }
.p2-voice { display: flex; flex-direction: column; gap: 6px; padding-top: 8px; border-top: 1px solid var(--line); }
.p2-vol { display: flex; align-items: center; gap: 8px; color: var(--text-muted); }
.p2-vol svg { width: 15px; height: 15px; flex: none; }
.p2-vol input { flex: 1; min-width: 0; accent-color: var(--brand-color); }
.p2-vol-val { width: 38px; text-align: right; font-size: 12px; font-variant-numeric: tabular-nums; }
.p2-mute { display: flex; align-items: center; justify-content: center; gap: 6px; height: 30px; border: 1px solid var(--line); border-radius: 8px; background: none; color: var(--text-normal); font: inherit; font-size: 13px; cursor: pointer; transition: background-color 120ms var(--ease-out), transform 120ms var(--ease-out); }
.p2-mute svg { width: 15px; height: 15px; }
.p2-mute:hover { background: rgba(255,255,255,0.05); }
.p2-mute:active { transform: scale(0.97); }
.p2-mute.on { border-color: rgba(239,68,68,0.4); color: #fca5a5; background: rgba(239,68,68,0.08); }
.p2-actions { display: flex; gap: 8px; }
.p2-actions > * { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; }
.p2-actions svg { width: 15px; height: 15px; }
.p2-actions > .p2-call { flex: 0 0 34px; padding: 0; }
.profile-banner { position: relative; background-size: cover !important; background-position: center !important; }
.p2-banner-edit { position: absolute; right: 48px; top: 10px; display: none; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border: none; border-radius: 14px; background: rgba(0,0,0,0.55); color: #fff; font: inherit; font-size: 12px; cursor: pointer; }
.p2-banner-edit svg { width: 14px; height: 14px; }
.profile-banner:hover .p2-banner-edit { display: inline-flex; }
.p2-stats.profile-section { border-top: none; padding-top: 0; }
#profile-badges { margin: 8px 0 2px; }
.p2-banner-row { display: flex; gap: 8px; }
.p2-banner-row .chip-btn { display: inline-flex; align-items: center; gap: 6px; }
.p2-banner-row svg { width: 14px; height: 14px; }
.vc-u.local-muted .vc-u-name { opacity: 0.55; text-decoration: line-through; text-decoration-thickness: 1px; }
.status-icon.local-mute { color: #fca5a5; }

/* ── Media gallery ── */
.gal-card { width: 760px; max-width: calc(100vw - 32px); height: min(640px, calc(100vh - 64px)); display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.gal-head { display: flex; align-items: center; gap: 12px; padding: 16px 16px 10px 20px; }
.gal-title { font-size: 16px; font-weight: 700; color: var(--text-header); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gal-search { flex: 1; display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px; border-radius: 8px; background: var(--bg-tertiary); border: 1px solid var(--line); color: var(--text-muted); margin-right: 36px; }
.gal-search svg { width: 15px; height: 15px; flex: none; }
.gal-search input { flex: 1; min-width: 0; border: none; background: none; outline: none; color: var(--text-normal); font: inherit; font-size: 13.5px; }
.gal-search:focus-within { border-color: var(--brand-color); }
.gal-close { top: 14px; right: 14px; }
.gal-tabs { padding: 0 20px; }
.gal-body { flex: 1; overflow-y: auto; padding: 4px 20px 20px; }
.gal-month { position: sticky; top: -4px; z-index: 1; background: var(--bg-secondary); padding: 12px 0 8px; margin: 0; }
.gal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 6px; }
.gal-tile { position: relative; aspect-ratio: 1; padding: 0; border: none; border-radius: 8px; overflow: hidden; background: var(--bg-tertiary); cursor: zoom-in; transition: transform 120ms var(--ease-out); }
.gal-tile:active { transform: scale(0.97); }
.gal-tile img, .gal-tile video { width: 100%; height: 100%; object-fit: cover; display: block; }
.gal-tile.sticker img { object-fit: contain; padding: 10px; }
.gal-tile.broken img, .gal-tile.broken video { visibility: hidden; }
.gal-tile.broken::after { content: 'Не загрузилось'; position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-muted); font-size: 12px; }
.gal-play { position: absolute; left: 50%; top: 50%; width: 38px; height: 38px; margin: -19px 0 0 -19px; display: grid; place-items: center; border-radius: 50%; background: rgba(0,0,0,0.6); color: #fff; }
.gal-play svg { width: 16px; height: 16px; margin-left: 2px; fill: currentColor; }
.gal-meta { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 8px 6px; font-size: 11px; color: #fff; text-align: left; background: linear-gradient(transparent, rgba(0,0,0,0.75)); opacity: 0; transition: opacity 120ms var(--ease-out); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gal-go { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 6px; background: rgba(0,0,0,0.6); color: #fff; opacity: 0; transition: opacity 120ms var(--ease-out); cursor: pointer; }
.gal-go svg { width: 14px; height: 14px; }
.gal-tile:hover .gal-meta, .gal-tile:hover .gal-go, .gal-tile:focus-visible .gal-meta { opacity: 1; }
.gal-list { display: flex; flex-direction: column; gap: 2px; padding-top: 8px; }
.gal-row { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 8px; transition: background-color 120ms var(--ease-out); }
.gal-row:hover { background: rgba(255,255,255,0.04); }
.gal-ico { width: 34px; height: 34px; flex: none; display: grid; place-items: center; border-radius: 8px; background: var(--bg-tertiary); color: var(--text-muted); }
.gal-ico svg { width: 17px; height: 17px; }
.gal-main { flex: 1; min-width: 0; }
.gal-name { font-size: 14px; color: var(--text-normal); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.gal-link { color: var(--brand-color); text-decoration: none; }
.gal-link:hover { text-decoration: underline; }
.gal-sub { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gal-btn { width: 30px; height: 30px; flex: none; display: grid; place-items: center; border: none; border-radius: 7px; background: none; color: var(--text-muted); cursor: pointer; opacity: 0.7; transition: opacity 120ms, background-color 120ms; }
.gal-btn svg { width: 16px; height: 16px; }
.gal-row:hover .gal-btn { opacity: 1; }
.gal-btn:hover { background: rgba(255,255,255,0.07); color: var(--text-header); }
.gal-empty { padding: 40px 0; text-align: center; }

/* ── Paste preview & crop ── */
.pc-modal { z-index: 3000; }
.pc-card { width: auto; max-width: min(900px, calc(100vw - 32px)); padding: 0; display: flex; flex-direction: column; overflow: hidden; }
.pc-head { display: flex; align-items: baseline; gap: 12px; padding: 16px 20px 10px; }
.pc-title { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; color: var(--text-header); }
.pc-title svg { width: 16px; height: 16px; }
.pc-hint { font-size: 12.5px; color: var(--text-muted); }
.pc-stage { padding: 0 20px; display: grid; place-items: center; min-width: 320px; }
.pc-frame { position: relative; overflow: hidden; border-radius: 6px; cursor: crosshair; touch-action: none; user-select: none; background: repeating-conic-gradient(#2a2a33 0% 25%, #22222a 0% 50%) 50% / 16px 16px; }
.pc-img { display: block; max-width: min(860px, calc(100vw - 72px)); max-height: calc(100vh - 220px); }
.pc-sel { position: absolute; border: 1.5px solid #fff; box-shadow: 0 0 0 9999px rgba(0,0,0,0.55); cursor: move; border-radius: 2px; }
.pc-sel.hidden { display: none; }
.pc-foot { display: flex; align-items: center; gap: 8px; padding: 14px 20px 16px; }
.pc-foot .spacer { flex: 1; }
.pc-size { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.pc-reset.hidden { display: none; }
.pc-foot .chip-btn { height: 34px; padding: 0 14px; font-size: 13px; }
.pc-foot .btn-primary { height: 34px; padding: 0 18px; }
.file-item .icon .file-thumb { width: 28px; height: 28px; object-fit: cover; border-radius: 4px; display: block; }
.gal-card, .pc-card { position: relative; background: var(--bg-secondary); border: 1px solid var(--line-strong, rgba(255,255,255,0.1)); border-radius: 18px; box-shadow: var(--shadow-modal, 0 30px 80px rgba(0,0,0,0.6)); }

/* ===== Onboarding ===== */
#modal-onboarding { z-index: 150; }
.ob-card { position: relative; width: 460px; max-width: calc(100vw - 32px); padding: 0; display: flex; flex-direction: column; background: var(--bg-secondary); border: 1px solid var(--line-strong, rgba(255,255,255,0.1)); border-radius: 18px; box-shadow: var(--shadow-modal, 0 30px 80px rgba(0,0,0,0.6)); overflow: hidden; }
.ob-body { padding: 26px 26px 18px; min-height: 236px; animation: menu-in 0.22s var(--ease-out); }
.ob-body h2 { margin: 2px 0 16px; font-size: 21px; letter-spacing: -0.01em; }
.ob-kicker { font-size: 12px; font-weight: 600; color: #c4b5fd; text-transform: uppercase; letter-spacing: 0.06em; }
.ob-label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.ob-body select { width: 100%; padding: 10px 34px 10px 12px; border-radius: 10px; background: var(--bg-tertiary) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center; color: var(--text-normal); border: 1px solid var(--line, rgba(255,255,255,0.06)); font-family: inherit; font-size: 14px; appearance: none; -webkit-appearance: none; cursor: pointer; outline: none; }
.ob-body select:focus { border-color: var(--brand-ring, var(--brand-color)); }
.ob-meter { margin-top: 14px; height: 10px; border-radius: 6px; background: var(--bg-tertiary); overflow: hidden; border: 1px solid var(--line, rgba(255,255,255,0.06)); }
.ob-meter-fill { display: block; height: 100%; width: 100%; transform-origin: left; transform: scaleX(0); background: linear-gradient(90deg, #22c55e, #a3e635 70%, #facc15); transition: transform 0.06s linear; }
.ob-mic-note { margin-top: 10px; font-size: 13px; color: var(--text-muted); min-height: 18px; }
.ob-mic-note.ok { color: #4ade80; }
.ob-mic-note.err { color: #f87171; }
.ob-avatar-row { display: flex; gap: 18px; align-items: center; }
.ob-avatar { position: relative; width: 96px; height: 96px; border-radius: 50%; border: 2px dashed var(--line-strong, rgba(255,255,255,0.18)); flex-shrink: 0; cursor: pointer; background-size: cover !important; background-position: center !important; transition: transform 0.16s var(--ease-out), border-color 0.16s ease; }
.ob-avatar.set { border-style: solid; border-color: var(--brand-color); }
.ob-avatar:hover { border-color: var(--brand-color); }
.ob-avatar:active { transform: scale(0.97); }
.ob-avatar-hint { position: absolute; right: -2px; bottom: -2px; width: 30px; height: 30px; border-radius: 50%; background: var(--brand-color); color: #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 0 0 3px var(--bg-secondary); }
.ob-avatar-hint .ico { width: 15px; height: 15px; }
.ob-avatar-text { font-size: 13.5px; color: var(--text-muted); line-height: 1.5; }
.ob-tour { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.ob-tour li { display: flex; gap: 12px; }
.ob-keys { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; margin-top: 6px; font-size: 12.5px; color: var(--text-muted); }
.ob-keys kbd { font-family: inherit; font-size: 11px; font-weight: 600; color: var(--text-normal); padding: 1px 6px; margin-right: 6px; border-radius: 5px; background: var(--bg-tertiary); box-shadow: 0 1px 0 rgba(255,255,255,0.08) inset, 0 1px 0 rgba(0,0,0,0.5); }
.ob-foot { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-top: 1px solid var(--line, rgba(255,255,255,0.06)); background: rgba(0,0,0,0.12); }
.ob-foot .btn-secondary, .ob-foot .btn-primary { flex: 0 0 auto; padding: 9px 16px; }
.ob-dots { flex: 1; display: flex; justify-content: center; gap: 6px; }
.ob-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--bg-tertiary); transition: background-color 0.2s ease, transform 0.2s var(--ease-out); }
.ob-dot.on { background: var(--brand-color); }
.ob-actions { display: flex; align-items: center; gap: 10px; }
.ob-skip { background: none; border: none; color: var(--text-muted); font: inherit; font-size: 13px; cursor: pointer; padding: 6px; }
.ob-skip:hover { color: var(--text-normal); }

/* ===== Drag users between voice channels ===== */
.vc-u.vm-movable { cursor: grab; user-select: none; -webkit-user-drag: none; touch-action: none; }
body.vm-dragging, body.vm-dragging * { cursor: grabbing !important; user-select: none; }
.vc-u.vm-src { opacity: 0.4; }
.channel-item.voice.vm-drop { background: rgba(139, 92, 246, 0.18); box-shadow: inset 0 0 0 1px rgba(167, 139, 250, 0.6); }
.vm-ghost { position: fixed; left: 0; top: 0; z-index: 3000; pointer-events: none; display: flex; align-items: center; gap: 8px; padding: 5px 12px 5px 5px; border-radius: 999px; background: var(--bg-secondary); border: 1px solid var(--line-strong, rgba(255,255,255,0.12)); box-shadow: var(--shadow-float, 0 10px 30px rgba(0,0,0,0.5)); font-size: 13px; font-weight: 600; color: var(--text-normal); animation: menu-in 0.14s var(--ease-out); }
.vm-ghost-av { width: 22px; height: 22px; border-radius: 50%; background-size: cover; background-position: center; flex-shrink: 0; }

/* ===== 1:1 calls ===== */
.call-pop { position: fixed; top: 52px; left: 50%; transform: translateX(-50%); z-index: 2500; width: 260px; padding: 30px 18px 18px; overflow: hidden; border-radius: 20px; background: var(--bg-secondary); border: 1px solid var(--line-strong, rgba(255,255,255,0.12)); box-shadow: var(--shadow-modal, 0 30px 80px rgba(0,0,0,0.6)); display: flex; flex-direction: column; align-items: center; text-align: center; animation: call-pop-in 0.26s var(--ease-out); }
@keyframes call-pop-in { from { opacity: 0; transform: translate(-50%, -10px) scale(0.96); } to { opacity: 1; transform: translate(-50%, 0) scale(1); } }
.call-pop-av { position: relative; width: 76px; height: 76px; margin-bottom: 12px; }
.call-av { position: absolute; inset: 0; border-radius: 50%; background-size: cover; background-position: center; }
.call-ring { position: absolute; inset: 0; border-radius: 50%; border: 2px solid rgba(74, 222, 128, 0.55); animation: call-ring 1.8s var(--ease-out) infinite; }
.call-ring.r2 { animation-delay: 0.9s; }
@keyframes call-ring { from { transform: scale(1); opacity: 0.9; } to { transform: scale(1.6); opacity: 0; } }
.call-pop-name { font-size: 16px; font-weight: 700; color: var(--text-normal); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.call-pop-sub { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.call-pop-note { font-size: 11.5px; color: var(--text-muted); margin-top: 6px; max-width: 220px; text-align: center; line-height: 1.35; opacity: .85; }
.call-pop-actions { display: flex; gap: 22px; margin-top: 18px; }
.call-btn { width: 50px; height: 50px; border-radius: 50%; border: none; color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: transform 0.16s var(--ease-out), filter 0.16s ease; }
.call-btn .ico { width: 21px; height: 21px; }
.call-btn:hover { filter: brightness(1.1); }
.call-btn:active { transform: scale(0.97); }
.call-btn.accept { background: #22c55e; box-shadow: 0 8px 22px rgba(34, 197, 94, 0.35); }
.call-btn.decline { background: #ef4444; box-shadow: 0 8px 22px rgba(239, 68, 68, 0.35); }
.channel-item.call-item .icon { color: #4ade80; }
.call-time { margin-left: auto; font-size: 11.5px; font-variant-numeric: tabular-nums; color: #4ade80; }
/* reduced motion: app setting (app.js), not the OS flag */
.reduce-motion .call-ring { animation: none; opacity: 0; }

/* Web build has no titlebar: overlays cover the whole viewport */
body.no-titlebar .modal { inset: 0; }
.chip-btn .ico { width: 14px; height: 14px; }
input[type="range"] { accent-color: var(--brand-color); }
.chat-header .icon-action.hidden { display: none; }
/* DM header: keep the call buttons apart from the voice controls (two camera-like icons otherwise sit side by side) */
#btn-vcall { position: relative; margin-right: 9px; }
#btn-vcall::after { content: ''; position: absolute; right: -6px; top: 9px; bottom: 9px; width: 1px; background: var(--line-strong, rgba(255,255,255,0.1)); }
#btn-whatsnew, #btn-check-update { vertical-align: middle; height: 28px; }

/* Panel resize handles (replace the native resize corner) */
.panel-resizer { position: absolute; top: 0; bottom: 0; width: 7px; z-index: 5; cursor: col-resize; touch-action: none; }
.channels-sidebar > .panel-resizer { right: 0; }
.users-sidebar > .panel-resizer { left: 0; }
.panel-resizer::after { content: ''; position: absolute; top: 0; bottom: 0; width: 2px; background: var(--brand-color); opacity: 0; transition: opacity 0.15s ease; }
.channels-sidebar > .panel-resizer::after { right: 0; }
.users-sidebar > .panel-resizer::after { left: 0; }
.panel-resizer:hover::after, .panel-resizer.dragging::after { opacity: 0.7; }
body.panel-resizing, body.panel-resizing * { cursor: col-resize !important; user-select: none; }
/* Settings footer: just save / cancel now */
.settings-modal-content .modal-actions .btn-primary, .settings-modal-content .modal-actions .btn-secondary { flex: 0 0 auto; min-width: 130px; }
.about-reset { display: flex; align-items: center; gap: 16px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--glass-border); }
.about-reset > div { flex: 1; min-width: 0; }
.about-reset-title { font-size: 13px; font-weight: 600; color: var(--text-normal); }
.about-reset-desc { font-size: 12px; color: var(--text-muted); margin-top: 3px; line-height: 1.45; }

/* ── Chat markdown ── */
.md-code { font-family: Consolas, 'Cascadia Mono', ui-monospace, monospace; font-size: 0.88em; padding: 1px 5px; border-radius: 4px; background: rgba(255,255,255,0.07); border: 1px solid var(--glass-border); color: var(--text-header); }
.md-pre { margin: 4px 0; padding: 8px 10px; border-radius: 6px; background: var(--bg-deep); border: 1px solid var(--glass-border); overflow-x: auto; white-space: pre; max-width: 100%; }
.md-pre code { font-family: Consolas, 'Cascadia Mono', ui-monospace, monospace; font-size: 13px; line-height: 1.45; color: var(--text-normal); }
.md-quote { margin: 2px 0; padding-left: 10px; border-left: 3px solid rgba(255,255,255,0.18); color: var(--text-normal); }
.message .text strong { color: var(--text-header); font-weight: 600; }
.md-spoiler { background: #2a2a33; color: transparent; border-radius: 4px; padding: 0 2px; cursor: pointer; transition: background 0.15s ease, color 0.15s ease; }
.md-spoiler * { visibility: hidden; }
.md-spoiler:hover { background: #34343f; }
.md-spoiler.shown { background: rgba(255,255,255,0.08); color: inherit; cursor: text; }
.md-spoiler.shown * { visibility: visible; }
.channels-sidebar, .users-sidebar { flex-shrink: 0; }
/* Small windows: keep the chat usable before the side panels. */
@media (max-width: 1100px) {
  .channels-sidebar { max-width: 230px; }
  .users-sidebar { max-width: 210px; min-width: 180px; }
}
/* Idle voice meters: show only the fill, not an empty grey track. */
.vc-u-meter { background: transparent; }
.chat-header { min-width: 0; }
.chat-header h3 { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-header .icon-action { flex-shrink: 0; }
.chat-search { flex-shrink: 1; min-width: 110px; }
@media (max-width: 1100px) {
  .chat-header { padding: 0 14px; gap: 6px; }
  .chat-search { width: 150px; }
  .chat-search:focus-within { width: 200px; }
}
.sfx-row { display: flex; align-items: center; gap: 12px; }
.sfx-row input[type="range"] { flex: 1; }
.sfx-row .chip-btn { flex-shrink: 0; }

/* Voice panel when not in a voice channel */
.users-empty { padding: 18px 12px; color: var(--text-muted); font-size: 12.5px; line-height: 1.45; text-align: center; }

/* Audio-only share (src/audioshare.js) */
.as-modal { width: 420px; max-width: 92vw; }
.as-sub { font-size: 13px; color: var(--text-muted); margin: -4px 0 14px; line-height: 1.45; }
.as-options { display: flex; flex-direction: column; gap: 8px; }
.as-opt { display: flex; align-items: flex-start; gap: 10px; padding: 11px 12px; border-radius: 12px; border: 1px solid var(--glass-border); background: var(--bg-tertiary); cursor: pointer; transition: border-color .15s, background-color .15s; }
.as-opt:hover { background: var(--bg-hover); }
.as-opt:has(input:checked) { border-color: var(--brand-color); background: var(--brand-soft); }
.as-opt input { margin-top: 3px; accent-color: var(--brand-color); }
.as-opt span { display: flex; flex-direction: column; gap: 2px; font-size: 13.5px; }
.as-opt small { font-size: 12px; color: var(--text-muted); }
.as-app { display: flex; gap: 8px; margin-top: 10px; }
.as-app select { flex: 1; min-width: 0; padding: 10px 34px 10px 12px; border-radius: 10px; background: var(--bg-tertiary) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center; color: var(--text-normal); border: 1px solid rgba(255,255,255,0.08); font-family: inherit; font-size: 14px; appearance: none; -webkit-appearance: none; cursor: pointer; outline: none; }
.as-app select:focus-visible { border-color: var(--brand-color); }
.as-refresh { flex: 0 0 auto; width: 42px !important; padding: 0 !important; display: grid; place-items: center; }
.as-app.hidden, .as-empty.hidden { display: none; }
.as-empty { margin-top: 10px; font-size: 12.5px; color: var(--text-muted); }
.as-start:disabled { opacity: .5; cursor: default; }
.vc-u-status .share-audio { color: var(--brand-color); }

/* Narrow windows: the voice panel only mirrors the rows already listed under
   the channel on the left, so it gives its width back to the chat. */
@media (max-width: 1000px) {
  .users-sidebar { display: none; }
}
/* Own user panel in a narrow (or narrowed) sidebar: tighter controls so the
   name keeps a readable width next to four buttons. */
.user-controls { container-type: inline-size; }
@container (max-width: 260px) {
  .user-controls .avatar { margin-right: 9px; }
  .control-btns button { width: 28px; }
}

/* Profile: stats as label/value rows, compact ID line. */
.p2-stats.profile-section { padding: 10px 14px; gap: 7px; }
.p2-stat { gap: 9px; font-size: 13px; line-height: 1.35; }
.p2-stat-k { flex: 1; min-width: 0; }
.p2-stat b { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.profile-id-section { padding: 6px 6px 6px 14px; }
.profile-id-section .profile-section-title { margin: 0; flex: none; }
.profile-id { color: var(--text-normal); opacity: .7; font-size: 12px; }

/* Avatar crop (src/avatarcrop.js) */
.ac-modal { z-index: 3000; }
.ac-card { width: 340px; max-width: calc(100vw - 32px); padding: 22px 24px 20px; }
.ac-title { font-size: 17px; font-weight: 700; color: var(--text-header); }
.ac-hint { font-size: 12.5px; color: var(--text-muted); margin: 4px 0 14px; }
.ac-stage { position: relative; width: 280px; height: 280px; margin: 0 auto; overflow: hidden; border-radius: 12px; background: #0b0b10; cursor: grab; touch-action: none; user-select: none; }
.ac-stage.dragging { cursor: grabbing; }
.ac-img { position: absolute; left: 0; top: 0; max-width: none; transform-origin: 0 0; pointer-events: none; }
.ac-ring { position: absolute; inset: 0; border-radius: 50%; box-shadow: 0 0 0 400px rgba(8, 8, 12, 0.62); outline: 2px solid rgba(255,255,255,0.85); outline-offset: -2px; pointer-events: none; }
.ac-zoom { display: flex; align-items: center; gap: 10px; margin: 14px 4px 4px; color: var(--text-muted); }
.ac-zoom svg { width: 14px; height: 14px; flex: none; }
.ac-zoom input { flex: 1; accent-color: var(--brand-color); }
.ac-card .modal-actions { margin-top: 16px; }
.p2-av-zoom { cursor: zoom-in; }

/* Soundboard clip editor (src/soundtrim.js) */
.st-modal { z-index: 3000; }
.st-card { width: 540px; max-width: calc(100vw - 32px); padding: 22px 24px 20px; }
.st-title { font-size: 17px; font-weight: 700; color: var(--text-header); margin-bottom: 14px; }
.st-name { width: 100%; box-sizing: border-box; height: 40px; padding: 0 12px; border-radius: 10px; background: var(--bg-deep); border: 1px solid rgba(255,255,255,0.08); color: var(--text-normal); font: inherit; font-size: 14px; outline: none; }
.st-name:focus { border-color: var(--brand-color); }
.st-name.invalid { border-color: var(--accent-danger); }
.st-label { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 16px 0 8px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); }
.st-hint { font-size: 11.5px; font-weight: 400; text-transform: none; letter-spacing: 0; }
.st-over { display: block; width: 100%; height: 30px; margin-bottom: 6px; border-radius: 6px; background: rgba(0,0,0,0.25); cursor: pointer; touch-action: none; }
.st-wave { display: block; width: 100%; height: 96px; border-radius: 10px; background: rgba(0,0,0,0.3); touch-action: none; }
.st-row { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.st-play { height: 32px; padding: 0 12px; }
.st-play.active { color: var(--brand-color); }
.st-time { margin-left: auto; font-size: 12.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.st-time b { color: var(--text-normal); font-weight: 600; margin-left: 8px; }

/* Audio share: synced-with-voice option */
.as-sync { display: flex; align-items: flex-start; gap: 10px; margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: var(--bg-tertiary); cursor: pointer; }
.as-sync input { margin-top: 3px; accent-color: var(--brand-color); flex-shrink: 0; }
.as-sync span { display: flex; flex-direction: column; gap: 3px; font-size: 13.5px; }
.as-sync small { font-size: 12px; line-height: 1.4; color: var(--text-muted); }

/* What's new, v2: releases as cards, quieter close button, compact footer */
.whatsnew-card { width: min(560px, calc(100vw - 32px)); }
.whatsnew-hero { padding: 22px 64px 20px 24px; position: relative; }
.whatsnew-head { min-width: 0; }
.whatsnew-card > .profile-close { top: 22px; right: 20px; width: 32px; height: 32px; border-radius: 9px; background: transparent; color: var(--text-muted); backdrop-filter: none; z-index: 2; }
.whatsnew-card > .profile-close:hover { background: var(--bg-hover); color: var(--text-header); }
.whatsnew-body { padding: 14px 16px 6px; display: flex; flex-direction: column; gap: 8px; scrollbar-width: thin; }
.wn-release { margin: 0; border: 1px solid var(--line, rgba(255,255,255,0.06)); background: rgba(255,255,255,0.015); border-radius: 14px; transition: background-color .15s, border-color .15s; }
.wn-release[open] { background: var(--bg-tertiary); border-color: var(--line-strong, rgba(255,255,255,0.1)); }
.wn-release summary { padding: 12px 14px; border-radius: 14px; }
.wn-release[open] summary:hover { background: transparent; }
.wn-rtitle { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wn-new { font-size: 11px; font-weight: 600; color: #fff; background: var(--brand-color); padding: 3px 8px; border-radius: 999px; flex-shrink: 0; }
.wn-list { padding: 0 14px 14px; gap: 14px; }
.wn-ico { width: 34px; height: 34px; border-radius: 10px; background: var(--brand-soft, rgba(124,92,252,0.14)); border: none; }
.wn-ico .ico { width: 17px; height: 17px; }
.wn-item > div { min-width: 0; padding-top: 1px; }
.wn-title { font-weight: 600; }
.wn-text { margin-top: 3px; }
.wn-text code { font: 12px/1.3 ui-monospace, Consolas, monospace; background: rgba(255,255,255,0.07); color: var(--text-normal); padding: 1px 5px; border-radius: 5px; white-space: nowrap; }
.whatsnew-foot { justify-content: flex-end; padding: 14px 20px 16px; }
.whatsnew-foot .btn-primary { width: auto; min-width: 130px; padding: 0 22px; height: 38px; }

/* Settings → profile: avatar buttons and colour swatches */
.av-pick-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.av-pick-row .chip-btn { height: 34px; padding: 0 12px; font-size: 13px; }
.av-pick-row .chip-btn .ico { width: 15px; height: 15px; }
.av-pick-row input[type="text"] { flex: 1; min-width: 180px; height: 34px; margin: 0; font-size: 13px; }
.color-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.color-swatch { width: 28px; height: 28px; border-radius: 50%; border: none; cursor: pointer; padding: 0; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.12); transition: transform .12s var(--ease-out), box-shadow .15s; }
.color-swatch:hover { transform: scale(1.1); }
.color-swatch.active { box-shadow: 0 0 0 2px var(--bg-secondary), 0 0 0 4px var(--text-header); }
.color-input { -webkit-appearance: none; appearance: none; width: 28px; height: 28px; padding: 0; border: none; border-radius: 50%; background: conic-gradient(#ef4444, #eab308, #22c55e, #06b6d4, #3b82f6, #a855f7, #ef4444); cursor: pointer; position: relative; transition: transform .12s var(--ease-out), box-shadow .15s; }
.color-input:hover { transform: scale(1.1); }
.color-input::-webkit-color-swatch-wrapper { padding: 4px; }
.color-input::-webkit-color-swatch { border: none; border-radius: 50%; }
.color-input:not(.active)::-webkit-color-swatch { opacity: 0; }
.color-input.active { box-shadow: 0 0 0 2px var(--bg-secondary), 0 0 0 4px var(--text-header); }
.whatsnew-card .whatsnew-foot .btn-primary { width: auto; flex: 0 0 auto; }
.p2-banner-row .chip-btn { height: 34px; padding: 0 12px; font-size: 13px; }
.p2-banner-row .chip-btn .ico { width: 15px; height: 15px; }
/* Plain header like the other modals: no glow, no badge */
.whatsnew-hero { background: none; padding: 20px 64px 16px 24px; }
.whatsnew-kicker { color: var(--text-muted); font-size: 12.5px; margin-bottom: 3px; }
.whatsnew-card > .profile-close { top: 18px; }

/* Feedback: sidebar button + form (src/feedback.js) + admin tab */
.feedback-btn { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 8px 10px 10px; height: 36px; flex-shrink: 0; border-radius: 10px; border: 1px solid color-mix(in srgb, var(--brand-color) 45%, transparent); background: color-mix(in srgb, var(--brand-color) 14%, transparent); color: var(--text-header); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; transition: background-color .15s, border-color .15s, transform .1s; }
.feedback-btn:hover { background: color-mix(in srgb, var(--brand-color) 24%, transparent); border-color: var(--brand-color); }
.feedback-btn:active { transform: scale(0.98); }
.feedback-btn svg { width: 16px; height: 16px; color: var(--brand-color); }
.fb-modal { z-index: 3000; }
.fb-card { width: 480px; max-width: calc(100vw - 32px); padding: 22px 24px 20px; }
.fb-title { font-size: 17px; font-weight: 700; color: var(--text-header); }
.fb-sub { font-size: 13px; color: var(--text-muted); margin: 4px 0 16px; line-height: 1.45; }
.fb-kinds { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.fb-kind { display: flex; align-items: center; justify-content: center; gap: 7px; height: 38px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.08); background: var(--bg-deep); color: var(--text-muted); font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; transition: background-color .15s, border-color .15s, color .15s; }
.fb-kind svg { width: 16px; height: 16px; }
.fb-kind:hover { color: var(--text-normal); background: var(--bg-hover); }
.fb-kind.active { color: var(--text-header); border-color: var(--brand-color); background: color-mix(in srgb, var(--brand-color) 14%, var(--bg-deep)); }
.fb-kind.active svg { color: var(--brand-color); }
.fb-text { width: 100%; box-sizing: border-box; min-height: 130px; max-height: 320px; resize: vertical; padding: 10px 12px; border-radius: 10px; background: var(--bg-deep); border: 1px solid rgba(255,255,255,0.08); color: var(--text-normal); font: inherit; font-size: 14px; line-height: 1.45; outline: none; }
.fb-text:focus { border-color: var(--brand-color); }
.fb-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; min-height: 32px; }
.fb-attach { height: 32px; padding: 0 12px; }
.fb-shot { position: relative; height: 44px; }
.fb-shot img { height: 44px; max-width: 120px; object-fit: cover; border-radius: 8px; display: block; border: 1px solid rgba(255,255,255,0.1); }
.fb-shot-x { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%; border: none; background: var(--bg-tertiary); color: var(--text-normal); display: grid; place-items: center; cursor: pointer; padding: 0; }
.fb-shot-x svg { width: 12px; height: 12px; }
.fb-count { margin-left: auto; font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.fb-note { font-size: 12px; color: var(--text-muted); margin-top: 10px; line-height: 1.4; }
.fb-card .modal-actions { margin-top: 16px; }
.fb-card .btn-primary:disabled { opacity: .5; cursor: default; }
.badge.red { background: rgba(239,68,68,0.15); color: #ef4444; }
.badge svg { width: 11px; height: 11px; vertical-align: -1px; }
.fb-item { padding: 10px 12px; border-radius: 9px; background: rgba(255,255,255,0.03); }
.fb-item.done { opacity: .55; }
.fb-item-head { display: flex; align-items: center; gap: 8px; }
.fb-item-head .badge { margin-left: 0; display: inline-flex; align-items: center; gap: 4px; }
.fb-item-who { font-size: 13px; font-weight: 600; color: var(--text-header); }
.fb-item-meta { font-size: 11.5px; color: var(--text-muted); }
.fb-item-head .admin-row-btns { margin-left: auto; }
.fb-item-text { margin-top: 6px; font-size: 13.5px; line-height: 1.45; color: var(--text-normal); white-space: pre-wrap; overflow-wrap: anywhere; user-select: text; }
.fb-item-img { display: block; margin-top: 8px; max-width: 240px; max-height: 160px; border-radius: 8px; cursor: zoom-in; }
/* Six admin tabs: keep «Выйти» on the same line */
.admin-tabs { flex-wrap: nowrap; gap: 2px; }
.admin-tab { padding: 6px 10px; white-space: nowrap; }
.admin-logout { flex-shrink: 0; white-space: nowrap; margin-left: auto; padding-left: 8px; }

/* Script-built dialogs (feedback, avatar crop, sound trim) get the same card as .glass modals */
.fb-card, .ac-card, .st-card { background: var(--bg-secondary); border: 1px solid var(--line-strong); border-radius: var(--radius-lg); box-shadow: var(--shadow-modal); }
.fb-card .modal-actions { justify-content: flex-end; border-top: none; padding-top: 0; }
.fb-card .modal-actions button { width: auto; flex: 0 0 auto; min-width: 110px; padding: 0 18px; height: 38px; }
.fb-kind { background: var(--bg-tertiary); }
.fb-kind.active { background: color-mix(in srgb, var(--brand-color) 14%, var(--bg-tertiary)); }
/* Link previews: no coloured accent stripe on the left */
.embed { border-left: 1px solid var(--line); }

/* macOS: native traffic lights sit over the left of the titlebar */
.platform-mac .window-controls { display: none; }
.platform-mac .titlebar { justify-content: center; }
.platform-mac .titlebar .title { padding-left: 0; }
.platform-mac #btn-audio-share { display: none; }

/* ── Browser / PWA (src/web.js) ── */
.platform-web .titlebar, .platform-web #btn-audio-share { display: none; }
.platform-web body { height: 100vh; height: 100dvh; }
.platform-web .app-container { height: 100vh; height: 100dvh; }
.platform-web .modal { inset: 0; }
.platform-web .setting-group:has(#setting-server-ip) { display: none; }
.no-screen-share #btn-screen { display: none; }
.drawer-btn, .drawer-shade, .voice-dock { display: none; }
.touch, .touch body { -webkit-tap-highlight-color: transparent; }
.touch input, .touch textarea, .touch select { font-size: 16px !important; }
.touch .panel-resizer { display: none; }
.standalone body { overscroll-behavior: none; }

/* Same account opened elsewhere (webrtc.js _sessionReplaced) */
.session-replaced { position: fixed; inset: 0; z-index: 5000; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(6, 6, 9, 0.78); backdrop-filter: blur(10px); animation: sr-in .3s var(--ease-out) both; }
.sr-card { width: min(380px, 100%); text-align: center; padding: 30px 26px 24px; border-radius: 22px; background: var(--bg-secondary); border: 1px solid var(--line-strong, rgba(255,255,255,.1)); box-shadow: 0 30px 80px -20px rgba(0,0,0,.8); animation: sr-pop .42s var(--ease-spring) both; }
.sr-icon { width: 56px; height: 56px; margin: 0 auto 16px; border-radius: 18px; display: grid; place-items: center; color: #fff; background: var(--brand-gradient); box-shadow: 0 10px 30px -8px rgba(124, 92, 252, .7); }
.sr-icon svg { width: 26px; height: 26px; }
.sr-title { font-size: 18px; font-weight: 700; color: var(--text-header); margin-bottom: 8px; }
.sr-text { font-size: 14px; line-height: 1.5; color: var(--text-muted); margin-bottom: 22px; }
.sr-btn { width: 100%; height: 46px; border-radius: 14px; font-size: 15px; }
@keyframes sr-in { from { opacity: 0; } }
@keyframes sr-pop { from { opacity: 0; transform: translateY(14px) scale(.96); } }

/* ── Phones ── */
@media (max-width: 760px) {
  .platform-web .app-container { position: relative; height: var(--app-h, 100dvh); padding: 0 env(safe-area-inset-right) 0 env(safe-area-inset-left); }
  .platform-web .main-content { border-radius: 0; }

  /* Channel drawer */
  .platform-web .channels-sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 60;
    width: min(86vw, 330px) !important; max-width: none; min-width: 0;
    padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom);
    border-radius: 0 22px 22px 0; border-right: 1px solid var(--line-strong, rgba(255,255,255,.08));
    transform: translateX(-104%); transition: transform .34s var(--ease-drawer);
    box-shadow: 18px 0 50px -10px rgba(0, 0, 0, .65);
  }
  .platform-web.drawer-open .channels-sidebar { transform: none; }
  .platform-web .channels-sidebar > .panel-resizer { display: none; }
  .platform-web .drawer-shade { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(4, 4, 7, .55); backdrop-filter: blur(2px); opacity: 0; pointer-events: none; transition: opacity .3s ease; }
  .platform-web.drawer-open .drawer-shade { opacity: 1; pointer-events: auto; }
  .platform-web .server-header { height: 60px; padding: 0 20px; }
  .platform-web .channel-item { min-height: 44px; border-radius: 12px; font-size: 15.5px; }
  .platform-web .vc-u { min-height: 36px; font-size: 14px; }
  .platform-web .vc-u .av { width: 26px; height: 26px; }
  .platform-web .category { padding-top: 18px; }
  .platform-web .user-controls { height: 70px; margin: 0 10px 10px; border-radius: 18px; background: var(--bg-tertiary); }
  .platform-web .control-btns button { width: 38px; height: 38px; }

  /* Header: menu, title, the essential actions */
  .platform-web .chat-header { height: calc(54px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 6px 0 8px; gap: 0; background: rgba(12, 12, 16, .86); backdrop-filter: blur(16px) saturate(140%); position: relative; z-index: 5; }
  .platform-web .drawer-btn { display: inline-flex; }
  .platform-web .chat-header .hash { display: none; }
  .platform-web .chat-header h3 { font-size: 16.5px; font-weight: 650; padding-left: 4px; }
  .platform-web .chat-search { display: none; }
  .platform-web .chat-header .icon-action { width: 40px; height: 40px; border-radius: 12px; }
  .platform-web .chat-header .icon-action svg { width: 21px; height: 21px; }
  .platform-web #btn-video, .platform-web #btn-screen { display: none; }
  .platform-web.in-voice #btn-screen { display: inline-flex; }
  .platform-web.in-voice.no-screen-share #btn-screen { display: none; }

  /* Messages */
  .platform-web .messages-container { padding-bottom: 6px; overscroll-behavior: contain; }
  .platform-web .message { padding-left: 12px; padding-right: 12px; }
  .platform-web .message .avatar { width: 36px; height: 36px; }
  .platform-web .msg-actions { right: 8px; top: -18px; }
  .platform-web .msg-actions button { width: 34px; height: 34px; }
  .platform-web .jump-new { bottom: calc(100% + 8px); }

  /* Composer */
  .platform-web .chat-input-wrapper { margin: 8px 10px max(10px, env(safe-area-inset-bottom)); padding: 4px 6px; border-radius: 24px; }
  .platform-web.kb-open .chat-input-wrapper { margin-bottom: 8px; }
  .platform-web .chat-input-row { min-height: 46px; align-items: center; gap: 2px; }
  .platform-web .chat-input-row button { width: 40px; height: 40px; flex-shrink: 0; }
  .platform-web #chat-input { padding: 9px 6px; line-height: 1.35; max-height: 140px; }
  .platform-web .typing-indicator { padding: 0 18px; }

  /* Voice call bar */
  .platform-web.in-voice .voice-dock { display: flex; }
  .platform-web .voice-dock {
    align-items: center; gap: 8px; margin: 6px 10px 0; padding: 7px 7px 7px 12px;
    border-radius: 20px; background: linear-gradient(135deg, rgba(34, 197, 94, .12), rgba(124, 92, 252, .1)), var(--bg-tertiary);
    border: 1px solid rgba(34, 197, 94, .22); box-shadow: 0 10px 30px -14px rgba(0, 0, 0, .8);
    animation: vd-in .4s var(--ease-spring) both;
  }
  .platform-web .vd-info { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; background: none; border: 0; color: inherit; text-align: left; font: inherit; padding: 0; }
  .platform-web .vd-live { width: 9px; height: 9px; border-radius: 50%; background: var(--accent-green); box-shadow: 0 0 0 0 rgba(34, 197, 94, .6); flex-shrink: 0; animation: vd-pulse 2s ease-out infinite; }
  .platform-web .voice-dock.vd-talking .vd-live { animation-duration: .9s; }
  .platform-web .vd-text { display: flex; flex-direction: column; min-width: 0; }
  .platform-web .vd-name { font-size: 14.5px; font-weight: 650; color: var(--text-header); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .platform-web .vd-sub { font-size: 11.5px; color: #86efac; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .platform-web .vd-avs { display: flex; margin-left: auto; padding-right: 2px; }
  .platform-web .vd-avs .av { box-shadow: none !important; animation: none !important; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--bg-tertiary); margin-left: -8px; flex-shrink: 0; }
  .platform-web .vd-avs .av:first-child { margin-left: 0; }
  .platform-web .vd-btns { display: flex; gap: 4px; flex-shrink: 0; }
  @media (max-width: 370px) { .platform-web .vd-avs { display: none; } }
  .platform-web .vd-btn { width: 40px; height: 40px; border-radius: 14px; border: 0; display: grid; place-items: center; background: rgba(255, 255, 255, .07); color: var(--text-header); transition: transform .15s var(--ease-spring), background-color .15s; }
  .platform-web .vd-btn:active { transform: scale(.9); }
  .platform-web .vd-btn svg { width: 20px; height: 20px; }
  .platform-web .vd-btn .ico-off { display: none; }
  .platform-web .vd-btn.muted { background: rgba(239, 68, 68, .18); color: #fca5a5; }
  .platform-web .vd-btn.muted .ico-on { display: none; }
  .platform-web .vd-btn.muted .ico-off { display: inline; }
  .platform-web .vd-btn[data-k="cam"].on { background: var(--brand-color); color: #fff; }
  .platform-web .vd-btn[data-k="leave"] { background: var(--accent-danger) !important; color: #fff !important; border: 0 !important; display: grid !important; }

  /* Video & streams: full-width tiles, controls always reachable by touch */
  .platform-web .video-grid { padding: 8px 10px; gap: 8px; max-height: 46vh; overflow-y: auto; }
  .platform-web .video-wrapper, .platform-web .video-wrapper.screen-share { max-width: 100%; width: 100%; border-radius: 16px; }
  .platform-web .video-wrapper:not(.screen-share) { width: calc(50% - 4px); }
  .platform-web .video-wrapper.focused { max-height: 40vh; }
  .platform-web .video-controls .v-btn { min-width: 36px; min-height: 36px; }
  .platform-web .v-vol-slider { display: none; }
  .platform-web .v-stream-info { display: none; }

  /* Menus, emoji and pins become bottom sheets */
  .platform-web .context-menu:not(.hidden) {
    left: 8px !important; right: 8px !important; top: auto !important; bottom: calc(8px + env(safe-area-inset-bottom)) !important;
    min-width: 0; max-height: 70dvh; overflow-y: auto; border-radius: 20px; padding: 8px;
    box-shadow: 0 0 0 100vmax rgba(4, 4, 7, .5), 0 -10px 40px rgba(0, 0, 0, .5);
    transform-origin: bottom center; animation: sheet-up .3s var(--ease-drawer) both;
  }
  .platform-web .context-menu .cx-btn, .platform-web .context-menu .cx-item { padding: 13px 14px; font-size: 15.5px; border-radius: 12px; }
  .platform-web .xp-pop, .platform-web .pins-pop {
    left: 0 !important; right: 0 !important; top: auto !important; bottom: 0 !important;
    width: 100% !important; max-width: 100%; max-height: 62dvh; border-radius: 22px 22px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 0 0 100vmax rgba(4, 4, 7, .45), 0 -10px 40px rgba(0, 0, 0, .5);
    animation: sheet-up .32s var(--ease-drawer) both;
  }

  /* Modals: cards fit the screen, settings and admin go full screen */
  .platform-web .glass { max-width: calc(100vw - 24px); max-height: calc(100dvh - 24px); overflow-y: auto; padding: 22px 18px; border-radius: 22px; }
  .platform-web .modal > .modal-content:not(.settings-modal-content):not(.admin-modal) { animation: sheet-up .32s var(--ease-drawer) both; }
  .platform-web .settings-modal-content { width: 100vw !important; height: 100dvh !important; max-width: 100vw; max-height: 100dvh; border-radius: 0; flex-direction: column !important; padding-top: env(safe-area-inset-top) !important; }
  .platform-web .modal-sidebar { width: auto; flex-direction: row; overflow-x: auto; padding: 10px; border-right: 0; border-bottom: 1px solid var(--glass-border); flex-shrink: 0; scrollbar-width: none; }
  .platform-web .modal-sidebar .sidebar-title { display: none; }
  .platform-web .modal-sidebar > * { flex-shrink: 0; white-space: nowrap; }
  .platform-web .modal-body { padding: 16px 16px max(16px, env(safe-area-inset-bottom)); overflow-y: auto; }
  .platform-web .admin-modal { width: 100vw !important; max-width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; padding-top: max(18px, env(safe-area-inset-top)); }

  /* Toasts at the top, clear of the composer and the keyboard */
  .platform-web .toast-container { top: calc(62px + env(safe-area-inset-top)); bottom: auto; left: 12px; right: 12px; align-items: center; }
  .platform-web .toast { max-width: 100%; }
}

@keyframes sheet-up { from { transform: translateY(24px); opacity: 0; } }
@keyframes vd-in { from { transform: translateY(10px) scale(.97); opacity: 0; } }
@keyframes vd-pulse { 0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, .55); } 80%, 100% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); } }
/* reduced motion: app setting (app.js), not the OS flag */
.reduce-motion.platform-web .channels-sidebar, .reduce-motion.platform-web .drawer-shade { transition: none; }
.reduce-motion .voice-dock, .reduce-motion .session-replaced, .reduce-motion .sr-card, .reduce-motion.platform-web .context-menu, .reduce-motion.platform-web .xp-pop, .reduce-motion.platform-web .modal-content { animation: none !important; }

/* Stream fullscreen without the Fullscreen API (media.js _pseudoFullscreen) */
.video-wrapper.pseudo-fs { position: fixed !important; inset: 0; z-index: 4000; width: 100vw !important; height: 100vh !important; max-width: none !important; max-height: none !important; aspect-ratio: auto; border-radius: 0 !important; background: #000; animation: none; }
.video-wrapper.pseudo-fs .video-controls { opacity: 1; pointer-events: auto; }
body.has-pseudo-fs .titlebar { visibility: hidden; }

/* Windows: macOS-like overlay scrollbars (thin, appear while hovering the
   scroll area) and text rendering closer to the Mac look. */
.platform-win ::-webkit-scrollbar { width: 6px; height: 6px; }
.platform-win ::-webkit-scrollbar-button, .platform-win ::-webkit-scrollbar-corner { display: none; background: transparent; }
.platform-win ::-webkit-scrollbar-thumb { background: transparent; border-radius: 3px; transition: background-color .2s; }
.platform-win :hover::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .1); }
.platform-win ::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, .2); }
.platform-win body { text-rendering: geometricPrecision; font-synthesis: none; }

/* Soundboard: stop what's playing (expr.js paintStop) */
.sb-stop { position: absolute; right: 8px; bottom: calc(100% + 10px); display: inline-flex; align-items: center; gap: 7px; padding: 7px 14px 7px 11px; border-radius: 999px; border: 1px solid rgba(248, 113, 113, .35); background: rgba(40, 18, 22, .92); color: #fecaca; font: 500 13px/1 inherit; font-family: inherit; cursor: pointer; box-shadow: var(--shadow-float, 0 10px 30px rgba(0,0,0,.45)); backdrop-filter: blur(8px); opacity: 0; transform: translateY(8px) scale(.96); pointer-events: none; transition: opacity .18s var(--ease-out), transform .22s var(--ease-spring), background-color .15s; z-index: 41; }
.sb-stop.show { opacity: 1; transform: none; pointer-events: auto; }
.sb-stop:hover { background: rgba(70, 22, 28, .95); }
.sb-stop svg { width: 13px; height: 13px; fill: currentColor; }
.platform-web .sb-stop { padding: 10px 16px 10px 13px; font-size: 14px; }

/* Touch laser on a stream (laser.js _touchAim): no browser gestures while aiming */
.touch .video-wrapper[data-laser="remote"] { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.touch .video-wrapper.laser-aiming { touch-action: none; }
