/* ChadSpeak — оформление. Базовые темы — тёмная (по умолчанию) и светлая.
   Цвета заданы переменными; цветные темы (синяя, красная, …) переопределяют их из theme.js. */

/* ---------- темы ---------- */

:root,
[data-theme='dark'] {
  --bg-app: #111214;
  --bg-guilds: #1a1b1e;
  --bg-sidebar: #232428;
  --bg-main: #2b2d31;
  --bg-elevated: #313338;
  --bg-input: #1e1f22;
  --bg-hover: rgba(255, 255, 255, 0.05);
  --bg-active: rgba(255, 255, 255, 0.09);
  --bg-floating: #18191c;
  --bg-modal: #2b2d31;
  --bg-stage: #0e0f11;
  --bg-tile: #1f2024;
  --border: rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 255, 255, 0.12);
  --text: #dbdee1;
  --text-muted: #949ba4;
  --text-faint: #6d6f78;
  --header: #f2f3f5;
  --accent: #5865f2;
  --accent-2: #8b5cf6;
  --accent-soft: rgba(88, 101, 242, 0.16);
  --accent-text: #ffffff;
  --link: #00a8fc;
  --green: #23a55a;
  --red: #f23f43;
  --yellow: #f0b232;
  --mention-bg: rgba(240, 178, 50, 0.1);
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 18px 50px rgba(0, 0, 0, 0.5);
  --login-bg: radial-gradient(1200px 600px at 20% 10%, #2c2f7a 0%, transparent 60%), radial-gradient(900px 500px at 90% 90%, #4a1f6e 0%, transparent 55%), #0b0c10;
  --scroll: rgba(255, 255, 255, 0.12);
  color-scheme: dark;
}

[data-theme='light'] {
  --bg-app: #e3e5e8;
  --bg-guilds: #e3e5e8;
  --bg-sidebar: #f2f3f5;
  --bg-main: #ffffff;
  --bg-elevated: #ffffff;
  --bg-input: #ebedef;
  --bg-hover: rgba(6, 6, 7, 0.05);
  --bg-active: rgba(6, 6, 7, 0.09);
  --bg-floating: #ffffff;
  --bg-modal: #ffffff;
  --bg-stage: #1e1f22;
  --bg-tile: #2b2d31;
  --border: rgba(6, 6, 7, 0.08);
  --border-strong: rgba(6, 6, 7, 0.14);
  --text: #313338;
  --text-muted: #5c5e66;
  --text-faint: #8a8d94;
  --header: #060607;
  --accent: #5865f2;
  --accent-2: #7c3aed;
  --accent-soft: rgba(88, 101, 242, 0.12);
  --accent-text: #ffffff;
  --link: #006ce7;
  --green: #1f9d55;
  --red: #da373c;
  --yellow: #c78b00;
  --mention-bg: rgba(240, 178, 50, 0.16);
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 18px 50px rgba(0, 0, 0, 0.2);
  --login-bg: radial-gradient(1200px 600px at 20% 10%, #c7ccff 0%, transparent 60%), radial-gradient(900px 500px at 90% 90%, #e5d4ff 0%, transparent 55%), #eef0f6;
  --scroll: rgba(6, 6, 7, 0.18);
  color-scheme: light;
}

:root {
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --font-base: 'Segoe UI Variable Text', 'Segoe UI', 'Noto Sans', 'Helvetica Neue', Arial, sans-serif;
  --font: var(--font-base);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --grad: linear-gradient(135deg, var(--accent), var(--accent-2));
}

/* ---------- основа ---------- */

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg-app);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

body,
.sidebar,
.main,
.members,
.guilds,
.modal,
.context-menu {
  transition: background-color 0.25s var(--ease), color 0.25s var(--ease);
}

button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  cursor: pointer;
}

input,
textarea,
select {
  font-family: inherit;
  font-size: inherit;
  color: var(--text);
  user-select: text;
}

.ico {
  flex-shrink: 0;
  display: block;
}

a.link {
  color: var(--link);
  text-decoration: none;
  cursor: pointer;
}

a.link:hover {
  text-decoration: underline;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-thumb {
  background: var(--scroll);
  border-radius: 10px;
  border: 3px solid transparent;
  background-clip: content-box;
}

::-webkit-scrollbar-track {
  background: transparent;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.muted {
  color: var(--text-muted);
}

.small-text {
  font-size: 13px;
}

.center {
  text-align: center;
}

.row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.center-row {
  justify-content: center;
  flex-wrap: wrap;
}

/* ---------- кнопки ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 9px 18px;
  font-weight: 600;
  min-height: 38px;
  transition: transform 0.12s var(--ease), filter 0.15s, background 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}

.btn:hover:not(:disabled) {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.btn:active:not(:disabled) {
  transform: translateY(0) scale(0.98);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn.primary {
  background: var(--grad);
  color: var(--accent-text);
  box-shadow: 0 4px 14px var(--accent-soft);
}

.btn.secondary {
  background: var(--bg-active);
  color: var(--header);
}

.btn.danger {
  background: var(--red);
  color: #fff;
}

.btn.success {
  background: var(--green);
  color: #fff;
}

.btn.link {
  background: none;
  color: var(--link);
  padding: 4px;
  min-height: 0;
  font-weight: 500;
}

.btn.link:hover {
  text-decoration: underline;
  transform: none;
}

.btn.small {
  padding: 5px 12px;
  min-height: 30px;
  font-size: 13px;
}

.btn.block {
  width: 100%;
}

.icon-btn {
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-muted);
  transition: background 0.15s, color 0.15s;
}

.icon-btn:hover {
  background: var(--bg-active);
  color: var(--header);
}

.icon-btn.off {
  color: var(--red);
}

.icon-btn.active {
  color: var(--green);
}

/* ---------- поля ---------- */

.input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

select.input {
  cursor: pointer;
}

.field {
  display: block;
  margin-bottom: 14px;
}

.field-label {
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.field-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin: -6px 0 12px;
}

.form-error {
  color: var(--red);
  font-size: 14px;
  margin-bottom: 10px;
}

.form-success {
  color: var(--green);
  font-size: 14px;
  margin-bottom: 10px;
}

.form-error:empty,
.form-success:empty {
  display: none;
}

.checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  line-height: 1.35;
}

.checkbox input {
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  accent-color: var(--accent);
  flex-shrink: 0;
}

input[type='range'] {
  accent-color: var(--accent);
}

.range {
  width: 100%;
}

/* ---------- аватары, бейджи ---------- */

.avatar {
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  flex-shrink: 0;
  position: relative;
  transition: box-shadow 0.15s;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.status-dot {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 38%;
  height: 38%;
  min-width: 10px;
  min-height: 10px;
  border-radius: 50%;
  border: 3px solid var(--bg-sidebar);
}

.status-dot.online {
  background: var(--green);
}

.status-dot.offline {
  background: #80848e;
}

.badge {
  background: var(--red);
  color: #fff;
  border-radius: 9px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ---------- экраны входа и подключения ---------- */

.screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--login-bg);
  overflow-y: auto;
  padding: 24px;
}

.login-lang {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--text-muted);
  background: color-mix(in srgb, var(--bg-main) 70%, transparent);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-strong);
}

.login-lang-select {
  background: transparent;
  border: none;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  outline: none;
}

.login-lang-select option {
  background: var(--bg-main);
  color: var(--text);
}

.login-card,
.connecting-card {
  position: relative;
  z-index: 1;
  background: color-mix(in srgb, var(--bg-main) 82%, transparent);
  backdrop-filter: blur(18px) saturate(1.2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 440px;
  max-width: 100%;
  box-shadow: var(--shadow-lg);
  margin: auto;
  animation: card-in 0.5s var(--ease);
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
}

.login-card h1 {
  text-align: center;
  color: var(--header);
  margin: 10px 0 4px;
  font-size: 26px;
  letter-spacing: -0.02em;
}

.notice {
  background: color-mix(in srgb, var(--yellow) 15%, transparent);
  border-left: 3px solid var(--yellow);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  font-size: 14px;
}

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  padding: 4px;
  background: var(--bg-input);
  border-radius: var(--radius);
}

.tab {
  flex: 1;
  background: none;
  border: none;
  padding: 8px 12px;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  font-weight: 600;
  transition: background 0.15s, color 0.15s;
}

.tab:hover {
  color: var(--header);
}

.tab.active {
  background: var(--bg-elevated);
  color: var(--header);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.connecting-card {
  text-align: center;
  width: 360px;
}

.connecting-card > div {
  margin-bottom: 16px;
}

.spinner {
  width: 40px;
  height: 40px;
  margin: 0 auto 16px;
  border: 4px solid var(--bg-active);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- раскладка ---------- */

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

.guilds {
  width: 72px;
  background: var(--bg-guilds);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
  gap: 8px;
  flex-shrink: 0;
  overflow-y: auto;
}

.guild-icon {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: none;
  color: var(--header);
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-radius 0.2s var(--ease), background 0.2s, transform 0.15s;
}

.guild-icon:hover {
  border-radius: 16px;
  background: var(--accent);
  color: #fff;
}

.guild-icon.active {
  border-radius: 16px;
  background: var(--grad);
  color: #fff;
  box-shadow: 0 6px 18px var(--accent-soft);
}

.guild-icon .badge {
  position: absolute;
  right: -4px;
  bottom: -4px;
  border: 3px solid var(--bg-guilds);
  height: 22px;
  border-radius: 11px;
}

.guild-pill {
  position: absolute;
  left: -16px;
  width: 8px;
  border-radius: 0 4px 4px 0;
  background: var(--header);
  height: 0;
  transition: height 0.2s var(--ease);
}

.guild-icon:hover .guild-pill {
  height: 20px;
}

.guild-icon.active .guild-pill {
  height: 40px;
}

.guild-icon.unread:not(.active) .guild-pill {
  height: 8px;
}

.guild-separator {
  width: 32px;
  height: 2px;
  background: var(--border-strong);
  border-radius: 1px;
}

.sidebar {
  width: 248px;
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  border-top-left-radius: var(--radius-lg);
}

.sidebar-header {
  height: 52px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  font-weight: 700;
  color: var(--header);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.server-menu-btn {
  width: 100%;
  height: 100%;
  background: none;
  border: none;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: var(--header);
  text-align: left;
  padding: 0;
}

.server-menu-btn .channel-name {
  flex: 1;
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg-main);
  position: relative;
}

.topbar {
  height: 52px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: var(--header);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.topbar .topbar-icon {
  color: var(--text-muted);
  font-size: 20px;
  display: flex;
}

.topbar .topbar-sub {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 13px;
  margin-left: 6px;
}

.topbar .spacer {
  flex: 1;
}

.topbar-btn {
  width: 36px;
  height: 36px;
}

.topbar-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

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

.offline-banner {
  background: var(--red);
  color: #fff;
  text-align: center;
  font-size: 13px;
  padding: 5px;
  font-weight: 600;
}

.empty-state {
  margin: auto;
  text-align: center;
  color: var(--text-muted);
  padding: 32px;
  max-width: 460px;
  line-height: 1.55;
}

.empty-state .big {
  display: flex;
  justify-content: center;
  margin-bottom: 14px;
  color: var(--accent);
}

.empty-state h2 {
  color: var(--header);
  margin: 0 0 8px;
}

.empty-state b {
  color: var(--header);
  user-select: text;
}

.empty-state.small {
  padding: 16px;
  font-size: 14px;
}

/* ---------- каналы и ЛС ---------- */

.channel-group {
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  padding: 18px 8px 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.channel-group:first-child {
  padding-top: 8px;
}

.channel-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 6px 8px;
  margin-bottom: 2px;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text-muted);
  text-align: left;
  font-weight: 500;
  min-height: 36px;
  transition: background 0.12s, color 0.12s;
}

.channel-item:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.channel-item.active {
  background: var(--bg-active);
  color: var(--header);
}

.channel-item.unread {
  color: var(--header);
  font-weight: 700;
}

.channel-item .channel-icon {
  width: 20px;
  display: flex;
  justify-content: center;
  color: var(--text-faint);
  flex-shrink: 0;
}

.channel-item.active .channel-icon {
  color: var(--accent);
}

.channel-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel-sub {
  display: block;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dm-call-dot {
  color: var(--green);
  display: flex;
}

.dm-call-dot svg {
  width: 15px;
  height: 15px;
}

.voice-users {
  margin: 0 0 6px 26px;
}

.voice-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-muted);
}

.voice-user:hover {
  background: var(--bg-hover);
}

.voice-user.speaking .avatar,
.user-panel .avatar.speaking {
  box-shadow: 0 0 0 2px var(--bg-sidebar), 0 0 0 4px var(--speaking, var(--green));
}

.voice-user .name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.state-icons {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--text-muted);
}

.state-icons svg {
  width: 14px;
  height: 14px;
}

.live {
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  border-radius: 4px;
  padding: 1px 5px;
}

/* ---------- панель звонка и пользователя ---------- */

.voice-panel {
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-sidebar) 70%, var(--bg-app));
  padding: 10px;
}

.voice-panel-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.voice-panel-title {
  color: var(--green);
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.voice-panel-title::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}

.voice-panel-title.connecting {
  color: var(--yellow);
}

.voice-panel-sub {
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
}

.voice-panel-sub:hover {
  text-decoration: underline;
}

.voice-panel-actions {
  display: flex;
  gap: 6px;
}

.voice-panel-actions .icon-btn {
  flex: 1;
  height: 34px;
  background: var(--bg-active);
  color: var(--text);
}

.voice-panel-actions .icon-btn:hover {
  filter: brightness(1.2);
}

.voice-panel-actions .icon-btn.active {
  background: var(--green);
  color: #fff;
}

.voice-panel-actions .icon-btn.danger:hover {
  background: var(--red);
  color: #fff;
}

.user-panel {
  height: 56px;
  background: color-mix(in srgb, var(--bg-sidebar) 70%, var(--bg-app));
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 8px;
  flex-shrink: 0;
}

.user-panel .avatar {
  margin-right: 6px;
}

.user-panel .avatar .status-dot {
  border-color: color-mix(in srgb, var(--bg-sidebar) 70%, var(--bg-app));
}

.user-panel-name {
  flex: 1;
  min-width: 0;
  font-weight: 700;
  font-size: 14px;
  color: var(--header);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  user-select: text;
}

.user-panel-name small {
  display: block;
  font-weight: 400;
  font-size: 12px;
  color: var(--text-muted);
}

.btn-group {
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-sm);
}

.btn-group:hover {
  background: var(--bg-hover);
}

.user-panel .icon-btn {
  width: 30px;
}

.user-panel .icon-btn.arrow {
  width: 14px;
  margin-left: -3px;
}

/* ---------- чат ---------- */

.chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 0 8px;
  user-select: text;
}

.messages-start {
  padding: 16px;
  color: var(--text-muted);
}

.messages-start h2 {
  color: var(--header);
  margin: 0 0 4px;
}

.history-loading {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  padding: 8px;
}

.date-divider {
  display: flex;
  align-items: center;
  margin: 18px 16px 8px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
}

.date-divider::before,
.date-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-strong);
}

.date-divider span {
  padding: 2px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
}

.message {
  position: relative;
  padding: 2px 48px 2px 72px;
  min-height: 24px;
  line-height: 1.4;
  transition: background 0.1s;
}

.message.first {
  margin-top: 14px;
  min-height: 44px;
}

.message:hover {
  background: var(--bg-hover);
}

.message.mentioned {
  background: var(--mention-bg);
  box-shadow: inset 3px 0 0 var(--yellow);
}

.message .avatar {
  position: absolute;
  left: 16px;
  top: 3px;
}

.message-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.message-author {
  font-weight: 700;
  color: var(--header);
}

.message-time {
  font-size: 12px;
  color: var(--text-faint);
}

.message-side-time {
  position: absolute;
  left: 0;
  width: 72px;
  text-align: center;
  font-size: 11px;
  color: var(--text-faint);
  top: 5px;
  visibility: hidden;
}

.message:hover .message-side-time {
  visibility: visible;
}

.message-text {
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

.message-edited {
  font-size: 11px;
  color: var(--text-faint);
  margin-left: 4px;
}

.mention {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  border-radius: 4px;
  padding: 0 3px;
}

.message-actions {
  position: absolute;
  right: 16px;
  top: -16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  display: none;
  padding: 2px;
  box-shadow: var(--shadow);
}

.message:hover .message-actions {
  display: flex;
}

.message-actions .icon-btn {
  width: 30px;
  height: 30px;
}

.message-edit textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  resize: none;
  outline: none;
  line-height: 1.4;
}

.message-edit-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.new-messages-btn {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 96px;
  background: var(--grad);
  color: #fff;
  border: none;
  border-radius: 18px;
  padding: 7px 18px;
  font-weight: 700;
  font-size: 13px;
  box-shadow: var(--shadow);
  z-index: 2;
}

.composer {
  padding: 0 16px 4px;
  flex-shrink: 0;
}

.composer-box {
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  display: flex;
  align-items: flex-end;
  padding: 0 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.composer-box:focus-within {
  border-color: color-mix(in srgb, var(--accent) 60%, transparent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.composer textarea {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  resize: none;
  padding: 12px 0;
  max-height: 40vh;
  line-height: 1.4;
}

.composer-plus {
  width: 28px;
  height: 28px;
  margin: 9px 10px 9px -4px;
  border: none;
  border-radius: 50%;
  background: var(--bg-active);
  color: var(--text);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.15s;
}

.composer-plus:hover {
  background: var(--accent);
  color: #fff;
  transform: rotate(90deg);
}

.composer-disabled {
  background: var(--bg-elevated);
  border-radius: var(--radius);
  padding: 12px;
  color: var(--text-muted);
  text-align: center;
}

.typing-line {
  height: 22px;
  font-size: 13px;
  color: var(--text);
  padding: 0 16px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.typing-dots {
  display: inline-block;
  margin-right: 4px;
}

.typing-dots span {
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-right: 2px;
  border-radius: 50%;
  background: var(--text);
  animation: blink 1.2s infinite;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes blink {
  0%,
  80%,
  100% {
    opacity: 0.3;
  }
  40% {
    opacity: 1;
  }
}

/* ---------- вложения ---------- */

.upload-queue {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 12px 12px 8px;
}

.upload-queue + .composer-box {
  border-radius: 0 0 var(--radius) var(--radius);
}

.upload-item {
  position: relative;
  width: 160px;
  flex-shrink: 0;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 8px;
}

.upload-item.error {
  outline: 1px solid var(--red);
}

.upload-thumb {
  width: 100%;
  height: 90px;
  object-fit: cover;
  border-radius: 4px;
  background: var(--bg-hover);
  display: block;
}

.upload-thumb.icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.upload-name {
  margin-top: 6px;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.upload-progress {
  height: 3px;
  background: var(--bg-hover);
  border-radius: 2px;
  margin-top: 4px;
  overflow: hidden;
}

.upload-progress div {
  height: 100%;
  background: var(--grad);
}

.upload-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: var(--red);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.drop-hint {
  position: absolute;
  inset: 10px;
  background: color-mix(in srgb, var(--accent) 80%, transparent);
  border: 3px dashed #fff;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  z-index: 5;
  pointer-events: none;
}

.drop-hint svg {
  margin: 0 auto 8px;
}

.attachments {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  margin-top: 4px;
}

.att {
  position: relative;
  max-width: min(480px, 100%);
}

.att-media {
  border-radius: var(--radius);
  overflow: hidden;
  cursor: zoom-in;
  background: var(--bg-hover);
}

.att-image {
  display: block;
  max-width: 100%;
  max-height: 320px;
  min-width: 40px;
  min-height: 40px;
}

.att-video {
  display: block;
  max-width: 100%;
  max-height: 360px;
  background: #000;
}

.att-file {
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 10px 12px;
  width: 420px;
}

.att-file audio {
  width: 100%;
  margin-top: 8px;
}

.att-file-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.att-icon {
  color: var(--accent);
  display: flex;
}

.att-info {
  flex: 1;
  min-width: 0;
}

.att-name {
  color: var(--link);
  text-decoration: none;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.att-name:hover {
  text-decoration: underline;
}

.att-size {
  font-size: 12px;
  color: var(--text-muted);
}

.att-download {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  display: none;
  align-items: center;
  justify-content: center;
}

.att:hover .att-download {
  display: flex;
}

.att-download.static {
  position: static;
  display: flex;
  background: none;
  color: var(--text-muted);
}

.att-download.static:hover {
  color: var(--header);
}

.lightbox-modal {
  width: auto !important;
  max-width: 95vw;
  background: transparent !important;
  box-shadow: none !important;
  border: none !important;
  padding: 0 !important;
}

.lightbox {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.lightbox-img {
  max-width: 92vw;
  max-height: 80vh;
  border-radius: var(--radius);
  cursor: zoom-out;
  box-shadow: var(--shadow-lg);
}

.lightbox-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-floating);
  padding: 8px 12px;
  border-radius: var(--radius);
}

.lightbox-name {
  color: var(--text-muted);
  font-size: 13px;
  margin-right: 8px;
}

/* ---------- участники ---------- */

.members {
  width: 248px;
  background: var(--bg-sidebar);
  flex-shrink: 0;
  overflow-y: auto;
  padding: 8px;
}

.members .add-member {
  width: 100%;
  margin: 8px 0;
}

.member {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.12s;
}

.member:hover {
  background: var(--bg-hover);
}

.member.offline {
  opacity: 0.45;
}

.member .name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.member .crown {
  color: var(--yellow);
  display: flex;
}

.member .crown svg {
  width: 15px;
  height: 15px;
}

/* ---------- друзья ---------- */

.friends-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
}

.friends-tab {
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  padding: 4px 12px;
  color: var(--text-muted);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.12s, color 0.12s;
}

.friends-tab:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.friends-tab.active {
  background: var(--bg-active);
  color: var(--header);
}

.friends-tab.add {
  background: var(--green);
  color: #fff;
}

.friends-tab.add.active {
  background: none;
  color: var(--green);
}

.friends-page {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
}

.friends-section-title {
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  margin: 8px 0;
}

.friend-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px;
  border-top: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: background 0.12s;
}

.friend-row:hover {
  background: var(--bg-hover);
}

.friend-row .info {
  flex: 1;
  min-width: 0;
}

.friend-row .name {
  font-weight: 700;
  color: var(--header);
}

.friend-row .sub {
  font-size: 13px;
  color: var(--text-muted);
}

.friend-row .actions {
  display: flex;
  gap: 8px;
}

.round-action {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.12s, background 0.12s, transform 0.12s;
}

.round-action:hover {
  color: var(--header);
  transform: scale(1.06);
}

.round-action.ok:hover {
  color: var(--green);
}

.round-action.no:hover {
  color: var(--red);
}

.add-friend-form {
  display: flex;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 8px 8px 8px 14px;
  margin: 12px 0 8px;
}

.add-friend-form:focus-within {
  border-color: var(--accent);
}

.add-friend-form input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
}

/* ---------- голосовой вид ---------- */

.voice-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg-stage);
}

.voice-lobby {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: var(--bg-main);
  padding: 24px;
  text-align: center;
}

.lobby-icon {
  width: 96px;
  height: 96px;
  border-radius: 32px;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.voice-lobby h2 {
  margin: 0;
  color: var(--header);
}

.voice-lobby.compact {
  flex: none;
  gap: 10px;
  padding: 16px;
  background: var(--bg-stage);
  color: #dbdee1;
}

.voice-lobby-users {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
}

.voice-lobby-user {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

/* сцена с плитками */

.stage {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 10px;
  gap: 10px;
}

.stage-grid {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  justify-content: center;
  gap: 10px;
  overflow: hidden;
}

.stage.focus .stage-main {
  flex: 1;
  min-height: 0;
  display: flex;
}

.stage.focus .stage-main .tile {
  flex: 1;
  width: auto !important;
  height: auto !important;
}

.stage-strip {
  height: 112px;
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
}

.stage-strip .tile {
  width: 199px !important;
  height: 112px !important;
  flex-shrink: 0;
}

.stage-strip .tile-avatar .avatar {
  width: 44px !important;
  height: 44px !important;
  font-size: 20px !important;
}

.stage-strip .tile-volume,
.stage-strip .tile-actions .tile-btn:not(:first-child) {
  display: none !important;
}

.tile {
  position: relative;
  background: var(--bg-tile);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  outline: 2px solid transparent;
  outline-offset: -2px;
  transition: outline-color 0.12s, box-shadow 0.15s, transform 0.15s;
  color: #fff;
}

.tile:hover {
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.tile.speaking {
  outline-color: var(--speaking, var(--green));
  box-shadow: 0 0 18px color-mix(in srgb, var(--speaking, var(--green)) 45%, transparent);
}

.tile.pinned {
  cursor: zoom-out;
}

.tile video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  display: block;
}

.tile.cam-tile video {
  object-fit: cover;
}

.stage.focus .stage-main .tile.cam-tile video {
  object-fit: contain;
}

.tile.self.cam-tile video {
  transform: scaleX(-1);
}

.tile.screen-tile {
  background: #000;
}

.tile-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
}

.tile-label {
  position: absolute;
  left: 8px;
  bottom: 8px;
  background: rgba(0, 0, 0, 0.62); /* без backdrop-filter: размытие под видео пересчитывалось бы каждый кадр */
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: calc(100% - 16px);
}

.tile-label .name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile-label .state-icons {
  color: #fff;
}

.muted-for-me {
  color: #ff8a8a;
  display: flex;
}

.tile-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s;
}

.tile:hover .tile-actions,
.tile.pinned .tile-actions {
  opacity: 1;
}

.tile-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s;
}

.tile-btn:hover {
  background: rgba(0, 0, 0, 0.8);
}

.tile-btn.active {
  background: var(--accent);
}

.tile-volume {
  position: absolute;
  left: 8px;
  top: 8px;
  background: rgba(0, 0, 0, 0.66);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #fff;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  cursor: default;
}

.tile:hover .tile-volume {
  opacity: 1;
  pointer-events: auto;
}

.tile-volume input {
  width: 110px;
}

.vol-value {
  min-width: 36px;
  text-align: right;
}

.voice-controls {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 10px 12px 14px;
  flex-shrink: 0;
}

.round-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.12s, box-shadow 0.15s;
}

.round-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  transform: translateY(-2px);
}

.round-btn.off {
  background: #fff;
  color: #e5484d;
}

.round-btn.active {
  background: var(--green);
  box-shadow: 0 4px 16px color-mix(in srgb, var(--green) 45%, transparent);
}

.round-btn.danger {
  background: var(--red);
  box-shadow: 0 4px 16px color-mix(in srgb, var(--red) 40%, transparent);
}

.round-btn.accept {
  background: var(--green);
  box-shadow: 0 4px 16px color-mix(in srgb, var(--green) 45%, transparent);
}

.voice-warning {
  background: color-mix(in srgb, var(--yellow) 18%, transparent);
  color: var(--yellow);
  text-align: center;
  padding: 6px;
  font-size: 13px;
}

.voice-calling {
  text-align: center;
  color: #fff;
  padding: 6px;
  font-size: 13px;
  background: color-mix(in srgb, var(--green) 25%, transparent);
}

/* ЛС со звонком */

.dm-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.dm-call-area {
  flex-shrink: 0;
  background: var(--bg-stage);
  display: flex;
  flex-direction: column;
  max-height: 58%;
}

.dm-call-area.in-call {
  height: 58%;
}

.dm-chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.voice-view.embedded .round-btn {
  width: 44px;
  height: 44px;
}

.voice-view.embedded .stage-strip {
  height: 84px;
}

.voice-view.embedded .stage-strip .tile {
  width: 150px !important;
  height: 84px !important;
}

/* ---------- модальные окна ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  /* без backdrop-filter: размытие всего окна под затемнением пересчитывалось в каждом кадре, когда в окне
     что-то двигается (превью баннеров, рамки, ник с эффектом) — «Оформление» шло 15–20 кадров в секунду */
  background: rgba(0, 0, 0, 0.68);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
  animation: fade-in 0.15s ease;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

.modal {
  background: var(--bg-modal);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  width: 460px;
  max-width: 100%;
  max-height: 100%;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: pop-in 0.2s var(--ease);
}

@keyframes pop-in {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(8px);
  }
}

.modal.wide {
  width: 760px;
}

.modal-title {
  margin: 0 0 14px;
  color: var(--header);
  font-size: 20px;
  letter-spacing: -0.01em;
}

.modal-text {
  color: var(--text);
  line-height: 1.45;
  white-space: pre-line;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

/* настройки */

.settings-section {
  margin-bottom: 22px;
}

.settings-section h3 {
  color: var(--header);
  font-size: 15px;
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.settings-section h3 svg {
  color: var(--accent);
}

.mic-meter {
  height: 8px;
  background: var(--bg-input);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 8px;
}

.mic-meter-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--green), var(--yellow));
  transition: width 0.05s linear;
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 10px;
}

.theme-card {
  border: 2px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 6px;
  background: none;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  transition: border-color 0.15s, transform 0.15s;
}

.theme-card:hover {
  transform: translateY(-2px);
}

.theme-card.active {
  border-color: var(--accent);
}

.theme-preview {
  height: 54px;
  border-radius: var(--radius-sm);
  display: flex;
  overflow: hidden;
  margin-bottom: 6px;
}

.theme-preview span {
  display: block;
}

.theme-preview span:nth-child(1) {
  width: 18%;
}

.theme-preview span:nth-child(2) {
  width: 28%;
}

.theme-preview span:nth-child(3) {
  flex: 1;
  position: relative;
}

.theme-preview span:nth-child(3)::after {
  content: '';
  position: absolute;
  left: 10%;
  right: 30%;
  bottom: 10px;
  height: 8px;
  border-radius: 4px;
  background: var(--swatch-accent);
}

/* выбор экрана */

.picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  max-height: 50vh;
  overflow-y: auto;
  padding: 4px;
  margin: 12px 0;
}

.picker-item {
  background: var(--bg-input);
  border: 2px solid transparent;
  border-radius: var(--radius);
  padding: 8px;
  text-align: left;
  transition: border-color 0.12s, transform 0.12s;
}

.picker-item:hover {
  transform: translateY(-2px);
}

.picker-item.selected {
  border-color: var(--accent);
}

.picker-item img,
.picker-item .no-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  background: #000;
  border-radius: var(--radius-sm);
  display: block;
}

.picker-name {
  margin-top: 6px;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.picker-audio {
  background: var(--bg-input);
  border-radius: var(--radius);
  padding: 10px 12px;
}

/* добавление участников */

.candidate-list {
  margin: 12px 0;
  max-height: 46vh;
  overflow-y: auto;
}

.candidate {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-radius: var(--radius-sm);
}

.candidate:hover {
  background: var(--bg-hover);
}

.candidate .avatar .status-dot {
  border-color: var(--bg-modal);
}

.candidate-info {
  flex: 1;
  min-width: 0;
}

.candidate-name {
  font-weight: 700;
  color: var(--header);
}

.candidate-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.invite-box {
  border-top: 1px solid var(--border-strong);
  padding-top: 12px;
}

/* входящий звонок */

.incoming-modal {
  width: 330px !important;
  text-align: center;
  padding: 30px 24px !important;
}

.incoming-avatar {
  display: flex;
  justify-content: center;
  margin-bottom: 14px;
}

.incoming-avatar .avatar {
  animation: ring-pulse 1.4s infinite;
}

@keyframes ring-pulse {
  0% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--green) 70%, transparent);
  }
  70% {
    box-shadow: 0 0 0 20px transparent;
  }
  100% {
    box-shadow: 0 0 0 0 transparent;
  }
}

.incoming-name {
  font-size: 20px;
  font-weight: 800;
  color: var(--header);
}

.incoming-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 22px;
}

/* ---------- меню и подсказки ---------- */

.context-menu {
  position: fixed;
  z-index: 200;
  background: var(--bg-floating);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 6px;
  min-width: 200px;
  max-width: 320px;
  box-shadow: var(--shadow-lg);
  animation: pop-in 0.12s var(--ease);
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px;
  font-size: 14px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu-item:hover {
  background: var(--accent);
  color: #fff;
}

.menu-item.danger {
  color: var(--red);
}

.menu-item.danger:hover {
  background: var(--red);
  color: #fff;
}

.menu-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 6px 8px 4px;
}

.menu-separator {
  height: 1px;
  background: var(--border-strong);
  margin: 4px 6px;
}

.menu-check {
  display: inline-flex;
  width: 18px;
  color: var(--green);
}

.menu-icon {
  display: inline-flex;
  color: var(--text-muted);
}

.menu-item:hover .menu-check,
.menu-item:hover .menu-icon {
  color: #fff;
}

.menu-range {
  padding: 6px 8px;
}

.menu-range-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.menu-range input {
  width: 100%;
}

.toast-root {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 300;
  pointer-events: none;
}

.toast {
  background: var(--bg-floating);
  color: var(--text);
  padding: 10px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  transition: opacity 0.3s, transform 0.3s;
  border-left: 4px solid var(--accent);
  max-width: 480px;
  animation: toast-in 0.25s var(--ease);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

.toast.success {
  border-left-color: var(--green);
}

.toast.error {
  border-left-color: var(--red);
}

.toast.hide {
  opacity: 0;
  transform: translateY(6px);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* переключатель-«таблетка» */
.segmented {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: var(--bg-input);
  border-radius: var(--radius);
}

.seg {
  border: none;
  background: none;
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 13px;
  transition: background 0.15s, color 0.15s;
}

.seg:hover {
  color: var(--header);
}

.seg.active {
  background: var(--grad);
  color: var(--accent-text);
}

.picker-options {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

/* =====================================================================
   Реакции, ответы, эмодзи, форматирование, статусы, анимации
   ===================================================================== */

/* ---------- форматирование текста ---------- */

.message-text strong {
  color: var(--header);
}

.inline-code {
  font-family: Consolas, 'Cascadia Mono', 'Courier New', monospace;
  font-size: 0.88em;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
}

.code-block {
  margin: 6px 0;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  overflow-x: auto;
  max-width: 100%;
  white-space: pre;
}

.code-block code {
  font-family: Consolas, 'Cascadia Mono', 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.45;
}

.spoiler {
  background: var(--text-faint);
  color: transparent;
  border-radius: 4px;
  padding: 0 2px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.spoiler:hover {
  background: var(--text-muted);
}

.spoiler.revealed {
  background: var(--bg-active);
  color: inherit;
  cursor: text;
}

.spoiler * {
  visibility: hidden;
}

.spoiler.revealed * {
  visibility: visible;
}

.message-text.jumbo {
  font-size: 42px;
  line-height: 1.2;
}

/* ---------- ответы ---------- */

.reply-quote {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 2px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  position: relative;
  min-width: 0;
}

.reply-quote:hover .reply-text {
  color: var(--header);
}

.reply-line {
  position: absolute;
  left: -38px;
  top: 9px;
  width: 30px;
  height: 12px;
  border-left: 2px solid var(--border-strong);
  border-top: 2px solid var(--border-strong);
  border-top-left-radius: 6px;
}

.message .reply-quote .avatar {
  position: relative; /* не static: от аватарки считается её рамка */
  font-size: 9px !important;
  flex-shrink: 0;
}

.reply-quote b {
  color: var(--header);
  font-weight: 600;
  flex-shrink: 0;
}

.reply-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.message:has(> .reply-quote) > .avatar {
  top: 25px;
}

.reply-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text-muted);
  animation: slide-up 0.18s var(--ease);
}

.reply-bar b {
  color: var(--header);
}

.reply-bar-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reply-bar-close {
  border: none;
  background: var(--bg-active);
  color: var(--text);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.reply-bar + div + .composer-box,
.reply-bar + .composer-box {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.reply-bar:not([hidden]) + div .upload-queue {
  border-radius: 0;
}

/* ---------- реакции ---------- */

.reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.reaction {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 8px;
  border-radius: 13px;
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  transition: background 0.12s, border-color 0.12s, transform 0.12s;
}

.reaction:hover:not(:disabled) {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.reaction.mine {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--header);
}

.reaction-emoji {
  font-size: 15px;
}

.reaction.add {
  color: var(--text-muted);
  opacity: 0;
  transition: opacity 0.15s;
}

.message:hover .reaction.add {
  opacity: 1;
}

.reaction.pop {
  animation: reaction-pop 0.35s var(--ease);
}

@keyframes reaction-pop {
  0% {
    transform: scale(0.6);
  }
  60% {
    transform: scale(1.18);
  }
  100% {
    transform: scale(1);
  }
}

/* ---------- эмодзи ---------- */

.composer-emoji {
  border: none;
  background: none;
  color: var(--text-muted);
  margin: 10px -2px 10px 8px;
  padding: 0;
  display: flex;
  transition: color 0.15s, transform 0.15s;
}

.composer-emoji:hover {
  color: var(--yellow);
  transform: scale(1.15) rotate(-8deg);
}

.emoji-picker {
  position: fixed;
  z-index: 210;
  width: 352px;
  background: var(--bg-floating);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: pop-in 0.15s var(--ease);
}

.emoji-tabs {
  display: flex;
  gap: 2px;
  padding: 6px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.emoji-tab {
  border: none;
  background: none;
  font-size: 18px;
  width: 34px;
  height: 32px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  filter: grayscale(0.7);
  transition: background 0.12s, filter 0.12s;
}

.emoji-tab:hover,
.emoji-tab.active {
  background: var(--bg-active);
  filter: none;
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  padding: 8px;
  max-height: 260px;
  overflow-y: auto;
}

.emoji-cat-name {
  grid-column: 1 / -1;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: 2px 4px 6px;
}

.emoji-btn {
  border: none;
  background: none;
  font-size: 24px;
  height: 38px;
  border-radius: var(--radius-sm);
  transition: background 0.1s, transform 0.1s;
}

.emoji-btn:hover {
  background: var(--bg-active);
  transform: scale(1.18);
}

/* ---------- статусы ---------- */

.status-dot.idle {
  background: var(--yellow);
}

.status-dot.dnd {
  background: var(--red);
}

.status-dot.dnd::after {
  content: '';
  position: absolute;
  left: 22%;
  right: 22%;
  top: 50%;
  height: 2px;
  margin-top: -1px;
  background: var(--bg-sidebar);
  border-radius: 1px;
}

.status-dot.invisible {
  background: var(--bg-sidebar);
  box-shadow: inset 0 0 0 2px #80848e;
}

.menu-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin: 0 4px 0 2px;
  flex-shrink: 0;
}

.menu-dot.online {
  background: var(--green);
}

.menu-dot.idle {
  background: var(--yellow);
}

.menu-dot.dnd {
  background: var(--red);
}

.menu-dot.invisible {
  box-shadow: inset 0 0 0 2px #80848e;
}

.user-panel-me {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  border: none;
  background: none;
  padding: 4px;
  margin-left: -4px;
  border-radius: var(--radius-sm);
  text-align: left;
  transition: background 0.12s;
}

.user-panel-me:hover {
  background: var(--bg-hover);
}

/* ---------- анимации ---------- */

/* новое сообщение */
.message.msg-in {
  animation: msg-in 0.35s var(--ease);
}

@keyframes msg-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

/* прыжок к сообщению по ответу */
.message.flash {
  animation: flash 1.4s ease;
}

@keyframes flash {
  0%,
  30% {
    background: var(--accent-soft);
  }
}

/* смена канала/раздела */
.content > * {
  animation: view-in 0.25s var(--ease);
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

@keyframes slide-up {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

/* «волна» на кнопках */
.btn,
.round-btn,
.seg,
.tab,
.friends-tab {
  position: relative;
  overflow: hidden;
}

.ripple {
  position: absolute;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.25;
  transform: scale(0);
  pointer-events: none;
  animation: ripple 0.6s ease-out forwards;
}

@keyframes ripple {
  to {
    transform: scale(1);
    opacity: 0;
  }
}

/* блик на главной кнопке */
.btn.primary::after {
  content: '';
  position: absolute;
  top: 0;
  left: -60%;
  width: 40%;
  height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  transform: skewX(-20deg);
  pointer-events: none;
}

.btn.primary:hover::after {
  animation: shine 0.8s ease;
}

@keyframes shine {
  to {
    left: 130%;
  }
}

/* говорящий — мягкая пульсация */
.tile.speaking {
  animation: speak-pulse 1.2s ease-in-out infinite;
}

@keyframes speak-pulse {
  50% {
    box-shadow: 0 0 26px color-mix(in srgb, var(--speaking, var(--green)) 60%, transparent);
  }
}

.voice-user.speaking .avatar {
  animation: speak-ring 1.2s ease-in-out infinite;
}

@keyframes speak-ring {
  50% {
    box-shadow: 0 0 0 2px var(--bg-sidebar), 0 0 0 5px color-mix(in srgb, var(--speaking, var(--green)) 70%, transparent);
  }
}

/* новая плитка в звонке */
.tile.tile-in {
  animation: tile-in 0.35s var(--ease);
}

@keyframes tile-in {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
}

/* иконка сервера при наведении */
.guild-icon:hover {
  transform: translateY(-1px);
}

/* конфетти */
.confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 400;
}

/* ---------- обновление ---------- */

.update-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: var(--grad);
  color: var(--accent-text);
  font-weight: 600;
  font-size: 14px;
  animation: slide-down 0.3s var(--ease);
}

.update-banner span {
  flex: 1;
}

.update-banner .btn.primary {
  background: rgba(255, 255, 255, 0.95);
  color: #111;
  box-shadow: none;
}

.update-banner-close {
  border: none;
  background: rgba(0, 0, 0, 0.2);
  color: inherit;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

@keyframes slide-down {
  from {
    opacity: 0;
    transform: translateY(-100%);
  }
}

/* ---------- аватарки ---------- */

.avatar {
  overflow: visible;
}

.avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  background: var(--bg-elevated);
}

.avatar-current {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.avatar-current b {
  color: var(--header);
  font-size: 16px;
}

.crop-box {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.crop-frame {
  position: relative;
  width: 280px;
  height: 280px;
  border-radius: var(--radius);
  overflow: hidden;
  background: repeating-conic-gradient(var(--bg-input) 0 25%, var(--bg-elevated) 0 50%) 0 0 / 20px 20px;
}

/* затемнение вокруг круга */
.crop-frame::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow: 0 0 0 200px rgba(0, 0, 0, 0.55);
  outline: 2px solid rgba(255, 255, 255, 0.8);
  outline-offset: -2px;
  pointer-events: none;
}

.crop-canvas {
  display: block;
  cursor: grab;
  touch-action: none;
}

.crop-canvas:active {
  cursor: grabbing;
}

.crop-zoom {
  width: 280px;
  color: var(--text-muted);
}

.preset-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

.preset {
  border: 2px solid transparent;
  background: none;
  padding: 2px;
  border-radius: 50%;
  aspect-ratio: 1;
  transition: transform 0.12s, border-color 0.12s;
}

.preset canvas {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: block;
}

.preset:hover {
  transform: scale(1.07);
}

.preset.selected {
  border-color: var(--accent);
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-input);
  border-radius: var(--radius);
  padding: 14px;
}

.profile-info {
  flex: 1;
  min-width: 0;
}

.profile-name {
  font-weight: 800;
  font-size: 17px;
  color: var(--header);
}

/* ---------- роли и права, создание каналов ---------- */

.channel-group .group-add {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.15s;
}

.channel-group .group-add:hover {
  background: var(--bg-hover);
  color: var(--header);
  transform: rotate(90deg);
}

.modal-title:has(svg) {
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-title svg {
  color: var(--accent);
  flex-shrink: 0;
}

.roles-editor {
  display: grid;
  grid-template-columns: 210px 1fr;
  gap: 16px;
  min-height: 420px;
}

.roles-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-right: 1px solid var(--border);
  padding-right: 12px;
  max-height: 60vh;
  overflow-y: auto;
}

.roles-list .btn {
  margin-bottom: 8px;
  gap: 6px;
}

.role-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 8px;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}

.role-item:hover {
  background: var(--bg-hover);
}

.role-item.active {
  background: var(--bg-active);
  color: var(--header);
  font-weight: 600;
}

.role-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.role-count {
  font-size: 12px;
  color: var(--text-faint);
}

.role-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px color-mix(in srgb, currentColor 10%, transparent);
}

.role-dot.everyone {
  background: conic-gradient(#e5484d, #f5a524, #22c55e, #3b82f6, #a855f7, #e5484d);
}

.role-pane {
  min-width: 0;
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 4px;
}

.role-pane-title {
  margin: 0 0 4px;
  color: var(--header);
  font-size: 16px;
}

.color-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.swatch {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  transition: transform 0.15s, border-color 0.15s;
}

.swatch:hover:not(:disabled) {
  transform: scale(1.12);
}

.swatch.active {
  border-color: var(--header);
  box-shadow: 0 0 0 2px var(--bg-modal) inset;
}

.swatch.none {
  background: repeating-linear-gradient(45deg, var(--bg-input) 0 4px, var(--bg-elevated) 4px 8px);
  border-color: var(--border-strong);
}

.swatch:disabled {
  cursor: default;
  opacity: 0.5;
}

.perm-list {
  display: flex;
  flex-direction: column;
  margin-top: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.perm {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}

.perm:last-child {
  border-bottom: none;
}

.perm:hover {
  background: var(--bg-hover);
}

.perm.disabled {
  cursor: default;
  opacity: 0.55;
}

.perm-text {
  flex: 1;
  min-width: 0;
}

.perm-label {
  color: var(--header);
  font-size: 14px;
  font-weight: 500;
}

.perm-hint {
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 2px;
}

/* Переключатель-«тумблер» вместо галочки */
input.switch {
  appearance: none;
  -webkit-appearance: none;
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  margin: 0;
  transition: background 0.2s;
}

input.switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: transform 0.2s var(--ease), background 0.2s;
}

input.switch:checked {
  background: var(--accent);
  border-color: var(--accent);
}

input.switch:checked::after {
  transform: translateX(16px);
  background: #fff;
}

input.switch:disabled {
  cursor: default;
}

.role-holders {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}

.holder-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 4px 3px 4px;
  border-radius: 999px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  font-size: 13px;
}

.holder-chip .avatar {
  position: relative;
}

.chip-x {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: none;
  padding: 0;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
}

.chip-x:hover {
  background: var(--red);
  color: #fff;
}

.role-holders select.input.small {
  width: auto;
  min-width: 180px;
  padding: 4px 8px;
  min-height: 28px;
  font-size: 13px;
}

.role-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.role-actions .btn {
  gap: 6px;
}

.role-checklist {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.role-check {
  align-items: center;
  padding: 7px 8px;
  border-radius: var(--radius-sm);
}

.role-check:hover {
  background: var(--bg-hover);
}

.role-check.disabled {
  opacity: 0.5;
  cursor: default;
}

.member .member-muted,
.state-icons .server-muted {
  color: var(--red);
  display: flex;
}

.member .member-muted svg {
  width: 15px;
  height: 15px;
}

.range-value {
  min-width: 64px;
  text-align: right;
  color: var(--text-muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 720px) {
  .roles-editor {
    grid-template-columns: 1fr;
  }

  .roles-list {
    border-right: none;
    padding-right: 0;
    max-height: 180px;
  }
}

/* ---------- права канала: запретить / как обычно / разрешить ---------- */

.tri-group {
  display: inline-flex;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
}

.tri {
  width: 34px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: var(--bg-input);
  color: var(--text-muted);
  cursor: pointer;
  font-weight: 700;
  transition: background 0.15s, color 0.15s;
}

.tri + .tri {
  border-left: 1px solid var(--border-strong);
}

.tri:hover {
  background: var(--bg-hover);
}

.tri.deny.active {
  background: var(--red);
  color: #fff;
}

.tri.inherit.active {
  background: var(--bg-active);
  color: var(--header);
}

.tri.allow.active {
  background: var(--green);
  color: #fff;
}

.private-toggle {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.roles-list > select.input.small {
  padding: 6px 8px;
  min-height: 32px;
  font-size: 13px;
  margin-bottom: 8px;
}

/* ---------- звуки в настройках, значки каналов ---------- */

.sound-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.sound-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}

.sound-row:last-child {
  border-bottom: none;
}

.sound-info {
  flex: 1;
  min-width: 0;
}

.sound-label {
  color: var(--header);
  font-size: 14px;
}

.sound-file {
  color: var(--text-muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sound-row .btn {
  gap: 4px;
}

.channel-flags {
  display: inline-flex;
  gap: 4px;
  color: var(--text-faint);
  margin-left: auto;
}

.channel-item .channel-flags + .badge {
  margin-left: 6px;
}

.guild-icon .guild-muted {
  position: absolute;
  left: -2px;
  bottom: -2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--bg-guilds);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------- профиль: карточка и личный кабинет ---------- */

.profile-link {
  cursor: pointer;
}

.message-author.profile-link:hover {
  text-decoration: underline;
}

.profile-pop {
  width: 300px;
  background: var(--bg-floating);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  position: relative;
}

.profile-pop.floating {
  position: fixed;
  z-index: 1000;
  animation: pop-in 0.18s var(--ease);
}

.profile-banner {
  height: 70px;
}

.profile-pop-avatar {
  position: absolute;
  top: 26px;
  left: 16px;
  padding: 5px;
  border-radius: 50%;
  background: var(--bg-floating);
}

.profile-pop-avatar .avatar {
  position: relative;
}

.profile-pop-body {
  padding: 46px 16px 16px;
}

.profile-pop-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--header);
  word-break: break-word;
}

.profile-pop-status {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 4px;
}

.profile-pop-section {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 14px;
}

.profile-pop-label {
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.profile-pop-bio {
  white-space: pre-wrap;
  word-break: break-word;
  user-select: text;
  line-height: 1.4;
}

.profile-roles {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.profile-role {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-input);
  font-size: 12px;
}

.profile-role .role-dot {
  width: 9px;
  height: 9px;
}

.profile-pop-actions {
  margin-top: 14px;
}

.profile-pop-actions .btn {
  gap: 6px;
}

.profile-editor {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 22px;
  align-items: start;
}

.profile-preview-col {
  position: sticky;
  top: 0;
}

.profile-preview .profile-pop {
  box-shadow: var(--shadow);
}

.bio-input {
  resize: vertical;
  min-height: 84px;
  font: inherit;
  line-height: 1.4;
}

.bio-counter {
  float: right;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
}

.password-form {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.password-form h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  color: var(--header);
  font-size: 16px;
}

.password-form .row .field {
  flex: 1;
}

.profile-card-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.profile-card-actions .btn {
  gap: 6px;
}

@media (max-width: 760px) {
  .profile-editor {
    grid-template-columns: 1fr;
  }
}

.private-toggle .perm-label {
  display: flex;
  align-items: center;
  gap: 6px;
}

.role-pane-title + .field-hint {
  margin-top: 4px;
}

/* ---------- музыкальный бот ---------- */

.bot-avatar {
  background: linear-gradient(135deg, #a855f7, #ec4899 55%, #f59e0b);
  color: #fff;
}

.bot-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 1px 5px;
  margin-left: 6px;
  border-radius: 4px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.03em;
  line-height: 1.4;
  vertical-align: 2px;
  flex-shrink: 0;
}

.member .bot-badge,
.voice-user .bot-badge {
  margin-left: 0;
}

.bot-tile {
  background: linear-gradient(160deg, color-mix(in srgb, #a855f7 22%, var(--bg-tile)), var(--bg-tile));
}

.bot-tile .bot-cover {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: blur(18px) brightness(0.55);
  transform: scale(1.15);
}

.bot-tile .tile-avatar {
  position: relative;
}

.bot-tile .bot-now {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 0.85;
  font-weight: 500;
}

.equalizer {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 18px;
  opacity: 0;
  transition: opacity 0.3s;
}

.bot-tile.playing .equalizer {
  opacity: 1;
}

.equalizer span {
  width: 4px;
  height: 30%;
  border-radius: 2px;
  background: #fff;
  animation: eq 0.9s ease-in-out infinite;
}

.equalizer span:nth-child(2) {
  animation-delay: -0.3s;
}

.equalizer span:nth-child(3) {
  animation-delay: -0.6s;
}

.equalizer span:nth-child(4) {
  animation-delay: -0.15s;
}

@keyframes eq {
  0%,
  100% {
    height: 25%;
  }
  50% {
    height: 100%;
  }
}

.music-bar {
  margin: 0 16px 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--bg-elevated) 92%, transparent);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.voice-lobby .music-bar {
  margin: 14px auto 0;
  max-width: 560px;
  width: 100%;
  text-align: left;
}

.music-main {
  display: flex;
  align-items: center;
  gap: 12px;
}

.music-cover {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}

.music-cover.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #a855f7, #ec4899);
  color: #fff;
}

.music-bar.playing .music-cover {
  box-shadow: 0 0 0 2px color-mix(in srgb, #ec4899 60%, transparent);
}

.music-info {
  flex: 1;
  min-width: 0;
}

.music-title {
  color: var(--header);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.music-title.link {
  cursor: pointer;
}

.music-title.link:hover {
  text-decoration: underline;
}

.music-sub {
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 1px;
}

.music-progress-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.music-time {
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  min-width: 34px;
}

.music-time:last-child {
  text-align: right;
}

.music-progress {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--bg-input);
  overflow: hidden;
}

.music-progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), #ec4899);
  transition: width 0.5s linear;
}

.music-controls {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.music-btn.active {
  color: var(--accent);
}

.music-vol {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
  color: var(--text-muted);
}

.music-volume {
  width: 80px;
}

.music-add {
  margin-top: 8px;
}

.music-queue {
  margin: 8px 0 0;
  padding: 6px 8px 6px 30px;
  max-height: 160px;
  overflow-y: auto;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.music-queue li {
  padding: 3px 0;
}

.music-queue li > * {
  vertical-align: middle;
}

.music-queue .q-title {
  display: inline-block;
  max-width: calc(100% - 80px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.music-queue .q-time {
  color: var(--text-muted);
  margin: 0 6px;
  font-size: 12px;
}

.music-queue .chip-x {
  display: inline-flex;
}

.bot-help {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bot-help-row {
  display: grid;
  grid-template-columns: 210px 1fr;
  gap: 10px;
  font-size: 14px;
}

.bot-help-row code {
  background: var(--bg-input);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
  align-self: start;
}

@media (max-width: 900px) {
  .music-volume {
    width: 50px;
  }
}

.music-vol-value {
  font-size: 11px;
  color: var(--text-muted);
  min-width: 30px;
  font-variant-numeric: tabular-nums;
}

.music-vol.bot-vol {
  color: var(--accent);
}

/* ---------- горячие клавиши ---------- */

.hotkey-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hotkey-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hotkey-label {
  flex: 1;
  font-size: 14px;
}

.hotkey-key {
  min-width: 170px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-input);
  color: var(--header);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.hotkey-key:hover {
  border-color: var(--accent);
}

.hotkey-key.empty {
  color: var(--text-faint);
  font-weight: 400;
}

.hotkey-key.recording {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  color: var(--accent);
  animation: pulse-border 1.2s ease-in-out infinite;
}

@keyframes pulse-border {
  50% {
    box-shadow: 0 0 0 5px var(--accent-soft);
  }
}

/* ---------- звонок: сворачивание участников и плеера, «перестать смотреть» ---------- */

.strip-toggle {
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--text-muted);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.15s, border-color 0.15s;
}

.strip-toggle:hover {
  color: var(--header);
  border-color: var(--border-strong);
}

.stage.focus .strip-toggle {
  margin: -4px 0;
}

.music-bar.collapsed {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px 4px 12px;
}

.music-mini-icon {
  display: flex;
  color: #ec4899;
}

.music-bar.collapsed.playing .music-mini-icon {
  animation: mini-note 1.2s ease-in-out infinite;
}

@keyframes mini-note {
  50% {
    transform: translateY(-2px) rotate(-8deg);
  }
}

.music-mini-title {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  color: var(--header);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.unwatched-streams {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px 0;
}

.unwatched-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 6px 5px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.unwatched-chip .live {
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 4px;
}

.unwatched-chip .chip-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
}

/* Настройки отдельной демонстрации: «заполнить плитку» и «только звук» */
.tile.screen-tile.fit-cover video {
  object-fit: cover;
}

.tile.screen-tile.audio-only {
  background: var(--bg-input);
}

.tile.screen-tile.audio-only .tile-avatar {
  flex-direction: column;
  gap: 10px;
  width: 100%;
  height: 100%;
}

.audio-only-note {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  padding: 0 12px;
  text-align: center;
}

/* ---------- рамки аватарок (ui/frames.js) ---------- */
.avatar-frame {
  position: absolute;
  inset: -10%;
  width: 120%;
  height: 120%;
  pointer-events: none;
  overflow: visible;
}

/* только у анимированных частей (у остальных transform-атрибут считается от центра рамки) */
.avatar-frame [class^='fr-'],
.avatar-frame [class*=' fr-'] {
  transform-box: fill-box;
  transform-origin: 50% 50%;
}

/* маленькие аватарки в списках оживают при наведении */
.avatar-frame.still * {
  animation-play-state: paused !important;
}

:hover > .avatar > .avatar-frame.still *,
:hover > * > .avatar > .avatar-frame.still * {
  animation-play-state: running !important;
}

.fr-pulse { animation: fr-pulse 2.4s ease-in-out infinite; }
.fr-spin { animation: fr-spin 4s linear infinite; }
.fr-spin-slow { animation: fr-spin 18s linear infinite; }
.fr-spin-rev { animation: fr-spin 12s linear infinite reverse; }
.fr-orbit { animation: fr-spin 9s linear infinite; }
.fr-orbit-rev { animation: fr-spin 14s linear infinite reverse; }
.fr-shine { animation: fr-spin 3.2s linear infinite; }
.fr-flicker { animation: fr-flicker 0.45s ease-in-out infinite alternate; transform-origin: 50% 100%; }
.fr-twinkle { animation: fr-twinkle 2s ease-in-out infinite; }
.fr-drip { animation: fr-drip 2.2s ease-in infinite; transform-origin: 50% 0; }
.fr-flash { animation: fr-flash 2.6s steps(1) infinite; }
.fr-bob { animation: fr-bob 1.8s ease-in-out infinite alternate; }
.fr-glitch { animation: fr-glitch 3s steps(1) infinite; }
.fr-sway { animation: fr-sway 2.4s ease-in-out infinite alternate; }
.fr-beat { animation: fr-beat 1.1s ease-in-out infinite; }
.fr-jaw-top { animation: fr-jaw-top 0.35s ease-in-out infinite alternate; transform-origin: 50% 100%; }
.fr-jaw-bottom { animation: fr-jaw-bottom 0.35s ease-in-out infinite alternate; transform-origin: 50% 0; }

@keyframes fr-pulse { 50% { opacity: 0.55; } }
@keyframes fr-spin { to { transform: rotate(360deg); } }
@keyframes fr-flicker { from { transform: scale(0.85, 0.75); } to { transform: scale(1.1, 1.15); } }
@keyframes fr-twinkle { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.25; transform: scale(0.6); } }
@keyframes fr-drip { 0% { transform: translateY(0) scaleY(0.4); opacity: 1; } 80% { transform: translateY(4px) scaleY(1); opacity: 1; } 100% { transform: translateY(7px) scaleY(1); opacity: 0; } }
@keyframes fr-flash { 0%, 100% { opacity: 1; } 8% { opacity: 0.2; } 12% { opacity: 1; } 16% { opacity: 0.3; } 20% { opacity: 1; } }
@keyframes fr-bob { from { transform: translateY(-1.5px); } to { transform: translateY(1.5px); } }
@keyframes fr-glitch { 0%, 100% { transform: none; } 30% { transform: translate(1.5px, -1px); } 32% { transform: translate(-1.5px, 1px); } 34% { transform: none; } 70% { transform: rotate(8deg); } 72% { transform: none; } }
@keyframes fr-sway { from { transform: rotate(-18deg); } to { transform: rotate(18deg); } }
@keyframes fr-beat { 0%, 100% { transform: scale(1); } 30% { transform: scale(1.3); } }
@keyframes fr-jaw-top { from { transform: rotate(0deg); } to { transform: rotate(-30deg); } }
@keyframes fr-jaw-bottom { from { transform: rotate(0deg); } to { transform: rotate(30deg); } }

/* ---------- баннер «панельки» (можно гифку): строка в голосовом, в списке участников, панель внизу слева ---------- */
.has-panel-banner {
  background-image: linear-gradient(90deg, rgba(0, 0, 0, 0.72), rgba(0, 0, 0, 0.35) 70%, rgba(0, 0, 0, 0.15)), var(--panel-image);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-origin: border-box; /* картинка — точно по краю строки, без зазора */
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.has-panel-banner small,
.has-panel-banner .name,
.has-panel-banner .user-panel-name {
  color: #fff;
}

.has-panel-banner .icon-btn {
  color: #fff;
}

/* Наведение: общие правила :hover задают фон сокращённо (background: …) и сбрасывали размер и позицию
   картинки — она «улетала» в угол. Здесь всё задано полностью, а плавно меняется только затемнение. */
.voice-user.has-panel-banner,
.member.has-panel-banner {
  transition: none;
}

.voice-user.has-panel-banner:hover,
.member.has-panel-banner:hover,
.voice-user.has-panel-banner:active,
.member.has-panel-banner:active {
  background-color: transparent;
  background-image: linear-gradient(90deg, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0.2) 70%, rgba(0, 0, 0, 0)), var(--panel-image);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* Кнопки микрофона и звука на фоне-баннере: выключенное состояние хорошо видно на любой картинке */
.has-panel-banner .icon-btn.off {
  color: #fff;
  background: rgba(218, 55, 60, 0.9);
}

.has-panel-banner .icon-btn {
  background: rgba(0, 0, 0, 0.35);
}

.has-panel-banner .btn-group {
  border-radius: var(--radius-sm);
}

.has-panel-banner .state-icons {
  background: rgba(0, 0, 0, 0.45);
  border-radius: 999px;
  padding: 1px 4px;
  color: #fff;
}

.has-panel-banner .state-icons .server-muted,
.has-panel-banner .member-muted {
  color: #ff6b6e;
}

/* ---------- профили: тема, баннеры-картинки, чипы, полный профиль, личный кабинет ---------- */
.row.wrap {
  flex-wrap: wrap;
  margin: 8px 0 6px;
}

.profile-banner,
.profile-full-banner {
  background-size: cover;
  background-position: center;
}

.profile-pop .profile-banner {
  height: 96px;
}

/* Картинка/гифка в шапке плавно растворяется вниз: сквозь низ картинки видно фон карточки — цвет
   или переливание темы, которые выбрал пользователь (без темы — обычный фон), без резкой границы */
.profile-banner.has-image,
.profile-full-banner.has-image {
  -webkit-mask-image: linear-gradient(to bottom, #000 45%, rgba(0, 0, 0, 0.6) 72%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 45%, rgba(0, 0, 0, 0.6) 72%, transparent 100%);
}
.profile-pop .profile-banner.has-image {
  height: 120px;
}
.profile-pop .profile-banner.has-image + .profile-pop-avatar {
  top: 76px;
}
.profile-full-banner.has-image {
  height: 250px;
}

.profile-pop .profile-pop-avatar {
  top: 52px;
}

.profile-pop .clickable,
.profile-full .clickable {
  cursor: pointer;
}

.profile-pop-name.clickable:hover {
  text-decoration: underline;
}

.profile-pop-avatar.clickable:hover .avatar {
  filter: brightness(1.08);
}

.profile-pop-bio.clamp {
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.profile-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 4px;
}

.profile-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--bg-input);
  font-size: 12.5px;
  line-height: 1.3;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.profile-chip svg {
  flex-shrink: 0;
  opacity: 0.8;
}

.profile-chip.more {
  color: var(--text-muted);
}

.profile-chip.editable {
  padding-right: 4px;
}

.profile-pop-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Тема профиля: градиент из двух цветов, содержимое — на тёмной подложке, текст светлый */
.profile-pop.themed,
.profile-full.themed {
  --header: #fff;
  --text: #eef0f3;
  --text-muted: rgba(255, 255, 255, 0.72);
  --border: rgba(255, 255, 255, 0.16);
  --bg-input: rgba(0, 0, 0, 0.32);
  color: var(--text);
  background: var(--pt-bg);
  border-color: color-mix(in srgb, var(--pt1) 60%, transparent);
}

/* «переливание»: градиент туда-обратно в два раза больше карточки плавно едет */
.profile-pop.themed.flowing,
.profile-full.themed.flowing {
  background-size: 200% 200%;
  animation: theme-flow 7s ease-in-out infinite alternate;
}

@keyframes theme-flow {
  from {
    background-position: 0% 0%;
  }
  to {
    background-position: 100% 100%;
  }
}

.profile-pop.themed .profile-pop-body {
  background: rgba(0, 0, 0, 0.42);
  margin: 0 8px 8px;
  border-radius: var(--radius);
  padding-top: 42px;
}

.profile-pop.themed .profile-pop-avatar,
.profile-full.themed .profile-full-avatar {
  background: color-mix(in srgb, var(--pt1) 80%, #000);
}

.profile-pop.themed .btn.secondary,
.profile-full.themed .btn.secondary {
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
}

/* полный профиль */
.modal.profile-modal {
  width: 640px;
  padding: 0;
  position: relative;
  overflow-x: hidden;
}

.profile-full {
  background: var(--bg-modal);
  min-height: 100%;
  display: flow-root; /* отступ последнего блока не «выпадает» за градиент темы */
}

.profile-full-banner {
  height: 220px;
}

.profile-full-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 0 24px;
  margin-top: -72px;
}

.profile-full-avatar {
  padding: 7px;
  border-radius: 50%;
  background: var(--bg-modal);
  display: flex;
}

.profile-full-actions {
  min-width: 190px;
  padding-bottom: 6px;
}

.profile-full-body {
  padding: 10px 24px 24px;
}

.profile-full.themed .profile-full-body {
  background: rgba(0, 0, 0, 0.42);
  margin: 12px 14px 14px;
  border-radius: var(--radius-lg);
  padding-top: 16px;
}

.profile-full-name {
  font-size: 26px;
  font-weight: 800;
  color: var(--header);
  display: flex;
  align-items: center;
  gap: 8px;
  word-break: break-word;
}

.profile-full-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 4px 22px;
  margin-top: 6px;
}

.profile-empty {
  margin-top: 16px;
  color: var(--text-muted);
  font-style: italic;
}

.profile-full-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
}

.profile-full-close:hover {
  background: rgba(0, 0, 0, 0.7);
}

@media (max-width: 640px) {
  .profile-full-grid {
    grid-template-columns: 1fr;
  }
  .profile-full-head {
    flex-wrap: wrap;
  }
}

/* личный кабинет */
.profile-tab-body {
  min-height: 300px;
}

.profile-tab .field {
  margin-bottom: 16px;
}

.chips-field .chips-edit:not(:empty) {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 6px;
}

.chips-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chips-counter {
  font-size: 12px;
  color: var(--text-muted);
  min-width: 36px;
  text-align: right;
}

.theme-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.theme-swatch {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 2px solid transparent;
  padding: 0;
  transition: transform 0.15s, border-color 0.15s;
}

.theme-swatch:hover {
  transform: scale(1.08);
}

.theme-swatch.active {
  border-color: var(--header);
  box-shadow: 0 0 0 2px var(--accent);
}

.theme-swatch.none {
  background: repeating-linear-gradient(45deg, var(--bg-input), var(--bg-input) 5px, var(--bg-elevated) 5px, var(--bg-elevated) 10px);
}

.theme-custom {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  border-radius: 10px;
  background: var(--bg-input);
}

.color-input {
  width: 30px;
  height: 28px;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
}

.panel-preview {
  max-width: 260px;
  border-radius: var(--radius);
  background: var(--bg-sidebar);
  padding: 6px;
}

.frame-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 8px;
}

.frame-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 14px 4px 8px;
  border-radius: var(--radius);
  border: 2px solid transparent;
  background: var(--bg-input);
  font-size: 12px;
  color: var(--text-muted);
  transition: border-color 0.15s, background 0.15s;
}

/* Сетка рамок в кабинете — самое тяжёлое там (43 аватарки с эффектами): плитка рисуется, только когда
   доходит до экрана, — «Оформление» открывается без подвисания */
.frame-grid > .frame-option {
  content-visibility: auto;
  contain-intrinsic-size: auto 104px;
}

.frame-option:hover {
  background: var(--bg-hover);
  color: var(--header);
}

.frame-option.active {
  border-color: var(--accent);
  color: var(--header);
}

/* редактор «Баннер и тема профиля» */
.look-editor {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.look-editor > .segmented {
  align-self: flex-start;
}

.look-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--bg-input);
}

.color-slots {
  display: flex;
  gap: 8px;
  align-items: center;
}

.color-slot {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px 5px 6px;
  border-radius: 999px;
  border: 2px solid transparent;
  background: var(--bg-elevated);
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
}

.color-slot.active {
  border-color: var(--accent);
}

.color-slot-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
}

.palette {
  display: grid;
  grid-template-columns: repeat(auto-fill, 26px);
  gap: 6px;
}

.palette .swatch.custom {
  position: relative;
  background: conic-gradient(#ef4444, #facc15, #22c55e, #06b6d4, #3b82f6, #a855f7, #ec4899, #ef4444);
  overflow: hidden;
}

.custom-color-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  border: none;
  padding: 0;
}

.look-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.look-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  min-width: 96px;
}

.look-value {
  font-size: 12px;
  color: var(--text-muted);
  min-width: 70px;
}

.balance-range {
  flex: 1;
  min-width: 120px;
  height: 8px;
  border-radius: 999px;
  appearance: none;
  -webkit-appearance: none;
  outline: none;
}

.balance-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid rgba(0, 0, 0, 0.4);
  cursor: pointer;
}

.balance-end {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}

.look-image {
  display: flex;
  flex-direction: column;
  margin-top: 10px;
}

.look-image .row.wrap {
  margin-top: 4px;
}

/* ---------- своя тема: анимированный фон под интерфейсом (ui/theme.js) ---------- */
html[data-theme-id='custom'] body,
html[data-theme-id='beach'] body {
  background: transparent; /* фон рисует html и слои под интерфейсом */
}

#theme-fx {
  position: fixed;
  inset: 0;
  z-index: -2; /* эффекты фона (#bg-effects, z-index: -1) — поверх него */
  overflow: hidden;
  pointer-events: none;
  background: var(--fx-c1);
}

#theme-fx > div {
  position: absolute;
  display: none;
}

#theme-fx .fx-base {
  display: block;
  inset: 0;
  background: var(--fx-grad);
}

/* когда окно не в фокусе (игра поверх) — всё замирает */
.fx-paused #theme-fx *,
.fx-paused #theme-fx,
.fx-paused #bg-effects * {
  animation-play-state: paused !important;
}

/* Переливание: градиент «туда-обратно» вдвое больше экрана медленно едет по направлению */
#theme-fx.fx-flow .fx-base {
  inset: -50%;
  background: var(--fx-grad-mirror);
  animation: fx-flow calc(18s * var(--fx-k)) ease-in-out infinite alternate;
  will-change: transform;
}

@keyframes fx-flow {
  from { transform: translate(calc(var(--fx-dx) * -1), calc(var(--fx-dy) * -1)); }
  to { transform: translate(var(--fx-dx), var(--fx-dy)); }
}

/* Дыхание: цвета плавно меняются местами */
#theme-fx.fx-breathe .fx-a {
  display: block;
  inset: 0;
  background: var(--fx-grad-rev);
  animation: fx-fade calc(9s * var(--fx-k)) ease-in-out infinite alternate;
  will-change: opacity;
}

@keyframes fx-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Радуга: оттенок всего фона идёт по кругу */
#theme-fx.fx-hue .fx-base {
  animation: fx-hue calc(30s * var(--fx-k)) linear infinite;
  will-change: filter;
}

@keyframes fx-hue {
  to { filter: hue-rotate(360deg); }
}

/* Сияние: большие мягкие пятна двух цветов плавают по тёмному фону */
#theme-fx.fx-aurora .fx-base {
  background: linear-gradient(var(--fx-angle), color-mix(in srgb, var(--fx-c1) 30%, #050507), color-mix(in srgb, var(--fx-c2) 30%, #050507));
}

#theme-fx.fx-aurora .fx-a,
#theme-fx.fx-aurora .fx-b,
#theme-fx.fx-aurora .fx-c {
  display: block;
  width: 75vmax;
  height: 75vmax;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--blob), transparent);
  opacity: 0.8;
  will-change: transform;
}

#theme-fx.fx-aurora .fx-a { --blob: var(--fx-c1); left: -25vmax; top: -30vmax; animation: fx-drift-a calc(24s * var(--fx-k)) ease-in-out infinite alternate; }
#theme-fx.fx-aurora .fx-b { --blob: var(--fx-c2); right: -30vmax; top: 5vmax; animation: fx-drift-b calc(30s * var(--fx-k)) ease-in-out infinite alternate; }
#theme-fx.fx-aurora .fx-c { --blob: var(--fx-mix); left: 15vmax; bottom: -40vmax; animation: fx-drift-c calc(36s * var(--fx-k)) ease-in-out infinite alternate; }

@keyframes fx-drift-a { to { transform: translate(35vmax, 25vmax) scale(1.25); } }
@keyframes fx-drift-b { to { transform: translate(-40vmax, 20vmax) scale(0.8); } }
@keyframes fx-drift-c { to { transform: translate(20vmax, -35vmax) scale(1.15); } }

/* Вихрь: два цвета крутятся вокруг центра */
#theme-fx.fx-spin .fx-a {
  display: block;
  width: 145vmax; /* диагональ окна — не больше 1,42 vmax (у квадратного), хватает при любом повороте; было 220vmax */
  height: 145vmax;
  left: 50%;
  top: 50%;
  margin: -72.5vmax 0 0 -72.5vmax;
  background: conic-gradient(from 0deg, var(--fx-c1), var(--fx-c2), var(--fx-c1), var(--fx-c2), var(--fx-c1));
  animation: fx-spin calc(45s * var(--fx-k)) linear infinite;
  will-change: transform;
}

#theme-fx.fx-spin .fx-b {
  display: block;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, transparent 0, rgba(0, 0, 0, 0.25) 100%);
}

@keyframes fx-spin {
  to { transform: rotate(360deg); }
}

/* Волны: полупрозрачные полосы второго и первого цвета плывут навстречу */
#theme-fx.fx-waves .fx-a,
#theme-fx.fx-waves .fx-b {
  display: block;
  top: 0;
  bottom: 0;
  left: -50%;
  width: 200%;
  will-change: transform;
}

#theme-fx.fx-waves .fx-a {
  background: repeating-linear-gradient(100deg, transparent 0 80px, color-mix(in srgb, var(--fx-c2) 32%, transparent) 150px, transparent 220px);
  animation: fx-wave calc(14s * var(--fx-k)) ease-in-out infinite alternate;
}

#theme-fx.fx-waves .fx-b {
  background: repeating-linear-gradient(75deg, transparent 0 120px, color-mix(in srgb, var(--fx-c1) 28%, transparent) 200px, transparent 280px);
  animation: fx-wave calc(19s * var(--fx-k)) ease-in-out infinite alternate-reverse;
}

@keyframes fx-wave {
  from { transform: translateX(-12%); }
  to { transform: translateX(12%); }
}

/* Звёзды: мерцающие точки в цветах темы медленно плывут вверх */
#theme-fx.fx-stars .fx-base {
  background: linear-gradient(var(--fx-angle), color-mix(in srgb, var(--fx-c1) 40%, #04040a), color-mix(in srgb, var(--fx-c2) 40%, #04040a));
}

#theme-fx.fx-stars .fx-stars {
  display: block;
  left: 0;
  top: 0;
  width: 1px;
  height: 1px;
  border-radius: 50%;
  will-change: transform, opacity;
}

#theme-fx.fx-stars .s1 { animation: fx-rise-stars calc(120s * var(--fx-k)) linear infinite, fx-twinkle 3s ease-in-out infinite alternate; }
#theme-fx.fx-stars .s2 { animation: fx-rise-stars calc(70s * var(--fx-k)) linear infinite, fx-twinkle 2.2s ease-in-out infinite alternate-reverse; }

@keyframes fx-rise-stars {
  from { transform: translateY(0); }
  to { transform: translateY(-100vh); }
}

@keyframes fx-twinkle {
  from { opacity: 1; }
  to { opacity: 0.35; }
}

/* Пузыри: прозрачные шарики цветов темы всплывают снизу */
#theme-fx.fx-bubbles .fx-bubbles {
  display: block;
  inset: 0;
}

#theme-fx .fx-bubbles span {
  position: absolute;
  bottom: -160px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, rgba(255, 255, 255, 0.55), color-mix(in srgb, var(--bc) 45%, transparent) 45%, color-mix(in srgb, var(--bc) 15%, transparent) 68%, transparent 71%);
  animation: fx-bubble calc(var(--d) * var(--fx-k)) linear infinite;
  animation-delay: var(--delay);
  will-change: transform;
}

@keyframes fx-bubble {
  0% { transform: translate(0, 0); }
  25% { transform: translate(18px, -32vh); }
  50% { transform: translate(-14px, -64vh); }
  75% { transform: translate(14px, -96vh); }
  100% { transform: translate(0, calc(-100vh - 320px)); }
}

/* карточка «Своя» и её настройки */
.theme-preview.custom-preview {
  position: relative;
}

.custom-theme-editor {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.fx-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 6px;
}

.fx-option {
  padding: 8px 6px;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.fx-option:hover {
  border-color: var(--border-strong);
}

.fx-option.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* ---------- эффекты фона (ui/bg-effects.js) ---------- */
#bg-effects {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

/* у тем с непрозрачными панелями — поверх окна, приглушённо (ниже окон и меню) */
#bg-effects.over {
  z-index: 50;
  opacity: 0.55;
}

@media (prefers-reduced-motion: reduce) {
  #bg-effects {
    display: none;
  }
}

#bg-effects span {
  position: absolute;
  display: block;
  will-change: transform, opacity;
}

/* кометы: хвост-градиент и яркая голова, летят по диагонали, потом пауза */
.fx-p-comets span {
  left: var(--x);
  top: var(--y);
  width: var(--len);
  height: 3px;
  border-radius: 3px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--c) 60%, transparent) 60%, #fff);
  filter: drop-shadow(0 0 4px var(--c));
  opacity: 0;
  animation: fx-comet var(--d) linear infinite var(--delay);
}

.fx-p-comets span::after {
  content: '';
  position: absolute;
  right: -4px;
  top: 50%;
  width: 8px;
  height: 8px;
  margin-top: -4px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 14px 5px var(--c), 0 0 4px 1px #fff;
}

@keyframes fx-comet {
  0% { transform: rotate(var(--a)) translateX(0); opacity: 0; }
  2% { opacity: 1; }
  12% { opacity: 1; }
  16% { transform: rotate(var(--a)) translateX(115vmax); opacity: 0; }
  100% { transform: rotate(var(--a)) translateX(115vmax); opacity: 0; }
}

/* снег */
.fx-p-snow span {
  left: var(--x);
  top: -10px;
  width: var(--s);
  height: var(--s);
  border-radius: 50%;
  background: #fff;
  opacity: var(--o);
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.6);
  animation: fx-fall var(--d) linear infinite var(--delay);
}

@keyframes fx-fall {
  0% { transform: translate(0, -5vh); }
  50% { transform: translate(var(--sway), 50vh); }
  100% { transform: translate(0, 110vh); }
}

/* светлячки: бродят и мерцают */
.fx-p-fireflies span {
  left: var(--x);
  top: var(--y);
  width: var(--s);
  height: var(--s);
  border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 10px 3px var(--c);
  animation: fx-wander var(--d) ease-in-out infinite alternate var(--delay), fx-blink var(--blink) ease-in-out infinite alternate var(--delay);
}

@keyframes fx-wander {
  0% { transform: translate(0, 0); }
  33% { transform: translate(var(--dx), calc(var(--dy) * -0.5)); }
  66% { transform: translate(calc(var(--dx) * -0.6), var(--dy)); }
  100% { transform: translate(calc(var(--dx) * 0.4), calc(var(--dy) * -1)); }
}

@keyframes fx-blink {
  from { opacity: 0.15; }
  to { opacity: 1; }
}

/* дождь: косые капли */
.fx-p-rain span {
  left: var(--x);
  top: -40px;
  width: 1.5px;
  height: var(--len);
  background: linear-gradient(transparent, rgba(174, 214, 255, 0.9));
  opacity: var(--o);
  animation: fx-rain var(--d) linear infinite var(--delay);
}

@keyframes fx-rain {
  from { transform: translate(0, 0) rotate(12deg); }
  to { transform: translate(-24vh, 112vh) rotate(12deg); }
}

/* искры: поднимаются снизу и гаснут */
.fx-p-embers span {
  left: var(--x);
  bottom: -10px;
  width: var(--s);
  height: var(--s);
  border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 8px 2px var(--c);
  opacity: 0;
  animation: fx-ember var(--d) ease-out infinite var(--delay);
}

@keyframes fx-ember {
  0% { transform: translate(0, 0); opacity: 0; }
  10% { opacity: 1; }
  50% { transform: translate(var(--sway), -50vh); }
  100% { transform: translate(calc(var(--sway) * -0.5), -100vh); opacity: 0; }
}

/* лепестки: кружатся и падают */
.fx-p-petals span {
  left: var(--x);
  top: -20px;
  width: var(--s);
  height: calc(var(--s) * 0.7);
  border-radius: 100% 0 100% 0;
  background: var(--c);
  opacity: 0.9;
  animation: fx-petal var(--d) linear infinite var(--delay);
}

@keyframes fx-petal {
  0% { transform: translate(0, -5vh) rotate(0deg); }
  50% { transform: translate(var(--sway), 50vh) rotate(calc(var(--spin) * 0.5)); }
  100% { transform: translate(calc(var(--sway) * -0.3), 110vh) rotate(var(--spin)); }
}

/* конфетти */
.fx-p-confetti span {
  left: var(--x);
  top: -20px;
  width: var(--s);
  height: calc(var(--s) * 0.45);
  border-radius: 1px;
  background: var(--c);
  animation: fx-confetti var(--d) linear infinite var(--delay);
}

@keyframes fx-confetti {
  0% { transform: translate(0, -5vh) rotate(0deg) scaleX(1); }
  25% { transform: translate(calc(var(--sway) * 0.5), 25vh) rotate(calc(var(--spin) * 0.25)) scaleX(-1); }
  50% { transform: translate(var(--sway), 50vh) rotate(calc(var(--spin) * 0.5)) scaleX(1); }
  75% { transform: translate(calc(var(--sway) * 0.3), 80vh) rotate(calc(var(--spin) * 0.75)) scaleX(-1); }
  100% { transform: translate(0, 110vh) rotate(var(--spin)) scaleX(1); }
}

/* ---------- модерация: категории прав, настройки сервера, баны, журнал, закрепы, перетаскивание ---------- */
.role-pane {
  overflow-anchor: none;
}

.perm-groups {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 6px;
}

.perm-group-title {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--header);
  margin-bottom: 6px;
}

.perm-group .perm-list {
  margin-top: 0;
}

.modal.server-settings {
  width: 860px;
}

.modal.server-settings .tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.server-settings-hint {
  margin: -4px 0 12px;
}

.server-settings-body {
  min-height: 420px;
}

.empty-note {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 40px 0;
  color: var(--text-muted);
}

.ban-list,
.audit-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
  max-height: 60vh;
  overflow-y: auto;
}

.ban-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--bg-input);
}

.ban-info {
  flex: 1;
  min-width: 0;
}

.ban-name {
  font-weight: 700;
  color: var(--header);
}

.ban-meta {
  font-size: 12.5px;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

.audit-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  font-size: 13.5px;
}

.audit-icon {
  display: flex;
  color: var(--accent);
  margin-top: 1px;
}

.audit-text {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
  user-select: text;
}

.audit-time {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.mute-options {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 3px;
  background: var(--bg-input);
  border-radius: var(--radius);
}

.composer-disabled.muted-chat {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--red);
}

.profile-pop-username {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: -2px;
}

.avatar-field {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* закреплённые */
.message.pinned {
  box-shadow: inset 2px 0 0 color-mix(in srgb, var(--yellow) 70%, transparent);
}

.message-pinned {
  display: inline-flex;
  color: var(--yellow);
  align-self: center;
}

.message-pinned.side {
  position: absolute;
  left: 6px;
  top: 6px;
}

.pins-panel {
  position: fixed;
  z-index: 1000;
  width: 380px;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-floating);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: pop-in 0.15s var(--ease);
}

.pins-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  font-weight: 700;
  color: var(--header);
  border-bottom: 1px solid var(--border);
}

.pins-list {
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pin-item {
  display: flex;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius);
  background: var(--bg-input);
}

.pin-body {
  flex: 1;
  min-width: 0;
}

.pin-meta {
  display: flex;
  gap: 8px;
  align-items: baseline;
  font-size: 12px;
  color: var(--text-muted);
}

.pin-meta b {
  color: var(--header);
  font-size: 14px;
}

.pin-text {
  font-size: 13.5px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow-wrap: anywhere;
}

.pin-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

/* перетаскивание участников между голосовыми каналами */
.voice-user.draggable {
  cursor: grab;
}

.voice-user.draggable:active {
  cursor: grabbing;
}

.dragging-member .voice-channel-block {
  border-radius: var(--radius-sm);
  outline: 1px dashed transparent;
  transition: outline-color 0.12s, background 0.12s;
}

.dragging-member .voice-channel-block:not(.drop-target) {
  outline-color: var(--border-strong);
}

.voice-channel-block.drop-target {
  outline: 2px solid var(--accent);
  background: var(--accent-soft);
}

/* где сработает бинд: «везде» (в других программах и играх) или «в окне» */
.hotkey-scope {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  background: var(--bg-input);
  color: var(--text-muted);
}

.hotkey-scope.global {
  color: var(--green);
  background: color-mix(in srgb, var(--green) 14%, transparent);
}

.hotkey-scope.busy {
  color: var(--yellow);
  background: color-mix(in srgb, var(--yellow) 14%, transparent);
}

/* ---------- аккаунт: логин и ID ---------- */
.id-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font: 600 12px/1.4 ui-monospace, Consolas, monospace;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.18);
  border-radius: 4px;
  padding: 1px 4px 1px 6px;
  user-select: text;
}
.id-copy {
  display: inline-flex;
  background: none;
  border: 0;
  padding: 2px;
  color: inherit;
  cursor: pointer;
  border-radius: 3px;
}
.id-copy:hover {
  color: var(--header);
  background: rgba(255, 255, 255, 0.08);
}
.profile-id-row {
  margin-top: 2px;
}
.my-id-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  font-size: 14px;
}
.account-login {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: var(--header);
}
.account-subtitle {
  margin: 18px 0 8px;
  color: var(--header);
}
.link-button {
  background: none;
  border: 0;
  color: var(--text-link, #00a8fc);
  cursor: pointer;
  font-size: 13px;
  padding: 0;
  margin-top: 10px;
}
.link-button:hover {
  text-decoration: underline;
}

/* ---------- свои серверы и лимиты каналов ---------- */
.guild-create {
  color: var(--green, #23a55a);
}
.guild-create:hover {
  background: var(--green, #23a55a);
  color: #fff;
}
.guild-create.disabled {
  opacity: 0.4;
}
.guild-create.disabled:hover {
  background: var(--bg-elevated);
  color: var(--green, #23a55a);
}
.channel-count {
  margin-left: auto;
  margin-right: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}
.channel-count.full {
  color: var(--red, #f23f43);
}
.group-add:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.id-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.id-block .id-badge {
  font-size: 15px;
  padding: 4px 6px 4px 10px;
}

/* ---------- пользовательское соглашение ---------- */
.terms-body {
  max-height: 52vh;
  overflow-y: auto;
  padding: 4px 12px 4px 0;
  margin: 8px 0 12px;
  font-size: 14px;
  line-height: 1.5;
}
/* На телефоне окно на весь экран — текст занимает всё место над кнопками */
@media (max-width: 768px) {
  .terms-body {
    max-height: calc(100dvh - 230px);
  }
}
.terms-body h4 {
  margin: 14px 0 4px;
  color: var(--header);
}
.terms-body section:first-child h4 {
  margin-top: 0;
}
.terms-body p {
  margin: 0;
  color: var(--text);
}
.terms-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 14px;
  cursor: pointer;
  margin: 10px 0 4px;
}
.terms-check input {
  margin-top: 3px;
  flex: none;
}
.terms-check .link-button {
  display: inline;
  margin: 0;
  font: inherit;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.login-terms-link {
  display: block;
  margin: 8px auto 0;
  font-size: 12px;
}

/* ======================================================================
   Телефон и узкие окна (веб-версия и приложение для Android)
   ====================================================================== */
.m-btn,
.m-backdrop,
.m-tabbar {
  display: none;
}

/* Сенсорный экран: действия с сообщением — по касанию (класс touch-active), а не при наведении */
.touch .message.touch-active .message-actions {
  display: flex;
}

@media (max-width: 768px) {
  html,
  body {
    overscroll-behavior: none;
  }
  .app {
    height: 100dvh;
    position: relative;
    overflow: hidden;
  }

  /* Два экрана, как в приложении для телефона: «список» (серверы, каналы, ЛС) и «экран» (чат, звонок…).
     Экран лежит поверх списка и выезжает справа; невидимый — не рисуется (ui/mobile.js) */
  .app {
    --m-tabbar-h: calc(58px + env(safe-area-inset-bottom));
  }
  .guilds,
  .sidebar {
    position: fixed;
    top: 0;
    bottom: var(--m-tabbar-h);
    z-index: 1;
    padding-top: env(safe-area-inset-top);
  }
  .guilds {
    left: 0;
    width: 72px;
  }
  .sidebar {
    left: 72px;
    right: 0;
    width: auto;
    border-radius: 0;
  }
  .main {
    position: fixed;
    inset: 0;
    z-index: 50;
    width: 100%;
    transform: translateX(100%);
    transition: transform 0.28s var(--ease);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.4);
  }
  .app[data-mscreen='content'] .main {
    transform: none;
  }
  .app.m-dragging .main {
    transition: none;
  }
  .app.m-list-hidden .guilds,
  .app.m-list-hidden .sidebar,
  .app.m-list-hidden .m-tabbar,
  .app.m-main-hidden .main {
    visibility: hidden;
  }

  /* Нижние вкладки на списке */
  .m-tabbar {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    height: var(--m-tabbar-h);
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--bg-tertiary, #1e1f22);
    border-top: 1px solid var(--border);
  }
  .m-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    border: 0;
    background: none;
    color: var(--text-muted);
    font: inherit;
    font-size: 11px;
    font-weight: 600;
    -webkit-tap-highlight-color: transparent;
  }
  .m-tab.active {
    color: var(--header);
  }
  .m-tab:active .m-tab-icon {
    transform: scale(0.9);
  }
  .m-tab-icon {
    position: relative;
    display: flex;
    transition: transform 0.12s;
  }
  .m-tab-badge {
    position: absolute;
    top: -4px;
    right: -10px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--danger, #ed4245);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    box-shadow: 0 0 0 2px var(--bg-tertiary, #1e1f22);
  }
  .m-tab .avatar {
    pointer-events: none;
  }

  /* Участники — панель справа поверх экрана */
  .members {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    width: min(320px, 86vw);
    transform: translateX(100%);
    visibility: hidden;
    transition: transform 0.24s var(--ease), visibility 0s linear 0.24s;
    padding-top: calc(8px + env(safe-area-inset-top));
    padding-bottom: env(safe-area-inset-bottom);
  }
  .app.members-open .members {
    transform: none;
    visibility: visible;
    transition: transform 0.24s var(--ease);
    box-shadow: -8px 0 24px rgba(0, 0, 0, 0.35);
  }

  .m-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
  }
  .app.members-open .m-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  /* Экран (чат, звонок, друзья…) — на весь экран, сверху «←» и участники */
  .main {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .topbar {
    padding: 0 52px 0 50px;
    overflow: hidden;
    white-space: nowrap;
  }
  .m-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: calc(6px + env(safe-area-inset-top));
    z-index: 5;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--header);
    -webkit-tap-highlight-color: transparent;
  }
  .m-btn:active {
    background: var(--bg-hover, rgba(255, 255, 255, 0.08));
  }
  .m-nav-btn {
    left: 6px;
  }
  .m-members-btn {
    right: 6px;
    display: none;
  }
  .app:has(#members:not([hidden])) .m-members-btn {
    display: flex;
  }
  .app:has(#members[hidden]) .topbar {
    padding-right: 12px;
  }

  /* Крупнее для пальца */
  .channel-item {
    min-height: 40px;
  }
  .composer textarea,
  input.input,
  select.input,
  textarea.input,
  .add-friend-form input {
    font-size: 16px; /* меньше 16px — iPhone увеличивает страницу при вводе */
  }
  .message-actions {
    right: 8px;
  }

  /* Окна — листы снизу (util.openModal): ручка сверху, свайп вниз — закрыть */
  .modal-backdrop.sheet-backdrop {
    padding: calc(env(safe-area-inset-top) + 12px) 0 0;
    align-items: flex-end;
    backdrop-filter: none;
    animation: fade-in 0.2s ease;
    transition: opacity 0.2s;
  }
  .modal-backdrop.sheet-backdrop.closing {
    opacity: 0;
    pointer-events: none;
  }
  .sheet {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-height: 100%;
    border-radius: 18px 18px 0 0;
    background: var(--bg-modal);
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.45);
    animation: sheet-in 0.28s var(--ease);
    transition: transform 0.22s var(--ease);
    overflow: hidden;
  }
  .sheet.dragging {
    transition: none;
  }
  @keyframes sheet-in {
    from {
      transform: translateY(100%);
    }
  }
  .sheet-handle {
    flex: none;
    height: 22px;
    display: flex;
    justify-content: center;
    align-items: center;
    touch-action: none;
  }
  .sheet-handle::before {
    content: '';
    width: 40px;
    height: 5px;
    border-radius: 3px;
    background: var(--text-muted);
    opacity: 0.5;
  }
  .sheet .modal,
  .sheet .modal.wide {
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: none;
    min-height: 0;
    flex: 1 1 auto;
    overflow-y: auto;
    overscroll-behavior: contain;
    border-radius: 0;
    border: 0;
    box-shadow: none;
    animation: none;
    padding: 4px 16px calc(16px + env(safe-area-inset-bottom));
  }
  .modal-actions {
    flex-wrap: wrap;
  }
  .profile-editor {
    grid-template-columns: 1fr;
  }
  .row {
    flex-wrap: wrap;
  }
  .sheet .modal.profile-modal {
    padding: 0 0 env(safe-area-inset-bottom);
  }
  /* мини-профиль листом */
  .sheet .modal.profile-sheet {
    padding: 0 0 calc(12px + env(safe-area-inset-bottom));
  }
  .profile-sheet .profile-pop {
    position: static;
    width: 100%;
    max-width: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    animation: none;
  }
  .profile-sheet-sheet .sheet-handle {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 3;
  }
  .profile-sheet-sheet .sheet-handle::before,
  .profile-modal-sheet .sheet-handle::before {
    background: #fff;
    opacity: 0.8;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
  }
  .profile-modal-sheet .sheet-handle {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 3;
  }
  /* меню (долгое нажатие, «…») — список крупных пунктов снизу */
  .sheet .modal.action-sheet {
    padding: 0 8px calc(10px + env(safe-area-inset-bottom));
  }
  .action-sheet .context-menu {
    position: static;
    width: 100%;
    max-width: none;
    max-height: none;
    min-width: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
    background: transparent;
    animation: none;
  }
  .action-sheet .menu-item {
    min-height: 50px;
    font-size: 16px;
    padding: 0 12px;
    border-radius: 12px;
  }
  .action-sheet .menu-title {
    padding: 4px 12px 10px;
    font-size: 13px;
  }

  /* Контекстные меню (долгое нажатие) — не вылезают за экран */
  .context-menu {
    max-width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
    overflow-y: auto;
  }
  .context-menu button {
    min-height: 40px;
  }

  /* Друзья: вкладки прокручиваются */
  .friends-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  /* Звонок: плитки в одну-две колонки, кнопки крупнее */
  .voice-controls {
    gap: 10px;
    flex-wrap: wrap;
    padding-bottom: calc(14px + env(safe-area-inset-bottom));
  }
  .update-banner {
    flex-wrap: wrap;
  }

  /* Экран входа */
  .login-screen {
    padding: 12px;
    align-items: flex-start;
    overflow-y: auto;
  }
  .login-card {
    width: 100%;
    max-width: 440px;
    margin: 48px auto 24px;
  }
  .login-lang {
    top: calc(10px + env(safe-area-inset-top));
    right: 10px;
  }
}
#bg-effects .fx-group {
  display: contents;
}

/* ---------- жалоба ---------- */
.report-reasons {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 12px 0;
}
.report-reason {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
}
.report-reason:hover {
  background: var(--bg-hover, rgba(255, 255, 255, 0.05));
}
.report-reason input {
  margin: 0;
  accent-color: var(--danger, #ed4245);
}
.report-comment {
  width: 100%;
  resize: vertical;
  min-height: 70px;
}

/* ---------- удаление аккаунта ---------- */
.danger-zone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 24px;
  padding: 14px 16px;
  border: 1px solid rgba(237, 66, 69, 0.35);
  border-radius: 10px;
  background: rgba(237, 66, 69, 0.06);
}
.danger-zone-title {
  font-weight: 600;
  margin-bottom: 2px;
}
.danger-zone .btn {
  flex: none;
}
.delete-account-list {
  margin: 10px 0 16px;
  padding-left: 20px;
  line-height: 1.5;
  color: var(--text-muted, #b5bac1);
}
.delete-account-list li + li {
  margin-top: 6px;
}
@media (max-width: 768px) {
  .danger-zone {
    flex-direction: column;
    align-items: stretch;
  }
}
.delete-account-form .terms-check {
  margin: 4px 0 14px;
}

/* ---------- @упоминания ---------- */
.mention.user {
  cursor: pointer;
}
.mention.user:hover {
  text-decoration: underline;
}
.mention.role {
  --mention-color: var(--accent);
  color: var(--mention-color);
  background: color-mix(in srgb, var(--mention-color) 16%, transparent);
}
.mention.me {
  background: var(--mention-bg, rgba(250, 204, 21, 0.18));
  color: #facc15;
}
.mention-panel {
  position: absolute;
  z-index: 30;
  max-height: 320px;
  overflow-y: auto;
  padding: 6px;
  border-radius: 10px;
  background: var(--bg-floating, #111214);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
}
.mention-panel-title {
  padding: 4px 8px 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted, #949ba4);
}
.mention-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
}
.mention-item.active {
  background: var(--bg-hover, rgba(255, 255, 255, 0.06));
}
.mention-item-icon {
  width: 24px;
  height: 24px;
  flex: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  background: var(--accent-soft);
  color: var(--accent);
}
.mention-item-icon.role {
  background: transparent;
  font-size: 16px;
}
.mention-item-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mention-item-sub {
  color: var(--text-muted, #949ba4);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mention-item-kind {
  margin-left: auto;
  color: var(--text-muted, #949ba4);
  font-size: 11px;
}
.mention-empty {
  padding: 8px;
  color: var(--text-muted, #949ba4);
  font-size: 13px;
}

/* ---------- стенка росписей в полном профиле ---------- */
.profile-pop-section.wall {
  margin-top: 16px;
}
.profile-pop-section.wall .profile-pop-label {
  display: flex;
  align-items: center;
  gap: 6px;
}
.wall-form {
  margin-bottom: 10px;
}
.wall-input {
  width: 100%;
  resize: vertical;
  min-height: 52px;
}
.wall-form-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}
.wall-counter {
  color: var(--text-muted);
  font-size: 12px;
}
.wall-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
}
.wall-entry {
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--bg-hover, rgba(255, 255, 255, 0.04));
  border: 1px solid var(--border);
}
.wall-entry-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  margin-bottom: 4px;
}
.wall-author {
  font-weight: 700;
  color: var(--accent);
}
.wall-author-id {
  color: var(--text-muted);
  font-family: ui-monospace, Consolas, monospace;
  font-size: 11px;
}
.wall-date {
  color: var(--text-muted);
  margin-left: auto;
}
.wall-del {
  width: 24px;
  height: 24px;
}
.wall-text {
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.4;
}
.wall-note {
  padding: 6px 0;
}

/* ---------- экран загрузки и подключения: глубокий космос, как на сайте ---------- */
/* Цвета свои, не зависят от темы оформления: это «вход» в приложение, как главная страница сайта */
.connecting-screen {
  background: #04050b;
  color: #eef0f6;
  padding: 0;
  overflow: hidden;
}

.space-sky {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

.connecting-stage {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 24px 24px calc(24px + env(safe-area-inset-bottom));
  animation: stage-in 0.8s ease-out both;
}

.connecting-stage .astronaut {
  width: min(260px, 62vw);
  height: auto;
  margin-bottom: 18px;
  user-select: none;
  filter: drop-shadow(0 18px 40px rgba(60, 70, 160, 0.25));
}

.connecting-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 650;
  font-size: 17px;
  letter-spacing: -0.01em;
  color: #eef0f6;
  margin-bottom: 10px;
}

.connecting-brand img {
  border-radius: 7px;
}

.connecting-text {
  color: #9aa0b4;
  font-size: 14px;
  line-height: 1.5;
  max-width: 34ch;
  min-height: 1.5em;
}

/* Три точки «идёт подключение» — спокойные, без вращения */
.connecting-dots {
  display: flex;
  gap: 6px;
  margin: 14px 0 6px;
}

.connecting-dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #8ea2ff;
  opacity: 0.25;
  animation: dot-pulse 1.4s ease-in-out infinite;
}

.connecting-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.connecting-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes dot-pulse {
  0%,
  100% {
    opacity: 0.25;
  }
  40% {
    opacity: 0.9;
  }
}

/* «Выйти из аккаунта» — появляется, только если подключение затянулось */
.connecting-logout {
  margin-top: 18px;
  background: none;
  border: none;
  color: #646a80;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
}

.connecting-logout.late {
  animation: fade-late 0.6s ease 6s forwards;
}

.connecting-logout:hover {
  color: #eef0f6;
}

@keyframes fade-late {
  to {
    opacity: 1;
    pointer-events: auto;
  }
}

@keyframes stage-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .connecting-stage,
  .connecting-dots span {
    animation: none;
  }
  .connecting-dots span {
    opacity: 0.6;
  }
}

/* ---------- активность: «Играет в …», «Слушает …» ---------- */
.member-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.member-name-row {
  display: flex;
  align-items: center;
  min-width: 0;
}

.member-name-row .name {
  flex: 0 1 auto;
  min-width: 0;
}

.member-text .name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-line {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  line-height: 1.3;
  color: var(--text-muted);
  min-width: 0;
}

.activity-line span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-line .ico {
  flex: none;
  opacity: 0.85;
}

.activity-card {
  margin: 10px 0 2px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
}

.activity-card-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.activity-card-body {
  display: flex;
  gap: 12px;
  align-items: center;
}

.activity-card-icon {
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--accent);
}

.activity-card-icon.listening {
  background: rgba(30, 215, 96, 0.14);
  color: #1ed760;
}

.activity-card-text {
  min-width: 0;
}

.activity-card-name {
  font-weight: 600;
  color: var(--header);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-card-details {
  font-size: 13px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-card-time {
  font-size: 12px;
  color: var(--text-muted);
}

/* ---------- звуковая панель ---------- */

.soundboard-pop {
  position: fixed;
  z-index: 200;
  width: 320px;
  max-width: calc(100vw - 16px);
  background: var(--bg-floating);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 12px;
  box-shadow: var(--shadow-lg);
  animation: pop-in 0.12s var(--ease);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.soundboard-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: var(--header);
}

.soundboard-count {
  margin-left: auto;
  font-weight: 500;
  font-size: 12px;
  color: var(--text-muted);
}

.soundboard-note,
.soundboard-empty {
  font-size: 13px;
  color: var(--text-muted);
}

.soundboard-empty {
  text-align: center;
  padding: 14px 0;
}

.soundboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.soundboard-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  text-align: left;
  transition: background-color 0.15s var(--ease), border-color 0.15s var(--ease), transform 0.1s var(--ease);
}

.soundboard-btn:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--accent);
}

.soundboard-btn.pressed {
  transform: scale(0.95);
  background: var(--accent-soft);
}

.soundboard-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.soundboard-emoji {
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
}

.soundboard-name {
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.soundboard-volume {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text-muted);
}

.soundboard-volume input {
  width: 100%;
}

.sound-add {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 12px 0 6px;
}

.sound-add .input:not(.sound-emoji-input) {
  flex: 1;
  min-width: 0;
}

.sound-emoji-input {
  width: 52px !important;
  flex: none;
  text-align: center;
}

.sounds-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

.sound-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
}

.sound-row > .input:not(.sound-emoji-input) {
  flex: 1;
  min-width: 0;
}

.sound-vol {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 140px;
  flex: none;
}

.sound-vol input {
  flex: 1;
  min-width: 0;
}

.sound-vol-label {
  font-size: 12px;
  color: var(--text-muted);
  width: 34px;
  text-align: right;
}

@media (max-width: 640px) {
  .sound-add {
    flex-wrap: wrap;
  }
  .sound-add .btn {
    width: 100%;
    justify-content: center;
  }
  .sound-row {
    flex-wrap: wrap;
  }
  .sound-vol {
    width: 100%;
    order: 5;
  }
}

/* ---------- пинги ---------- */

/* Обычные непрочитанные в каналах и серверах — спокойный значок; пинги (@) — красный, заметный */
.channel-item .badge:not(.mention),
.guild-server .badge:not(.mention) {
  background: color-mix(in srgb, var(--text) 22%, transparent);
  color: var(--header);
}

.badge.mention {
  background: var(--red);
  color: #fff;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--red) 28%, transparent);
}

/* ---------- порядок каналов перетаскиванием ---------- */

.dragging-channel .channel-item,
.dragging-channel .voice-channel-block {
  position: relative;
}

.channel-item.drop-before::before,
.channel-item.drop-after::after,
.voice-channel-block.drop-before::before,
.voice-channel-block.drop-after::after {
  content: '';
  position: absolute;
  left: 6px;
  right: 6px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent);
  pointer-events: none;
}

.channel-item.drop-before::before,
.voice-channel-block.drop-before::before {
  top: -1px;
}

.channel-item.drop-after::after,
.voice-channel-block.drop-after::after {
  bottom: -1px;
}

/* Шрифты для ника (личный кабинет → Оформление → Ник). Все — SIL Open Font License 1.1 (fonts/LICENSE.txt).
   Кириллица и латиница отдельными файлами: браузер скачивает только нужную часть. */
@font-face {
  font-family: 'Nick pixel';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/nick-pixel-cyrillic.woff2') format('woff2');
  unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116;
}
@font-face {
  font-family: 'Nick pixel';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/nick-pixel-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: 'Nick rounded';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/nick-rounded-cyrillic.woff2') format('woff2');
  unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116;
}
@font-face {
  font-family: 'Nick rounded';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/nick-rounded-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: 'Nick hand';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/nick-hand-cyrillic.woff2') format('woff2');
  unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116;
}
@font-face {
  font-family: 'Nick hand';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/nick-hand-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: 'Nick tech';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/nick-tech-cyrillic.woff2') format('woff2');
  unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116;
}
@font-face {
  font-family: 'Nick tech';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/nick-tech-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: 'Nick wide';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/nick-wide-cyrillic.woff2') format('woff2');
  unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116;
}
@font-face {
  font-family: 'Nick wide';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/nick-wide-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: 'Nick script';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/nick-script-cyrillic.woff2') format('woff2');
  unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116;
}
@font-face {
  font-family: 'Nick script';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/nick-script-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: 'Nick mono';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/nick-mono-cyrillic.woff2') format('woff2');
  unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116;
}
@font-face {
  font-family: 'Nick mono';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/nick-mono-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: 'Nick gothic';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/nick-gothic-cyrillic.woff2') format('woff2');
  unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116;
}
@font-face {
  font-family: 'Nick gothic';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/nick-gothic-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: 'Nick bubble';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/nick-bubble-cyrillic.woff2') format('woff2');
  unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116;
}
@font-face {
  font-family: 'Nick bubble';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/nick-bubble-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

/* ---------- стиль ника (js/ui/nick.js): шрифты и эффекты ---------- */
/* Свои цвета — переменные --n1 и --n2. Бесконечные анимации двигает fx-clock (экономно, с паузой). */
.nick-font-pixel { font-family: 'Nick pixel', var(--font); letter-spacing: 0.02em; }
.nick-font-tech { font-family: 'Nick tech', var(--font); font-weight: 400; letter-spacing: 0.02em; }
.nick-font-wide { font-family: 'Nick wide', var(--font); font-size: 0.92em; }
.nick-font-rounded { font-family: 'Nick rounded', var(--font); }
.nick-font-hand { font-family: 'Nick hand', var(--font); font-size: 1.2em; line-height: 1; }
.nick-font-script { font-family: 'Nick script', var(--font); font-weight: 400; font-size: 1.06em; letter-spacing: 0.01em; }
.nick-font-gothic { font-family: 'Nick gothic', var(--font); font-weight: 400; letter-spacing: 0.04em; }
.nick-font-bubble { font-family: 'Nick bubble', var(--font); font-weight: 400; font-size: 1.04em; }
.nick-font-mono { font-family: 'Nick mono', ui-monospace, monospace; font-size: 0.95em; }

/* Свечение не обрезается краем строки (там, где длинный ник обрезается «…») */
.nick-fx-neon,
.nick-fx-glow,
.nick-fx-pulse,
.nick-fx-glitch,
.nick-fx-fire,
.nick-fx-outline,
.nick-fx-shadow {
  overflow-clip-margin: 8px;
}
.nick.nick-fx-neon:is(.name, .channel-name, .user-panel-name),
.nick.nick-fx-glow:is(.name, .channel-name, .user-panel-name),
.nick.nick-fx-pulse:is(.name, .channel-name, .user-panel-name),
.nick.nick-fx-glitch:is(.name, .channel-name, .user-panel-name),
.nick.nick-fx-fire:is(.name, .channel-name, .user-panel-name) {
  overflow: clip;
}

.nick-fx-color { color: var(--n1); }

/* Цвет «внутри букв»: градиенты, радуга, блик, огонь */
.nick-fx-gradient,
.nick-fx-wave,
.nick-fx-rainbow,
.nick-fx-shine,
.nick-fx-fire {
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}
.nick-fx-gradient { background-image: linear-gradient(90deg, var(--n1), var(--n2)); }
.nick-fx-wave {
  background-image: linear-gradient(90deg, var(--n1), var(--n2), var(--n1));
  background-size: 200% 100%;
  animation: nick-slide 3.2s linear infinite;
}
.nick-fx-rainbow {
  background-image: linear-gradient(90deg, #ff5a5a, #ffb547, #f5f05a, #5af58a, #4ad2ff, #8f6bff, #ff5ad8, #ff5a5a);
  background-size: 200% 100%;
  animation: nick-slide 4s linear infinite;
}
@keyframes nick-slide {
  to { background-position: 200% 0; }
}
.nick-fx-shine {
  background-image: linear-gradient(110deg, var(--n1) 0 40%, #fff 50%, var(--n1) 60% 100%);
  background-size: 300% 100%;
  animation: nick-shine 3.2s ease-in-out infinite;
}
@keyframes nick-shine {
  0% { background-position: 100% 0; }
  55%, 100% { background-position: 0% 0; }
}
.nick-fx-fire {
  background-image: linear-gradient(0deg, #ff3d00, #ff8a00 35%, #ffd54f 65%, #fff6c2 85%, #ff8a00);
  background-size: 100% 220%;
  filter: drop-shadow(0 0 3px rgba(255, 110, 0, 0.75));
  animation: nick-fire 1.3s ease-in-out infinite alternate;
}
@keyframes nick-fire {
  from { background-position: 0 0; }
  to { background-position: 0 100%; }
}

/* Неон: светлая «трубка» и свечение своего цвета, иногда мигает */
.nick-fx-neon {
  color: color-mix(in srgb, var(--n1) 35%, #fff);
  text-shadow: 0 0 2px var(--n1), 0 0 6px var(--n1), 0 0 14px var(--n1);
  animation: nick-flicker 6s linear infinite;
}
@keyframes nick-flicker {
  0%, 17%, 21%, 23%, 61%, 64%, 100% { opacity: 1; }
  19%, 22%, 62.5% { opacity: 0.45; }
}
/* Подсветка: мягкое свечение «дышит» */
.nick-fx-glow {
  color: var(--n1);
  animation: nick-glow 2.4s ease-in-out infinite alternate;
}
@keyframes nick-glow {
  from { text-shadow: 0 0 2px color-mix(in srgb, var(--n1) 50%, transparent); }
  to { text-shadow: 0 0 6px var(--n1), 0 0 14px var(--n1); }
}
.nick-fx-pulse {
  color: var(--n1);
  display: inline-block;
  transform-origin: left center;
  animation: nick-pulse 1.8s ease-in-out infinite;
}
@keyframes nick-pulse {
  0%, 100% { transform: scale(1); text-shadow: none; }
  50% { transform: scale(1.07); text-shadow: 0 0 10px var(--n1); }
}
/* Глитч: цветные «помехи» по краям, иногда дёргается */
.nick-fx-glitch {
  color: var(--header);
  display: inline-block;
  text-shadow: -1px 0 var(--n1), 1px 0 var(--n2);
  animation: nick-glitch 3.5s steps(1) infinite;
}
@keyframes nick-glitch {
  0%, 84%, 100% { text-shadow: -1px 0 var(--n1), 1px 0 var(--n2); transform: none; }
  86% { text-shadow: -3px 0 var(--n1), 3px 0 var(--n2); transform: translateX(1px); }
  88% { text-shadow: 2px 0 var(--n1), -2px 0 var(--n2); transform: translateX(-1px) skewX(-10deg); }
  90% { text-shadow: -2px 1px var(--n1), 2px -1px var(--n2); transform: translateY(-1px); }
  92% { text-shadow: -1px 0 var(--n1), 1px 0 var(--n2); transform: none; }
}
.nick-fx-outline {
  color: var(--n1);
  text-shadow: 1px 1px 0 var(--n2), -1px 1px 0 var(--n2), 1px -1px 0 var(--n2), -1px -1px 0 var(--n2), 0 1px 0 var(--n2),
    0 -1px 0 var(--n2), 1px 0 0 var(--n2), -1px 0 0 var(--n2);
}
.nick-fx-shadow {
  color: var(--n1);
  text-shadow: 1px 1px 0 var(--n2), 2px 2px 0 color-mix(in srgb, var(--n2) 70%, #000), 3px 3px 4px rgba(0, 0, 0, 0.35);
}

/* ---------- подсказки под полями: не налезают на поле ---------- */
.field .field-hint,
.field + .field-hint {
  margin: 6px 0 0;
}
.field + .field-hint {
  margin: -6px 0 14px;
}

/* ---------- настройки: разделы слева, справа — выбранный раздел блоками ---------- */
.modal.settings-modal {
  width: 940px;
  height: min(760px, 100%);
  padding: 0;
  overflow: hidden;
  display: flex;
}
.settings-layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas:
    'title title'
    'nav pane'
    'nav actions';
  width: 100%;
  min-height: 0;
}
.settings-title {
  grid-area: title;
  margin: 0;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border-strong);
}
.settings-nav {
  grid-area: nav;
  overflow-y: auto;
  padding: 12px 10px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-strong);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.settings-nav-item {
  background: none;
  border: 0;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 14px;
  text-align: left;
  white-space: nowrap;
}
.settings-nav-item svg {
  flex: none;
  width: 17px;
  height: 17px;
  color: var(--accent);
}
.settings-nav-item:hover {
  background: var(--bg-hover);
  color: var(--text);
}
.settings-nav-item.active {
  background: var(--accent-soft);
  color: var(--header);
  box-shadow: inset 3px 0 0 var(--accent);
}
.settings-pane {
  grid-area: pane;
  overflow-y: auto;
  padding: 18px 22px 8px;
  min-height: 0;
  background: var(--bg-modal);
}
.settings-pane .settings-section {
  margin: 0;
}
.settings-pane .settings-section > h3 {
  font-size: 19px;
  margin: 0 0 14px;
}
.settings-actions {
  grid-area: actions;
  margin: 0;
  padding: 12px 22px;
  border-top: 1px solid var(--border-strong);
  background: var(--bg-modal);
}

/* Блок внутри раздела — отдельная плашка: видно, где кончается одно и начинается другое */
.settings-block,
.edit-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 14px;
  color: var(--text);
}
[data-theme='light'] .settings-block,
[data-theme='light'] .edit-card {
  background: var(--bg-sidebar);
}
.settings-block > :last-child,
.edit-card > :last-child {
  margin-bottom: 0;
}
.settings-block-title {
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.settings-block.profile-card {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.settings-block.profile-card .profile-info {
  flex: 1;
  min-width: 160px;
}
.settings-block.profile-card .profile-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--header);
}
.settings-block .custom-theme-editor:first-child {
  margin-top: 0;
}
.settings-block .field-hint,
.edit-card .field-hint {
  color: var(--text-muted);
  line-height: 1.4;
}

/* ---------- личный кабинет: шапка и кнопки на месте, прокручивается только содержимое ---------- */
.modal.profile-editor-modal {
  width: 1000px;
  height: min(780px, 100%);
  padding: 0;
  overflow: hidden;
  display: flex;
}
.profile-editor-wrap {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 0;
}
.profile-editor-wrap > .modal-title {
  margin: 0;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border-strong);
}
.profile-editor-wrap > .profile-editor {
  flex: 1;
  min-height: 0;
  padding: 0 0 0 22px;
  gap: 0;
  align-items: stretch;
  grid-template-columns: minmax(0, 1fr) 330px;
}
.pe-left {
  overflow-y: auto;
  min-height: 0;
  padding: 0 18px 16px 0;
}
.pe-left > .tabs {
  position: sticky;
  top: 12px;
  z-index: 3;
  margin: 12px 0 14px;
  /* под закреплёнными вкладками прокручивающееся содержимое не просвечивает */
  box-shadow: 0 -12px 0 6px var(--bg-modal), 0 6px 0 6px var(--bg-modal);
}
.profile-editor-wrap .profile-preview-col {
  position: static;
  overflow-y: auto;
  min-height: 0;
  padding: 16px 22px 16px 18px;
  background: var(--bg-sidebar);
  border-left: 1px solid var(--border-strong);
}
.profile-editor-wrap > .modal-actions {
  margin: 0;
  padding: 12px 22px;
  border-top: 1px solid var(--border-strong);
}
.profile-tab-body {
  min-height: 0;
}
.edit-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  font-size: 15px;
  color: var(--header);
}
.edit-card-title svg {
  color: var(--accent);
}
.edit-card .field:last-child {
  margin-bottom: 0;
}
.account-tab .danger-zone {
  margin-top: 0;
}

/* ---------- редактор ника ---------- */
.nick-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 74px;
  margin: 4px 0 14px;
  padding: 14px;
  border-radius: var(--radius);
  background: #111214;
  border: 1px solid var(--border-strong);
  font-size: 26px;
  font-weight: 800;
  color: #f2f3f5;
  overflow: hidden;
  text-align: center;
  word-break: break-word;
}
.nick-preview .nick-fx-glitch {
  --header: #f2f3f5;
}
.nick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.nick-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 10px 6px 8px;
  border-radius: var(--radius);
  background: #17181b;
  border: 2px solid transparent;
  color: #f2f3f5;
}
.nick-option:hover {
  border-color: var(--border-strong);
}
.nick-option.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.nick-option-sample {
  display: block;
  max-width: 100%;
  min-height: 24px;
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
  overflow: clip;
  overflow-clip-margin: 8px;
  text-overflow: ellipsis;
  --header: #f2f3f5;
}
.nick-option-label {
  font-size: 12px;
  font-weight: 600;
  color: #b5bac1;
}
.nick-colors {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: -2px 0 16px;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--bg-input);
}
.nick-color-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.nick-color-label {
  min-width: 110px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.nick-color-input {
  width: 42px;
  height: 32px;
  padding: 2px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--bg-modal);
  cursor: pointer;
}
.nick-swatches {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.nick-swatch {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.35);
}
.nick-swatch.active {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- телефон ---------- */
@media (max-width: 768px) {
  .modal.settings-modal,
  .modal.profile-editor-modal {
    height: 100%;
    padding: 0;
  }
  .settings-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    grid-template-areas: 'title' 'nav' 'pane' 'actions';
  }
  .settings-title,
  .profile-editor-wrap > .modal-title {
    padding: calc(14px + env(safe-area-inset-top)) 16px 12px;
  }
  /* Разделы — полоса кнопок, листается вбок */
  .settings-nav {
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 8px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--border-strong);
    scrollbar-width: none;
  }
  .settings-nav-item {
    width: auto;
    flex: none;
    padding: 8px 12px;
  }
  .settings-nav-item.active {
    box-shadow: inset 0 -3px 0 var(--accent);
  }
  .settings-pane {
    padding: 14px 12px 8px;
  }
  .settings-actions,
  .profile-editor-wrap > .modal-actions {
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  }
  .settings-block,
  .edit-card {
    padding: 14px 12px;
  }
  .profile-editor-wrap > .profile-editor {
    display: block;
    overflow-y: auto;
    padding: 0 12px;
  }
  .pe-left {
    overflow: visible;
    padding: 0;
  }
  .profile-editor-wrap .profile-preview-col {
    overflow: visible;
    margin: 0 -12px;
    padding: 14px 12px 16px;
    border-left: 0;
    border-top: 1px solid var(--border-strong);
  }
  .nick-grid {
    grid-template-columns: repeat(auto-fill, minmax(98px, 1fr));
  }
  .nick-color-label {
    min-width: 0;
    width: 100%;
  }
}

/* Светлая тема: ник не «смывается» на белом (в плитках редактора фон всегда тёмный — там как есть) */
[data-theme='light'] .nick-fx-neon:not(.nick-preview *, .nick-option *) {
  color: color-mix(in srgb, var(--n1) 70%, #000);
  text-shadow: 0 0 1px var(--n1), 0 0 6px color-mix(in srgb, var(--n1) 55%, transparent);
}
[data-theme='light'] .nick-fx-fire:not(.nick-preview *, .nick-option *) {
  background-image: linear-gradient(0deg, #b91c1c, #ea580c 40%, #f59e0b 70%, #c2410c);
  filter: drop-shadow(0 0 1px rgba(124, 45, 18, 0.5));
}
[data-theme='light'] :is(.nick-fx-color, .nick-fx-gradient, .nick-fx-wave, .nick-fx-rainbow, .nick-fx-shine, .nick-fx-glow, .nick-fx-pulse):not(.nick-preview *, .nick-option *) {
  filter: drop-shadow(0 0 0.6px rgba(0, 0, 0, 0.55));
}
[data-theme='light'] .nick-fx-glow:not(.nick-preview *, .nick-option *) {
  color: color-mix(in srgb, var(--n1) 72%, #000);
}

/* рамка «Эквалайзер»: столбики растут от аватарки наружу */
.avatar-frame .fr-eq {
  transform-origin: 50% 100%;
  animation: fr-eq 0.8s ease-in-out infinite alternate;
}
@keyframes fr-eq {
  from { transform: scaleY(0.25); }
  to { transform: scaleY(1); }
}

/* ---------- своя рамка: конструктор в личном кабинете ---------- */
.frame-builder:not(:empty) {
  margin-top: 14px;
  padding: 14px;
  border-radius: var(--radius);
  border: 1px dashed var(--accent);
  background: var(--accent-soft);
}
.frame-builder .look-label {
  margin: 4px 0 8px;
}
.frame-grid.compact {
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  margin-bottom: 12px;
}
.frame-option.small span {
  font-size: 11.5px;
}
.frame-option.custom {
  border-style: dashed;
}
.frame-option.custom span {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: var(--accent);
  font-weight: 700;
}

/* «живые» рамки: искры и пузырьки поднимаются и тают */
.avatar-frame .fr-ember {
  animation: fr-ember 2.2s ease-out infinite;
}
.avatar-frame .fr-bubble {
  animation: fr-bubble 3s ease-in infinite;
}
@keyframes fr-ember {
  0% { transform: translateY(0) scale(1); opacity: 0; }
  15% { opacity: 1; }
  100% { transform: translateY(-9px) scale(0.3); opacity: 0; }
}
@keyframes fr-bubble {
  0% { transform: translateY(2px) scale(0.6); opacity: 0; }
  20% { opacity: 0.9; }
  100% { transform: translateY(-10px) scale(1.1); opacity: 0; }
}

/* счётчик повторов у всплывающего сообщения («×3») */
.toast {
  cursor: pointer;
}
.toast-count {
  margin-left: 8px;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  font-size: 12px;
  font-weight: 700;
}
.toast {
  pointer-events: auto;
}

/* ---------- надпись «техническая неполадка» / «нет интернета» (js/outage.js) ---------- */
.outage-banner {
  position: fixed;
  top: calc(10px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 3000;
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(560px, calc(100vw - 24px));
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  background: #2a1215;
  border: 1px solid rgba(248, 113, 113, 0.45);
  color: #fde8e8;
  box-shadow: var(--shadow-lg);
  animation: pop-in 0.25s var(--ease);
}
.outage-banner.internet {
  background: #2a2312;
  border-color: rgba(250, 204, 21, 0.45);
  color: #fef3c7;
}
.outage-banner svg {
  flex: none;
  color: #f87171;
}
.outage-banner.internet svg {
  color: #facc15;
}
.outage-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13.5px;
  line-height: 1.35;
}
.outage-text b {
  font-size: 15px;
  color: #fff;
}
.outage-text span {
  opacity: 0.85;
}
body.has-outage .offline-banner {
  display: none;
}

/* ---------- значки у ников (js/ui/badges.js) и подсказки (js/ui/tooltip.js) ---------- */
.user-badges {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: 5px;
  vertical-align: middle;
  flex-shrink: 0;
}
.user-badges .bot-badge {
  margin-left: 0;
}
.user-badge {
  display: inline-flex;
  line-height: 0;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.35));
}
.user-badge svg text {
  font-family: var(--font);
}
.profile-full-name .user-badges,
.profile-pop-name .user-badges {
  gap: 4px;
}
.profile-full-name .user-badge svg {
  width: 22px;
  height: 22px;
}
.tooltip {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 5000;
  max-width: 260px;
  padding: 6px 10px;
  border-radius: 8px;
  background: #111214;
  color: #f2f3f5;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  box-shadow: var(--shadow);
  pointer-events: none;
}
/* ЛС с ботом ChadSpeak: тихий серый счётчик вместо красного */
.badge.quiet {
  background: var(--text-faint);
  color: #fff;
}
.system-bot-avatar {
  background: #fff;
}
.dm-name-row {
  display: flex;
  align-items: center;
  min-width: 0;
}
.dm-name-row .dm-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- стикеры, гифки, свои эмодзи ---------- */
.media-picker {
  position: fixed;
  z-index: 210;
  width: 400px;
  max-width: calc(100vw - 16px);
  display: flex;
  flex-direction: column;
  background: var(--bg-floating);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: pop-in 0.15s var(--ease);
}
.media-picker.drop {
  outline: 2px dashed var(--accent);
  outline-offset: -4px;
}
.media-tabs {
  display: flex;
  gap: 4px;
  padding: 8px 8px 0;
}
.media-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: none;
  color: var(--text-muted);
  font: inherit;
  font-weight: 600;
  font-size: 13px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  transition: background 0.12s, color 0.12s;
}
.media-tab:hover {
  background: var(--bg-hover);
  color: var(--text);
}
.media-tab.active {
  background: var(--accent-soft);
  color: var(--text);
}
.media-body {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.media-body .emoji-tabs {
  border-bottom: 1px solid var(--border);
}
.media-body .emoji-tab .ico {
  vertical-align: middle;
}
.media-body .emoji-grid {
  height: 280px;
  max-height: none;
  align-content: start;
}
.emoji-btn.custom,
.emoji-btn.media-add-emoji {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}
.emoji-btn.custom .custom-emoji {
  width: 28px;
  height: 28px;
}
.emoji-btn.media-add-emoji {
  border: 1px dashed var(--border-strong);
}
.media-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 8px;
  height: 320px;
  overflow-y: auto;
  align-content: start;
}
.media-grid.sticker {
  grid-template-columns: repeat(4, 1fr);
}
.media-item {
  position: relative;
  border: none;
  padding: 0;
  aspect-ratio: 1;
  border-radius: var(--radius);
  background: var(--bg-input);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.12s var(--ease), background 0.12s;
}
.media-grid.gif .media-item {
  aspect-ratio: 4 / 3;
}
.media-grid.sticker .media-item {
  background: none;
}
.media-item:hover {
  transform: scale(1.04);
  background: var(--bg-hover);
}
.media-thumb {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  pointer-events: none;
}
.media-grid.gif .media-thumb {
  object-fit: cover;
}
.media-add {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--text-muted);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  border: 1px dashed var(--border-strong);
  background: none;
}
.media-add:hover {
  color: var(--text);
}
.media-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  opacity: 0;
  transition: opacity 0.12s;
}
.media-item:hover .media-remove {
  opacity: 1;
}
.media-remove:hover {
  background: var(--red);
}
.media-empty {
  padding: 4px 16px 16px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.45;
  text-align: center;
}
.media-empty.small {
  grid-column: 1 / -1;
  padding: 8px 4px;
}
@media (hover: none) {
  .media-remove {
    opacity: 1;
  }
}

/* стикер или гифка в сообщении */
.message-sticker {
  position: relative;
  display: inline-block;
  margin-top: 4px;
  max-width: 100%;
}
.message-sticker .sticker-media {
  display: block;
  width: 160px;
  height: 160px;
  object-fit: contain;
}
.message-sticker.gif .sticker-media {
  width: auto;
  height: auto;
  max-width: min(320px, 100%);
  max-height: 260px;
  border-radius: var(--radius);
}
.sticker-save {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 0.15s, transform 0.15s var(--ease), background 0.15s;
}
.message-sticker:hover .sticker-save {
  opacity: 1;
  transform: none;
}
.sticker-save:hover {
  background: var(--yellow);
  color: #222;
}
@media (hover: none) {
  .sticker-save {
    opacity: 0.85;
    transform: none;
  }
}

/* свой эмодзи в тексте */
.custom-emoji {
  width: 22px;
  height: 22px;
  object-fit: contain;
  vertical-align: -5px;
  margin: 0 1px;
}
.message-text.jumbo .custom-emoji {
  width: 48px;
  height: 48px;
  vertical-align: middle;
}

/* стикер в звонке — «выпрыгивает» над плиткой */
.call-sticker {
  position: fixed;
  z-index: 150;
  pointer-events: none;
  animation: call-sticker-in 0.45s cubic-bezier(0.2, 1.6, 0.4, 1) both;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.45));
}
.call-sticker.out {
  animation: call-sticker-out 0.4s ease-in both;
}
.call-sticker-media {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: var(--radius);
}
@keyframes call-sticker-in {
  from {
    opacity: 0;
    transform: scale(0.3) translateY(30px) rotate(-12deg);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes call-sticker-out {
  to {
    opacity: 0;
    transform: translateY(-40px) scale(0.8);
  }
}
@media (prefers-reduced-motion: reduce) {
  .call-sticker,
  .call-sticker.out {
    animation-duration: 0.01s;
  }
}
@media (max-width: 768px) {
  .media-picker {
    left: 8px !important;
    right: 8px;
    width: auto;
  }
  .media-grid {
    height: 40vh;
  }
}
.media-broken {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  min-height: 48px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  background: var(--bg-input);
  border-radius: var(--radius);
}

/* демонстрация: «глазик» — кто смотрит; режим без кнопок */
.tile-viewers {
  position: absolute;
  top: 8px;
  left: 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  z-index: 2;
  cursor: default;
  backdrop-filter: none;
}
.tile-viewers.none {
  opacity: 0.6;
}
.screen-tile.controls-hidden .tile-actions,
.screen-tile.controls-hidden .tile-volume {
  display: none;
}
.screen-tile.controls-hidden .tile-label {
  opacity: 0;
  transition: opacity 0.2s;
}
.screen-tile.controls-hidden:hover .tile-label {
  opacity: 1;
}
.live-viewers {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}

/* фон в звонке: картинка или гифка за аватаркой (у каждого свой, из «Личного кабинета») */
.tile.has-call-bg {
  background-image: linear-gradient(rgba(0, 0, 0, 0.28), rgba(0, 0, 0, 0.28)), var(--call-image);
  background-size: cover;
  background-position: center;
}
.tile.has-call-bg .tile-avatar .avatar {
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
}
.call-bg-preview .tile {
  position: relative;
  width: 100%;
  max-width: 360px;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
  background-color: var(--bg-tile);
  margin-bottom: 10px;
}
.speaking-color-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.speaking-color-row input[type='color'] {
  width: 44px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: none;
}
.speaking-swatch {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
}
.speaking-swatch.active {
  border-color: var(--text);
}
.speaking-demo {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--bg-modal), 0 0 0 4px var(--speaking, var(--green));
}

/* «настроение голоса» в углу плитки (справа внизу: слева внизу — имя, сверху — громкость и кнопки) */
.tile-mood {
  position: absolute;
  bottom: 8px;
  right: 8px;
  z-index: 2;
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  gap: 4px;
  pointer-events: auto;
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.tile-mood.on {
  opacity: 1;
  transform: none;
}
.tile-mood.on.pop .mood-face {
  animation: mood-pop 0.35s cubic-bezier(0.2, 1.6, 0.4, 1);
}
.mood-face {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  line-height: 1;
  background: rgba(0, 0, 0, 0.55);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}
.mood-face.unclear {
  font-weight: 800;
  font-size: 14px;
  color: #fff;
}
.mood-censored {
  position: relative;
  display: inline-grid;
  height: 22px;
  padding: 0 7px;
  border-radius: 11px;
  background: #fde047;
  color: #b91c1c;
  font: 900 13px/22px 'Comic Sans MS', 'Comic Neue', 'Segoe Print', system-ui, sans-serif;
  letter-spacing: 1px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  transform: rotate(4deg);
}
.mood-censored > span {
  grid-area: 1 / 1;
  opacity: 0;
  animation: mood-cycle 0.48s steps(1, end) infinite;
}
.mood-censored > span:nth-child(2) {
  animation-delay: 0.12s;
}
.mood-censored > span:nth-child(3) {
  animation-delay: 0.24s;
}
.mood-censored > span:nth-child(4) {
  animation-delay: 0.36s;
}
@keyframes mood-cycle {
  0% {
    opacity: 1;
  }
  25% {
    opacity: 0;
  }
}
@keyframes mood-pop {
  from {
    transform: scale(0.5);
  }
  to {
    transform: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .mood-censored > span {
    animation: none;
  }
  .mood-censored > span:first-child {
    opacity: 1;
  }
}

/* ===================== встроенные баннеры («сцены», ui/scenes.js) ===================== */
.has-scene {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}
.scene {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  contain: strict;
}
.scene > * {
  position: absolute;
}
.scene .sc-fill {
  inset: 0;
  width: 100%;
  height: 100%;
}
/* строка участника: слева затемнение, чтобы ник и значки читались */
.scene.slot-panel::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.22) 65%, rgba(0, 0, 0, 0.05));
}
.scene.slot-call::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 45%, rgba(0, 0, 0, 0.35));
}
.has-scene.member,
.has-scene.voice-user,
.has-scene.user-panel {
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
}
.has-scene .name,
.has-scene small,
.has-scene .user-panel-name {
  color: #fff;
}
/* окно не в фокусе (игра поверх) или «меньше движения» в системе — сцены замирают */
.fx-paused .scene *,
.fx-paused .scene *::before,
.fx-paused .scene *::after {
  animation-play-state: paused !important;
}
@media (prefers-reduced-motion: reduce) {
  .scene *,
  .scene *::before {
    animation-play-state: paused !important;
  }
}

/* --- готовые картинки сцен (рисуются один раз, ui/scenes.js) --- */
.scene .sc-art {
  position: absolute;
  inset: 0;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  transition: opacity 0.6s;
}
.scene .sc-art.sc-wait {
  opacity: 0;
}
/* бесшовная полоса: картинка — ровно половина ширины, сдвиг на половину = тот же кадр */
.scene .sc-drift {
  inset: 0 auto 0 0;
  width: 200%;
  background-size: 50% 100%;
  background-repeat: repeat-x;
  will-change: transform;
}
@keyframes sc-pan {
  to { transform: translateX(-50%); }
}
@keyframes sc-pan-back {
  from { transform: translateX(-50%); }
  to { transform: translateX(0); }
}
.sc-star-group {
  inset: 0;
}
.sc-star {
  position: absolute;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 4px 1px rgba(200, 220, 255, 0.7);
}
@keyframes sc-twinkle {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 1; }
}
/* летит слева направо через всю ширину: сам элемент шириной во всю сцену, рисунок — слева в нём */
.sc-flyer {
  left: 0;
  width: 100%;
  height: 0;
}
@keyframes sc-fly-across {
  0% { transform: translateX(-12%); opacity: 0; }
  6% { opacity: 1; }
  94% { opacity: 1; }
  100% { transform: translateX(106%); opacity: 0; }
}
.scene .sc-sprite {
  inset: auto;
  left: 0;
  top: 0;
  background-size: 100% 100%;
}
.scene .sc-gull {
  width: calc(var(--sc) * 26px * var(--s, 1));
  aspect-ratio: 96 / 40;
}
.scene .sc-bat {
  width: calc(var(--sc) * 30px * var(--s, 1));
  aspect-ratio: 2;
}
@keyframes sc-flap {
  from { scale: 1 1; }
  to { scale: 1 0.3; }
}

/* --- Туман --- */
.scene-mist { background: #5d6b7c; }

/* --- Тонкие линии (топографическая карта) --- */
.scene-lines { background: #101419; }
.scene .sc-map { inset: -4%; will-change: transform; }
@keyframes sc-map-drift {
  from { transform: translate(-2%, -1%); }
  to { transform: translate(2%, 1%); }
}
.sc-lamp {
  top: -40%;
  left: 0;
  width: 45%;
  height: 180%;
  background: radial-gradient(closest-side, rgba(255, 226, 180, 0.13), transparent);
  will-change: transform;
}
@keyframes sc-lamp-pass {
  from { transform: translateX(-60%); }
  to { transform: translateX(240%); }
}

/* --- Точки --- */
.scene-dots { background: #0d0f13; }
.sc-dots-spot {
  top: -60%;
  left: 0;
  width: 30%;
  height: 220%;
  background: radial-gradient(closest-side, rgba(160, 190, 255, 0.22), transparent);
  will-change: transform;
}
@keyframes sc-spot {
  from { transform: translateX(-40%); }
  to { transform: translateX(300%); }
}

/* --- Тихий закат --- */
.scene-dusk { background: #6a2e62; }
.scene .sc-clouds { inset: 0 -4%; will-change: transform; }
@keyframes sc-cloud-drift {
  from { transform: translateX(-2%); }
  to { transform: translateX(2%); }
}
@keyframes sc-shimmer {
  0%, 100% { opacity: 0.15; }
  50% { opacity: 1; }
}

/* --- Неоновые трубки --- */
.scene-neon-tubes { background: #0c0a0b; }
@keyframes sc-hum {
  from { opacity: 0.88; }
  to { opacity: 1; }
}
@keyframes sc-flicker {
  0%, 8%, 11%, 61%, 64%, 100% { opacity: 1; }
  9%, 62% { opacity: 0.12; }
  10% { opacity: 0.8; }
  63% { opacity: 0.4; }
}

/* --- Пульс (кардиомонитор) --- */
.scene-pulse { background: #03100b; }
.sc-ecg-erase {
  top: 0;
  bottom: 0;
  left: 0;
  width: 14%;
  background: linear-gradient(90deg, rgba(3, 16, 11, 0), #03100b 45%);
  will-change: transform;
}
@keyframes sc-ecg-sweep {
  from { transform: translateX(-100%); }
  to { transform: translateX(714%); }
}

/* --- Эквалайзер (светодиодный индикатор) --- */
.scene-equalizer { background: #07080b; }
.scene .sc-eq { background-size: 100% 100%; }
.scene .sc-eq-cover { transform: translateY(-100%); will-change: transform; }
@keyframes sc-eq-level {
  from { transform: translateY(-87.5%); }
  to { transform: translateY(-25%); }
}
.sc-eq-gloss {
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0) 45%, rgba(0, 0, 0, 0.25));
}

/* --- Микросхема --- */
.scene-circuit { background: #0b3424; }
.sc-pcb-lane {
  height: 0;
  overflow: visible;
}
.sc-pcb-pulse {
  position: absolute;
  left: 0;
  top: calc(var(--sc) * -4px);
  width: 14%;
  height: calc(var(--sc) * 8px);
  background: radial-gradient(closest-side, rgba(190, 255, 230, 0.95), rgba(60, 255, 190, 0.35) 55%, transparent);
  will-change: transform, opacity;
}
@keyframes sc-pcb-run {
  0% { transform: translateX(-100%); opacity: 0; }
  10% { opacity: 1; }
  85% { opacity: 1; }
  100% { transform: translateX(714%); opacity: 0; }
}
.sc-pcb-led {
  width: calc(var(--sc) * 7px);
  height: calc(var(--sc) * 4px);
  border-radius: 1px;
  background: #ff4a30;
  box-shadow: 0 0 6px 2px rgba(255, 70, 40, 0.7);
}
@keyframes sc-led {
  0% { opacity: 1; }
  50% { opacity: 0.12; }
}

/* --- Неоновый горизонт --- */
.scene-synth { background: #12021f; }
.sc-synth-floor {
  left: -50%;
  right: -50%;
  top: 58.5%;
  bottom: -10%;
  perspective: 220px;
  overflow: hidden;
}
.sc-synth-grid {
  position: absolute;
  inset: -100% 0 0 0;
  background: linear-gradient(90deg, rgba(255, 79, 216, 0.75) 1.5px, transparent 1.5px) 0 0 / 40px 40px, linear-gradient(0deg, rgba(255, 79, 216, 0.75) 1.5px, transparent 1.5px) 0 0 / 40px 40px;
  transform-origin: 50% 100%;
  transform: rotateX(70deg);
  will-change: transform;
}
@keyframes sc-grid-run {
  from { transform: rotateX(70deg) translateY(0); }
  to { transform: rotateX(70deg) translateY(40px); }
}
.sc-synth-haze {
  left: 0;
  right: 0;
  top: 56%;
  height: 26%;
  background: linear-gradient(180deg, rgba(255, 90, 190, 0.35), rgba(120, 20, 110, 0.18) 35%, rgba(18, 2, 31, 0));
}

/* --- Северное сияние --- */
.scene-aurora { background: #041020; }
.scene .sc-curtain {
  inset: 0 -6%;
  transform-origin: 50% 80%;
  will-change: transform, opacity;
}
@keyframes sc-curtain-sway {
  from { translate: -3% 0; scale: 1 0.94; }
  to { translate: 3% 1%; scale: 1.04 1.06; }
}
@keyframes sc-curtain-glow {
  from { opacity: 0.6; }
  to { opacity: 1; }
}

/* --- Звёздная ночь --- */
.scene-starfield { background: #03040c; }
.scene .sc-sky-drift { inset: -5%; will-change: transform; }
@keyframes sc-sky-turn {
  from { transform: rotate(-1.2deg); }
  to { transform: rotate(1.2deg); }
}
.sc-shoot {
  width: calc(var(--sc) * 110px);
  height: 1.5px;
  border-radius: 1px;
  background: linear-gradient(90deg, transparent, rgba(200, 220, 255, 0.6) 70%, #fff);
  box-shadow: 0 0 4px rgba(200, 220, 255, 0.6);
  opacity: 0;
}
@keyframes sc-shooting {
  0% { transform: rotate(22deg) translateX(0); opacity: 0; }
  2% { opacity: 1; }
  9% { transform: rotate(22deg) translateX(calc(var(--sc) * 280px)); opacity: 0; }
  100% { transform: rotate(22deg) translateX(calc(var(--sc) * 280px)); opacity: 0; }
}

/* --- Светлячки --- */
.scene-fireflies { background: #07131a; }
.sc-firefly {
  width: calc(var(--sc) * 12px * var(--s, 1));
  height: calc(var(--sc) * 12px * var(--s, 1));
}
.sc-firefly-dot {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle, #fffbd2 0 9%, rgba(220, 255, 120, 0.75) 20%, rgba(170, 235, 70, 0.25) 42%, transparent 70%);
  transform: scale(2.2);
}
.sc-firefly.near {
  width: calc(var(--sc) * 38px);
  height: calc(var(--sc) * 38px);
}
.sc-firefly.near .sc-firefly-dot {
  background: radial-gradient(circle, rgba(250, 255, 170, 0.3) 0 40%, rgba(230, 255, 130, 0.12) 56%, transparent 68%);
  transform: none;
}
@keyframes sc-glow-pulse {
  0%, 100% { opacity: 0.1; }
  50% { opacity: 1; }
}
@keyframes sc-wander-a {
  0% { transform: translate(0, 0); }
  33% { transform: translate(28px, -16px); }
  66% { transform: translate(-12px, -30px); }
  100% { transform: translate(18px, 10px); }
}
@keyframes sc-wander-b {
  0% { transform: translate(0, 0); }
  33% { transform: translate(-26px, 12px); }
  66% { transform: translate(14px, 24px); }
  100% { transform: translate(-20px, -14px); }
}

/* --- Лепестки --- */
.scene-petals { background: #e6a7bb; }
.scene .sc-branch { transform-origin: 0 0; will-change: transform; }
@keyframes sc-branch-sway {
  from { transform: rotate(-0.7deg); }
  to { transform: rotate(0.7deg); }
}
/* лепесток: колонка во всю высоту, сам лепесток — сверху; колонка опускается ровно на высоту сцены */
.sc-petal {
  top: 0;
  height: 100%;
  will-change: transform;
}
.scene .sc-petal-img {
  inset: auto;
  top: -16px;
  left: 0;
  width: 100%;
  aspect-ratio: 72 / 52;
  background-size: contain;
}
@keyframes sc-fall {
  0% { transform: translate(0, 0); opacity: 0; }
  8% { opacity: 1; }
  50% { transform: translate(calc(var(--sc) * 30px), 52%); }
  92% { opacity: 1; }
  100% { transform: translate(calc(var(--sc) * -10px), 106%); opacity: 0; }
}
@keyframes sc-petal-spin {
  from { transform: rotate(-30deg) scaleX(1); }
  to { transform: rotate(200deg) scaleX(0.35); }
}

/* --- Глубина --- */
.scene-ocean { background: #0b4a68; }
@keyframes sc-crossfade {
  from { opacity: 0.15; }
  to { opacity: 1; }
}
.scene .sc-fish {
  width: calc(var(--sc) * 170px);
  aspect-ratio: 320 / 170;
}
.scene .sc-rays { transform-origin: 50% 0; will-change: transform, opacity; }
@keyframes sc-ray-sway {
  from { transform: skewX(-5deg); opacity: 0.65; }
  to { transform: skewX(5deg); opacity: 1; }
}
/* пузырёк: колонка во всю высоту, сам пузырёк — внизу; колонка едет вверх ровно на высоту сцены */
.sc-bubble {
  top: 0;
  height: 100%;
  will-change: transform;
}
.sc-bubble::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -12px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, rgba(255, 255, 255, 0.85) 0 9%, transparent 16%), radial-gradient(circle, rgba(180, 235, 255, 0.05) 0 58%, rgba(210, 245, 255, 0.55) 70%, rgba(210, 245, 255, 0) 74%);
}
@keyframes sc-rise {
  0% { transform: translateY(0); opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 0.8; }
  100% { transform: translateY(-105%); opacity: 0; }
}

/* --- Наблюдатели и глаза --- */
.scene-watchers { background: #030101; }
.sc-eye-halo {
  position: absolute;
  inset: -80% -45%;
  background: radial-gradient(closest-side, var(--halo), transparent);
}
.scene .sc-eye-lid {
  background-size: 100% 100%;
  transform-origin: 50% 46%;
}
.scene .sc-eye-iris,
.scene .sc-eye-shade {
  background-size: 100% 100%;
}
@keyframes sc-hover {
  from { translate: calc(var(--sc) * -7px) calc(var(--sc) * 4px); }
  to { translate: calc(var(--sc) * 7px) calc(var(--sc) * -5px); }
}
@keyframes sc-fade-in-out {
  0%, 45%, 92%, 100% { opacity: 1; }
  58%, 78% { opacity: 0; }
}
@keyframes sc-blink {
  0%, 91%, 100% { scale: 1 1; }
  94% { scale: 1 0.05; }
  97% { scale: 1 1; }
}
@keyframes sc-look-a {
  0%, 100% { translate: 0 0; }
  25% { translate: -12% 2%; }
  50% { translate: 10% -2%; }
  75% { translate: 3% 4%; }
}
@keyframes sc-look-b {
  0%, 100% { translate: 4% 0; }
  30% { translate: 12% 3%; }
  60% { translate: -10% 0; }
  80% { translate: -3% -3%; }
}

/* --- Помехи --- */
.scene-static { background: #0b0b0c; }
.scene .sc-noise {
  inset: -12%;
  background-size: 256px 256px;
  background-repeat: repeat;
  image-rendering: pixelated;
  opacity: 0.5;
  will-change: transform;
}
@keyframes sc-jitter {
  0% { transform: translate(0, 0); }
  20% { transform: translate(-7%, 4%); }
  40% { transform: translate(5%, -6%); }
  60% { transform: translate(-3%, 7%); }
  80% { transform: translate(6%, 2%); }
  100% { transform: translate(0, 0); }
}
@keyframes sc-swap {
  0% { opacity: 0; }
  50% { opacity: 0.5; }
}
.scene .sc-ghost { opacity: 0; }
@keyframes sc-ghost {
  0%, 70%, 86%, 100% { opacity: 0; }
  74% { opacity: 0.55; }
  76% { opacity: 0.1; }
  79% { opacity: 0.65; }
}
.sc-scanlines {
  inset: 0;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.42) 0 1px, transparent 1px 3px);
}
.sc-static-bar {
  left: 0;
  right: 0;
  top: 0;
  height: 100%;
  will-change: transform;
}
.sc-static-bar::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 16%;
  background: linear-gradient(180deg, transparent, rgba(220, 220, 220, 0.14), transparent);
}
@keyframes sc-bar-down {
  from { transform: translateY(-20%); }
  to { transform: translateY(100%); }
}
.sc-static-flash {
  inset: 0;
  background: #d9d9d9;
  opacity: 0;
}
@keyframes sc-flash {
  0%, 48%, 52%, 100% { opacity: 0; }
  49% { opacity: 0.2; }
  50% { opacity: 0.05; }
  51% { opacity: 0.16; }
}

/* --- Кровавая луна --- */
.scene-blood-moon { background: #0a0102; }
@keyframes sc-moon-pulse {
  from { opacity: 0.84; }
  to { opacity: 1; }
}

/* --- Бездна --- */
.scene-void { background: #000; }
.scene .sc-vortex {
  inset: auto;
  left: 50%;
  top: 50%;
  width: 150%;
  aspect-ratio: 1;
  translate: -50% -50%;
  background-size: 100% 100%;
  will-change: transform;
}
@keyframes sc-spin {
  to { transform: rotate(360deg); }
}

/* --- выбор сцены в «Личном кабинете» --- */
/* Превью — стоп-кадры: оживает только то, на которое навели мышь, и выбранное. Десятки живых сцен сразу
   (сотни слоёв) роняли частоту кадров окна; превью вне видимой части окна не рисуются вовсе */
.scene-option:not(:hover):not(.active) .scene *,
.scene-option:not(:hover):not(.active) .scene *::before,
.scene-option:not(:hover):not(.active) .scene *::after {
  animation-play-state: paused !important;
}
.scene-option {
  content-visibility: auto;
  contain-intrinsic-size: auto 120px;
}
.scene-picker-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 8px;
}
.scene-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}
.scene-grid.slot-panel {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.scene-option {
  position: relative;
  border: 2px solid transparent;
  border-radius: var(--radius);
  padding: 0;
  overflow: hidden;
  background: var(--bg-input);
  color: #fff;
  cursor: pointer;
  text-align: left;
  font: inherit;
  transition: border-color 0.12s, transform 0.12s;
}
.scene-option:hover {
  transform: translateY(-1px);
}
.scene-option.active {
  border-color: var(--accent);
}
.scene-option .scene-preview {
  position: relative;
  display: block;
  aspect-ratio: 5 / 2;
}
.scene-grid.slot-panel .scene-preview {
  aspect-ratio: 6 / 1;
}
.scene-grid.slot-call .scene-preview {
  aspect-ratio: 16 / 9;
}
.scene-option .scene-name {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  background: var(--bg-elevated);
}
.scene-option .scene-tag {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.scene-option.none .scene-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 12px;
}

/* ---------- роли: ник переливом из двух цветов, редактор цвета, перетаскивание ---------- */
.role-grad {
  background: linear-gradient(90deg, var(--r1), var(--r2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}
.role-color-editor {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.role-color-mode {
  align-self: flex-start;
}
.role-color-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.role-color-row > .field-hint {
  min-width: 52px;
}
.swatch.palette {
  position: relative;
  overflow: hidden;
  background: conic-gradient(#ff4d4d, #ffd84d, #4dff88, #4dd8ff, #6b4dff, #ff4dd2, #ff4d4d);
  cursor: pointer;
}
.swatch.palette input {
  position: absolute;
  inset: -6px;
  width: calc(100% + 12px);
  height: calc(100% + 12px);
  opacity: 0;
  cursor: pointer;
}
.role-color-sample {
  display: flex;
  align-items: center;
  gap: 8px;
}
.role-color-preview {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
}
.role-grip {
  color: var(--text-muted);
  font-size: 11px;
  letter-spacing: -2px;
  cursor: grab;
  opacity: 0.5;
  margin-right: -2px;
}
.role-item:hover .role-grip {
  opacity: 1;
}
.dragging-role .role-item {
  position: relative;
}
.role-item.drop-before::before,
.role-item.drop-after::after {
  content: '';
  position: absolute;
  left: 6px;
  right: 6px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent);
  pointer-events: none;
}
.role-item.drop-before::before {
  top: -1px;
}
.role-item.drop-after::after {
  bottom: -1px;
}

/* ---------- «Предложка» (ui/ideas.js) ---------- */
.ideas-page {
  max-width: 760px;
  margin: 0 auto;
  padding: 20px 24px 40px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  height: 100%;
  box-sizing: border-box;
}
.ideas-compose {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ideas-compose h2 {
  margin: 0;
  font-size: 18px;
  color: var(--header);
}
.ideas-compose p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
}
.ideas-text {
  resize: vertical;
  min-height: 96px;
  font: inherit;
  line-height: 1.5;
}
.ideas-compose-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.ideas-compose-row .spacer {
  flex: 1;
}
.ideas-quota {
  font-size: 13px;
  color: var(--text-muted);
}
.ideas-quota.empty {
  color: var(--warning, #f5a524);
}
.ideas-counter {
  font-size: 12px;
  color: var(--text-muted);
}
.ideas-compose .btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.ideas-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.ideas-head h3 {
  margin: 0;
  font-size: 15px;
  color: var(--header);
}
.seg-count {
  margin-left: 6px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 11px;
  background: var(--bg-hover);
}
.ideas-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ideas-empty {
  padding: 24px;
  text-align: center;
  font-size: 13px;
}
.idea-card {
  border: 1px solid var(--border);
  border-left: 3px solid var(--idea-color, var(--text-muted));
  border-radius: var(--radius);
  padding: 12px 14px;
  background: var(--bg-elevated);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.idea-card.status-dev { --idea-color: #3b82f6; }
.idea-card.status-done { --idea-color: #22c55e; }
.idea-card.status-rejected { --idea-color: #e5484d; }
.idea-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.idea-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: var(--idea-color, var(--text-muted));
  background: color-mix(in srgb, var(--idea-color, var(--text-muted)) 16%, transparent);
}
.idea-status.status-dev { --idea-color: #3b82f6; }
.idea-status.status-done { --idea-color: #22c55e; }
.idea-status.status-rejected { --idea-color: #e5484d; }
.idea-date,
.idea-updated {
  font-size: 12px;
  color: var(--text-muted);
}
.idea-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.5;
  color: var(--text);
}
.idea-note {
  font-size: 13px;
  line-height: 1.5;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Телефон: долгое нажатие открывает наше меню — без системного выделения текста и всплывающего меню браузера */
@media (max-width: 768px) {
  .message,
  .channel-item,
  .member,
  .voice-user,
  .friend-row,
  .m-tab,
  .guild-item {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
  }
  .composer textarea,
  .composer input {
    -webkit-user-select: text;
    user-select: text;
  }
}

/* Сколько реально приходит у демонстрации («720p») */
.tile-label .res-tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.85);
  flex-shrink: 0;
}

/* У демонстрации с «глазиком» ползунок громкости — под ним, а не поверх */
.tile-viewers ~ .tile-volume {
  top: 40px;
}

/* ---------- «я в звонке» на иконке сервера / личных сообщений ---------- */
.guild-icon.in-call {
  margin-bottom: 8px; /* мини-аватарки свисают снизу — не наезжают на следующую иконку */
}
.guild-call {
  position: absolute;
  left: 50%;
  bottom: -9px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  padding: 2px 3px;
  border-radius: 999px;
  background: var(--bg-guilds);
  pointer-events: none;
  white-space: nowrap;
}
.guild-call-av {
  display: flex;
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--bg-guilds);
  transition: box-shadow 0.12s;
}
.guild-call-av + .guild-call-av {
  margin-left: -5px;
}
.guild-call-av .avatar {
  font-size: 9px;
}
.guild-call-av.speaking {
  box-shadow: 0 0 0 2px var(--speaking, var(--green));
  position: relative;
  z-index: 1;
}
.guild-call-more {
  margin-left: 2px;
  font-size: 10px;
  font-weight: 800;
  color: var(--text-muted);
}
.guild-call-flag {
  position: absolute;
  left: -3px;
  top: -3px;
  width: 18px;
  height: 18px;
  box-shadow: 0 0 0 3px var(--bg-guilds);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  color: var(--header);
}
.guild-call-flag.live {
  background: var(--red);
  color: #fff;
}
/* счётчик непрочитанного при звонке — наверх, чтобы не спорить с мини-аватарками */
.guild-icon.in-call .badge {
  bottom: auto;
  top: -4px;
}
.guild-icon.in-call .guild-muted {
  bottom: auto;
  top: -2px;
}

/* Подсказка-карточка: кто в звонке */
.tooltip.rich {
  max-width: 280px;
  padding: 10px 12px;
}
.call-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 190px;
}
.call-card-head {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--green);
  font-weight: 700;
}
.call-card-title {
  color: #f2f3f5;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.call-card-sub {
  margin-top: -4px;
  font-size: 11px;
  font-weight: 600;
  color: #a5a9b0;
}
.call-card-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.call-card-row .avatar {
  flex-shrink: 0;
  border-radius: 50%;
  box-shadow: 0 0 0 2px transparent;
}
.call-card-row.speaking .avatar {
  box-shadow: 0 0 0 2px var(--speaking, var(--green));
}
.call-card-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}
.call-card-you {
  margin-left: 4px;
  font-weight: 500;
  color: #a5a9b0;
}
.call-card-icons {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #a5a9b0;
  flex-shrink: 0;
}
.call-card-icons .live {
  font-size: 9px;
  padding: 0 4px;
}
.call-card-more {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #a5a9b0;
}
.call-card-dots {
  letter-spacing: 1px;
  font-weight: 800;
}
/* та же карточка в меню (правая кнопка; на телефоне — долгое нажатие) */
.context-menu .call-card {
  padding: 6px 8px 4px;
  color: var(--text);
}
.context-menu .call-card-title {
  color: var(--header);
}
.context-menu .call-card-sub,
.context-menu .call-card-you,
.context-menu .call-card-icons,
.context-menu .call-card-more {
  color: var(--text-muted);
}
/* карточка сервера: голосовые каналы, где кто-то есть */
.call-card-server {
  font-weight: 800;
  color: #f2f3f5;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.call-card-row + .call-card-head,
.call-card-more + .call-card-head {
  margin-top: 4px;
}
.call-card-head:not(.mine) {
  color: #a5a9b0;
}
.call-card-here {
  margin-left: auto;
  padding-left: 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--green);
  white-space: nowrap;
}
.context-menu .call-card-server {
  color: var(--header);
}
.context-menu .call-card-head:not(.mine) {
  color: var(--text-muted);
}

/* ---------- картинка сервера ---------- */
.guild-icon .server-img {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
  pointer-events: none;
}
.guild-icon.active:has(.server-img),
.guild-icon:hover:has(.server-img) {
  background: var(--bg-elevated);
}
.server-header-icon {
  display: flex;
  flex-shrink: 0;
}
.server-header-icon .server-img {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  object-fit: cover;
}
.server-icon-field {
  display: flex;
  align-items: center;
  gap: 14px;
}
.server-icon-preview {
  flex-shrink: 0;
  width: 72px;
  height: 72px;
  border-radius: 22px;
  overflow: hidden;
  border: none;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--grad);
  color: #fff;
  font-size: 30px;
  font-weight: 800;
  cursor: pointer;
}
.server-icon-preview .server-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.server-icon-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}
.server-icon-actions .field-hint {
  margin: 0;
}
/* обрезка картинки сервера — скруглённый квадрат, а не круг */
.avatar-editor.square .crop-frame::after {
  border-radius: 26%;
}

/* ================= «Вид интерфейса» (ui/look.js) ================= */

/* --- выбор в настройках --- */
.look-hint {
  margin: -2px 0 10px;
}
.look-grid {
  display: grid;
  gap: 8px;
}
.look-grid.packs {
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
.look-grid.layouts,
.look-grid.chats,
.look-grid.fonts,
.look-grid.tabs {
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
}
.look-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 10px;
  border-radius: var(--radius);
  border: 2px solid transparent;
  background: var(--bg-input);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.look-option:hover {
  background: var(--bg-hover);
}
.look-option.active {
  border-color: var(--accent);
}
.look-option-label {
  font-weight: 700;
  color: var(--header);
  font-size: 13px;
}
.look-option-hint {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.3;
}
.icon-pack {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 8px;
  width: 100%;
  border-radius: var(--radius-sm);
  background: var(--bg-main);
  color: var(--header);
  box-sizing: border-box;
}
/* мини-схема расположения панелей */
.layout-sketch {
  display: grid;
  grid-template-columns: 10px 26px 1fr 22px;
  gap: 3px;
  width: 100%;
  height: 58px;
  padding: 4px;
  box-sizing: border-box;
  border-radius: var(--radius-sm);
  background: var(--bg-main);
}
.layout-sketch > span {
  border-radius: 3px;
}
.lk-rail {
  background: var(--bg-guilds);
  box-shadow: inset 0 0 0 1px var(--border-strong);
}
.lk-side,
.lk-members {
  background: var(--bg-sidebar);
}
.lk-main {
  background: linear-gradient(var(--accent-soft), transparent);
  box-shadow: inset 0 0 0 1px var(--border);
}
.layout-sketch.lk-mirror {
  direction: rtl;
}
.layout-sketch.lk-top {
  grid-template-columns: 26px 1fr 22px;
  grid-template-rows: 9px 1fr;
}
.layout-sketch.lk-top .lk-rail {
  grid-column: 1 / -1;
}
.layout-sketch.lk-compact {
  grid-template-columns: 7px 18px 1fr 15px;
}
/* мини-схема сообщений */
.chat-sketch {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 100%;
  padding: 7px;
  box-sizing: border-box;
  border-radius: var(--radius-sm);
  background: var(--bg-main);
}
.cs-line {
  display: flex;
  align-items: center;
  gap: 5px;
}
.cs-av {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}
.cs-text {
  height: 8px;
  width: var(--w);
  border-radius: 4px;
  background: var(--text-faint);
}
.cs-bubbles .cs-text {
  height: 12px;
  border-radius: 7px;
  background: var(--bg-elevated);
}
.cs-bubbles .cs-line.mine {
  justify-content: flex-end;
}
.cs-bubbles .cs-line.mine .cs-av {
  display: none;
}
.cs-bubbles .cs-line.mine .cs-text {
  background: var(--accent);
}
.cs-compact {
  gap: 2px;
}
.cs-compact .cs-av {
  width: 7px;
  height: 7px;
}
.cs-compact .cs-text {
  height: 5px;
}
/* мини-схема вкладок телефона */
.tabs-sketch {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 64px;
  border-radius: var(--radius-sm);
  background: var(--bg-main);
  overflow: hidden;
}
.ts-screen {
  flex: 1;
}
.ts-bar {
  display: flex;
  justify-content: space-around;
  align-items: center;
  height: 22px;
  background: var(--bg-elevated);
  color: var(--text-muted);
}
.ts-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}
.ts-tab i {
  width: 12px;
  height: 2px;
  border-radius: 1px;
  background: var(--text-faint);
}
.ts-icons .ts-bar {
  height: 16px;
}
.ts-icons .ts-tab i {
  display: none;
}
.ts-float .ts-bar {
  margin: 0 8px 6px;
  border-radius: 11px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
}

/* --- стиль сообщений: «Пузыри» --- */
[data-chat='bubbles'] .message {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 1px 64px 1px 64px;
}
[data-chat='bubbles'] .message:hover {
  background: none;
}
[data-chat='bubbles'] .message .message-text,
[data-chat='bubbles'] .message .message-edit {
  max-width: min(640px, 100%);
}
[data-chat='bubbles'] .message .message-text:not(.jumbo) {
  padding: 7px 12px;
  border-radius: 4px 16px 16px 16px;
  background: var(--bg-elevated);
  color: var(--text);
}
[data-chat='bubbles'] .message:not(.first) .message-text:not(.jumbo) {
  border-radius: 16px;
}
[data-chat='bubbles'] .message.mine {
  align-items: flex-end;
  padding-left: 96px;
  padding-right: 18px;
}
[data-chat='bubbles'] .message.mine > .avatar,
[data-chat='bubbles'] .message.mine .message-author,
[data-chat='bubbles'] .message.mine .user-badges,
[data-chat='bubbles'] .message.mine .message-side-time {
  display: none;
}
[data-chat='bubbles'] .message.mine .message-text:not(.jumbo) {
  border-radius: 16px 4px 16px 16px;
  background: var(--accent);
  color: #fff;
}
[data-chat='bubbles'] .message.mine:not(.first) .message-text:not(.jumbo) {
  border-radius: 16px;
}
[data-chat='bubbles'] .message.mine .message-text a,
[data-chat='bubbles'] .message.mine .message-text .mention {
  color: #fff;
}
[data-chat='bubbles'] .message.mine .message-text .message-edited {
  color: rgba(255, 255, 255, 0.7);
}
[data-chat='bubbles'] .message.mentioned .message-text:not(.jumbo) {
  box-shadow: inset 0 0 0 2px var(--yellow);
}
[data-chat='bubbles'] .message.mentioned {
  box-shadow: none;
  background: none;
}
[data-chat='bubbles'] .message-header {
  margin-bottom: 2px;
}
[data-chat='bubbles'] .message.mine .message-actions {
  right: auto;
  left: 16px;
}

/* --- стиль сообщений: «Компактно» --- */
[data-chat='compact'] .message {
  padding: 1px 48px 1px 64px;
  min-height: 0;
  line-height: 1.35;
}
[data-chat='compact'] .message.first {
  margin-top: 6px;
  min-height: 0;
}
[data-chat='compact'] .message > .avatar {
  width: 20px !important;
  height: 20px !important;
  min-width: 20px;
  left: 38px;
  top: 2px;
  font-size: 10px !important;
}
[data-chat='compact'] .message.first .message-header {
  display: inline-flex;
  margin-right: 6px;
}
[data-chat='compact'] .message.first .message-header + .message-text {
  display: inline;
}
[data-chat='compact'] .message-time {
  font-size: 11px;
}
[data-chat='compact'] .message-side-time {
  width: 64px;
  top: 2px;
}

/* --- расположение панелей (только ПК: на телефоне — свой вид) --- */
@media (min-width: 769px) {
  /* Зеркально: серверы и каналы справа, участники слева */
  [data-layout='mirror'] .app {
    flex-direction: row-reverse;
  }
  [data-layout='mirror'] .sidebar {
    border-top-left-radius: 0;
    border-top-right-radius: var(--radius-lg);
  }
  [data-layout='mirror'] .guild-pill {
    left: auto;
    right: -16px;
    border-radius: 4px 0 0 4px;
  }

  /* Серверы сверху: колонка иконок — полосой над окном */
  [data-layout='top'] .app {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-rows: auto minmax(0, 1fr);
  }
  [data-layout='top'] .guilds {
    grid-column: 1 / -1;
    flex-direction: row;
    width: auto;
    height: auto;
    padding: 8px 16px 12px;
    overflow-x: auto;
    overflow-y: hidden;
  }
  [data-layout='top'] .guild-icon {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    font-size: 16px;
  }
  [data-layout='top'] .guild-icon.in-call {
    margin-bottom: 0;
  }
  [data-layout='top'] .guild-separator {
    width: 2px;
    height: 28px;
    flex-shrink: 0;
  }
  [data-layout='top'] .guild-pill {
    left: 50%;
    top: auto;
    bottom: -10px;
    width: 0;
    height: 4px !important;
    transform: translateX(-50%);
    border-radius: 4px 4px 0 0;
    transition: width 0.2s var(--ease);
  }
  [data-layout='top'] .guild-icon:hover .guild-pill {
    width: 16px;
  }
  [data-layout='top'] .guild-icon.active .guild-pill {
    width: 30px;
  }
  [data-layout='top'] .guild-icon.unread:not(.active) .guild-pill {
    width: 6px;
  }
  [data-layout='top'] .guild-call {
    bottom: -8px;
    transform: translateX(-50%) scale(0.85);
  }
  [data-layout='top'] .sidebar,
  [data-layout='top'] .main,
  [data-layout='top'] .members {
    grid-row: 2;
    min-height: 0;
  }

  /* Компактно: узкие панели и мелкие иконки серверов */
  [data-layout='compact'] .guilds {
    width: 58px;
    padding: 8px 0;
    gap: 6px;
  }
  [data-layout='compact'] .guild-icon {
    width: 40px;
    height: 40px;
    font-size: 15px;
  }
  [data-layout='compact'] .guild-call {
    transform: translateX(-50%) scale(0.8);
  }
  [data-layout='compact'] .guild-pill {
    left: -9px;
  }
  [data-layout='compact'] .sidebar {
    width: 208px;
  }
  [data-layout='compact'] .members {
    width: 200px;
  }
  [data-layout='compact'] .topbar,
  [data-layout='compact'] .sidebar-header {
    height: 44px;
  }
}

/* --- телефон: вид нижних вкладок --- */
@media (max-width: 768px) {
  [data-mtabs='icons'] .app {
    --m-tabbar-h: calc(48px + env(safe-area-inset-bottom));
  }
  [data-mtabs='icons'] .m-tab-label {
    display: none;
  }
  [data-mtabs='float'] .app {
    --m-tabbar-h: calc(78px + env(safe-area-inset-bottom));
  }
  [data-mtabs='float'] .m-tabbar {
    left: 12px;
    right: 12px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    height: 58px;
    padding-bottom: 0;
    border: 1px solid var(--border-strong);
    border-radius: 20px;
    box-shadow: 0 8px 26px rgba(0, 0, 0, 0.45);
  }
  [data-mtabs='float'] .m-tab.active .m-tab-icon {
    color: var(--accent);
  }
  /* пузыри на узком экране — без лишних отступов */
  [data-chat='bubbles'] .message {
    padding-left: 56px;
    padding-right: 40px;
  }
  [data-chat='bubbles'] .message.mine {
    padding-left: 56px;
    padding-right: 12px;
  }
}

/* ---------- предупреждение от администрации: обычное окно приложения, сверху — тонкая красная подсветка ---------- */
.warn-backdrop {
  z-index: 4500; /* поверх всех окон и меню */
}
.warn-edge {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--red);
  box-shadow: 0 0 18px 2px rgba(242, 63, 67, 0.55);
}
.warn-modal {
  border-color: rgba(242, 63, 67, 0.45);
}
.warn-modal .modal-title {
  display: flex;
  align-items: center;
  gap: 8px;
}
.warn-modal .modal-title svg {
  color: var(--red);
  flex: none;
}
.warn-modal .modal-text {
  overflow-wrap: anywhere;
}

/* красный флажок «N/3» рядом с ником в профиле */
.warn-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 6px;
  background: rgba(242, 63, 67, 0.16);
  color: var(--red);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.5;
  vertical-align: middle;
  cursor: help;
}
.warn-badge .ico {
  fill: currentColor;
  fill-opacity: 0.4;
}

/* Рисованные наборы иконок (ui/look.js, icons.js): «аниме» — цветная обводка, заливка, светлая линия */
.ico-art-anime .anime-edge {
  stroke: var(--ico-anime-edge, #ff5fae);
}
.ico-art-anime .anime-fill {
  fill: var(--ico-anime-fill, #ffc2e2);
  fill-opacity: 0.55;
}
.ico-art-anime .anime-line {
  stroke: currentColor;
}
.ico-art-pixel {
  shape-rendering: crispEdges;
}

/* --- шрифт интерфейса (ui/look.js): все надписи, кроме ников. font-size-adjust выравнивает высоту строчных
   букв — мелкий рукописный и крупный пиксельный читаются одинаково; жирность у этих шрифтов не подделываем --- */
:root[data-font='pixel'] {
  --font: 'Nick pixel', var(--font-base);
}
:root[data-font='hand'] {
  --font: 'Nick hand', var(--font-base);
}
:root[data-font='script'] {
  --font: 'Nick script', var(--font-base);
}
:root[data-font='rounded'] {
  --font: 'Nick rounded', var(--font-base);
}
:root[data-font='tech'] {
  --font: 'Nick tech', var(--font-base);
}
:root[data-font='mono'] {
  --font: 'Nick mono', ui-monospace, monospace;
}
:root[data-font]:not([data-font='default']) body {
  font-size-adjust: 0.52;
  font-synthesis: none;
}
:root[data-font='pixel'] body {
  letter-spacing: 0.02em;
}
/* ник — своим шрифтом (из профиля или обычным) */
:root[data-font]:not([data-font='default']) .uname {
  font-size-adjust: none;
}
:root[data-font]:not([data-font='default']) .uname:not([class*='nick-font-']) {
  font-family: var(--font-base);
  letter-spacing: normal;
}
/* образцы в настройках */
.font-sample {
  font-size: 16px;
  font-size-adjust: 0.52;
  font-synthesis: none;
  color: var(--header);
}
.font-sample[data-font='default'] {
  font-family: var(--font-base);
  font-size-adjust: none;
}
.font-sample[data-font='pixel'] {
  font-family: 'Nick pixel', var(--font-base);
}
.font-sample[data-font='hand'] {
  font-family: 'Nick hand', var(--font-base);
}
.font-sample[data-font='script'] {
  font-family: 'Nick script', var(--font-base);
}
.font-sample[data-font='rounded'] {
  font-family: 'Nick rounded', var(--font-base);
}
.font-sample[data-font='tech'] {
  font-family: 'Nick tech', var(--font-base);
}
.font-sample[data-font='mono'] {
  font-family: 'Nick mono', ui-monospace, monospace;
}

/* «Оформление скрыто для тебя» в профиле (скрыл сам или после жалобы) */
.decor-hidden-note {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--radius);
  background: var(--bg-input);
  color: var(--text-muted);
  font-size: 13px;
}
.decor-hidden-note span {
  flex: 1;
}
.decor-hidden-note .link-btn,
.message.blocked-msg .link-btn {
  background: none;
  border: none;
  padding: 0;
  color: var(--text-link, var(--accent));
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

/* --- курсор (ui/cursor.js) --- */
.look-grid.cursors {
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  margin-bottom: 12px;
}
.cursor-sample {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--bg-tertiary, rgba(0, 0, 0, 0.25));
}
.cursor-sample.system {
  font-size: 22px;
  color: var(--text-muted);
}
.cursor-sample svg {
  overflow: visible;
}
.cursor-selects {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 0 12px;
}
.cursor-test {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
  padding: 12px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
}
.cursor-test .field-hint {
  flex-basis: 100%;
  margin: 0;
}

/* ЛС без уведомлений: колокольчик перечёркнут, строка приглушена */
.dm-muted {
  display: flex;
  color: var(--text-faint);
}

.channel-item.muted:not(.active) .channel-name {
  opacity: 0.6;
}

/* Сообщения заблокированного: одна тихая строка на группу, остальные спрятаны */
.message.blocked-msg {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 4px 16px 4px 72px;
  color: var(--text-faint);
  font-size: 13px;
}

.message.blocked-msg.rest {
  display: none;
}

[data-chat='compact'] .message.blocked-msg {
  padding-left: 16px;
}

.dm-name.profile-link:hover,
.topbar-nick.profile-link:hover {
  text-decoration: underline;
}

/* ---------- экран входа и регистрации: глубокий космос, как на странице скачивания ----------
   Всегда тёмный (не зависит от темы): свои цвета вместо переменных темы */
.login-screen {
  --auth-text: #eef0f6;
  --auth-muted: #9aa0b4;
  --auth-faint: #646a80;
  --auth-line: rgba(255, 255, 255, 0.09);
  --auth-line-strong: rgba(255, 255, 255, 0.18);
  --auth-card: rgba(12, 14, 24, 0.72);
  --auth-input: rgba(255, 255, 255, 0.035);
  --auth-focus: #8ea2ff;
  background: #04050b;
  color: var(--auth-text);
  color-scheme: dark;
}

.login-screen .login-lang {
  background: rgba(12, 14, 24, 0.6);
  border-color: var(--auth-line);
  color: var(--auth-muted);
  backdrop-filter: blur(6px);
}

.login-screen .login-lang-select {
  color: var(--auth-text);
}

.login-screen .login-lang-select option {
  background: #0c0e18;
  color: var(--auth-text);
}

.auth-card.login-card {
  width: 400px;
  padding: 32px 32px 24px;
  background: var(--auth-card);
  border: 1px solid var(--auth-line);
  border-radius: 16px;
  box-shadow: none;
  backdrop-filter: blur(8px);
  animation: auth-in 280ms cubic-bezier(0.23, 1, 0.32, 1);
}

@keyframes auth-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--auth-text);
  margin-bottom: 28px;
}

.auth-brand img {
  border-radius: 8px;
}

.auth-card .auth-title {
  margin: 0;
  text-align: left;
  font-size: 26px;
  font-weight: 650;
  letter-spacing: -0.025em;
  color: var(--auth-text);
}

.auth-sub {
  margin: 6px 0 24px;
  color: var(--auth-muted);
  font-size: 14.5px;
}

.auth-card .field-label {
  color: var(--auth-muted);
  font-size: 12.5px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
}

.auth-card .input {
  background: var(--auth-input);
  border: 1px solid var(--auth-line);
  border-radius: 10px;
  color: var(--auth-text);
  height: 42px;
  font-size: 14.5px;
  transition: border-color 150ms ease, background-color 150ms ease;
}

.auth-card select.input option {
  background: #0c0e18;
}

.auth-card .input:hover {
  border-color: var(--auth-line-strong);
}

.auth-card .input:focus {
  outline: none;
  border-color: var(--auth-focus);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: none;
}

.auth-card .field-hint,
.auth-card .terms-check {
  color: var(--auth-faint);
}

.auth-card .terms-check .link-button,
.auth-card .login-terms-link {
  color: var(--auth-muted);
}

.auth-card .btn.primary {
  height: 44px;
  margin-top: 6px;
  border-radius: 10px;
  background: #f3f4f8;
  color: #0a0b12;
  font-weight: 600;
  box-shadow: none;
  transition: background-color 150ms ease, transform 160ms cubic-bezier(0.23, 1, 0.32, 1);
}

.auth-card .btn.primary::before,
.auth-card .btn.primary::after {
  display: none;
}

@media (hover: hover) and (pointer: fine) {
  .auth-card .btn.primary:hover {
    background: #fff;
  }
}

.auth-card .btn.primary:active {
  transform: scale(0.97);
}

.auth-card .btn.primary:disabled {
  opacity: 0.6;
}

.auth-switch {
  margin-top: 18px;
  text-align: center;
  font-size: 14px;
  color: var(--auth-faint);
}

.auth-switch-btn {
  margin-left: 6px;
  padding: 0;
  border: none;
  background: none;
  color: var(--auth-text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

@media (hover: hover) and (pointer: fine) {
  .auth-switch-btn:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
  }
}

.auth-card .login-terms-link {
  display: block;
  margin: 14px auto 0;
  font-size: 12.5px;
}

.auth-card .form-error {
  color: #ff8a8a;
}

.auth-card .notice {
  background: rgba(250, 204, 21, 0.08);
  border-left-color: #facc15;
  color: var(--auth-text);
}

@media (prefers-reduced-motion: reduce) {
  .auth-card.login-card {
    animation: none;
  }
}

/* ---------- поддержка (ui/support.js) ---------- */
.support-topic {
  max-width: 320px;
}

.support-thread {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 8px 0 10px;
}

.support-msg {
  max-width: 88%;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--bg-input);
}

.support-msg.admin {
  align-self: flex-end;
  background: color-mix(in srgb, var(--accent) 16%, var(--bg-input));
}

.support-msg-meta {
  font-size: 12px;
  color: var(--text-faint);
  margin-bottom: 2px;
}

.support-more {
  width: 100%;
  resize: vertical;
}

.support-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.support-status.status-open {
  color: var(--yellow);
}

.support-status.status-answered {
  color: var(--green);
}

.support-status.status-closed {
  color: var(--text-faint);
}
