:root {
  --bg: #06060c;
  --surface: rgba(255, 255, 255, 0.06);
  --surface-card: rgba(255, 255, 255, 0.03);
  --border: rgba(255, 255, 255, 0.09);
  --border-soft: rgba(255, 255, 255, 0.08);
  --text: #ffffff;
  --muted: rgba(255, 255, 255, 0.45);
  --accent: #8b5cf6;
  --accent2: #3b82f6;
  --speaking: #22c55e;
  --danger: #ef4444;
  --radius: 12px;
  --radius-card: 20px;
  --font: 'Outfit', -apple-system, sans-serif;
  --ctrl-h: 38px;
  --pill-h: 40px;
}

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

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.hidden,
.dn {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  clip-path: inset(50%);
  overflow: hidden;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  white-space: nowrap;
}

/* ───────────── Scrollbar (ідентичний Cortex) ───────────── */
.screen-scroll,
.peers-grid,
.pm-list {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
}

@supports not (scrollbar-color: auto) {
  ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
  }

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

  ::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.28);
    border-radius: 99px;
    border: 2px solid transparent;
    background-clip: padding-box;
  }

  ::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.42);
  }
}

/* ───────────── Загальні скляні контейнери ───────────── */
.screen-scroll {
  position: absolute;
  inset: 0;
  overflow-x: clip;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg);
}

.center-shell {
  width: 100%;
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.glass-card {
  background: var(--surface-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-card);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.auth-card,
.preview-card {
  width: 100%;
  max-width: 420px;
  padding: 32px 26px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.25);
}

.brand-icon-sm {
  border-radius: 7px;
  display: block;
}

.logo {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.25;
  flex-shrink: 0;
  background: linear-gradient(135deg, #ffffff 12%, #c4b5fd 62%, #93c5fd 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 12px rgba(139, 92, 246, 0.28));
}

.logo-lg {
  font-size: 28px;
}

.logo-sm {
  font-size: 18px;
}

.card-desc {
  font-size: 0.94rem;
  color: var(--muted);
  font-weight: 400;
  line-height: 1.55;
}

.ico {
  width: 20px;
  height: 20px;
  display: block;
  flex-shrink: 0;
}

.ico-sm {
  width: 17px;
  height: 17px;
  display: block;
  flex-shrink: 0;
}

.ico-xs {
  width: 14px;
  height: 14px;
  display: block;
  flex-shrink: 0;
}

/* ───────────── Форми, інпути, кнопки (як у Cortex) ───────────── */
.vx-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.vx-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.vx-label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.58);
}

.vx-input,
.vx-select {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: max(1rem, 1em);
  outline: none;
  transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.vx-select {
  cursor: pointer;
  color-scheme: dark;
}

.vx-select option {
  background: #0d0d17;
  color: #ffffff;
}

.vx-input-pill {
  border-radius: 9999px;
  padding: 8px 18px;
  min-height: 42px;
}

.vx-input::placeholder {
  color: rgba(255, 255, 255, 0.35);
}

.vx-input:hover,
.vx-select:hover {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.07);
}

.vx-input:focus-visible,
.vx-select:focus-visible {
  border-color: rgba(139, 92, 246, 0.65);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.18);
}

.vx-input:user-invalid {
  border-color: rgba(239, 68, 68, 0.65);
}

.input-with-btn {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-btn .vx-input {
  padding-right: 46px;
}

.input-eye-btn {
  position: absolute;
  right: 6px;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: none;
  background: transparent;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.input-eye-btn:hover,
.input-eye-btn[aria-pressed="true"] {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.input-eye-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.form-error {
  font-size: 0.86rem;
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.28);
  border-radius: 10px;
  padding: 9px 12px;
}

.vx-hint {
  font-size: 0.8rem;
  color: #fcd34d;
  line-height: 1.45;
  margin-top: 2px;
}

.vx-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 20px;
  border-radius: 9999px;
  font-family: var(--font);
  font-size: 0.92rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.15s ease;
}

.vx-btn:focus-visible,
.pill-btn:focus-visible,
.dock-btn:focus-visible,
.dock-caret-btn:focus-visible,
.hud-icon-btn:focus-visible,
.pm-close-btn:focus-visible,
.pm-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.vx-btn:active,
.pill-btn:active,
.dock-btn:active {
  transform: scale(0.97);
}

.vx-btn-full {
  width: 100%;
}

.vx-btn-primary {
  background: rgba(255, 255, 255, 0.92);
  color: #06060c;
  border: 1px solid transparent;
}

.vx-btn-primary:hover {
  background: #ffffff;
}

.vx-btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.vx-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.11);
  border-color: rgba(255, 255, 255, 0.24);
  color: #ffffff;
}

.vx-btn-danger-soft {
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.vx-btn-danger-soft:hover {
  background: rgba(239, 68, 68, 0.22);
  color: #fecaca;
}

/* ───────────── Sticky Header та Lobby (як у Cortex) ───────────── */
.app-header {
  width: 100%;
  background: rgba(6, 6, 12, 0.55);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  justify-content: center;
}

.header-inner {
  max-width: 900px;
  width: 100%;
  height: 64px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.88);
  font-family: var(--font);
  font-size: 0.86rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.15s ease;
}

.pill-btn:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}

.pill-btn[aria-pressed="true"] {
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.35);
  color: #fecaca;
}

.pill-btn-accent {
  background: rgba(139, 92, 246, 0.16);
  border-color: rgba(167, 139, 250, 0.32);
  color: #ddd6fe;
}

.pill-btn-accent:hover {
  background: rgba(139, 92, 246, 0.28);
  border-color: rgba(196, 181, 253, 0.55);
  color: #ffffff;
}

.mini-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #ffffff;
}

.lobby-container {
  max-width: 900px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 28px 24px 48px;
}

.hero-card {
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.hero-copy {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hero-title {
  font-size: clamp(1.5rem, 3.6vw, 2.05rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
  background: linear-gradient(135deg, #fff 0%, rgba(255, 255, 255, 0.7) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.join-inline-form {
  flex: 1;
  min-width: 240px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.recent-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 2px;
}

.section-title {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: rgba(255, 255, 255, 0.92);
}

.section-hint {
  font-size: 0.82rem;
  color: var(--muted);
}

.recent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.room-card {
  background: var(--surface-card);
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.18s ease;
}

.room-card:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
}

.room-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.room-card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-card-code {
  font-size: 0.78rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.room-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.room-card-actions .vx-btn {
  min-height: 34px;
  padding: 0 14px;
  font-size: 0.84rem;
}

.icon-chip-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.72);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.icon-chip-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.24);
  color: #ffffff;
}

.icon-chip-btn.danger:hover {
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(239, 68, 68, 0.35);
  color: #fecaca;
}

/* ───────────── Екран перед входом за інвайт-лінком ───────────── */
.preview-badge {
  align-self: flex-start;
  padding: 4px 10px;
  border-radius: 9999px;
  background: rgba(139, 92, 246, 0.18);
  border: 1px solid rgba(167, 139, 250, 0.32);
  color: #ddd6fe;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.preview-room-name {
  font-size: 1.65rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.preview-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.preview-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

/* ───────────── Кімната (Макет Discord + Стиль Cortex) ───────────── */
.room-shell {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.room-topbar {
  height: 58px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(6, 6, 12, 0.68);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  flex-shrink: 0;
  z-index: 20;
}

.room-top-left,
.room-top-right {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.top-brand-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 8px;
  transition: background-color 0.15s ease;
}

.top-brand-btn:hover {
  background: rgba(255, 255, 255, 0.06);
}

.top-sep {
  color: rgba(255, 255, 255, 0.22);
  user-select: none;
}

.room-code-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 12px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.09);
  color: rgba(255, 255, 255, 0.9);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  min-width: 0;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.room-code-chip:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.2);
}

.room-code-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fbbf24;
  box-shadow: 0 0 8px rgba(251, 191, 36, 0.6);
  flex-shrink: 0;
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.status-dot.connected {
  background: var(--speaking);
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.7);
}

.status-dot.error {
  background: var(--danger);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.7);
}

.count-badge {
  font-size: 0.78rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding: 3px 8px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.7);
}

.bt-warning {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 9999px;
  background: rgba(245, 158, 11, 0.14);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #fcd34d;
  cursor: help;
}

/* ───────────── Основна сцена кімнати ───────────── */
.room-main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 18px 24px 96px;
  position: relative;
  overflow: hidden;
}

.room-main.has-stream {
  justify-content: flex-start;
  padding-top: 14px;
}

/* Сцена стріму екрана (в стилі плеєра Cortex + glow) */
.stream-stage {
  width: 100%;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stream-glow-wrap {
  position: relative;
  height: 100%;
  max-height: 100%;
  width: 100%;
  max-width: min(calc((100vh - 285px) * 16 / 9), 1180px);
  aspect-ratio: 16 / 9;
}

.glow-canvas {
  position: absolute;
  inset: -64px;
  width: calc(100% + 128px);
  height: calc(100% + 128px);
  filter: blur(130px) saturate(1.6) brightness(0.75);
  opacity: 0.38;
  pointer-events: none;
  z-index: 0;
  transform: scale(1.25);
}

.video-shell {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: var(--radius);
  overflow: hidden;
  background: #040408;
  z-index: 1;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.08);
}

#stream-video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  background: #040408;
}

.self-stream-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: radial-gradient(circle at 50% 42%, rgba(139, 92, 246, 0.14), rgba(6, 6, 12, 0.96) 72%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  text-align: center;
}

.self-stream-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.9rem;
  font-weight: 600;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.8);
}

.stream-hud-top,
.stream-hud-bottom {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 4;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.stream-hud-top {
  top: 0;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.72), transparent);
}

.stream-hud-bottom {
  bottom: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.78), transparent);
}

.video-shell:hover .stream-hud-top,
.video-shell:hover .stream-hud-bottom,
.video-shell:focus-within .stream-hud-top,
.video-shell:focus-within .stream-hud-bottom {
  opacity: 1;
}

.stream-hud-top > *,
.stream-hud-bottom > * {
  pointer-events: auto;
}

.stream-hud-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.live-pill {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(239, 68, 68, 0.9);
  color: #ffffff;
}

.stream-owner {
  font-size: 0.88rem;
  font-weight: 600;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}

.stats-badge {
  font-size: 0.75rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  padding: 3px 9px;
  border-radius: 9999px;
  background: rgba(10, 10, 18, 0.7);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.85);
}

.stream-switcher {
  display: flex;
  align-items: center;
  gap: 6px;
}

.stream-switch-pill {
  height: 28px;
  padding: 0 10px;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(10, 10, 18, 0.72);
  color: rgba(255, 255, 255, 0.78);
  font-family: var(--font);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
}

.stream-switch-pill.active {
  background: rgba(139, 92, 246, 0.38);
  border-color: rgba(196, 181, 253, 0.6);
  color: #ffffff;
}

.stream-vol-box {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stream-hud-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.hud-icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(10, 10, 18, 0.65);
  backdrop-filter: blur(10px);
  color: rgba(255, 255, 255, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.hud-icon-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

.hud-icon-btn[aria-pressed="true"] {
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.45);
}

/* ───────────── Сітка учасників (Discord Voice Grid + Cortex Glass) ───────────── */
.peers-grid {
  width: 100%;
  max-width: 980px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 260px));
  justify-content: center;
  gap: 16px;
  overflow-y: auto;
  padding: 4px;
}

.room-main.has-stream .peers-grid {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  gap: 10px;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  flex-shrink: 0;
  padding: 4px 8px;
}

.peer-card {
  position: relative;
  background: var(--surface-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-card);
  padding: 24px 18px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.42);
  transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.peer-card.is-speaking {
  border-color: rgba(34, 197, 94, 0.55);
  background: rgba(34, 197, 94, 0.04);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45), 0 0 24px rgba(34, 197, 94, 0.12);
}

.room-main.has-stream .peer-card {
  flex-direction: row;
  padding: 8px 12px;
  border-radius: 9999px;
  gap: 10px;
  min-width: 150px;
  max-width: 240px;
  flex-shrink: 0;
}

.peer-avatar-ring {
  position: relative;
  width: 78px;
  height: 78px;
  border-radius: 50%;
  padding: 3px;
  background: rgba(255, 255, 255, 0.08);
  transition: box-shadow 0.12s ease, background-color 0.12s ease;
  flex-shrink: 0;
}

.peer-card.is-speaking .peer-avatar-ring {
  background: var(--speaking);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.25), 0 0 18px rgba(34, 197, 94, 0.5);
}

.room-main.has-stream .peer-avatar-ring {
  width: 38px;
  height: 38px;
  padding: 2px;
}

.peer-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.55rem;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  user-select: none;
  border: 2px solid var(--bg);
}

.room-main.has-stream .peer-avatar {
  font-size: 0.95rem;
  border-width: 1.5px;
}

.peer-status-badges {
  position: absolute;
  right: -2px;
  bottom: -2px;
  display: flex;
  gap: 3px;
}

.peer-badge {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #12121e;
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  color: #fca5a5;
  display: flex;
  align-items: center;
  justify-content: center;
}

.peer-badge svg {
  width: 12px;
  height: 12px;
}

.room-main.has-stream .peer-badge {
  width: 16px;
  height: 16px;
}

.room-main.has-stream .peer-badge svg {
  width: 9px;
  height: 9px;
}

.peer-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
  width: 100%;
}

.room-main.has-stream .peer-meta {
  align-items: flex-start;
  width: auto;
  flex: 1;
}

.peer-name-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  max-width: 100%;
}

.peer-name {
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-main.has-stream .peer-name {
  font-size: 0.84rem;
}

.peer-you-tag {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 9999px;
  background: rgba(139, 92, 246, 0.22);
  color: #ddd6fe;
  flex-shrink: 0;
}

.peer-live-tag {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(239, 68, 68, 0.85);
  color: #ffffff;
  flex-shrink: 0;
}

.peer-vol-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
  padding: 4px 8px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.room-main.has-stream .peer-vol-row {
  display: none;
}

.peer-vol-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.65);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
}

.peer-vol-btn:hover {
  color: #ffffff;
}

.peer-vol-btn.muted {
  color: #fca5a5;
}

.vx-range {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  min-width: 72px;
  height: 3px;
  background: rgba(255, 255, 255, 0.22);
  border-radius: 99px;
  outline: none;
  cursor: pointer;
}

.vx-range::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #ffffff;
  cursor: pointer;
}

.vx-range::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border: none;
  border-radius: 50%;
  background: #ffffff;
  cursor: pointer;
}

/* ───────────── Нижня скляна панель керування (Control Dock) ───────────── */
.control-dock-wrap {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 18px;
  display: flex;
  justify-content: center;
  padding: 0 16px;
  z-index: 30;
  pointer-events: none;
}

.control-dock {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 9999px;
  background: rgba(14, 14, 24, 0.86);
  backdrop-filter: blur(24px) saturate(1.5);
  -webkit-backdrop-filter: blur(24px) saturate(1.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.72), 0 0 0 1px rgba(139, 92, 246, 0.08);
}

.dock-split {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 9999px;
  padding-right: 4px;
}

.dock-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 42px;
  padding: 0 15px;
  border: none;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.88);
  font-family: var(--font);
  font-size: 0.86rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.16s ease, color 0.16s ease, transform 0.14s ease;
}

.dock-split .dock-btn {
  background: transparent;
}

.dock-btn:hover {
  background: rgba(255, 255, 255, 0.13);
  color: #ffffff;
}

.dock-btn[aria-pressed="true"] {
  background: rgba(239, 68, 68, 0.22);
  color: #fecaca;
}

#btn-screen[aria-pressed="true"] {
  background: rgba(139, 92, 246, 0.34);
  color: #ede9fe;
}

.dock-caret-btn {
  width: 28px;
  height: 32px;
  border: none;
  border-radius: 9999px;
  background: transparent;
  color: rgba(255, 255, 255, 0.6);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.dock-caret-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.dock-btn-danger {
  background: rgba(239, 68, 68, 0.88);
  color: #ffffff;
}

.dock-btn-danger:hover {
  background: #ef4444;
}

/* ───────────── Модальні діалоги (Cortex .pm-card + native dialog) ───────────── */
.vx-dialog {
  margin: auto;
  border: none;
  padding: 0;
  background: transparent;
  max-width: min(380px, calc(100vw - 32px));
  width: 100%;
  color: var(--text);
  overflow: visible;
}

.vx-dialog::backdrop {
  background: rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  overflow: hidden;
  overscroll-behavior: contain;
}

.vx-dialog:modal {
  overscroll-behavior: contain;
}

.pm-card {
  background: rgba(12, 12, 22, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  width: 100%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(139, 92, 246, 0.12);
  animation: pm-slide-up 0.2s cubic-bezier(0.34, 1.3, 0.64, 1);
}

@keyframes pm-slide-up {
  from {
    transform: translateY(20px) scale(0.96);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.pm-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  flex-shrink: 0;
}

.pm-title {
  font-size: 12px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.45);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.pm-close-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.38);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: 8px;
  transition: color 0.15s, background-color 0.15s;
}

.pm-close-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.pm-list {
  overflow-y: auto;
  padding: 10px;
  flex: 1;
  overscroll-behavior: contain;
}

.vx-dialog-body {
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.vx-dialog-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.pm-item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 13px 16px;
  border: none;
  background: transparent;
  border-radius: 12px;
  cursor: pointer;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.78);
  text-align: left;
  transition: background-color 0.12s, color 0.12s;
}

.pm-item:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #ffffff;
}

.pm-item.pm-active {
  color: #c4b5fd;
  background: rgba(139, 92, 246, 0.14);
}

.pm-radio {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pm-item.pm-active .pm-radio {
  background: var(--accent);
  border-color: var(--accent);
}

.pm-radio-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ffffff;
  opacity: 0;
}

.pm-item.pm-active .pm-radio-dot {
  opacity: 1;
}

.pm-item-label {
  flex: 1;
  min-width: 0;
}

.pm-item-badge {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.55);
}

/* ───────────── Тост ───────────── */
.vx-toast {
  position: fixed;
  top: 74px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  padding: 9px 16px;
  border-radius: 9999px;
  background: rgba(14, 14, 24, 0.92);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.65);
  color: #ffffff;
  font-size: 0.86rem;
  font-weight: 500;
  pointer-events: none;
}

@media (max-width: 640px) {
  .header-inner {
    padding: 0 16px;
  }

  .lobby-container {
    padding: 18px 16px 36px;
  }

  .hero-card {
    padding: 20px;
  }

  .room-topbar {
    padding: 0 12px;
  }

  .room-main {
    padding: 12px 12px 92px;
  }

  .dock-label {
    display: none;
  }

  .dock-btn {
    padding: 0 13px;
  }

  .peers-grid {
    grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
    gap: 10px;
  }

  .peer-card {
    padding: 18px 12px 14px;
  }

  .peer-avatar-ring {
    width: 62px;
    height: 62px;
  }
}
