@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

body {
  font-family: 'Inter', system-ui, sans-serif;
}

.chat-scroll {
  scrollbar-width: thin;
  scrollbar-color: rgba(139, 92, 246, 0.4) transparent;
}

.chat-scroll::-webkit-scrollbar {
  width: 6px;
}

.chat-scroll::-webkit-scrollbar-thumb {
  background: rgba(139, 92, 246, 0.4);
  border-radius: 999px;
}

.message-own {
  background: linear-gradient(to right, #8b5cf6, #9333ea);
}

.avatar-circle {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.875rem;
  color: white;
  flex-shrink: 0;
}

.voice-speaking {
  animation: voice-pulse 1.5s ease-in-out infinite;
}

@keyframes voice-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(52, 211, 153, 0); }
}

.participant-media {
  position: relative;
  width: 100%;
  max-width: 220px;
  aspect-ratio: 4 / 3;
  border-radius: 1rem;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.4);
}

.participant-media--expandable {
  cursor: pointer;
  max-width: 100%;
}

.participant-media--expandable::after {
  content: '⛶';
  position: absolute;
  right: 0.4rem;
  bottom: 0.4rem;
  z-index: 4;
  font-size: 0.75rem;
  line-height: 1;
  padding: 0.2rem 0.35rem;
  border-radius: 0.35rem;
  background: rgba(0, 0, 0, 0.55);
  color: rgba(255, 255, 255, 0.85);
  pointer-events: none;
}

.participant-media--expandable:hover {
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.45);
}

.participant-video {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #0a0a0a;
  transform: scaleX(-1);
}

.participant-video.remote-video {
  transform: none;
}

.participant-video.participant-video--screen {
  object-fit: contain;
  transform: none;
  background: #000;
}

.participant-avatar-fallback {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.participant-avatar-fallback.is-hidden {
  display: none !important;
}

.participant-avatar-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #0a0a0a;
}

.participant-avatar-initials {
  position: relative;
  width: 4rem;
  height: 4rem;
  font-size: 1.125rem;
}

.participant-self-badge {
  position: absolute;
  bottom: -0.2rem;
  right: -0.2rem;
  font-size: 0.625rem;
  line-height: 1;
  padding: 0.15rem 0.4rem;
  border-radius: 9999px;
  background: rgb(124 58 237);
  color: #fff;
  font-weight: 600;
}

.user-menu-btn {
  cursor: pointer;
  border: 2px solid rgba(139, 92, 246, 0.55);
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(124, 58, 237, 0.1));
  box-shadow: 0 0 24px rgba(139, 92, 246, 0.35);
}

.user-menu-btn:hover {
  border-color: rgba(167, 139, 250, 0.8);
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.35), rgba(124, 58, 237, 0.2));
}

.user-menu-panel {
  color: #fff;
  display: flex;
  flex-direction: column;
  min-width: 260px;
  max-width: 320px;
  box-sizing: border-box;
}

.user-menu-panel.hidden {
  display: none !important;
}

.user-menu-panel a,
.user-menu-panel .user-menu-link {
  color: rgba(255, 255, 255, 0.9) !important;
  display: flex !important;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  box-sizing: border-box;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  line-height: 1.25;
  text-decoration: none !important;
  white-space: nowrap;
  transition: background 0.15s;
}

.user-menu-panel a:hover,
.user-menu-panel .user-menu-link:hover {
  background: rgba(255, 255, 255, 0.06);
}

.user-menu-panel .user-menu-logout {
  margin-top: 0.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: #fca5a5 !important;
}

.app-top-header {
  position: relative;
  z-index: 200;
}

/* ——— Голосовой канал: телефон (портрет) ——— */

.voice-dock-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  padding: 0.65rem 0.85rem;
  min-width: 3.5rem;
  border-radius: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.1;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.voice-dock-btn:active {
  transform: scale(0.96);
}

.voice-dock-btn.is-active {
  border-color: rgba(56, 189, 248, 0.5);
  background: rgba(56, 189, 248, 0.15);
  color: #7dd3fc;
}

.voice-dock-btn.is-muted {
  border-color: rgba(248, 113, 113, 0.45);
  background: rgba(248, 113, 113, 0.12);
  color: #fca5a5;
}

.voice-dock-leave {
  border-color: rgba(248, 113, 113, 0.45);
  background: rgba(239, 68, 68, 0.2);
  color: #fecaca;
}

.voice-dock-icon {
  font-size: 1.35rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.voice-dock-icon svg,
.call-ctrl-icon svg {
  width: 1.5rem;
  height: 1.5rem;
  display: block;
}

.voice-dock-label {
  max-width: 4.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Личные звонки 1:1 */
.call-ctrl-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 0.75rem 1rem;
  min-width: 4.5rem;
  border-radius: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.1;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.call-ctrl-btn:active {
  transform: scale(0.96);
}

.call-ctrl-btn.is-active {
  border-color: rgba(56, 189, 248, 0.5);
  background: rgba(56, 189, 248, 0.15);
  color: #7dd3fc;
}

.call-ctrl-btn.is-muted {
  border-color: rgba(248, 113, 113, 0.45);
  background: rgba(248, 113, 113, 0.12);
  color: #fca5a5;
}

.call-ctrl-btn--hangup {
  border-color: rgba(248, 113, 113, 0.45);
  background: rgba(239, 68, 68, 0.25);
  color: #fecaca;
  min-width: 5.5rem;
}

.call-ctrl-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.call-ctrl-label {
  max-width: 5.5rem;
  text-align: center;
}

/* ——— Голосовая: мобильный экран до входа ——— */
@media (max-width: 767px) {
  .voice-room:not(.voice-in-call) .voice-room-badge {
    display: none;
  }

  .voice-room:not(.voice-in-call) .voice-http-hint {
    max-height: 24vh;
    margin-top: 0.35rem;
  }

  .voice-room:not(.voice-in-call) .voice-room-header {
    flex-shrink: 0;
    padding-bottom: 0.5rem;
  }

  .voice-room:not(.voice-in-call) .voice-body,
  .voice-room:not(.voice-in-call) .voice-presence-rail {
    display: none;
  }

  .voice-room:not(.voice-in-call) .voice-main {
    flex: 1 1 0;
    min-height: 0;
  }

  #join-overlay:not(.hidden) {
    position: fixed;
    inset: 0;
    z-index: 280;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    padding-top: max(3.5rem, env(safe-area-inset-top, 0px));
    padding-bottom: max(1.25rem, env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(8px);
  }

  #join-overlay:not(.hidden) #btn-join {
    flex-shrink: 0;
    max-width: 20rem;
    width: 100%;
  }
}

@media (max-width: 767px) {
  .voice-in-call .app-top-header > div {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
  }

  .voice-in-call .app-top-header .font-bold.hidden {
    display: none !important;
  }

  .voice-in-call .voice-prejoin-nav,
  .voice-in-call .voice-room-title,
  .voice-in-call .voice-room-desc,
  .voice-in-call .voice-room-badge,
  .voice-in-call .voice-http-hint {
    display: none !important;
  }

  .voice-in-call .voice-room-header {
    padding: 0.35rem 0.75rem 0.25rem;
    border-bottom: none;
    background: transparent;
  }

  .voice-in-call .voice-status-pill {
    display: none;
  }

  .voice-in-call .voice-room {
    border-radius: 1rem;
  }

  .voice-in-call .voice-main {
    min-height: 0;
  }

  .voice-in-call .voice-body {
    flex: 1 1 0;
    min-height: 0;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .voice-in-call .voice-stage {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px));
  }

  .voice-in-call .voice-dock {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 300;
    margin: 0;
    border: none;
    border-radius: 0;
    padding: 0.5rem 0.5rem calc(0.55rem + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(to top, rgba(0, 0, 0, 0.92) 55%, rgba(0, 0, 0, 0.55) 85%, transparent);
    flex-wrap: nowrap;
    justify-content: space-evenly;
    gap: 0.35rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .voice-in-call .voice-dock-extra {
    display: none;
  }

  .voice-in-call .voice-dock-btn {
    min-width: 3.25rem;
    padding: 0.55rem 0.4rem;
    border-radius: 1.1rem;
  }

  .voice-in-call .voice-dock-label {
    font-size: 0.62rem;
    max-width: 3.25rem;
  }

  .voice-camera-on.voice-in-call .voice-stage {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    align-content: flex-start;
    gap: 0.35rem;
    padding: 0.35rem;
    padding-bottom: calc(5.75rem + env(safe-area-inset-bottom, 0px));
    flex: 1 1 0;
    min-height: 0;
    max-height: 100%;
    overflow-x: hidden;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    grid-template-columns: 1fr !important;
  }

  .voice-room.voice-show-chat .voice-presence-rail {
    display: none;
  }

  .voice-camera-on.voice-in-call .voice-stage.voice-stage-single {
    justify-content: stretch;
  }

  .voice-camera-on.voice-in-call .participant-card {
    flex: 0 0 auto;
    width: 100%;
    max-width: none;
    padding: 0.4rem 0.5rem 0.5rem;
    border-radius: 1.25rem;
    display: flex;
    flex-direction: column;
  }

  .voice-camera-on.voice-in-call .participant-media {
    flex: 0 0 auto;
    min-height: min(50vh, 420px);
    max-height: min(52vh, 440px);
    max-width: none;
    width: 100%;
    aspect-ratio: 3 / 4;
    border-radius: 1rem;
  }

  .voice-camera-on.voice-in-call .voice-stage-multi-video .participant-media {
    min-height: min(30vh, 260px);
    max-height: min(34vh, 300px);
    aspect-ratio: 16 / 10;
  }

  .voice-camera-on.voice-in-call .participant-card .participant-name {
    flex-shrink: 0;
    font-size: 0.8rem;
  }

  .voice-camera-on.voice-in-call .participant-card .participant-status {
    flex-shrink: 0;
    font-size: 0.65rem;
  }

  .voice-alone-banner {
    display: none !important;
  }

  .voice-in-call .voice-presence-rail {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 44;
    margin: 0;
    border: none;
    border-radius: 1rem 1rem 0 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    max-height: min(52vh, 340px);
    background: rgba(8, 8, 12, 0.94);
    backdrop-filter: blur(12px);
    transform: translateY(calc(100% - 2.85rem));
    transition: transform 0.22s ease;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.45);
  }

  .voice-in-call.voice-presence-open .voice-presence-rail {
    transform: translateY(0);
  }

  .voice-in-call.voice-presence-open .voice-presence-chevron {
    transform: rotate(180deg);
  }

  .voice-presence-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.55rem 0.85rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.75);
    border: none;
    background: transparent;
  }

  .voice-presence-toggle-label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
  }

  .voice-presence-chevron {
    font-size: 0.65rem;
    opacity: 0.5;
    transition: transform 0.2s ease;
  }

  .voice-in-call:not(.voice-presence-open) .voice-presence-columns {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
  }

  .voice-in-call.voice-presence-open .voice-presence-columns {
    max-height: min(42vh, 280px);
    overflow: hidden;
    opacity: 1;
    pointer-events: auto;
  }

  .voice-in-call .voice-presence-list {
    max-height: min(28vh, 180px);
  }
}

@media (max-width: 767px) and (orientation: landscape) {
  .voice-camera-on.voice-in-call .voice-stage {
    flex-direction: row;
    flex-wrap: wrap;
    align-content: stretch;
    overflow-y: auto;
  }

  .voice-camera-on.voice-in-call .participant-card {
    flex: 1 1 45%;
    min-height: 0;
  }

  .voice-camera-on.voice-in-call .participant-media {
    flex: 1 1 0;
    min-height: 12rem;
    aspect-ratio: 16 / 10;
  }
}

/* ——— Чат внутри голосовой разговорной ——— */

.voice-view-tabs {
  display: flex;
}

.voice-view-tab {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border-radius: 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.55);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.voice-view-tab.is-active {
  background: rgba(139, 92, 246, 0.25);
  border-color: rgba(139, 92, 246, 0.45);
  color: #e9d5ff;
}

.voice-chat-panel {
  display: none;
  flex-direction: column;
  min-height: 0;
  background: rgba(0, 0, 0, 0.2);
}

.voice-chat-messages {
  min-height: 120px;
}

@media (min-width: 768px) {
  .voice-chat-panel {
    display: flex !important;
    width: min(360px, 38%);
    max-width: 360px;
  }

  .voice-in-call .voice-main {
    min-width: 0;
  }
}

@media (max-width: 767px) {
  .voice-in-call .voice-chat-panel {
    display: none;
  }

  .voice-room.voice-show-chat .voice-chat-panel {
    display: flex !important;
    flex-direction: column;
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: 350;
    background: rgba(8, 8, 12, 0.98);
    border: none;
    min-height: 0;
  }

  .voice-room.voice-show-chat .voice-chat-header {
    flex-shrink: 0;
    padding-top: max(0.5rem, env(safe-area-inset-top, 0px));
  }

  .voice-room.voice-show-chat .voice-chat-messages {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.5rem;
  }

  .voice-room.voice-show-chat .voice-chat-form {
    flex-shrink: 0;
    padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
    background: rgba(0, 0, 0, 0.5);
  }

  .voice-room.voice-show-chat .voice-main {
    visibility: hidden;
    pointer-events: none;
  }

  .voice-room.voice-show-chat .voice-dock {
    display: none !important;
  }

  .voice-room.voice-show-chat .voice-presence-rail {
    display: none !important;
  }

  .voice-shell.voice-show-chat .app-top-header {
    z-index: 360;
    position: relative;
  }

  body.voice-mobile-chat-open {
    overflow: hidden;
  }

  .voice-shell.voice-show-chat {
    overflow: hidden;
  }
}

/* Presence: кто в чате / в разговоре (Discord-style) */
.voice-main {
  min-height: 0;
}

.voice-presence-rail {
  max-height: min(28vh, 220px);
}

@media (min-width: 768px) {
  .voice-presence-toggle {
    display: none !important;
  }

  .voice-in-call .voice-presence-rail {
    position: static;
    transform: none;
    max-height: min(28vh, 220px);
    box-shadow: none;
    border-radius: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
  }

  .voice-in-call .voice-presence-columns,
  .voice-in-call:not(.voice-presence-open) .voice-presence-columns {
    max-height: none;
    opacity: 1;
    pointer-events: auto;
    overflow: visible;
  }

  .voice-in-call .voice-main {
    flex: 1 1 0;
    min-height: 0;
  }

  .voice-in-call .voice-body {
    flex: 1 1 0;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .voice-in-call .voice-stage,
  .voice-in-call #participants-grid.voice-stage {
    flex: 1 1 0;
    min-height: 0;
    max-height: 100%;
    overflow-x: hidden;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    align-content: start;
  }

  .voice-camera-on.voice-in-call .voice-stage {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)) !important;
    gap: 0.75rem;
    padding: 0.75rem;
    padding-bottom: 0.75rem;
    flex-direction: unset;
  }

  .voice-camera-on.voice-in-call .participant-card {
    flex: unset;
    width: auto;
    max-width: none;
    padding: 0.5rem;
  }

  .voice-camera-on.voice-in-call .participant-media {
    min-height: 0;
    max-height: min(28vh, 240px);
    max-width: 100%;
    width: 100%;
    aspect-ratio: 16 / 10;
  }

  .voice-camera-on.voice-in-call .voice-stage-multi-video .participant-media {
    max-height: min(24vh, 200px);
  }
}

/* Полноэкранный просмотр камеры в голосовом канале */
.voice-video-spotlight {
  position: fixed;
  inset: 0;
  z-index: 680;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(1rem, env(safe-area-inset-top, 0px)) max(1rem, env(safe-area-inset-right, 0px))
    max(1rem, env(safe-area-inset-bottom, 0px)) max(1rem, env(safe-area-inset-left, 0px));
}

.voice-video-spotlight.hidden {
  display: none !important;
}

body.voice-video-spotlight-open {
  overflow: hidden;
}

.voice-video-spotlight-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  padding: 0;
  margin: 0;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(8px);
  cursor: pointer;
}

.voice-video-spotlight-panel {
  position: relative;
  z-index: 1;
  width: min(96vw, 56rem);
  max-height: min(92vh, 52rem);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.65rem;
}

.voice-video-spotlight-close {
  position: absolute;
  top: -0.25rem;
  right: -0.25rem;
  z-index: 3;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(20, 20, 24, 0.95);
  color: #fff;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.voice-video-spotlight-close:hover {
  background: rgba(220, 38, 38, 0.85);
}

.voice-video-spotlight-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  max-height: min(78vh, calc(96vw * 10 / 16));
  border-radius: 1rem;
  overflow: hidden;
  background: #000;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.65);
}

.voice-video-spotlight-frame video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.voice-video-spotlight-frame video.participant-video:not(.remote-video) {
  transform: scaleX(-1);
}

.voice-video-spotlight-name {
  text-align: center;
  font-size: 0.95rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
}

.voice-presence-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  min-height: 0;
}

.voice-presence-group {
  min-width: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.voice-presence-group:last-child {
  border-right: none;
}

.voice-presence-head,
.chat-presence-head {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.75rem;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.45);
  margin: 0;
}

.voice-presence-count {
  margin-left: auto;
  min-width: 1.25rem;
  text-align: center;
  padding: 0.1rem 0.35rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.75);
  font-variant-numeric: tabular-nums;
}

.voice-presence-dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  flex-shrink: 0;
}

.voice-presence-dot--voice {
  background: #34d399;
  box-shadow: 0 0 6px rgba(52, 211, 153, 0.6);
}

.voice-presence-dot--chat {
  background: #a78bfa;
  box-shadow: 0 0 6px rgba(167, 139, 250, 0.5);
}

.voice-presence-list {
  list-style: none;
  margin: 0;
  padding: 0 0 0.35rem;
  max-height: min(22vh, 160px);
  overflow-y: auto;
}

.presence-member {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.75rem;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.88);
}

.presence-member:hover {
  background: rgba(255, 255, 255, 0.05);
}

.presence-member-name {
  flex: 1;
  min-width: 0;
}

.presence-badges {
  display: flex;
  gap: 0.15rem;
  flex-shrink: 0;
  opacity: 0.85;
}

.presence-badge {
  font-size: 0.75rem;
  line-height: 1;
}

.presence-empty {
  padding: 0.35rem 0.75rem 0.5rem;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.28);
  list-style: none;
}

html.chat-page-root,
html.chat-page-root body.chat-page {
  height: 100%;
  overflow: hidden;
}

.chat-page-shell {
  height: 100dvh;
  height: 100svh;
  max-height: 100dvh;
  max-height: 100svh;
}

@supports (-webkit-touch-callout: none) {
  .chat-page-shell {
    height: -webkit-fill-available;
    max-height: -webkit-fill-available;
  }
}

.chat-page-layout {
  min-height: 0;
}

.chat-rail--channels,
.voice-rail--channels {
  order: -1;
}

@media (min-width: 768px) {
  .chat-page-layout > .chat-rail--channels,
  .chat-page-layout > .chat-rail--friends,
  .voice-shell > .flex-1 > .voice-rail--channels {
    position: static;
    transform: none;
    visibility: visible;
    pointer-events: auto;
    display: flex;
    width: auto;
    max-height: none;
    border-radius: 28px;
    padding-top: 0;
    padding-bottom: 0;
  }

  .chat-page-layout > .chat-rail--channels,
  .voice-shell > .flex-1 > .voice-rail--channels {
    flex: 0 0 auto;
    max-width: 260px;
  }

  .chat-page-layout > .chat-rail--friends {
    flex: 0 0 auto;
    max-width: 280px;
  }

  .voice-shell > .flex-1 > .voice-rail--channels {
    max-width: 260px;
  }

  .chat-rail--channels .server-block,
  .voice-rail--channels .server-block {
    min-width: 0;
  }

  .chat-rail--channels .server-subchannels,
  .voice-rail--channels .server-subchannels {
    margin-left: 0.5rem;
  }
}

.voice-rail-scroll {
  min-height: 0;
}

.chat-main {
  min-height: 0;
}

/* Кто в комнате — под активной комнатой в левой колонке */
.channel-room-presence {
  margin: 0.15rem 0 0.5rem 0.65rem;
  padding: 0.35rem 0.35rem 0.45rem 0.5rem;
  border-left: 2px solid rgba(139, 92, 246, 0.35);
  background: rgba(0, 0, 0, 0.2);
  border-radius: 0 0.5rem 0.5rem 0;
}

.channel-room-presence--voice {
  border-left-color: rgba(16, 185, 129, 0.45);
  background: rgba(16, 185, 129, 0.06);
}

.channel-room-presence-badges {
  display: flex;
  gap: 0.15rem;
  flex-shrink: 0;
  font-size: 0.65rem;
  line-height: 1;
}

.channel-room-presence-badge {
  opacity: 0.85;
}

.channel-room-presence-label {
  margin: 0 0 0.35rem;
  padding: 0 0.15rem;
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.38);
}

.channel-room-presence-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  max-height: min(28vh, 220px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.channel-room-presence-member {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.28rem 0.35rem;
  border-radius: 0.5rem;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.75rem;
  line-height: 1.2;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}

.channel-room-presence-member--self {
  color: rgba(196, 181, 253, 0.95);
}

.channel-room-presence-member.presence-member--clickable:hover {
  background: rgba(255, 255, 255, 0.06);
}

.channel-room-presence-avatar {
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 9999px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.channel-room-presence-avatar--initials {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.5rem;
  font-weight: 700;
  color: #fff;
}

.channel-room-presence-name {
  min-width: 0;
  flex: 1 1 0;
}

.channel-room-presence-empty {
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.32);
  padding: 0.2rem 0.35rem;
  list-style: none;
}

@media (max-width: 767px) {
  .chat-page-layout {
    flex: 1 1 0;
    min-height: 0;
    padding: 0.5rem;
    padding-left: max(0.5rem, env(safe-area-inset-left, 0px));
    padding-right: max(0.5rem, env(safe-area-inset-right, 0px));
    padding-bottom: 0;
    position: relative;
  }

  .chat-page-layout > .chat-rail--channels,
  .chat-page-layout > .chat-rail--friends,
  .voice-shell > .flex-1 > .voice-rail--channels {
    display: none;
    position: fixed;
    z-index: 250;
    top: 0;
    bottom: 0;
    width: min(100%, 19.5rem);
    max-width: 92vw;
    margin: 0;
    border-radius: 0;
    transform: translateX(-108%);
    transition: transform 0.28s ease;
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .chat-page-layout > .chat-rail--friends {
    left: auto;
    right: 0;
    transform: translateX(108%);
  }

  .voice-shell > .flex-1 > .voice-rail--channels {
    left: 0;
    right: 0;
    width: 100%;
    max-width: none;
    transform: translateY(108%);
    border-radius: 1.25rem 1.25rem 0 0;
    top: auto;
    max-height: min(88vh, 100%);
  }

  body.chat-drawer-channels .chat-page-layout > .chat-rail--channels,
  body.chat-drawer-channels .voice-shell > .flex-1 > .voice-rail--channels {
    display: flex;
    transform: translate(0, 0);
  }

  body.chat-drawer-friends .chat-page-layout > .chat-rail--friends {
    display: flex;
    transform: translateX(0);
  }

  .chat-page-layout > .chat-main {
    flex: 1 1 100%;
    min-width: 0;
    width: 100%;
  }

  body.chat-drawer-open {
    overflow: hidden;
  }

  .chat-mobile-backdrop {
    position: fixed;
    inset: 0;
    z-index: 240;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(3px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease, visibility 0.25s;
  }

  body.chat-drawer-open .chat-mobile-backdrop {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .chat-rail-mobile-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.35);
  }

  .chat-rail-mobile-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
  }

  .chat-rail-mobile-close {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.65rem;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.85);
    font-size: 1rem;
    line-height: 1;
    flex-shrink: 0;
  }

  .chat-mobile-bar-btn {
    padding: 0.55rem 0.65rem;
    border-radius: 0.85rem;
    border: 1px solid rgba(139, 92, 246, 0.35);
    background: rgba(139, 92, 246, 0.12);
    color: rgb(196 181 253);
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    min-width: 0;
  }

  .chat-mobile-bar-btn:active {
    background: rgba(139, 92, 246, 0.22);
  }

  .voice-mobile-bar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
  }

  .server-block-head {
    flex-wrap: wrap;
    row-gap: 0.25rem;
  }

  .server-block-head > a {
    flex: 1 1 calc(100% - 2.5rem);
    min-width: 0;
  }

  .server-block-toolbar {
    padding-left: 0.35rem;
    padding-right: 0.35rem;
  }

  .server-subchannels {
    margin-left: 0.35rem;
    padding-left: 0.25rem;
  }

  .chat-subchannel-link {
    gap: 0.35rem;
    padding: 0.45rem 0.4rem;
  }

  .chat-subchannel-link > .text-\[10px\] {
    display: none;
  }

  .chat-subchannel-row .subchannel-delete-btn {
    width: 1.75rem;
    height: 1.75rem;
  }

  .server-hub {
    padding: 0.75rem 0.65rem 1rem;
  }

  .server-hub-card {
    padding: 1rem 1rem 1.25rem;
    border-radius: 1.25rem;
  }

  .server-hub-card .flex.items-center.gap-4 {
    gap: 0.75rem;
  }

  .server-hub-card .w-16 {
    width: 3rem;
    height: 3rem;
  }

  .server-hub-card h2 {
    font-size: 1.05rem;
  }

  .server-hub-room {
    padding: 0.7rem 0.75rem;
  }

  .chat-page .chat-main {
    flex: 1 1 0;
    min-height: 0;
    width: 100%;
    border-radius: 1rem;
  }

  .chat-page .chat-main > div:first-child {
    flex-shrink: 0;
    padding-top: max(0.75rem, env(safe-area-inset-top, 0px));
  }

  .chat-page #messages {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding-bottom: calc(4.5rem + env(safe-area-inset-bottom, 0px) + var(--chat-kb-offset, 0px));
  }

  .chat-page .chat-composer-dock {
    position: fixed;
    left: max(0.5rem, env(safe-area-inset-left, 0px));
    right: max(0.5rem, env(safe-area-inset-right, 0px));
    bottom: 0;
    z-index: 120;
    margin: 0;
    padding: 0.5rem 0.65rem;
    padding-bottom: calc(0.5rem + env(safe-area-inset-bottom, 0px) + var(--chat-kb-offset, 0px));
    background: linear-gradient(to top, rgba(0, 0, 0, 0.94) 70%, rgba(0, 0, 0, 0.75));
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1rem 1rem 0 0;
  }

  .chat-page .chat-composer {
    max-width: 100%;
  }

  .chat-page #message-input {
    font-size: 16px;
  }

  .chat-page .chat-emoji-panel {
    bottom: calc(100% + 0.25rem);
    max-height: min(8rem, 28vh);
  }

  .chat-page .app-top-header {
    flex-shrink: 0;
  }
}

.chat-rail {
  min-height: 0;
}

.chat-rail-scroll {
  min-height: 0;
}

.chat-presence-section {
  min-width: 0;
}

.chat-rail--presence .chat-presence-list {
  max-height: min(32vh, 240px);
}

.chat-rail--presence .chat-presence-section:last-child .chat-presence-list {
  max-height: min(38vh, 280px);
}

@media (min-width: 768px) {
  .chat-page-layout .chat-rail--presence .voice-presence-head {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }
}

.presence-member--clickable:hover,
.participant-card--clickable:hover {
  background: rgba(255, 255, 255, 0.06);
}

.user-card-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 1rem;
  padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
}

.user-card-overlay.hidden {
  display: none;
}

.user-report-overlay {
  position: fixed;
  inset: 0;
  z-index: 520;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 1rem;
  padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
}

.user-report-overlay.hidden {
  display: none;
}

.user-report-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.user-report-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 24rem;
  max-height: min(90vh, 32rem);
  overflow-y: auto;
  background: rgba(18, 18, 24, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 1.5rem;
  padding: 1.25rem 1.25rem 1.5rem;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

.user-report-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.6);
}

.chat-subchannel-row .chat-subchannel-link {
  border-radius: 0.65rem;
}

.subchannel-delete-btn {
  line-height: 1;
}

body.user-card-open {
  overflow: hidden;
}

.user-card-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
}

.user-card-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 22rem;
  background: rgba(18, 18, 24, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 1.5rem;
  padding: 1.25rem 1.25rem 1.5rem;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  animation: user-card-in 0.2s ease-out;
}

@keyframes user-card-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.user-card-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.9rem;
}

.user-card-content {
  text-align: center;
}

.user-card-name {
  font-size: 1.25rem;
  font-weight: 700;
  margin-top: 0.75rem;
}

.user-card-id {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.4);
  font-family: ui-monospace, monospace;
  margin-top: 0.25rem;
}

.user-card-online {
  font-size: 0.8rem;
  margin-top: 0.35rem;
}

.user-card-status {
  font-size: 0.85rem;
  margin: 0.75rem 0;
}

.user-card-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.user-card-btn {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  transition: background 0.15s, transform 0.15s;
}

.user-card-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  transform: scale(1.01);
}

.user-card-btn--primary {
  background: linear-gradient(to right, #6366f1, #8b5cf6);
  border-color: transparent;
}

.user-card-btn--danger {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.35);
  color: #fecaca;
}

.user-card-btn--warn {
  border-color: rgba(251, 191, 36, 0.35);
  color: rgb(253 224 71);
}

.user-card-btn--muted {
  color: rgba(255, 255, 255, 0.65);
}

.user-card-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.user-card-trigger {
  cursor: pointer;
  background: transparent;
  border: none;
  padding: 0;
}

.call-nav-btn {
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.85rem;
  font-weight: 600;
}

.call-nav-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

@media (min-width: 768px) {
  .user-card-overlay {
    align-items: center;
  }
}

.media-device-select {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 1rem;
  padding: 0.65rem 0.85rem;
  color: #fff;
  font-size: 0.875rem;
  outline: none;
}

.media-device-select:focus {
  border-color: rgba(139, 92, 246, 0.55);
}

.media-device-select option {
  background: #121218;
  color: #fff;
}

.chat-composer-btn {
  width: 2.25rem;
  height: 2.25rem;
  flex-shrink: 0;
  border-radius: 0.75rem;
  font-size: 1.1rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: background 0.15s;
}

.chat-composer-btn:hover {
  background: rgba(139, 92, 246, 0.25);
}

.chat-emoji-panel {
  position: absolute;
  bottom: calc(100% + 0.35rem);
  left: 0;
  right: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 0.15rem;
  padding: 0.5rem;
  max-height: 10rem;
  overflow-y: auto;
  background: #141414;
  border: 1px solid rgba(139, 92, 246, 0.35);
  border-radius: 1rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
}

.chat-emoji-panel.hidden {
  display: none;
}

.chat-emoji-btn {
  font-size: 1.25rem;
  line-height: 1.2;
  padding: 0.2rem;
  border-radius: 0.5rem;
}

.chat-emoji-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.chat-unread-pill {
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.45);
}

.chat-unread-pill.hidden {
  display: none;
}

.chat-unread-pill--nav {
  position: absolute;
  top: -0.25rem;
  right: -0.15rem;
  min-width: 1rem;
  height: 1rem;
  font-size: 0.6rem;
}

.chat-missed-banner {
  padding: 0.35rem 0.65rem;
  border-radius: 0.65rem;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.chat-channel-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 0.75rem;
  border-radius: 1rem;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s;
}

.chat-channel-link:hover {
  background: rgba(255, 255, 255, 0.05);
}

.chat-channel-link.is-active {
  background: rgba(139, 92, 246, 0.18);
  border-color: rgba(139, 92, 246, 0.35);
}

.chat-friend-row {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  border-radius: 1rem;
  border: 1px solid transparent;
}

.chat-friend-row.is-active {
  background: rgba(139, 92, 246, 0.12);
  border-color: rgba(139, 92, 246, 0.28);
}

.chat-friend-row.has-unread {
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.06);
}

.chat-friend-main {
  text-decoration: none;
  color: inherit;
}

.chat-friend-action {
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.65rem;
  font-size: 0.95rem;
  background: rgba(255, 255, 255, 0.05);
  text-decoration: none;
  transition: background 0.15s;
}

.chat-friend-action:hover {
  background: rgba(139, 92, 246, 0.25);
}

.chat-msg-link {
  color: rgb(196 181 253);
  text-decoration: underline;
  word-break: break-all;
}

.chat-msg-link:hover {
  color: rgb(221 214 254);
}

.chat-video-embed {
  margin: 0.5rem 0 0.15rem;
  max-width: 100%;
}

.chat-video-embed-frame {
  position: relative;
  width: 100%;
  max-width: min(100%, 100%);
  min-width: min(100%, 16rem);
  aspect-ratio: 16 / 9;
  min-height: 9rem;
  border-radius: 0.75rem;
  overflow: hidden;
  background: #000;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-msg-content .chat-video-embed-frame,
.message-own .chat-video-embed-frame {
  max-width: 100%;
}

.chat-video-embed-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.chat-video-play-btn {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: #000;
  cursor: pointer;
  overflow: hidden;
}

.chat-video-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.88;
  transition: opacity 0.15s ease;
}

.chat-video-play-btn:hover .chat-video-thumb {
  opacity: 0.65;
}

.chat-video-play-icon {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 3rem;
  height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  background: rgba(220, 38, 38, 0.92);
  color: #fff;
  font-size: 1.15rem;
  line-height: 1;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.45);
  padding-left: 0.15rem;
}

.chat-video-play-label {
  position: absolute;
  left: 50%;
  bottom: 0.65rem;
  transform: translateX(-50%);
  font-size: 0.7rem;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
  pointer-events: none;
}

.chat-video-embed-frame--playing .chat-video-play-btn {
  display: none;
}

.message-own .chat-video-embed,
.bg-white\/5 .chat-video-embed {
  margin-left: 0;
  margin-right: 0;
}

/* Большое окно видео поверх чата */
.chat-video-lightbox {
  position: fixed;
  inset: 0;
  z-index: 650;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(1rem, env(safe-area-inset-top, 0px)) max(1rem, env(safe-area-inset-right, 0px))
    max(1rem, env(safe-area-inset-bottom, 0px)) max(1rem, env(safe-area-inset-left, 0px));
}

.chat-video-lightbox.hidden {
  display: none !important;
}

body.chat-video-lightbox-open {
  overflow: hidden;
}

.chat-video-lightbox-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  padding: 0;
  margin: 0;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(6px);
  cursor: pointer;
}

.chat-video-lightbox-panel {
  position: relative;
  z-index: 1;
  width: min(96vw, 56rem);
  max-height: min(92vh, 52rem);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.65rem;
}

.chat-video-lightbox-close {
  position: absolute;
  top: -0.25rem;
  right: -0.25rem;
  z-index: 3;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(20, 20, 24, 0.95);
  color: #fff;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.chat-video-lightbox-close:hover {
  background: rgba(220, 38, 38, 0.85);
  border-color: rgba(255, 255, 255, 0.35);
}

.chat-video-lightbox-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: min(78vh, calc(96vw * 9 / 16));
  border-radius: 1rem;
  overflow: hidden;
  background: #000;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.65);
}

.chat-video-lightbox-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.chat-video-lightbox-yt {
  align-self: center;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.55);
  text-decoration: none;
}

.chat-video-lightbox-yt:hover {
  color: rgb(196 181 253);
  text-decoration: underline;
}

@media (max-width: 767px) {
  .chat-video-lightbox-panel {
    width: 100%;
    max-height: 88vh;
  }

  .chat-video-lightbox-close {
    top: 0.25rem;
    right: 0.25rem;
  }
}

.chat-video-embed-link {
  display: inline-block;
  margin-top: 0.35rem;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.45);
  text-decoration: none;
}

.chat-video-embed-link:hover {
  color: rgb(196 181 253);
  text-decoration: underline;
}

.message-own .chat-video-embed-frame {
  border-color: rgba(255, 255, 255, 0.15);
}

.chat-msg-image {
  cursor: zoom-in;
}

.chat-msg-delete {
  padding: 0.1rem 0.35rem;
  border-radius: 0.4rem;
  font-size: 0.85em;
  line-height: 1;
  opacity: 0.45;
  transition: opacity 0.15s, background 0.15s;
}

.chat-msg-delete:hover {
  opacity: 1;
  background: rgba(239, 68, 68, 0.2);
}

.chat-msg-delete:disabled {
  opacity: 0.25;
  cursor: wait;
}

.chat-msg-row--own:hover .chat-msg-delete {
  opacity: 0.75;
}

.app-user-search {
  z-index: 50;
}

.app-user-search-field {
  max-width: 9.5rem;
}

@media (min-width: 640px) {
  .app-user-search-field {
    max-width: 10.5rem;
  }
}

.app-user-search-input {
  width: 100%;
}

.user-search-results {
  position: absolute;
  right: 0;
  left: auto;
  top: calc(100% + 0.35rem);
  width: min(92vw, 320px);
  min-width: 260px;
  max-height: min(60vh, 420px);
  overflow-y: auto;
  background: #141414;
  border: 1px solid rgba(139, 92, 246, 0.35);
  border-radius: 1rem;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.75);
  z-index: 60;
}

.user-search-results.hidden {
  display: none;
}

.user-search-empty {
  padding: 0.85rem 1rem;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.45);
  text-align: center;
}

.user-search-item {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.user-search-item:last-child {
  border-bottom: none;
}

.user-search-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.5rem;
}

.user-search-action {
  font-size: 0.7rem;
  padding: 0.35rem 0.55rem;
  border-radius: 0.55rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s;
}

.user-search-action:hover {
  background: rgba(139, 92, 246, 0.25);
}

.user-search-action--primary {
  border-color: rgba(139, 92, 246, 0.4);
  background: rgba(139, 92, 246, 0.18);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.user-search-section-label {
  padding: 0.5rem 1rem 0.25rem;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(167, 139, 250, 0.85);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.user-search-section-label--users {
  margin-top: 0.35rem;
  color: rgba(255, 255, 255, 0.4);
}

.user-search-item--channel {
  background: rgba(139, 92, 246, 0.06);
}

.chat-channel-link--user.has-unread {
  border-color: rgba(251, 191, 36, 0.35);
}

.chat-channel-link--user .chat-unread-pill {
  flex-shrink: 0;
}

.channel-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.channel-modal.hidden {
  display: none;
}

.channel-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
}

.channel-modal-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 400px);
  padding: 1.25rem 1.35rem;
  border-radius: 1.25rem;
  border: 1px solid rgba(139, 92, 246, 0.35);
  background: #141414;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.85);
}

body.voice-settings-open {
  overflow: hidden;
}

#voice-settings-modal.channel-modal {
  z-index: 400;
}

.server-block {
  border-radius: 0.75rem;
}

.server-settings-btn,
.server-leave-btn {
  flex-shrink: 0;
}

.server-block-head {
  width: 100%;
}

.server-block-toolbar {
  display: flex;
  justify-content: flex-end;
  padding: 0.2rem 0.5rem 0.45rem;
  position: relative;
  z-index: 2;
}

.server-add-sub {
  font-size: 0.625rem;
  line-height: 1.25;
  color: rgb(167 139 250);
  padding: 0.15rem 0.35rem;
  border-radius: 0.375rem;
  transition: color 0.15s ease, background 0.15s ease;
}

.server-add-sub:hover {
  color: rgb(196 181 253);
  background: rgba(139, 92, 246, 0.12);
}

.server-block.is-open .server-block-head {
  margin-bottom: 0.1rem;
}

.channel-settings-members {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.channel-settings-members-list {
  max-height: 12rem;
  overflow-y: auto;
}

.channel-member-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.channel-member-row:last-child {
  border-bottom: 0;
}

.channel-member-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  justify-content: flex-end;
}

.channel-member-btn {
  font-size: 0.625rem;
  padding: 0.2rem 0.45rem;
  border-radius: 0.4rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.65);
  background: rgba(255, 255, 255, 0.04);
}

.channel-member-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.channel-member-btn--danger {
  border-color: rgba(248, 113, 113, 0.35);
  color: rgb(252 165 165);
}

.channel-member-btn--warn {
  border-color: rgba(251, 191, 36, 0.35);
  color: rgb(253 224 71);
}

.user-card-mod-divider {
  width: 100%;
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 0.65rem 0;
}

.server-subchannels {
  border-left: 2px solid rgba(139, 92, 246, 0.2);
  margin-left: 0.65rem;
  padding-left: 0.35rem;
}

.chat-subchannel-link {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.55rem;
  border-radius: 0.65rem;
  color: rgba(255, 255, 255, 0.72);
  text-decoration: none;
  transition: background 0.15s ease;
}

.chat-subchannel-link:hover {
  background: rgba(255, 255, 255, 0.06);
}

.chat-subchannel-link.is-active {
  background: rgba(139, 92, 246, 0.22);
  color: #fff;
}

.chat-subchannel-link.has-unread {
  border: 1px solid rgba(251, 191, 36, 0.25);
}

.chat-subchannel-icon {
  flex-shrink: 0;
  font-size: 0.85rem;
}

@keyframes server-hub-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.animate-server-hub-in {
  animation: server-hub-in 0.35s ease-out;
}

.server-hub-room {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.85rem 1rem;
  border-radius: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  text-decoration: none;
  color: inherit;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.server-hub-room:hover {
  background: rgba(139, 92, 246, 0.12);
  border-color: rgba(139, 92, 246, 0.35);
  transform: translateY(-1px);
}

.server-hub-room--voice {
  border-color: rgba(16, 185, 129, 0.25);
}

.server-hub-room--voice:hover {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.45);
}

.admin-tabs {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 0.25rem;
}

.admin-tab {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1rem;
  border-radius: 0.75rem 0.75rem 0 0;
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.5);
  text-decoration: none;
  transition: color 0.15s ease, background 0.15s ease;
}

.admin-tab:hover {
  color: rgba(255, 255, 255, 0.85);
}

.admin-tab.is-active {
  color: #c4b5fd;
  background: rgba(139, 92, 246, 0.15);
}

.admin-filter {
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.55);
  text-decoration: none;
}

.admin-filter.is-active {
  border-color: rgba(139, 92, 246, 0.45);
  color: #c4b5fd;
  background: rgba(139, 92, 246, 0.12);
}

.admin-report-card {
  padding: 1rem;
  border-radius: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.admin-report-card--pending {
  border-color: rgba(251, 191, 36, 0.35);
  background: rgba(251, 191, 36, 0.05);
}

.admin-report-status {
  display: inline-block;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.45);
}

.admin-report-status--pending {
  color: #fcd34d;
}

.admin-report-screenshot {
  max-width: 100%;
  object-fit: contain;
}

.admin-btn {
  padding: 0.4rem 0.85rem;
  border-radius: 0.65rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.8);
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
  white-space: nowrap;
}

.admin-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.admin-btn--danger {
  border-color: rgba(248, 113, 113, 0.4);
  color: #fecaca;
  background: rgba(239, 68, 68, 0.12);
}

.admin-btn--danger:hover {
  background: rgba(239, 68, 68, 0.22);
}

.admin-banned-row {
  transition: background 0.15s ease;
}

.admin-banned-row:hover {
  background: rgba(255, 255, 255, 0.07);
}

.server-hub-room-icon {
  font-size: 1.35rem;
  flex-shrink: 0;
}

.voice-server-rail .chat-subchannel-link.is-active {
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid rgba(16, 185, 129, 0.35);
}

