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

.hidden {
  display: none !important;
}

:root {
  /* ═══════════════════════════════════════════════════════
     ТЕМА: DEFAULT DARK (Материал You, тёмная)
     Чтобы поменять тему — измените значения переменных ниже
     или подключите файл themes.css и добавьте класс на <html>
     ═══════════════════════════════════════════════════════ */

  /* — Фоны и поверхности — */
  --color-bg: #111111;
  --color-surface: #111111;
  --color-surface-container: #1A1A1A;
  --color-surface-high: #242424;
  --color-surface-highest: #333333;
  --color-surface-island: #2B2930;
  --color-surface-input: #1E1E1E;
  --color-surface-card: #1A1A1A;
  --color-surface-overlay: #211E26;
  --color-surface-toast: #312E3A;

  /* — Основной акцент (primary) — */
  --color-primary: #B19CD9;
  --color-primary-dim: #EADDFF;
  --color-primary-container: #312B3D;
  --color-primary-on: #381E72;

  /* — Вторичный акцент — */
  --color-secondary-container: #2A2A2A;
  --color-secondary-on: #E6E0E9;

  /* — Tertiary / розовый — */
  --color-tertiary: #EFB8C8;
  --color-tertiary-on: #492532;

  /* — Текст — */
  --color-text: #E6E0E9;
  --color-text-muted: #9E9E9E;
  --color-text-bright: #fff;
  --color-text-disabled: #888;
  --color-text-hint: #666;

  /* — Обводки / разделители — */
  --color-outline: #938F99;
  --color-outline-variant: #49454F;
  --color-divider: rgba(255, 255, 255, 0.06);
  --color-divider-strong: rgba(255, 255, 255, 0.1);

  /* — Статусные цвета — */
  --color-success: #4ade80;
  --color-success-dim: #a5f5c8;
  --color-success-bg: rgba(74, 222, 128, 0.1);
  --color-success-border: rgba(74, 222, 128, 0.35);
  --color-success-glow: rgba(74, 222, 128, 0.5);
  --color-warning: #f59e0b;
  --color-warning-dim: #fbbf24;
  --color-warning-bg: rgba(245, 158, 11, 0.1);
  --color-warning-border: rgba(245, 158, 11, 0.35);
  --color-warning-glow: rgba(245, 158, 11, 0.5);
  --color-error: #F2B8B5;
  --color-error-solid: #ef4444;
  --color-error-hover: #b71c1c;
  --color-error-bg: rgba(239, 68, 68, 0.1);
  --color-error-border: rgba(239, 68, 68, 0.35);
  --color-error-on: #601410;
  --color-error-container: #3F1D1D;
  --color-error-container-on: #F9DEDC;

  /* — Специальные цвета — */
  --color-youtube: #FF0000;
  --color-danger: #984061;

  /* — Скроллбар — */
  --color-scrollbar-track: #1a1a1a;
  --color-scrollbar-thumb: #333;
  --color-scrollbar-hover: #444;

  /* — Типографика — */
  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-brand: 'Montserrat', sans-serif;
  --font-label: 'Roboto', sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', monospace;

  /* — Форма / скругления — */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 28px;
  --radius-full: 100px;

  /* — Анимации — */
  --easing-emphasized: cubic-bezier(0.2, 0.0, 0, 1.0);
  --duration-long: 0.5s;

  /* ── Алиасы (для обратной совместимости с M3) ── */
  --md-sys-color-background: var(--color-bg);
  --md-sys-color-surface: var(--color-surface);
  --md-sys-color-surface-container: var(--color-surface-container);
  --md-sys-color-surface-container-high: var(--color-surface-high);
  --md-sys-color-surface-container-highest: var(--color-surface-highest);
  --md-sys-color-primary: var(--color-primary);
  --md-sys-color-on-primary: var(--color-primary-on);
  --md-sys-color-primary-container: var(--color-primary-container);
  --md-sys-color-on-primary-container: var(--color-primary-dim);
  --md-sys-color-secondary-container: var(--color-secondary-container);
  --md-sys-color-on-secondary-container: var(--color-secondary-on);
  --md-sys-color-tertiary: var(--color-tertiary);
  --md-sys-color-on-tertiary: var(--color-tertiary-on);
  --md-sys-color-on-surface: var(--color-text);
  --md-sys-color-on-surface-variant: var(--color-text-muted);
  --md-sys-color-outline: var(--color-outline);
  --md-sys-color-outline-variant: var(--color-outline-variant);
  --md-sys-color-error: var(--color-error);
  --md-sys-color-on-error: var(--color-error-on);
  --md-sys-shape-corner-medium: var(--radius-md);
  --md-sys-shape-corner-large: var(--radius-lg);
  --md-sys-shape-corner-extra-large: var(--radius-xl);
  --md-sys-shape-corner-full: var(--radius-full);
  --md-sys-motion-easing-emphasized: var(--easing-emphasized);
  --md-sys-motion-duration-long2: var(--duration-long);

  /* — Brand / Logo (Expressive Gradient) — */
  --color-logo-stop-1: #D0BCFF; /* Primary */
  --color-logo-stop-2: #B19CD9; /* Slightly darker */
  --color-logo-stop-3: #9275B2; /* Muted primary */
  --color-logo-glow:   rgba(208, 188, 255, 0.25);
}

svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
  display: block;

  pointer-events: none;

  transition: transform 0.3s ease, opacity 0.3s ease;
}

.control-btn svg {
  width: 28px;
  height: 28px;
}

/* Stroke-стиль для иконок демонстрации экрана */
#shareBtn svg,
#stopShareBtn svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8px;
  stroke-linecap: round;
  stroke-linejoin: round;
  width: 24px;
  height: 24px;
}

.control-btn.hang-btn svg {
  width: 32px;
  height: 32px;
  fill: var(--color-text-bright);
}

.btn-icon-bg svg {
  width: 32px;
  height: 32px;
}

/* Вращение спиннера */
.animate-spin {
  animation: spin 1s linear infinite;
  transform-origin: center;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: background-color 0.3s ease, border-color 0.3s ease, transform 0.2s ease, opacity 0.3s ease;
  scrollbar-width: thin;
  scrollbar-color: var(--color-scrollbar-thumb) var(--color-scrollbar-track);
}

*::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

*::-webkit-scrollbar-track {
  background: var(--color-scrollbar-track);
  border-radius: 3px;
}

*::-webkit-scrollbar-thumb {
  background: var(--color-scrollbar-thumb);
  border-radius: 3px;
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--color-scrollbar-hover);
}

html {
  height: 100%;
  width: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  background: var(--md-sys-color-background);
  color: var(--md-sys-color-on-surface);
  font-family: var(--font-ui);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  overflow-x: hidden;
}

/* --- Canvas & Layout --- */

.background-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.6;
}

.container {
  max-width: 440px;
  width: 100%;
  position: relative;
  z-index: 20000 !important;
}

.hidden {
  display: none !important;
}

/* =================================================================
   NEW MATERIAL 3 HEADER (CLEAN CAPSULES)
   ================================================================= */

body.mode-call .app-header {
  position: fixed !important;
  top: 16px !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important; /* Расстояние между капсулами */
  
  width: auto !important;
  height: 48px !important;
  margin: 0 !important;
  padding: 0 !important;
  z-index: 22000;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

/* Общий стиль для всех "островков" в хедере */
body.mode-call .main-island,
body.mode-call .header-extras-btn {
  background: var(--color-surface-high) !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
  border-radius: 24px !important; /* M3 Shape */
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important;
  height: 100% !important;
  display: inline-flex !important;
  align-items: center !important;
  transition: all 0.3s cubic-bezier(0.2, 0, 0, 1) !important;
}

/* Левый островок (Таймер + Участники) */
body.mode-call .main-island {
  padding: 0 16px !important;
  gap: 12px !important;
}

/* Правый островок (Кнопка Дополнения) */
body.mode-call .header-extras-btn {
  width: auto !important;
  min-width: 48px !important;
  padding: 0 16px !important;
  cursor: pointer !important;
  color: var(--color-primary) !important;
  text-decoration: none !important;
}

body.mode-call .header-extras-btn:hover {
  background: var(--color-surface-highest) !important;
  transform: translateY(-1px);
}

body.mode-call .header-extras-btn:active {
  transform: scale(0.95);
}

/* Иконка внутри кнопки дополнений */
.header-extras-btn .invite-icon-box {
  display: flex !important;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin: 0 !important;
  flex-shrink: 0;
}

.header-extras-btn .invite-icon-box svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  position: static !important; /* Сброс старых стилей */
  transform: none !important;
}

/* Текст "Дополнения" */
.header-extras-btn .invite-text {
  font-family: var(--font-label);
  font-size: 14px;
  font-weight: 600;
  margin-left: 8px;
  color: inherit;
  display: inline-block;
}

/* Разделитель внутри левого островка */
body.mode-call .header-separator {
  display: block !important;
  width: 1px !important;
  height: 16px !important;
  background: rgba(255, 255, 255, 0.15) !important;
  margin: 0 !important;
}

/* ══════════════════════════════════════════════
   АДАПТИВНОСТЬ (МОБИЛКА / ОКОННЫЙ РЕЖИМ)
   ══════════════════════════════════════════════ */

@media (max-width: 768px) {
  /* Схлопываем кнопку дополнений в круг */
  body.mode-call .header-extras-btn {
    width: 48px !important;
    padding: 0 !important;
    justify-content: center !important;
  }

  body.mode-call .header-extras-btn .invite-text {
    display: none !important; /* Убираем текст, оставляем только иконку */
  }
  
  body.mode-call .header-extras-btn .invite-icon-box {
    margin: 0 !important;
  }

  /* Чуть компактнее левый островок */
  body.mode-call .main-island {
    padding: 0 12px !important;
    gap: 8px !important;
  }
}

/* --- КНОПКА ПРИГЛАШЕНИЯ (M3 Filled/Tonal Button) --- */
.header-invite-btn {
  display: flex;
  align-items: center;
  gap: 10px;


  background: var(--color-surface-high) !important;


  color: var(--color-secondary-on) !important;


  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  padding: 0 20px 0 16px;

  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.2, 0.0, 0, 1.0);
  height: 44px;
  /* Larger touch target */
  margin-left: 8px;

  font-family: var(--font-label);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.1px;

  overflow: hidden;
  position: relative;
}

.header-invite-btn:hover {
  background: var(--color-secondary-container) !important;

  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.15) !important;
}

.header-invite-btn:active {
  transform: scale(0.96) translateY(0);
  background: var(--color-surface-highest) !important;
}

.invite-icon-box {
  width: 24px;
  height: 24px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 8px;
  color: inherit;
}

.invite-icon-box svg {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  transform: translate(-50%, -50%) scale(1) rotate(0deg);
}

.invite-icon-box .icon-link {
  opacity: 1;
}

.invite-icon-box .icon-check {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.5) rotate(-45deg);
}

/* === STATE: COPIED === */
.header-invite-btn.copied {

  background: var(--color-success-bg) !important;

  color: var(--color-success-dim) !important;
  /* Light Green Text */
  border-color: var(--color-success-border) !important;
  padding-right: 24px;

}

.header-invite-btn.copied:hover {
  background: rgba(74, 222, 128, 0.07) !important;
  box-shadow: 0 0 15px rgba(74, 222, 128, 0.2);
}

.header-invite-btn.copied .icon-link {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.5) rotate(45deg);
}

.header-invite-btn.copied .icon-check {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1) rotate(0deg);
  stroke: var(--color-success) !important;
  fill: var(--color-success);
}

.header-invite-btn.copied .invite-text {
  color: var(--color-success-dim) !important;
}

.invite-text {
  font-size: 14px;
  font-weight: 500;
  color: inherit;
  padding-right: 0;
  transition: color 0.3s ease;
}

.header-invite-btn.hidden {
  display: none !important;
}

@media (max-width: 768px) {

  /* ── ТОП-ОСТРОВКИ (МОБИЛЬНАЯ ВЕРСИЯ) ── */
  body.mode-call .app-header {
    position: fixed !important;
    top: 20px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: auto !important;
    height: 48px !important;
    margin: 0 !important;
    z-index: 22000 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-wrap: nowrap !important;
    white-space: nowrap !important;
    gap: 10px !important;
    padding: 0 !important;
    /* Убираем фон родителя */
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  body.mode-call .main-island,
  body.mode-call .header-extras-btn {
    backdrop-filter: blur(24px) saturate(200%) !important;
    -webkit-backdrop-filter: blur(24px) saturate(200%) !important;
    border-radius: 999px !important;
    box-shadow: 0 4px 28px rgba(0, 0, 0, 0.55) !important;
    display: inline-flex !important;
    align-items: center !important;
    height: 100% !important;
  }

  body.mode-call .main-island {
    background: rgba(20, 18, 24, 0.92) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    padding: 10px 18px !important;
    gap: 10px !important;
  }

  body.mode-call .header-extras-btn {
    width: 48px !important; /* Делаем ширину равной высоте */
    height: 48px !important;
    padding: 0 !important;   /* Убираем боковые отступы, чтобы иконка была в центре */
    flex-shrink: 0;
  }

  body.mode-call .header-extras-btn .invite-text {
    display: none !important; /* Скрываем надпись */
  }

  body.mode-call .header-extras-btn .invite-icon-box {
    margin: 0 !important;
    width: 100% !important;
    height: 100% !important;
  }

  body.mode-call .header-extras-btn {
    width: 44px !important;
    height: 44px !important;
    padding: 0 !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
  }

body.mode-call .header-extras-btn .invite-text {
  display: none !important;
}

body.mode-call .header-extras-btn .invite-icon-box {
  margin: 0 !important;
  display: flex !important;
}

  body.mode-call .header-extras-btn .invite-icon-box {
    margin: 0 !important;
    width: 20px !important;
    height: 20px !important;
  }

  body.mode-call .header-extras-btn svg {
    width: 20px !important;
    height: 20px !important;
  }
}

/* --- Timers & Badges --- */
.call-timer {
  font-family: var(--font-label) !important;
  font-size: 15px !important;
  font-weight: 500 !important;
  color: var(--color-text) !important;
  padding: 0 !important;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.1px !important;
  position: static !important;
  transform: none !important;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  opacity: 1;
  margin: 0 !important;
  height: auto !important;
  min-width: auto !important;
  border-left: none !important;
  border-radius: 0 !important;
  line-height: 1 !important;
  contain: layout;
}

/* ── Timer tick animation (CSS class, не блокирует клики) ── */
@keyframes m3-time-in {
  from {
    opacity: 1;
    transform: scale(0.96);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.call-timer.timer-tick {
  animation: m3-time-in 0.18s cubic-bezier(0.34, 1.4, 0.64, 1) forwards;
}

/* ── View Transition: Status morphing ── */
::view-transition-old(m3-status-box) {
  animation: m3-status-fade-out 0.2s ease-in forwards;
}

::view-transition-new(m3-status-box) {
  animation: m3-status-fade-in 0.3s ease-out forwards;
}

@keyframes m3-status-fade-out {
  to {
    opacity: 0;
    transform: scale(0.98);
  }
}

@keyframes m3-status-fade-in {
  from {
    opacity: 0;
    transform: scale(1.02);
  }
}

.call-timer.hidden {
  display: none !important;
}

.participant-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--md-sys-color-secondary-container) !important;
  color: var(--md-sys-color-on-primary-container) !important;
  border: none !important;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 13px;
  margin-top: 8px;
  pointer-events: auto;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform-origin: center;
}

body.mode-call .participant-badge svg {
  width: 18px !important;
  height: 18px !important;
  margin-right: 6px;
  stroke-width: 2px;
  opacity: 1;
  display: block;
}

body.mode-call .participant-badge span {
  font-family: var(--font-label);
  font-weight: 500;
  font-size: 14px;
  line-height: 1;
  padding: 0;
  margin: 0;
}

body.mode-call .participant-badge.full {
  color: var(--color-primary) !important;
}

body.mode-call .participant-badge.full svg {
  opacity: 1;
}

.participant-badge.hidden {
  display: none;
}

.participant-badge:not(.full):not(.hidden) {

  animation: none;
}

.participant-badge.pop-anim {
  animation: badgePop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
}

@keyframes badgePop {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.15);
  }


  100% {
    transform: scale(1);
  }
}

.participant-badge.exit-anim {
  animation: badgeExit 0.5s cubic-bezier(0.33, 1, 0.68, 1) !important;
}

@keyframes badgeExit {
  0% {
    transform: scale(1);
  }

  30% {
    transform: scale(0.85);
    opacity: 0.7;
  }

  100% {
    transform: scale(1);
  }
}

/* --- Auth & User Badge --- */

#authSection {
  background: var(--color-surface-high) !important;
  border-radius: 20px !important;
  border: none !important;
  padding: 14px 18px !important;
  margin-bottom: 16px !important;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  box-shadow: none !important;
  transition: none;
}

#authStatus {
  color: var(--color-text-muted) !important;
  font-family: var(--font-label) !important;
  font-size: 13px !important;
  font-weight: 400 !important;
  line-height: 1.5 !important;
  text-align: left !important;
  max-width: 190px;
}

#authStatus strong {
  color: var(--color-primary) !important;
  font-weight: 600 !important;
}

#telegramLoginContainer {
  display: flex;
  justify-content: center;
  flex-shrink: 0;
  background: transparent !important;
  padding: 0 !important;
  margin: 0 !important;
}

/* === USER BADGE — flat pill, Secondary Container === */
/* ── Profile Section (below menu card) ── */
.profile-section {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 12px 0 4px;
  min-height: 48px;
}

body.mode-call .profile-section {
  display: none;
}

/* ── M3 User Badge ── */
.user-badge {
  background: var(--color-secondary-container) !important;
  border: none !important;
  border-radius: var(--radius-full) !important;
  padding: 6px 14px 6px 6px !important;
  color: var(--color-secondary-on) !important;
  font-family: var(--font-label) !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  display: flex;
  align-items: center;
  gap: 8px !important;
  cursor: pointer !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  /* M3 state layer */
  transition:
    transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
    background 0.2s ease !important;
  /* Prevent overflow on mobile */
  max-width: min(280px, calc(100vw - 48px));
  min-width: 0;
  flex-shrink: 1;
}

.user-badge:hover {
  background: var(--color-surface-highest) !important;
  transform: scale(1.04) !important;
}

.user-badge:active {
  transform: scale(0.96) !important;
}

.user-avatar {
  width: 30px !important;
  height: 30px !important;
  border-radius: 50% !important;
  border: none !important;
  object-fit: cover !important;
  display: block;
}

.user-badge-icon {
  width: 30px !important;
  height: 30px !important;
  background: var(--color-primary-container) !important;
  color: var(--color-primary-dim) !important;
  border: none !important;
  border-radius: 50% !important;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-badge-icon svg {
  width: 16px !important;
  height: 16px !important;
  fill: currentColor !important;
}

.user-badge-name {
  /* Truncate long names properly on all screen sizes */
  max-width: clamp(80px, 30vw, 160px);
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 !important;
  flex-shrink: 1;
}

.user-badge.hidden,
.user-avatar.hidden,
.user-badge-icon.hidden {
  display: none !important;
}

/* --- Menu Card & Interface --- */

.menu-card {
  background: var(--color-surface-overlay) !important;
  border-radius: var(--radius-xl) !important;
  border: none !important;
  box-shadow: none !important;
  padding: 12px !important;
  margin-bottom: 20px;
  transition: transform 0.4s ease, opacity 0.4s ease;
}

body.mode-call .menu-card {
  display: none;
}

.card,
.settings-panel,
.create-screen,
.join-screen {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
}

.create-screen,
.join-screen {
  display: none;
}

.create-screen.active {
  display: block;
}

.join-screen.active {
  display: flex;
  flex-direction: column;
  gap: 24px;
  animation: fadeIn 0.4s cubic-bezier(0.2, 0.0, 0, 1.0);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- Mode Buttons (M3 Expressive Redesign) --- */

.mode-selector {
  display: flex;
  flex-direction: column;
  gap: 6px;
  /* M3 Expressive плотная группировка (эффект пазла) */
  width: 100%;
}

/* Базовая кнопка */
.mode-btn {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  padding: 24px 28px;
  /* Щедрые отступы */
  cursor: pointer;
  text-align: left;
  overflow: hidden;
  border: none !important;
  transition: transform 0.4s var(--m3-spring-smooth), box-shadow 0.4s ease;
}

.mode-btn:hover {
  transform: translateY(-4px);
}

/* M3 State Layer (Слой состояния для hover/active эффекта) */
.mode-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: currentColor;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.mode-btn:hover::before {
  opacity: 0.08;
  /* Полупрозрачное затемнение/осветление */
}

.mode-btn:active::before {
  opacity: 0.12;
}

.mode-btn:active {
  transform: scale(0.96) translateY(0) !important;
  transition-duration: 0.1s !important;
}

/* === КНОПКА 1: "Новая встреча" (Primary) === */
.mode-btn.mode-create {
  background: var(--color-primary-container) !important;
  color: var(--color-primary-dim) !important;
  /* Умная привязка к переменным тем */
  border-radius: 32px 32px 12px 32px !important;
  /* Асимметричная форма */
}

/* === КНОПКА 2: "Войти по коду" (Secondary) === */
.mode-btn.mode-join {
  background: var(--color-secondary-container) !important;
  color: var(--color-secondary-on) !important;
  border-radius: 12px 32px 32px 32px !important;
  /* Дополняющая форма, как диалог */
}

/* Иконка-круг */
.btn-icon-bg {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  margin-right: 20px;
  flex-shrink: 0;
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mode-btn:hover .btn-icon-bg {
  transform: scale(1.15) rotate(-12deg);
}

.mode-btn:hover .btn-icon-bg svg {
  transform: scale(1.1);
  transition: transform 0.4s var(--m3-spring-bouncy);
}

/* Полупрозрачные фоны для иконок вычисляются динамически на основе цвета текста */
.mode-create .btn-icon-bg {
  background: color-mix(in srgb, var(--color-primary-dim) 15%, transparent);
}

.mode-join .btn-icon-bg {
  background: color-mix(in srgb, var(--color-secondary-on) 15%, transparent);
}

.btn-icon-bg svg {
  width: 28px;
  height: 28px;
  fill: currentColor;
}

/* Текст */
.btn-text-group {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 4px;
}

.btn-title {
  font-family: var(--font-brand, 'Montserrat', sans-serif);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.2px;
  color: inherit;
  /* Наследует цвет от родителя, никаких жестких цветов */
}

.btn-desc {
  font-family: var(--font-ui, sans-serif);
  font-size: 14px;
  font-weight: 400;
  opacity: 0.85;
  line-height: 1.3;
  color: inherit;
}

.mode-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  filter: grayscale(1);
}

/* --- Inputs --- */
/* --- Стили экрана "Войти по коду" (M3 Redesign) --- */

.screen-header {
  text-align: center;
  margin-bottom: 24px;
}

.screen-header h3 {
  font-family: var(--font-label);
  font-size: 24px;
  font-weight: 500;
  color: var(--md-sys-color-on-surface);
  margin-bottom: 8px;
}

.screen-header p {
  font-size: 14px;
  color: var(--md-sys-color-on-surface-variant);
  margin: 0;
}

.m3-input-group {
  margin-bottom: 20px;
  width: 100%;
}

.m3-text-field {
  position: relative;
  background-color: var(--md-sys-color-surface-container-highest);
  border-radius: 8px 8px 0 0;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--md-sys-color-on-surface-variant);
  transition: background-color 0.3s ease, border-color 0.3s ease, transform 0.2s var(--m3-spring-bouncy);
}

.m3-text-field:hover {
  background-color: var(--color-surface-highest);
}

.m3-text-field:focus-within {
  border-bottom: 2px solid var(--md-sys-color-primary);
  background-color: var(--color-surface-highest);
  transform: scale(1.02);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  z-index: 2;
}

.m3-text-field input {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--md-sys-color-on-surface);
  font-family: var(--font-label);
  font-size: 16px;
  padding: 24px 16px 8px 16px;
  outline: none;
}

.m3-text-field label {
  position: absolute;
  left: 16px;
  top: 16px;
  font-size: 16px;
  color: var(--md-sys-color-on-surface-variant);
  pointer-events: none;
  transition: transform 0.2s ease, color 0.2s ease;
  transform-origin: left top;
}

.m3-text-field input:focus~label,
.m3-text-field input:not(:placeholder-shown)~label {
  transform: translateY(-10px) scale(0.75);
  color: var(--md-sys-color-primary);
}

.m3-text-field input:not(:focus):not(:placeholder-shown)~label {
  color: var(--md-sys-color-on-surface-variant);
}

.large-code-field {
  border-radius: 16px 16px 0 0;
}

.large-code-field input {
  font-size: 36px;
  font-weight: 700;
  text-align: center;
  letter-spacing: 12px;
  padding: 32px 16px 12px 16px;
  text-transform: uppercase;
  caret-color: var(--md-sys-color-primary);
}

.large-code-field label {
  left: 50%;
  transform: translateX(-50%);
  transform-origin: center top;
  font-size: 16px;
}

.large-code-field input:focus~label,
.large-code-field input:not(:placeholder-shown)~label {
  transform: translateX(-50%) translateY(-14px) scale(0.75);
}

.trailing-icon {
  position: absolute;
  right: 16px;
  color: var(--md-sys-color-on-surface-variant);
  display: flex;
  align-items: center;
  pointer-events: none;
  transition: color 0.2s ease;
}

.trailing-icon svg {
  width: 24px;
  height: 24px;
}

.large-code-field:focus-within .trailing-icon {
  color: var(--md-sys-color-primary);
}

.m3-text-field.input-error {
  border-bottom-color: var(--md-sys-color-error) !important;
  animation: shake 0.4s ease-in-out;
}

.m3-text-field.input-error label,
.m3-text-field.input-error .trailing-icon {
  color: var(--md-sys-color-error) !important;
}

.m3-text-field.input-error input {
  caret-color: var(--md-sys-color-error);
}

@keyframes shake {

  10%,
  90% {
    transform: translate3d(-1px, 0, 0);
  }

  20%,
  80% {
    transform: translate3d(2px, 0, 0);
  }

  30%,
  50%,
  70% {
    transform: translate3d(-4px, 0, 0);
  }

  40%,
  60% {
    transform: translate3d(4px, 0, 0);
  }
}

/* --- Action Buttons --- */

.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}


.action-btn:hover {
  background-color: var(--color-primary-dim) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px 3px rgba(0, 0, 0, 0.15);
}

.action-btn:disabled {
  background: var(--color-scrollbar-hover);
  cursor: not-allowed;
  color: var(--color-text-disabled);
}

.exit-btn {
  background: transparent !important;
  color: var(--md-sys-color-primary) !important;
  border: 1px solid var(--md-sys-color-outline) !important;
}

.exit-btn:hover {
  background: rgba(208, 188, 255, 0.08) !important;
  border-color: var(--md-sys-color-primary) !important;
  color: var(--md-sys-color-primary) !important;
}

/* --- Room Info --- */

.room-code {
  text-align: center;
  margin-bottom: 28px;
}

.room-code-label {
  font-size: 14px;
  color: var(--color-text-disabled);
  margin-bottom: 16px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.room-code-value {
  text-align: center;
  background: transparent;
  border: none;
  font-size: 64px;
  font-weight: 200;
  color: var(--color-text-bright);
  letter-spacing: 8px;
  padding: 0;
  cursor: pointer;
  transition: all 0.3s ease;
}

.room-code-value:hover {
  transform: scale(1.05);
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

.room-url {
  text-align: center;
  margin-bottom: 28px;
}

.room-url-label {
  font-size: 13px;
  color: var(--color-text-disabled);
  margin-bottom: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.room-url-value {
  font-size: 13px;
  font-family: "SF Mono", "Monaco", "Courier New", monospace;
  color: var(--color-text-bright);
  word-break: break-all;
  padding: 12px 16px;
  background: transparent;
  border-radius: 8px;
  border: 1px solid var(--color-scrollbar-thumb);
  cursor: pointer;
}

.room-url-value:hover {
  border-color: var(--color-text-bright);
}

.status {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-radius: 16px;
  font-size: 14px;
  margin-bottom: 20px;
  font-weight: 600;
  border: none;
}


.status.connected {
  background: rgba(34, 197, 94, 0.1);
  color: var(--color-success);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.status-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-outline);
  flex-shrink: 0;
}

.status.waiting {
  background: rgba(255, 111, 0, 0.15);
  color: var(--color-warning-dim);
  border: 1px solid rgba(255, 183, 77, 0.4);
  box-shadow: 0 0 15px rgba(255, 111, 0, 0.1);
}

.status.waiting .status-indicator {
  background: var(--color-warning);
  animation: statusPulse 1.5s ease-in-out infinite;
  box-shadow: 0 0 8px var(--color-warning);
}

.status.disconnected {
  background: rgba(186, 26, 26, 0.15);
  color: var(--color-error-solid);
  border: 1px solid rgba(255, 137, 125, 0.4);
  box-shadow: 0 0 15px rgba(186, 26, 26, 0.15);
}

.status.connected .status-indicator {
  background: var(--color-success);
}

/* --- Controls Panel (Bottom Island) --- */
@keyframes controlsPop {
  0% {
    transform: translateX(-50%) scale(1);
  }

  50% {
    transform: translateX(-50%) scale(1.05);
  }

  100% {
    transform: translateX(-50%) scale(1);
  }
}

@keyframes reconnectPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 109, 0, 0.4), 0 0 20px rgba(255, 109, 0, 0.2);
    border-color: rgba(255, 152, 0, 0.6);
    transform: translateX(-50%) scale(1);
  }

  50% {
    box-shadow: 0 0 0 12px rgba(255, 109, 0, 0), 0 0 40px rgba(255, 109, 0, 0.4);
    border-color: rgba(255, 152, 0, 1);
    transform: translateX(-50%) scale(1.02);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(255, 109, 0, 0), 0 0 20px rgba(255, 109, 0, 0.2);
    border-color: rgba(255, 152, 0, 0.6);
    transform: translateX(-50%) scale(1);
  }
}

.controls-panel.state-reconnecting {
  background: linear-gradient(135deg, #3E1810 0%, #5D1A00 100%) !important;
  color: var(--color-warning-dim) !important;
  /* Orange A100 */
  border: 1px solid #FF9800 !important;
  animation: reconnectPulse 1.5s infinite !important;
}

.controls-panel.state-success {
  background: rgba(255, 255, 255, 0.4) !important;
  border-color: rgba(255, 255, 255, 0.9) !important;
  box-shadow: 0 0 30px rgba(255, 255, 255, 0.5);
  animation: controlsPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.controls-panel.state-error {
  background: rgba(239, 68, 68, 0.45) !important;
  border-color: rgba(239, 68, 68, 0.8) !important;
  box-shadow: 0 0 30px rgba(239, 68, 68, 0.3);
  animation: controlsPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Control Buttons */


.control-btn span {
  display: none;
}


.controls-panel:hover .control-btn {
  opacity: 0.7;
}

.controls-panel .control-btn:hover {
  opacity: 1;
}

.control-btn.muted,
.control-btn.hidden-camera {
  background: var(--color-error-bg) !important;
  color: var(--color-error) !important;
  box-shadow: none;
  border: 1px solid var(--color-error-border) !important;
}

.control-btn.muted:hover {
  background: rgba(239, 68, 68, 0.34) !important;
  box-shadow:
    inset 0 0 0 1.5px rgba(239, 68, 68, 0.75),
    0 0 18px rgba(239, 68, 68, 0.22) !important;
}

.control-btn.muted svg,
.control-btn.muted .mic-off {
  stroke: var(--color-error);
}

.control-btn.sharing-active {
  background-color: var(--color-success) !important;
  color: var(--color-primary-on) !important;
}

.control-btn.hang-btn {
  width: 56px !important;
  height: 56px !important;
  border-radius: 16px !important;
  margin-left: 0 !important;
  aspect-ratio: 1 / 1;
  background-color: var(--color-error-solid) !important;
  /* Vibrant Red */
  color: var(--color-text-bright) !important;
}

.control-btn.hang-btn:hover {
  background-color: var(--color-error-hover) !important;
  box-shadow: 0 4px 12px rgba(224, 43, 29, 0.4);
}

.control-btn.secondary-btn {
  background: rgba(255, 255, 255, 0.08);
  /* Variant */
  border: none;
  color: var(--color-text);
}

.control-btn .icon-container {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  transition: transform 0.5s cubic-bezier(0.4, 0.0, 0.2, 1);
}

/* Mic Dropdown */

.mic-dropdown {
  position: relative;
  display: flex !important;
  align-items: stretch;
  padding: 0 !important;
  gap: 1px;
  overflow: visible !important;
  border-radius: 16px !important;
  background-color: var(--color-primary) !important;
  /* Primary */
  color: var(--color-primary-on) !important;
  /* On Primary */
  transition: transform 0.2s ease, background-color 0.2s ease !important;
  box-shadow: none !important;
  height: 56px !important;
}

.mic-dropdown:hover {
  filter: brightness(1.08);
}

.mic-main-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent !important;
  width: 56px !important;
  height: 100% !important;
  border-radius: 16px 4px 4px 16px !important;
  margin: 0 !important;
  color: inherit !important;
  box-shadow: none !important;
  transform: none !important;
}

.mic-dropdown-toggle {
  display: flex !important;
  align-items: center !important;
  justify-content: center;
  flex-direction: row !important;
  gap: 0 !important;
  width: 32px !important;
  height: 100% !important;
  border-radius: 4px 16px 16px 4px !important;
  background: rgba(0, 0, 0, 0.1) !important;
  color: inherit !important;
  padding: 0 !important;
  margin: 0 !important;
  box-shadow: none !important;
  border-left: 1px solid rgba(0, 0, 0, 0.1) !important;
}

.mic-dropdown-toggle svg {
  width: 16px;
  height: 16px;
}

.dropdown-arrow {
  transition: transform 0.3s ease;
}

.mic-dropdown.active .dropdown-arrow {
  transform: rotate(180deg);
}

.mic-dropdown:has(.muted) {
  background-color: var(--color-error-bg) !important;
  color: var(--color-error) !important;
}

.mic-dropdown:has(.muted) .mic-dropdown-toggle {
  background: rgba(239, 68, 68, 0.12) !important;
  border-left: 1px solid var(--color-error-border) !important;
}

.mic-dropdown-menu {
  position: absolute;
  bottom: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%);
  width: 320px;
  max-width: 90vw;
  background: var(--color-surface-card);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  z-index: 1001;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.mic-dropdown-menu:not(.hidden) {
  animation: menuPopUp 0.3s var(--md-sys-motion-easing-emphasized);
}

@keyframes menuPopUp {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(16px) scale(0.9);
  }

  100% {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
}

.dropdown-section {
  margin-bottom: 12px;
}

.dropdown-section:last-child {
  margin-bottom: 0;
}

.dropdown-section label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--color-text-muted);
  margin-bottom: 8px;
  font-weight: 700;
  padding-left: 2px;
}

.dropdown-select {
  width: 100%;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  color-scheme: dark;
  background-color: var(--color-surface-container);
  color: var(--color-text);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 36px 10px 12px;
  font-size: 13px;
  font-family: inherit;
  line-height: 1.4;
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239CA3AF' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-select:hover {
  background-color: var(--color-surface-high);
  border-color: rgba(255, 255, 255, 0.1);
}

.dropdown-select:focus {
  background-color: var(--color-surface-high);
  border-color: var(--color-primary);
}

.dropdown-select option {
  background-color: var(--color-surface-card);
  color: var(--color-text-bright);
  padding: 10px;
}


.mic-on.hidden,
.mic-off.hidden {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.5) rotate(-90deg) !important;
  pointer-events: none;
}


#muteBtn.muted {
  --mic-level: 0 !important;
  background: rgba(239, 68, 68, 0.24) !important;
  border: none !important;
  box-shadow:
    inset 0 0 0 1.5px rgba(239, 68, 68, 0.55),
    0 0 14px rgba(239, 68, 68, 0.14) !important;
  color: #ff8080 !important;
}

#muteBtn.muted .mic-off {
  transform: scale(1);
  filter: none;
}

.mic-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  will-change: transform, filter;
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
  transform: translateY(0);
  opacity: 1;
}

.mic-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
  transform: translateY(150%);
  opacity: 0;
  pointer-events: none;
}

.mic-loader svg {
  width: 20px;
  height: 20px;
  color: var(--color-warning-dim);
  animation: spin 1s linear infinite;
}

#muteBtn.loading-mic .mic-wrapper {
  transform: translateY(-150%);
  opacity: 0;
}

#muteBtn.loading-mic .mic-loader {
  transform: translateY(0);
  opacity: 1;
}

#muteBtn.loading-mic {
  pointer-events: none;
  background: rgba(255, 255, 255, 0.05);
}

/* --- Modals & Overlays --- */


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

@keyframes modalEnter {
  0% {
    transform: scale(0.85) translateY(30px);
    opacity: 0;
  }

  100% {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}


.modal-body {
  padding: 0 24px;
  font-family: var(--font-label);
  color: var(--md-sys-color-on-surface-variant);
  font-size: 14px;
  line-height: 20px;
}


.modal-actions .action-btn {
  flex: 0 1 auto;
  /* Do not stretch */
  min-width: unset;
  height: 40px !important;
  padding: 0 24px;
  font-size: 14px !important;
  border-radius: 20px;
  margin: 0;
}

.action-btn.primary {
  background: var(--md-sys-color-primary) !important;
  color: var(--md-sys-color-on-primary) !important;
}

.action-btn.primary:hover {
  background: var(--color-primary-dim) !important;

  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Quality Dialog */


.quality-select option {
  background-color: var(--color-surface-high);
  color: var(--color-text);
  padding: 12px;
}


.quality-info-box strong {
  color: var(--md-sys-color-on-secondary-container);
  font-weight: 500;
}

/* Share Dialog */
.share-modal-content {
  max-width: 380px;
  text-align: center;
}

.share-prompt {
  color: var(--color-text-muted);
  margin-bottom: 20px;
  font-size: 15px;
}

.room-share-info {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 15px;
  margin-bottom: 20px;
  text-align: left;
}

.info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  word-break: break-all;
}

.info-label {
  color: var(--color-text-muted);
  font-size: 14px;
}

.info-value {
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  color: var(--color-text-bright);
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 60%;
}

/* --- Settings Panel --- */

.settings-panel {
  display: none;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  padding: 0;
  margin-bottom: 24px;
  z-index: 21000 !important;
  position: relative;
}

.settings-panel.active {
  display: block;
}

.settings-panel h3 {
  margin-bottom: 24px;
  color: var(--color-text-bright);
  font-size: 20px;
  font-weight: 500;
  text-align: center;
}

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

.settings-section h4 {
  color: var(--color-text);
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--color-scrollbar-thumb);
}

.settings-toggle-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--color-outline-variant);
  gap: 18px;
}

.settings-toggle-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.settings-toggle-text {
  flex: 1 1 auto;
}

.settings-toggle-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--color-text);
}

.settings-toggle-desc {
  font-size: 12px;
  color: var(--color-text-disabled);
  margin-top: 6px;
  line-height: 1.5;
}

.settings-switch {
  position: relative;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.settings-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.settings-switch-track {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  background: var(--color-scrollbar-thumb);
  border-radius: 999px;
  transition: background 0.2s ease;
}

.settings-switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: var(--color-text);
  border-radius: 50%;
  transition: transform 0.2s ease, background 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.settings-switch input:checked+.settings-switch-track {
  background: rgba(255, 255, 255, 0.8);
}

.settings-switch input:checked+.settings-switch-track::after {
  transform: translateX(22px);
  background: var(--color-primary-on);
}

.settings-switch input:focus-visible+.settings-switch-track {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.35);
}

.settings-switch input:disabled+.settings-switch-track {
  background: var(--color-surface-container);
  opacity: 0.6;
}

.settings-switch input:disabled+.settings-switch-track::after {
  background: var(--color-outline-variant);
}

.settings-select {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--color-scrollbar-thumb);
  border-radius: 8px;
  background: var(--color-scrollbar-track);
  color: var(--color-text);
  font-size: 14px;
  cursor: pointer;
}

.settings-select option {
  background-color: var(--color-scrollbar-track);
  color: var(--color-text);
}

.settings-select:focus {
  outline: none;
  border-color: var(--color-text-bright);
}

.settings-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

/* ================================================================
   SCREEN SHARE / CAMERA CONTAINER — Redesigned
   ================================================================ */

.screen-container {
  position: fixed;
  z-index: 100;

  /* Центрирование */
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);


  width: calc(100vw - 48px);
  height: calc(100vh - 180px);

  max-width: 1600px;


  margin-top: 10px;

  /* Стиль */
  background: #050506;
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.5),
    0 24px 80px rgba(0, 0, 0, 0.7),
    0 0 120px rgba(0, 0, 0, 0.3);


  display: flex;
  align-items: center;
  justify-content: center;

  /* Анимация появления */
  animation: screenContainerIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;


  transition:
    border-radius 0.4s cubic-bezier(0.2, 0, 0, 1),
    box-shadow 0.3s ease;
}

@keyframes screenContainerIn {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.92);
  }

  100% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

.screen-container.hidden {
  display: none !important;
}

/* --- Видео элемент --- */

.screen-container video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #09080b;
  border-radius: 0;

  transition: object-fit 0.3s ease;
}

/* --- Режим камеры: object-fit cover + зеркалирование для себя --- */

.screen-container.camera-mode video {
  object-fit: cover;
}

.screen-container.camera-mode::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  border-radius: inherit;
  background: radial-gradient(ellipse at center,
      transparent 50%,
      rgba(0, 0, 0, 0.25) 100%);
}

/* --- Информационный бейдж (верхний левый угол) --- */

.screen-info {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 102;
  pointer-events: none;


  padding: 8px 16px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);

  /* Типографика */
  color: rgba(255, 255, 255, 0.9);
  font-family: var(--font-label);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.2px;

  /* Анимация появления */
  animation: badgeFadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) 0.3s both;
}

@keyframes badgeFadeIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- Кнопка полноэкранного режима --- */

.screen-fullscreen-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 102;


  width: 44px;
  height: 44px;
  padding: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;

  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;

  display: flex;
  align-items: center;
  justify-content: center;

  transition: all 0.25s cubic-bezier(0.2, 0, 0, 1);


  animation: badgeFadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) 0.4s both;
}

.screen-fullscreen-btn svg {
  width: 20px;
  height: 20px;
  stroke-width: 2;
  transition: transform 0.25s cubic-bezier(0.2, 0, 0, 1);
}

.screen-fullscreen-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.2);
  transform: scale(1.08);
  color: var(--color-text-bright);
}

.screen-fullscreen-btn:hover svg {
  transform: scale(1.1);
}

.screen-fullscreen-btn:active {
  transform: scale(0.95);
  background: rgba(255, 255, 255, 0.1);
}

/* --- Полноэкранный режим --- */

.screen-container:fullscreen,
.screen-container:-webkit-full-screen {
  border-radius: 0;
  border: none;
  box-shadow: none;
  width: 100vw;
  height: 100vh;
  max-width: none;
  margin: 0;
}

.screen-container:fullscreen video,
.screen-container:-webkit-full-screen video {
  border-radius: 0;
}

.screen-container:fullscreen .screen-info,
.screen-container:-webkit-full-screen .screen-info {
  top: 24px;
  left: 24px;
}

.screen-container:fullscreen .screen-fullscreen-btn,
.screen-container:-webkit-full-screen .screen-fullscreen-btn {
  top: 24px;
  right: 24px;
}

.screen-container:fullscreen .screen-info,
.screen-container:fullscreen .screen-fullscreen-btn {
  opacity: 1;
  transition: opacity 0.3s ease;
}

/* --- Тень под UI (чтобы текст был читаем на светлом контенте) --- */

.screen-container::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 80px;
  z-index: 101;
  pointer-events: none;
  border-radius: 24px 24px 0 0;
  background: linear-gradient(to bottom,
      rgba(0, 0, 0, 0.45) 0%,
      rgba(0, 0, 0, 0.15) 50%,
      transparent 100%);
  opacity: 1;
  transition: opacity 0.3s ease;
}

.screen-container.hidden::after {
  display: none;
}

/* --- Блокировка взаимодействия --- */

.screen-container.no-interact {
  pointer-events: none;
}

body.ui-priority .screen-container {
  pointer-events: none;
}

/* --- Индикатор демонстрации экрана --- */

.screen-share-indicator {
  position: fixed;
  top: 90px;

  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  pointer-events: none;


  background: rgba(20, 18, 24, 0.8);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  padding: 10px 24px;

  /* Тень */
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(0, 0, 0, 0.1);

  /* Текст */
  color: var(--color-text);
  font-family: var(--font-label);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.1px;

  /* Анимация */
  animation: indicatorSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes indicatorSlideIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-12px);
  }

  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.screen-share-indicator.hidden {
  display: none;
}

.screen-share-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.screen-share-info::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-primary);
  /* Primary */
  flex-shrink: 0;
  animation: dotPulse 2s ease-in-out infinite;
}

@keyframes dotPulse {

  0%,
  100% {
    opacity: 1;
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(208, 188, 255, 0.4);
  }

  50% {
    opacity: 0.7;
    transform: scale(1.2);
    box-shadow: 0 0 0 6px rgba(208, 188, 255, 0);
  }
}

.screen-share-text {
  white-space: nowrap;
}

/* ================================================================
   MOBILE RESPONSIVE — Screen Container
   ================================================================ */
@media (max-width: 640px) {
  .screen-container {

    width: 100vw;
    height: calc(100vh - 160px);
    max-width: none;
    border-radius: 0;
    border: none;
    margin-top: 0;
    box-shadow: none;


    top: calc(50% - 20px);
  }

  .screen-container::after {
    border-radius: 0;
  }

  .screen-container video {
    object-fit: contain;
  }


  .screen-container.camera-mode video {
    object-fit: cover;
  }

  .screen-info {
    top: 12px;
    left: 12px;
    padding: 6px 12px;
    font-size: 11px;
  }

  .screen-fullscreen-btn {
    top: 12px;
    right: 12px;
    width: 38px;
    height: 38px;
  }

  .screen-fullscreen-btn svg {
    width: 18px;
    height: 18px;
  }

  .screen-share-indicator {
    top: 70px;
    padding: 8px 18px;
    font-size: 13px;
  }
}

@media (max-width: 380px) {
  .screen-container {
    height: calc(100vh - 140px);
  }

  .screen-info {
    top: 8px;
    left: 8px;
    font-size: 10px;
    padding: 4px 10px;
  }

  .screen-fullscreen-btn {
    width: 34px;
    height: 34px;
  }
}

@media (max-height: 500px) and (orientation: landscape) {
  .screen-container {
    height: calc(100vh - 80px);
    top: 40px;
    transform: translateX(-50%);
    border-radius: var(--radius-md);
  }

  .screen-info {
    top: 8px;
    left: 8px;
  }

  .screen-fullscreen-btn {
    top: 8px;
    right: 8px;
  }
}

/* --- Notifications & Banners --- */


.participant-banner {
  position: fixed;
  bottom: calc(110px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translate(-50%, 16px);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  background: rgba(18, 18, 18, 0.95);
  border: 1px solid var(--color-scrollbar-thumb);
  border-radius: var(--radius-full);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3) !important;
  color: var(--color-text);
  font-weight: 500;
  font-size: 14px;
  letter-spacing: 0.3px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.4s cubic-bezier(0.19, 1, 0.22, 1);
  z-index: 1100;
  max-width: calc(100% - 48px);
  text-align: center;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.participant-banner.visible {
  opacity: 1;
  transform: translate(-50%, 0);
  border-color: rgba(255, 255, 255, 0.15);
}

.participant-banner.hidden {
  display: none;
}

.participant-banner .banner-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  color: var(--color-text-bright);
}

.participant-banner .banner-icon::before {
  content: none;
}

.participant-banner .banner-text {
  display: inline-block;
  white-space: nowrap;
}

/* --- Preloader M3 (Полноэкранный) --- */
.preloader {
  position: fixed;
  inset: 0;
  z-index: 50000;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background-color: var(--md-sys-color-background);
  /* Тёмный фон M3 */
  pointer-events: all;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.4s ease, visibility 0.4s;
}

.preloader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.logo-container {
  width: 180px;
  height: 180px;
  animation: preloader-glow 3s cubic-bezier(0.4, 0.0, 0.2, 1) infinite;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preloader .logo-container svg {
  width: 100%;
  height: 100%;
}

@keyframes preloader-glow {

  0%,
  35%,
  58%,
  100% {
    filter: drop-shadow(0 0 4px rgba(208, 188, 255, 0.05));
  }

  46% {
    filter: drop-shadow(0 0 20px rgba(208, 188, 255, 0.3));
  }
}

.line1,
.line2 {
  stroke: var(--md-sys-color-primary);
  stroke-width: 4.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.line1 {
  stroke-dasharray: 100;
  animation: draw1 3s cubic-bezier(0.4, 0.0, 0.2, 1) infinite;
}

.line2 {
  stroke-dasharray: 90;
  animation: draw2 3s cubic-bezier(0.4, 0.0, 0.2, 1) infinite;
}

@keyframes draw1 {

  0%,
  3% {
    stroke-dashoffset: 100;
  }

  33% {
    stroke-dashoffset: 0;
  }

  60% {
    stroke-dashoffset: 0;
  }

  93%,
  100% {
    stroke-dashoffset: -100;
  }
}

@keyframes draw2 {

  0%,
  11% {
    stroke-dashoffset: 90;
  }

  41% {
    stroke-dashoffset: 0;
  }

  56% {
    stroke-dashoffset: 0;
  }

  89%,
  100% {
    stroke-dashoffset: -90;
  }
}

.loading-text-wrapper {
  color: var(--md-sys-color-on-surface-variant);
  margin-top: 32px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.1px;
}

.dot {
  animation: blink 1.4s cubic-bezier(0.4, 0.0, 0.2, 1) infinite;
  opacity: 0;
}

.dot:nth-child(2) {
  animation-delay: 0.2s;
}

.dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes blink {

  0%,
  60%,
  100% {
    opacity: 0;
  }

  30% {
    opacity: 1;
  }
}

/* ===== RECONNECT PRELOADER — orange jagged drawing ===== */
.preloader.reconnect-mode .logo-container {
  animation: reconnect-glow 2.4s ease-in-out infinite;
}

@keyframes reconnect-glow {

  0%,
  100% {
    filter: drop-shadow(0 0 4px rgba(255, 120, 0, 0.2));
  }

  50% {
    filter: drop-shadow(0 0 18px rgba(255, 140, 0, 0.6));
  }
}

/* Override line colors */
.preloader.reconnect-mode .line1,
.preloader.reconnect-mode .line2 {
  stroke: #FF8C00;
  stroke-dasharray: 5 13;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.preloader.reconnect-mode .line1 {
  stroke-dashoffset: 100;
  animation: reconnect-draw1 3.2s cubic-bezier(0.45, 0.0, 0.55, 1.0) infinite;
}

.preloader.reconnect-mode .line2 {
  stroke-dashoffset: 90;
  animation: reconnect-draw2 3.2s cubic-bezier(0.45, 0.0, 0.55, 1.0) infinite;
  animation-delay: 0.3s;
}

@keyframes reconnect-draw1 {
  0% {
    stroke-dashoffset: 100;
  }

  85% {
    stroke-dashoffset: -18;
  }

  100% {
    stroke-dashoffset: -60;
    opacity: 0;
  }
}

@keyframes reconnect-draw2 {
  0% {
    stroke-dashoffset: 90;
  }

  85% {
    stroke-dashoffset: -16;
  }

  100% {
    stroke-dashoffset: -55;
    opacity: 0;
  }
}

/* Orange dots */
.preloader.reconnect-mode .loading-text-wrapper {
  color: var(--color-warning-dim);
}

.preloader.reconnect-mode .dot {
  color: var(--color-warning);
}

/* --- СТАТИЧНЫЙ ЛОГОТИП ГЛАВНОЙ СТРАНИЦЫ --- */
.main-logo {
  display: none;
  width: 100px;
  height: 100px;
  margin: 0 auto 24px;
}

body.mode-mode .main-logo {
  display: flex;
  align-items: center;
  justify-content: center;
}

.main-logo svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0 16px rgba(208, 188, 255, 0.35));
}

/* Subtle breathing animation on main logo */
.nova-main-l1,
.nova-main-l2 {
  animation: nova-logo-breathe 3.5s ease-in-out infinite alternate;
}

.nova-main-l2 {
  animation-delay: 0.5s;
  animation-duration: 4s;
}

@keyframes nova-logo-breathe {
  from {
    opacity: 0.75;
  }

  to {
    opacity: 1;
    filter: drop-shadow(0 0 8px rgba(208, 188, 255, 0.6));
  }
}

/* --- КНОПКА ДОПОЛНЕНИЯ В ХЕДЕРЕ --- */
/* Базовая кнопка дополнений */
.header-extras-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 20px; /* Отступы для десктопа (с текстом) */
  border-radius: var(--radius-full);
  background: var(--color-surface-high) !important;
  color: var(--color-primary) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.header-extras-btn:hover {
  background: var(--color-surface-highest) !important;
  transform: translateY(-1px);
}

/* Контейнер иконки — делаем его гибким */
.header-extras-btn .invite-icon-box {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0; /* Убираем лишние отступы */
}

.header-extras-btn .invite-icon-box svg {
  width: 20px;
  height: 20px;
  position: static; /* Убираем абсолютное позиционирование, которое все ломает */
  transform: none;
}

/* --- ПАНЕЛЬ ДОПОЛНЕНИЯ --- */
.extras-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
  z-index: 30000;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.extras-overlay.hidden {
  display: none !important;
}

/* Dropdown появляется прямо под шапкой, не требует взгляда вниз */
.extras-panel {
  position: fixed;
  top: 88px;
  /* чуть ниже островка (56px высота + 20px gap + 12px top) */
  left: 50%;
  transform: translateX(-50%) translateY(-12px);
  width: min(340px, calc(100vw - 24px));
  max-height: calc(100dvh - 120px);
  overflow-y: auto;
  background: color-mix(in srgb, var(--color-surface-high) 90%, transparent);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  z-index: 30001;
  padding: 6px 0 10px;
  opacity: 0;
  pointer-events: none;
  transition:
    transform 0.28s cubic-bezier(0.2, 0, 0, 1),
    opacity 0.22s ease;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
}

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

.extras-panel.extras-panel--visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* Скрываем ручку — она нужна только у bottom-sheet */
.extras-handle {
  display: none;
}

/* На мобилке немного опускаем если шапка выше */
@media (max-width: 768px) {
  .extras-panel {
    top: 80px;
    width: min(320px, calc(100vw - 20px));
  }
}

.extras-header {
  padding: 16px 24px 8px;
}

.extras-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text);
  letter-spacing: 0.1px;
}

.extras-section {
  padding: 4px 0;
}

.extras-section-label {
  font-size: 11px;
  font-weight: 600;
  color: rgba(202, 196, 208, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 12px 24px 4px;
}

.extras-item {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 12px 24px;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
  border-radius: 0;
  color: inherit;
}

.extras-item:hover:not(.extras-item--disabled) {
  background: rgba(255, 255, 255, 0.05);
}

.extras-item--disabled {
  opacity: 0.45;
  cursor: default;
  pointer-events: none;
}

.extras-item-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: rgba(208, 188, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--color-primary);
}

.extras-item-icon svg {
  width: 20px;
  height: 20px;
}

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

.extras-item-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text);
  line-height: 1.3;
}

.extras-item-desc {
  font-size: 12px;
  color: rgba(202, 196, 208, 0.6);
  margin-top: 2px;
}

.extras-item-arrow {
  color: rgba(202, 196, 208, 0.4);
  flex-shrink: 0;
}

.extras-item-arrow svg {
  width: 18px;
  height: 18px;
}

.extras-badge {
  font-size: 10px;
  font-weight: 700;
  color: var(--color-primary);
  background: rgba(208, 188, 255, 0.12);
  border: 1px solid rgba(208, 188, 255, 0.25);
  border-radius: var(--radius-full);
  padding: 2px 8px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* --- Misc Components --- */
/* Code Invite Button */
.call-room-code {
  position: fixed;
  top: 24px;
  right: 20px;
  bottom: auto;
  left: auto;
  transform: none;
  z-index: 22000;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background-color: var(--md-sys-color-primary-container) !important;
  color: var(--md-sys-color-on-primary-container) !important;
  border-radius: 16px !important;
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0 16px;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.call-room-code:hover {
  background-color: var(--md-sys-color-primary) !important;
  color: var(--md-sys-color-on-primary) !important;
  transform: translateY(-1px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.call-room-code:hover svg {
  color: var(--md-sys-color-on-primary) !important;
}

.call-room-code:active {
  transform: translateY(1px);
}

.call-room-code svg {
  opacity: 0.8;
  transition: opacity 0.2s;
  color: var(--md-sys-color-on-primary-container) !important;
}

.call-room-code.copied {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.3);
  cursor: default;
}

.code-context-menu {
  position: fixed;
  z-index: 1600;
  background: rgba(17, 24, 39, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.45);
  min-width: 180px;
  padding: 6px 0;
  display: none;
}

.code-context-menu:not(.hidden) {
  display: block;
}

.code-value-text {
  font-family: "SF Mono", "Monaco", monospace;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--color-text-bright);
}

.code-label-text {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-disabled);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.code-copy-icon {
  width: 16px;
  height: 16px;
  color: var(--color-text-disabled);
  transition: color 0.2s;
}

.code-context-menu button {
  width: 100%;
  background: transparent;
  border: 0;
  color: var(--color-text);
  font-size: 14px;
  text-align: left;
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.code-context-menu button:hover:not(:disabled),
.code-context-menu button:focus-visible:not(:disabled) {
  background: rgba(255, 255, 255, 0.18);
  color: var(--color-text-bright);
}

.code-context-menu button:disabled {
  color: rgba(240, 240, 240, 0.35);
  cursor: not-allowed;
}

.code-context-menu::after {
  content: "";
  position: absolute;
  top: -8px;
  left: var(--menu-arrow-left, 24px);
  border-width: 0 8px 8px 8px;
  border-style: solid;
  border-color: transparent transparent rgba(17, 24, 39, 0.95) transparent;
}

.code-context-menu.invert::after {
  top: auto;
  bottom: -8px;
  border-width: 8px 8px 0 8px;
  border-color: rgba(17, 24, 39, 0.95) transparent transparent transparent;
}

/* --- Participant Panel (M3 Expressive — Click-triggered) --- */

.participant-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

body.mode-call .participant-badge {
  background: transparent !important;
  margin: 0 !important;
  padding: 0 !important;
  color: var(--color-text-muted) !important;
  box-shadow: none !important;
  animation: none !important;
  border: none !important;
  height: auto !important;
  width: auto !important;
  border-radius: 0 !important;
  gap: 6px !important;
  font-size: 14px !important;
  cursor: pointer !important;
  user-select: none;
}

body.mode-call .participant-badge:active {
  transform: scale(0.92) !important;
}

.participant-panel-overlay {
  position: fixed;
  inset: 0;
  z-index: 22500;
  display: none;
}

.participant-panel-overlay.active {
  display: block;
}

/* Сама панель */
.participant-tooltip {
  position: absolute;
  top: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(-16px) scale(0.88);
  transform-origin: top center;
  width: 296px;


  background: var(--color-surface-input);
  border: 1px solid rgba(208, 188, 255, 0.1);
  box-shadow:
    0 2px 6px rgba(0, 0, 0, 0.3),
    0 8px 24px rgba(0, 0, 0, 0.45),
    0 24px 56px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  border-radius: 24px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;

  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 23000;

  transition:
    opacity 0.28s cubic-bezier(0.2, 0, 0, 1),
    transform 0.38s cubic-bezier(0.34, 1.45, 0.64, 1),
    visibility 0.28s;
}

/* Состояние открытия */
.participant-tooltip.panel-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0) scale(1);
}

/* Заголовок панели */
.pt-header {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 12px 6px;
  font-size: 11px;
  font-family: var(--font-label);
  font-weight: 500;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: rgba(202, 196, 208, 0.55);
}

.pt-header::before {
  content: '';
  display: inline-block;
  width: 16px;
  height: 1px;
  background: rgba(202, 196, 208, 0.2);
  flex-shrink: 0;
}

.pt-header::after {
  content: '';
  display: inline-block;
  flex: 1;
  height: 1px;
  background: rgba(202, 196, 208, 0.2);
}

/* Строка участника */
.pt-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: var(--radius-lg);
  transition:
    background-color 0.18s cubic-bezier(0.2, 0, 0, 1),
    transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
  cursor: default;
}

.pt-item::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(208, 188, 255, 0);
  border-radius: inherit;
  transition: background 0.2s ease;
  pointer-events: none;
}

.pt-item:hover::before {
  background: rgba(208, 188, 255, 0.07);
}

.pt-item:active {
  transform: scale(0.97);
}

.pt-item:nth-child(2) {
  animation: ptItemSlide 0.35s cubic-bezier(0.34, 1.45, 0.64, 1) both;
}

.pt-item:nth-child(3) {
  animation: ptItemSlide 0.35s 0.06s cubic-bezier(0.34, 1.45, 0.64, 1) both;
}

@keyframes ptItemSlide {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Аватар контейнер */
.pt-avatar-box {
  position: relative;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}

.pt-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--color-primary-container);
  color: var(--color-primary-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-weight: 700;
  font-family: var(--font-label);

  box-shadow:
    0 0 0 2px var(--color-surface-input),
    0 0 0 3.5px rgba(208, 188, 255, 0.35);
  transition: box-shadow 0.3s ease;
}

.pt-item:hover .pt-avatar {
  box-shadow:
    0 0 0 2px var(--color-surface-input),
    0 0 0 3.5px rgba(208, 188, 255, 0.6);
}

.pt-avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  box-shadow:
    0 0 0 2px var(--color-surface-input),
    0 0 0 3.5px rgba(208, 188, 255, 0.35);
}

.pt-avatar.local {
  background: linear-gradient(135deg, rgba(74, 222, 128, 0.15), rgba(74, 222, 128, 0.22));
  color: var(--color-success-dim);
  box-shadow:
    0 0 0 2px var(--color-surface-input),
    0 0 0 3.5px rgba(188, 235, 226, 0.4);
}

/* Ожидание */
.pt-avatar.waiting {
  background: var(--color-surface-container);
  color: var(--color-outline-variant);
  border: 2px dashed rgba(255, 255, 255, 0.12);
  box-shadow: none;
  animation: waitingPulse 2s ease-in-out infinite;
}

@keyframes waitingPulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.55;
  }
}

/* Инфо-блок */
.pt-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  gap: 2px;
}

.pt-name {
  font-size: 14px;
  font-weight: 400;
  font-family: var(--font-label);
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.1px;
}

.pt-status-text {
  font-size: 12px;
  font-family: var(--font-label);
  color: rgba(202, 196, 208, 0.65);
  letter-spacing: 0.1px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.pt-status-text.status-online::before,
.pt-status-text.status-call::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-success-dim);
  flex-shrink: 0;
}

.pt-status-text.status-call::before {
  background: var(--color-success-dim);
  box-shadow: 0 0 5px rgba(165, 245, 200, 0.6);
}

/* Бейдж "ВЫ" */
.pt-you-badge {
  font-size: 10px;
  font-weight: 700;
  font-family: var(--font-label);
  background: rgba(239, 184, 200, 0.12);
  color: var(--color-tertiary);
  padding: 3px 9px;
  border-radius: 20px;
  border: 1px solid rgba(239, 184, 200, 0.25);
  letter-spacing: 0.8px;
  flex-shrink: 0;
}

.pt-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
  margin: 4px 10px;
}

.pt-actions {
  display: flex;
  gap: 6px;
  padding: 6px 10px 4px;
}

.pt-action-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 14px;
  border: none;
  background: rgba(255, 255, 255, 0.05);
  color: rgba(202, 196, 208, 0.45);
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-label);
  cursor: not-allowed;
  transition: all 0.2s ease;
  letter-spacing: 0.2px;
}

.pt-action-btn svg {
  width: 15px;
  height: 15px;
  opacity: 0.5;
}

/* Цвета статусов */
.status-online {
  color: rgba(188, 235, 226, 0.85) !important;
}

.status-call {
  color: rgba(165, 245, 200, 0.9) !important;
}

.status-connecting {
  color: rgba(147, 143, 153, 0.75) !important;
}

.legal-footer {
  position: relative;
  display: flex;
  justify-content: center;
  margin-top: 40px;
  width: 100%;
  z-index: 10;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.legal-footer.hidden {
  opacity: 0;
  pointer-events: none;
}

.legal-pill-container {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 14px;
  padding: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: border-color 0.3s ease;
}

.legal-pill-container:hover {
  border-color: rgba(208, 188, 255, 0.15);
}

.legal-link {
  color: var(--color-text-muted);
  text-decoration: none;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.2px;
  padding: 10px 20px;
  border-radius: 8px;
  transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
  cursor: pointer;
  white-space: nowrap;
}

.legal-link:hover {
  background-color: rgba(255, 255, 255, 0.08);
  color: var(--color-text-bright);
}

.legal-link:active {
  background-color: rgba(255, 255, 255, 0.12);
  transform: scale(0.98);
}

.legal-separator {
  width: 1px;
  height: 16px;
  background-color: rgba(255, 255, 255, 0.2);
  margin: 0 2px;
}

/* Debug / Tools */
.log {
  background: transparent;
  border: 1px solid var(--color-scrollbar-thumb);
  border-radius: 8px;
  padding: 12px;
  max-height: 120px;
  overflow-y: auto;
  font-size: 11px;
  color: var(--color-text-disabled);
  font-family: "SF Mono", "Monaco", "Courier New", monospace;
  margin-top: 16px;
}

.log:empty {
  display: none;
}

.log div {
  padding: 2px 0;
  border-bottom: 1px solid var(--color-scrollbar-thumb);
}

.log div:last-child {
  border-bottom: none;
}

.connection-quality {
  position: fixed;
  top: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 8px;
  background: rgba(20, 20, 20, 0.75);
  border-radius: 10px;
  border: 1px solid rgba(45, 45, 45, 0.6);
  z-index: 100;
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.connection-quality.hidden {
  display: none;
}

.quality-indicator {
  display: flex;
  gap: 2px;
  align-items: end;
  height: 16px;
}

.quality-bar {
  width: 3px;
  background: var(--color-outline);
  border-radius: 1px;
  transition: all 0.4s ease;
}

.quality-bar:nth-child(1) {
  height: 6px;
}

.quality-bar:nth-child(2) {
  height: 8px;
}

.quality-bar:nth-child(3) {
  height: 10px;
}

.quality-bar:nth-child(4) {
  height: 12px;
}

.connection-quality.excellent .quality-bar {
  background: var(--color-success);
}

.connection-quality.good .quality-bar {
  background: var(--color-warning-dim);
}

.connection-quality.poor .quality-bar {
  background: var(--color-error-solid);
}

.quality-text {
  display: none;
}

.stats-panel {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9001;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 10, 0.9);
}

.stats-panel.hidden {
  display: none;
}

.stats-content {
  background: var(--color-scrollbar-track);
  border: 1px solid var(--color-scrollbar-thumb);
  border-radius: var(--radius-md);
  padding: 24px;
  width: 90%;
  max-width: 400px;
  max-height: 80vh;
  overflow-y: auto;
}

.stats-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--color-scrollbar-thumb);
}

.stats-header h3 {
  color: var(--color-text-bright);
  font-size: 18px;
  font-weight: 500;
  margin: 0;
}

.stats-close {
  background: var(--color-scrollbar-thumb);
  border: none;
  color: var(--color-text);
  cursor: pointer;
  padding: 8px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stats-close:hover {
  background: var(--color-scrollbar-hover);
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.stat-section {
  margin-bottom: 16px;
}

.stat-section h4 {
  font-size: 14px;
  color: var(--color-text);
  margin-bottom: 12px;
  font-weight: 500;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--color-scrollbar-thumb);
}

.stat-label {
  font-size: 12px;
  color: var(--color-text-disabled);
  font-weight: 500;
}

.stat-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-bright);
  font-family: "SF Mono", "Monaco", "Courier New", monospace;
}

.stat-unit {
  font-size: 11px;
  color: var(--color-outline);
  margin-left: 4px;
}

.stats-history {
  border-top: 1px solid var(--color-scrollbar-thumb);
  padding-top: 16px;
}

.stat-chart {
  text-align: center;
}

.stat-chart canvas {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}

.chart-label {
  font-size: 11px;
  color: var(--color-text-disabled);
  margin-top: 8px;
  font-weight: 500;
}

.speaker-indicator {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: transparent;
  border: none;
  width: 200px;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  bottom: auto;
  z-index: 105;
}

.speaker-indicator .bar {
  display: none;
}

.speaker-indicator::after {
  content: '';
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--color-text-bright);
  opacity: 0.1;
  transition: transform 0.1s ease;
  box-shadow: 0 0 40px rgba(255, 255, 255, 0.2);
}

.speaker-indicator.active::after {
  transform: scale(1.5);
  opacity: 0.3;
  box-shadow: 0 0 80px rgba(255, 255, 255, 0.4);
}

.speaker-indicator.hidden,
#speakerIndicator {
  display: none !important;
}

/* --- Dialogs --- */
.modal-dialog {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20000;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  visibility: hidden;
}

.modal-dialog.visible {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
}

.modal-content {
  background: var(--color-surface-high);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-xl);
  padding: 32px;
  width: 90%;
  max-width: 440px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  transform: scale(0.9);
  transition: transform 0.3s cubic-bezier(0.2, 0, 0, 1);
}

.modal-dialog.visible .modal-content {
  animation: modalEnter 0.5s var(--m3-spring-bouncy) forwards;
  transform: scale(1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 24px 16px;
  margin-bottom: 24px;
}

.modal-header h3 {
  color: var(--color-text);
  font-family: var(--font-label);
  font-size: 22px;
  font-weight: 400;
  margin: 0;
  line-height: 32px;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  font-size: 24px;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  line-height: 1;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.modal-close:hover {
  background: rgba(230, 224, 233, 0.08);
}

.quality-info-box {
  background: var(--color-surface-highest);
  border: none;
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 24px;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 12px;
  border-left: 4px solid var(--color-primary);
}

.quality-info-box p {
  color: var(--color-text);
  font-size: 14px;
  margin: 0;
  line-height: 1.5;
}

.input-group label {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-muted);
  margin-bottom: 8px;
  font-weight: 500;
}

.quality-select {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--color-outline);
  border-bottom: 1px solid var(--md-sys-color-outline);
  border-radius: 8px;
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 16px;
  cursor: pointer;
  margin-bottom: 2px;
  transition: border-color 0.2s;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23CAC4D0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 24px;
  appearance: none;
  outline: none;
}

.quality-select:focus {
  outline: none;
  border-bottom: 2px solid var(--md-sys-color-primary);
  background: var(--color-surface-highest);
  border-color: var(--color-primary);
  border-width: 2px;
  padding: 11px 15px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 24px;
  margin-top: 32px;
  border-top: none;
}

/* Action Buttons */
.action-btn {
  width: 100%;
  padding: 10px 24px;
  border-radius: var(--radius-full);
  height: 56px !important;
  font-size: 14px;
  font-weight: 500;
  text-transform: none !important;
  cursor: pointer;
  text-align: center;
  letter-spacing: 0.1px;
  transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
  background-color: var(--md-sys-color-primary) !important;
  color: var(--md-sys-color-on-primary) !important;
  border: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.action-btn.exit-btn {
  background: transparent;
  color: var(--color-primary);
  border: 1px solid rgba(208, 188, 255, 0.2);
}

.action-btn.exit-btn:hover {
  background: rgba(208, 188, 255, 0.08);
  border-color: var(--color-primary);
}

#startWithQuality {
  background: var(--color-danger) !important;
  /* Tertiary */
  color: var(--color-text-bright) !important;

  box-shadow: 0 2px 6px rgba(152, 64, 97, 0.3);
}

#startWithQuality:hover {
  background: var(--color-danger) !important;
  box-shadow: 0 4px 10px rgba(152, 64, 97, 0.4);
  transform: translateY(-1px);
}

/* --- Control Bar (Bottom Island) --- */
.controls-panel {
  display: flex !important;
  align-items: center;
  gap: 12px;
  background: rgba(20, 18, 24, 0.95);
  backdrop-filter: blur(20px);
  padding: 12px 24px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.control-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 !important;
  border: none;
  cursor: pointer;
  color: var(--color-text);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--color-surface-high);
}

.control-btn:hover {
  background: var(--color-surface-highest);
  color: var(--color-text-bright);
  transform: translateY(-1px);
}

.control-btn .material-symbols-rounded,
.control-btn svg {
  font-size: 24px;
  width: 24px;
  height: 24px;
}

/* Segmented Control (Mic & Camera Groups) */
.mic-dropdown,
.camera-dropdown {
  display: flex;
  align-items: center;
  background: var(--color-surface-high);
  border-radius: var(--radius-full);
  overflow: hidden;
  transition: all 0.25s ease;
}

.mic-dropdown:hover,
.camera-dropdown:hover {
  background: var(--color-surface-highest);
}

.mic-main-btn,
#cameraBtn {
  width: 56px !important;
  height: 52px !important;
  border-radius: 0 !important;
  background: transparent !important;
}

.mic-dropdown-toggle,
.camera-dropdown-toggle {
  width: 32px !important;
  height: 52px !important;
  border-radius: 0 !important;
  background: rgba(255, 255, 255, 0.05) !important;
  border-left: 1px solid rgba(255, 255, 255, 0.08) !important;
  color: var(--color-text-muted) !important;
}

.mic-dropdown-toggle:hover,
.camera-dropdown-toggle:hover {
  background: rgba(255, 255, 255, 0.12) !important;
  color: var(--color-text-bright) !important;
}

/* Active / Muted States */
.control-btn.muted,
.control-btn.camera-off,
.mic-dropdown:has(.muted),
.camera-dropdown:has(.sharing-active.camera-off),
.camera-dropdown:has(.cam-unavailable) {
  background: rgba(239, 68, 68, 0.15) !important;
}

.control-btn.muted,
.control-btn.camera-off {
  color: #ff8080 !important;
}

.control-btn.sharing-active:not(.camera-off) {
  background: var(--color-primary-container) !important;
  color: var(--color-primary-dim) !important;
}

.camera-dropdown:has(.sharing-active:not(.camera-off)) {
  background: var(--color-primary-container) !important;
}

/* 1. HANGUP BUTTON */
#hangBtn {
  background: var(--color-error-solid) !important;
  color: white !important;
  width: 64px;
  height: 52px;
  border-radius: var(--radius-full);
}

#hangBtn:hover {
  background: #d32f2f !important;
  box-shadow: 0 4px 12px rgba(211, 47, 47, 0.4);
}

#hangBtn svg {
  fill: white;
}

/* 2. SHARE BUTTON - Secondary (#9B4244) or Tertiary (var(--color-danger))
   User gave Secondary: #9B4244, Tertiary: var(--color-danger).
   Let's use Tertiary for Share to differentiate from the Red Hangup.
   Actually, Tertiary (var(--color-danger)) is also pink/red.
   Let's use Primary Container (var(--color-primary-dim)) with Dark Text (#22005D) for a high-contrast style that stands out from dark buttons?
   
   OR better, let's stick to the "Expressive" idea:
   Active Share = Tertiary Key (var(--color-danger)).
*/
/* ── Share Dropdown ───────────────────────────────────────── */
.share-dropdown {
  position: relative;
}

.share-quality-dropdown {
  position: absolute;
  bottom: calc(100% + 14px);
  left: 50%;
  transform: translateX(-50%);
  width: 260px;
  background: var(--color-surface-card);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
  z-index: 1001;
  display: flex;
  flex-direction: column;
  gap: 14px;
  /* Arrow pointer */
}

.share-quality-dropdown::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 7px solid transparent;
  border-top-color: var(--color-surface-card);
}

.share-quality-dropdown::before {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 8px solid transparent;
  border-top-color: rgba(255, 255, 255, 0.1);
  margin-top: 1px;
}

.share-quality-dropdown:not(.hidden) {
  animation: sqDropDown 0.4s var(--m3-spring-bouncy) forwards;
}

@keyframes sqDropDown {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(20px) scale(0.9);
  }

  100% {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
}

.sqd-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sqd-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  letter-spacing: 0.2px;
}

.sqd-close {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
}

.sqd-close:hover {
  background: rgba(255, 255, 255, 0.07);
  color: var(--color-text);
}

.sqd-close svg {
  width: 16px;
  height: 16px;
}

.sqd-quality-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(208, 188, 255, 0.08);
  border: 1px solid rgba(208, 188, 255, 0.2);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--color-primary);
  font-size: 13px;
  font-weight: 500;
}

.sqd-quality-badge svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8px;
}

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

.sqd-field label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--color-text-muted);
  font-weight: 700;
}

.sqd-select {
  width: 100%;
  padding: 9px 36px 9px 12px;
  background: var(--color-bg);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  color: var(--color-text);
  font-size: 13px;
  cursor: pointer;
  appearance: none;
  outline: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23CAC4D0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  transition: border-color 0.15s;
}

.sqd-select:focus {
  border-color: var(--color-primary);
  background-color: var(--color-surface-input);
}

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

.sqd-btn {
  flex: 1;
  padding: 9px 12px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background 0.15s, opacity 0.15s;
}

.sqd-btn-ghost {
  background: rgba(255, 255, 255, 0.06);
  color: var(--color-text-muted);
}

.sqd-btn-ghost:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--color-text);
}

.sqd-btn-primary {
  background: var(--color-primary);
  color: var(--color-primary-on);
  font-weight: 600;
}

.sqd-btn-primary:hover {
  background: var(--color-secondary-on);
}

.share-quality-dropdown.visible {
  display: flex !important;
}

/* ── end Share Dropdown ───────────────────────────────────── */

#shareBtn {
  background: var(--color-surface-high) !important;
  color: var(--color-text-bright) !important;
}

#shareBtn:hover {
  background: var(--color-surface-highest) !important;
  color: var(--color-secondary-on) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

#stopShareBtn {
  background: var(--color-primary-dim) !important;
  /* Primary Container */
  color: var(--color-primary-on) !important;

  animation: pulsePurple 2s infinite;
}

@keyframes pulsePurple {
  0% {
    box-shadow: 0 0 0 0 rgba(234, 221, 255, 0.4);
  }

  70% {
    box-shadow: 0 0 0 10px rgba(234, 221, 255, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(234, 221, 255, 0);
  }
}

/* Tooltip for buttons */
.control-btn::after {
  content: attr(title);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-12px);
  background: rgba(227, 226, 230, 0.9);
  /* Inverse Surface */
  color: var(--color-primary-on);
  /* Inverse On Surface */
  padding: 4px 8px;
  font-size: 11px;
  border-radius: 4px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  font-weight: 500;
}

.control-btn:hover::after {
  opacity: 1;
}

.checkbox-label {
  display: flex !important;
  align-items: center;
  cursor: pointer;
  font-size: 13px;
  color: var(--color-text);
  margin-bottom: 0 !important;
}

.checkbox-label input {
  display: none;
}

.checkmark {
  width: 16px;
  height: 16px;
  border: 1px solid var(--color-scrollbar-thumb);
  border-radius: 3px;
  margin-right: 8px;
  position: relative;
  background: transparent;
  transition: all 0.3s ease;
}

.checkbox-label input:checked+.checkmark {
  background: var(--color-text-bright);
  border-color: var(--color-text-bright);
}

.checkbox-label input:checked+.checkmark::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 6px;
  height: 10px;
  border: solid #000;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* --- Media Queries --- */
@media (max-width: 640px) {

  /* Layout */
  .container {
    max-width: 100%;
  }


  body.mode-call .app-header {
    height: 32px !important;
    padding: 0 12px !important;
    gap: 8px !important;
    top: 16px !important;
  }

  body.mode-call .app-header h1 {
    display: none !important;
  }

  body.mode-call .participant-badge {
    padding-left: 10px !important;
    gap: 4px;
    font-size: 12px;
  }

  body.mode-call .participant-badge span {
    font-size: 12px;
  }

  .call-timer {
    top: 16px;
    left: 16px;
    height: 28px;
    padding: 0 8px;
    border-radius: 6px;
    font-size: 12px !important;
    border-left: none !important;
    padding-left: 0 !important;
  }

  .call-room-code {
    top: 16px;
    right: 16px;
    height: 36px;
    padding: 6px 12px;
    border-radius: 10px;
    background: rgba(10, 10, 10, 0.85);
  }

  .code-label-text {
    display: none;
  }

  .code-value-text {
    font-size: 13px;
  }

  .code-copy-icon {
    width: 14px;
    height: 14px;
  }


  .controls-panel {
    bottom: 24px;
    padding: 8px 12px;
    gap: 8px;
    width: 92%;
    border-radius: var(--radius-xl);
    max-width: 360px;
    justify-content: space-evenly;
  }

  .control-btn {
    width: 48px !important;
    height: 48px !important;
    border-radius: 14px !important;
  }

  .mic-dropdown {
    border-radius: 14px !important;
  }

  .mic-main-btn {
    width: 42px !important;
    height: 48px !important;
  }

  .mic-dropdown-toggle {
    width: 24px !important;
    height: 48px !important;
  }

  .control-btn.hang-btn {
    width: 48px !important;
    height: 48px !important;
    border-radius: 14px !important;
  }


  .screen-container {
    width: 100vw;
    height: 80vh;
    max-height: none;
    aspect-ratio: auto;
    border-radius: 0;
    border: none;
    background: #09080b;
  }

  .screen-container video {
    object-fit: contain !important;
    width: 100%;
    height: 100%;
  }

  .screen-info {
    top: 12px;
    left: 10px;
    padding: 6px 10px;
    font-size: 11px;
  }

  .screen-fullscreen-btn {
    top: 12px;
    right: 10px;
    padding: 6px;
    border-radius: 4px;
  }

  .screen-fullscreen-btn svg {
    width: 16px;
    height: 16px;
  }

  .notifications-container {
    top: 16px;
    max-width: calc(100vw - 32px);
  }

  .notification-item {
    padding: 10px 14px;
    font-size: 12px;
    max-width: 100%;
    min-width: 180px;
  }

  .notification-icon {
    width: 16px;
    height: 16px;
  }

  .participant-banner {
    bottom: calc(100px + env(safe-area-inset-bottom, 0px));
    padding: 8px 16px;
    font-size: 13px;
    gap: 10px;
  }

  .participant-banner .banner-text {
    white-space: normal;
  }
}

@media (max-width: 480px) {
  body {
    padding: 16px;
  }

  .header {
    margin-bottom: 32px;
  }

  h1 {
    font-size: 20px;
  }

  .card {
    padding: 0;
    border-radius: 0;
  }

  .menu-card {
    padding: 20px;
    border-radius: 20px;
  }

  .app-header {
    justify-content: flex-start;
  }

  .app-header h1 {
    font-size: 18px;
  }

  .user-badge {
    padding: 4px 12px 4px 4px !important;
    font-size: 13px !important;
    max-width: calc(100vw - 32px) !important;
  }

  .user-badge-name {
    max-width: clamp(60px, 45vw, 160px);
    font-size: 13px;
  }

  .user-avatar,
  .user-badge-icon {
    width: 28px !important;
    height: 28px !important;
  }

  #authSection {
    padding: 20px 16px !important;
    border-radius: 20px !important;
  }

  .settings-toggle-row {
    padding: 12px 0;
    gap: 10px;
  }

  .settings-toggle-title {
    font-size: 14px;
  }

  .settings-toggle-desc {
    font-size: 11px;
  }

  .settings-switch {
    width: 44px;
    height: 24px;
  }

  .settings-switch-track::after {
    width: 18px;
    height: 18px;
    top: 3px;
    left: 3px;
  }

  .settings-switch input:checked+.settings-switch-track::after {
    transform: translateX(20px);
  }

  #shareBtn,
  #stopShareBtn {
    display: none !important;
  }

  .speaker-indicator {
    width: 150px;
    height: 150px;
  }

  .speaker-indicator::after {
    width: 60px;
    height: 60px;
  }

  .room-code-value {
    font-size: 48px;
    letter-spacing: 6px;
  }

  .connection-quality {
    top: 16px;
    right: 16px;
    padding: 6px 10px;
  }

  .quality-text {
    font-size: 10px;
    min-width: 40px;
  }

  .stats-content {
    padding: 20px;
    margin: 16px;
    width: calc(100% - 32px);
  }

  .stats-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .mic-dropdown-menu {
    width: 240px;
  }

  .notifications-container {
    top: 12px;
    max-width: calc(100vw - 24px);
  }

  .notification-item {
    padding: 9px 12px;
    font-size: 11.5px;
    gap: 8px;
  }

  .legal-footer {
    margin-top: 32px;
  }

  .legal-pill-container {
    width: 90%;
    justify-content: space-between;
  }

  .legal-link {
    font-size: 12px;
    padding: 10px 0;
    flex: 1;
    text-align: center;
  }
}

/* --- JUICY ANIMATIONS PACK (FIXED) --- */

:root {
  --ease-spring: cubic-bezier(0.2, 0, 0, 1);
  /* M3 Expressive spring curves */
  --m3-spring-bouncy: cubic-bezier(0.175, 0.885, 0.32, 1.25);
  --m3-spring-smooth: cubic-bezier(0.05, 0.7, 0.1, 1.0);
}

/* 1. Плавное нажатие (без прыжков) */
.control-btn,
.action-btn,
.mode-btn {
  transition:
    transform 0.15s cubic-bezier(0.2, 0, 0, 1),
    background-color 0.2s ease,
    box-shadow 0.2s ease,
    border-radius 0.2s ease !important;
}

.control-btn:active,
.action-btn:active,
.mode-btn:active {
  transform: scale(0.96) !important;
}

/* 2. Морфинг (ФОРМА) кнопки микрофона */

#muteBtn:not(.muted) {

  border-radius: var(--blob-radius, 24px) !important;
  will-change: border-radius;

  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

/* 3. Анимация появления панели */
.controls-panel {
  position: fixed;
  bottom: 24px;
  left: 50%;
  right: auto;
  transform: translateX(-50%) translateY(120%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  background-color: var(--color-surface-high) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: var(--radius-full);
  /* Expressive: Rounded Rectangle / Squircle */
  padding: 12px !important;
  gap: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.08);
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  transition: transform 0.6s var(--ease-spring), opacity 0.3s ease;
  background: var(--color-surface-high);
  padding: 12px 24px;
  opacity: 0;
}

.controls-panel:not(.hidden) {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

#muteBtn .mic-on,
#muteBtn .mic-off {
  position: absolute;
  width: 24px;
  height: 24px;
  transition: opacity 0.2s ease;
}

#muteBtn .mic-on.hidden,
#muteBtn .mic-off.hidden {
  opacity: 0 !important;
  pointer-events: none;
}

/* --- ИСПРАВЛЕНИЕ МОБИЛЬНОЙ ВЕРСТКИ (FINAL FIX) --- */
@media (max-width: 640px) {
  .controls-panel {
    bottom: 24px;
    /* Чуть выше от края */
    padding: 6px !important;
    gap: 12px !important;

    width: auto !important;
    max-width: 90vw;
    border-radius: var(--radius-full) !important;
    background: var(--color-surface-card) !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5) !important;
  }

  /* --- 1. Фикс размеров кнопок --- */
  .control-btn {
    width: 52px !important;

    height: 52px !important;
    border-radius: 50% !important;
    flex-shrink: 0;
  }

  /* --- 2. Фикс "Развалившейся" кнопки микрофона --- */


  .mic-dropdown {
    height: 52px !important;
    border-radius: var(--radius-full) !important;
    padding: 0 !important;
    gap: 0 !important;

    overflow: hidden;


  }


  .mic-main-btn {
    width: 60px !important;
    height: 100% !important;
    border-radius: 0 !important;
    background: transparent !important;

  }


  #muteBtn:not(.muted) {
    background-color: transparent !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }


  .mic-dropdown-toggle {
    width: 32px !important;
    height: 100% !important;
    border-radius: 0 !important;

    background: rgba(0, 0, 0, 0.1) !important;
    border-left: 1px solid rgba(0, 0, 0, 0.1) !important;
  }

  /* --- 3. Кнопка сброса (Красная) --- */
  .control-btn.hang-btn {
    width: 68px !important;
    /* Широкая пилюля */
    height: 52px !important;
    border-radius: var(--radius-full) !important;
  }

  /* --- 4. Фикс верхнего бара (чтобы не прилипал) --- */
  body.mode-call .app-header {
    top: 16px !important;
    width: auto !important;
    padding: 0 !important;
  }
}

/* ===== FIX: Центрирование иконки микрофона ===== */

#muteBtn .mic-wrapper {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

#muteBtn .mic-on,
#muteBtn .mic-off {
  position: absolute !important;
  width: 28px !important;
  height: 28px !important;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.2, 0, 0, 1);
  z-index: 1;
  font-size: 28px;
  inset: 0 !important;
  margin: auto !important;
}

/* Видимая иконка */
#muteBtn .mic-on:not(.hidden),
#muteBtn .mic-off:not(.hidden) {
  opacity: 1;
  transform: scale(1) rotate(0deg) !important;
}

#muteBtn .mic-on.hidden,
#muteBtn .mic-off.hidden {
  opacity: 0;
  transform: scale(0.5) rotate(-90deg) !important;
}

/* Улучшение видимости иконки микрофона в включенном состоянии */
.mic-dropdown:not(.muted) {
  background-color: var(--color-surface-high) !important;
  color: var(--color-text-bright) !important;
}

#muteBtn:not(.muted) .mic-on {
  color: var(--color-text-bright) !important;
}

/* Отключенное состояние: серый фон */
.mic-dropdown:has(.muted) {
  background-color: var(--color-surface-container) !important;
  color: var(--color-text-muted) !important;
}

/* ========== USER BADGE BUTTON ========== */
button.user-badge {
  background: var(--color-secondary-container) !important;
  border: none !important;
  border-radius: var(--radius-full) !important;
  cursor: pointer !important;
  transition: background 0.18s ease, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
  /* M3 elevation 1 tonal */
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 1px 3px 1px rgba(0, 0, 0, 0.15) !important;
}

button.user-badge:hover {
  background: color-mix(in srgb, var(--color-secondary-container) 85%, var(--color-secondary-on) 15%) !important;
  transform: scale(1.03) !important;
}

button.user-badge:active {
  transform: scale(0.96) !important;
}

.user-badge-chevron {
  width: 16px !important;
  height: 16px !important;
  opacity: 0.5;
  flex-shrink: 0;
}

/* ========== GOOGLE SIGN-IN BUTTON ========== */
.btn-google-signin {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 0 16px;
  height: 40px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: var(--color-text);
  font-family: 'Inter', 'Roboto', sans-serif;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.15s ease, box-shadow 0.18s ease;
  white-space: nowrap;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.btn-google-signin:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

.btn-google-signin:active {
  background: rgba(255, 255, 255, 0.06);
  transform: translateY(0);
  box-shadow: none;
}

.btn-google-signin svg {
  width: 18px !important;
  height: 18px !important;
  fill: none !important;
  flex-shrink: 0;
}

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

.auth-divider {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.25);
  padding: 0 2px;
  flex-shrink: 0;
}

/* ========== ACCOUNT PANEL (Material 3 Expressive Redesign) ========== */
.account-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 50000;
  opacity: 0;
  transition: opacity 0.3s cubic-bezier(0.2, 0, 0, 1);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.account-overlay--visible {
  opacity: 1;
}

.account-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 420px;
  background: var(--md-sys-color-surface);
  /* var(--color-bg) */
  z-index: 50001;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.05, 0.7, 0.1, 1);
  overflow-y: auto;
  border-radius: 36px 0 0 36px;
  box-shadow: -8px 0 40px rgba(0, 0, 0, 0.5);
  padding: 12px;
}

.account-panel--visible {
  transform: translateX(0);
}

.account-tab-content {
  display: none;
}

.account-tab-content.active {
  display: block;
  animation: tabFadeIn 0.3s ease-out;
}

@keyframes tabFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Account Panel Tabs */
.account-tabs {
  display: flex;
  gap: 8px;
  padding: 0 16px 16px;
  border-bottom: 1px solid var(--color-divider);
  margin-bottom: 16px;
}

.account-tab-btn {
  flex: 1;
  padding: 12px 16px;
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  font-family: var(--font-label);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius-full);
  transition: all 0.3s cubic-bezier(0.2, 0.0, 0, 1.0);
  position: relative;
  overflow: hidden;
}

.account-tab-btn:hover {
  background: var(--color-surface-container-high);
  color: var(--color-text);
}

.account-tab-btn.active {
  background: var(--color-surface-highest) !important; /* Вместо фиолетового фона — темно-серый */
  color: var(--color-primary) !important;              /* Только текст фиолетовый */
  border: 1px solid var(--color-primary-container);
}

/* Customization Styles */
.customization-label {
  font-family: var(--font-label);
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  padding: 0 16px 12px;
}

.customization-themes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 0 8px 16px;
}

.customization-theme-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--color-surface-container) !important;
  border: 1px solid var(--color-surface-highest) !important;
  border-radius: 24px;
  color: var(--color-text);
  font-family: var(--font-label);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.2, 0.0, 0, 1.0);
  position: relative;
  text-align: center;
}

.customization-theme-btn:hover {
  background: var(--color-surface-high) !important;
  border-color: var(--color-outline);
  transform: translateY(-2px);
}

.customization-theme-btn.active {
  background: var(--color-surface-high) !important;
  border-color: var(--color-primary) !important; /* Фиолетовая только рамка */
  color: var(--color-primary) !important;
}

.custom-lang-btn {
  flex-direction: row;
  justify-content: center;
  padding: 12px 16px;
  gap: 10px;
}

.custom-lang-flag {
  font-size: 20px;
}

.theme-preview {
  width: 100%;
  height: 48px;
  border-radius: 12px;
  border: 1px solid var(--color-outline-variant);
}

.theme-preview-dark { background: #141218; }
.theme-preview-light { background: #FEF7FF; }

.theme-active-dot {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-primary);
  opacity: 0;
  transform: scale(0.5);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.customization-theme-btn.active .theme-active-dot {
  opacity: 1;
  transform: scale(1);
}

/* Header */
.account-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 24px 16px 24px 8px;
  border-bottom: none;
  /* Убираем бордер для Flat стиля */
}

.account-back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--md-sys-color-on-surface);
  cursor: pointer;
  transition: background 0.2s ease;
}

.account-back-btn:hover {
  background: var(--md-sys-color-surface-container-highest);
}

.account-back-btn svg {
  width: 24px !important;
  height: 24px !important;
}

.account-title {
  font-family: 'Montserrat', sans-serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--md-sys-color-on-surface);
  margin: 0;
  letter-spacing: -0.5px;
}

/* Profile Card */
/* ОБНОВЛЕНО: Облегченная шапка профиля */
.account-profile-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--color-surface-container) !important; /* Нейтральный фон */
  border-radius: 24px;
  border: 1px solid #282828;
  margin: 0 0 24px;
  box-shadow: none;
}

.account-profile-avatar {
  width: 64px;
  /* Было 80px */
  height: 64px;
  border-radius: 50%;
  background: var(--md-sys-color-primary-container);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.account-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.account-avatar-fallback {
  color: var(--md-sys-color-on-primary-container);
}

.account-avatar-fallback svg {
  width: 40px !important;
  height: 40px !important;
}

.account-profile-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.account-profile-name {
  font-family: 'Montserrat', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--md-sys-color-on-surface);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-profile-provider {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--md-sys-color-on-surface-variant);
  background: var(--md-sys-color-surface-container-highest);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  width: fit-content;
}

.provider-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--md-sys-color-on-surface-variant);
}

/* Section */
.account-section {
  padding: 0 8px 16px;
  border-bottom: none;
}

.account-section-header {
  padding: 8px 16px 16px;
}

/* ОБНОВЛЕНО: Смягченные заголовки */
.account-section-title {
  font-family: var(--font-label);
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-muted);
  /* Серый вместо фиолетового */
  text-transform: uppercase;
  letter-spacing: 1.5px;
  /* Добавляем воздуха */
}

/* List Item (Card Style) */
.account-item {
  display: flex;
  flex-direction: column;
  padding: 20px;
  background: var(--color-surface-container) !important;
  border-radius: var(--radius-xl);
  margin-bottom: 12px;
  border: 1px solid #222222;
}

.account-item-content {
  display: flex;
  align-items: center;
  gap: 16px;
}

.account-item-icon {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--md-sys-color-primary);
  flex-shrink: 0;
}

.account-item-icon svg {
  width: 28px !important;
  height: 28px !important;
}

.account-item-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.account-item-label {
  font-size: 16px;
  font-weight: 500;
  color: var(--md-sys-color-on-surface);
}

.account-item-description {
  font-size: 13px;
  color: var(--md-sys-color-on-surface-variant);
}

/* ОБНОВЛЕНО: Единая пилюля для поля и кнопки */
.account-item-action {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  background: var(--color-surface-highest);
  border-radius: var(--radius-full);
  padding: 6px 6px 6px 20px;
  /* Кнопка аккуратно встанет справа */
  border: 1px solid transparent;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.account-item-action:focus-within {
  background: var(--color-surface-high);
  border-color: var(--color-primary-dim);
}

/* ОБНОВЛЕНО: Убран эффект коробки в коробке */
.account-item-value {
  margin-top: 8px;
  padding: 0;
  border-radius: 0;
  background: transparent;
  font-size: 15px;
  font-family: var(--font-ui);
  font-weight: 500;
  color: var(--color-text-bright);
  text-align: left;
  letter-spacing: 0;
}

/* M3 Expressive Field */
.m3-filled-field {
  flex: 1;
  height: 40px;
  background: transparent !important;
  /* Убираем лишний фон */
  box-shadow: none !important;
  padding: 0;
}

.m3-filled-field:hover,
.m3-filled-field:focus-within {
  background: transparent !important;
  box-shadow: none !important;
}

.m3-filled-field-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--color-text-bright);
  font-size: 15px;
  font-family: inherit;
  outline: none;
  width: 100%;
  height: 100%;
  padding: 0;
}

.m3-filled-field-input::placeholder {
  color: rgba(202, 196, 208, 0.5);
}

/* M3 Expressive Icon Button */
.m3-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
   /* Делаем цвета кнопки чуть мягче */
   background: var(--color-primary) !important;
   color: #111 !important; /* Черная иконка на светлом фоне для контраста */
  cursor: pointer;
  transition: transform 0.2s ease, filter 0.2s ease;
  flex-shrink: 0;
}

/* Save Status */
.account-save-status {
  font-size: 13px;
  font-weight: 500;
  padding: 12px 16px;
  border-radius: var(--radius-full);
  margin-top: 12px;
  text-align: center;
  animation: modalEnter 0.5s var(--m3-spring-bouncy);
}

.account-save-status--ok {
  background: rgba(74, 222, 128, 0.15);
  color: var(--color-success);
}

.account-save-status--err {
  background: var(--md-sys-color-error);
  color: var(--md-sys-color-on-error);
}

/* Logout Button */
/* ОБНОВЛЕНО: Легкая полупрозрачная кнопка выхода */
.account-logout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: calc(100% - 16px);
  margin: 8px auto 24px;
  padding: 16px;
  border-radius: var(--radius-full);
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Новые цвета */
  background: transparent !important;
  color: #ff6b6b !important;
  border: 1px solid rgba(239, 68, 68, 0.2) !important;
}

.account-logout-btn:hover {
  background: rgba(239, 68, 68, 0.1) !important;
  border-color: rgba(239, 68, 68, 0.5) !important;
  transform: scale(1.02);
}

.account-logout-btn:active {
  transform: scale(0.96);
}

.account-logout-icon {
  fill: currentColor;
  width: 20px !important;
  height: 20px !important;
}

/* Responsive */
@media (max-width: 480px) {
  .account-panel {
    max-width: 100%;
    top: auto;
    bottom: 0;
    border-radius: 36px 36px 0 0;
    transform: translateY(100%);
    max-height: 92vh;
    padding: 8px;
  }

  .account-panel--visible {
    transform: translateY(0);
  }

  .account-header {
    padding: 20px 12px;
  }

  .account-profile-card {
    padding: 20px;
    margin: 0 4px 20px;
    border-radius: var(--radius-xl);
  }

  .account-item {
    padding: 16px;
    margin-bottom: 8px;
    border-radius: 24px;
  }

  .m3-filled-field {
    height: 52px;
  }

  .m3-icon-btn {
    width: 52px;
    height: 52px;
  }
}

/* =================================================================
   MOBILE FIX v3 — CENTER CONTROLS + CLEAN LAYOUT
   ================================================================= */
.controls-panel.hidden {
  display: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

body.mode-call {
  padding: 0 !important;
  overflow: hidden !important;
}

@media (max-width: 768px) {

  body:not(.mode-call) {
    padding: 20px 16px !important;
    overflow-y: auto !important;
    align-items: flex-start !important;
  }

  /* ── ВИДЕО НА ВЕСЬ ЭКРАН ── */
  body.mode-call .screen-container:not(.hidden) {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100dvh !important;
    transform: none !important;
    border-radius: 0 !important;
    border: none !important;
    margin: 0 !important;
    max-width: none !important;
    box-shadow: none !important;
    background: var(--color-bg) !important;
    z-index: 50 !important;
  }

  /* ── ТОП-ОСТРОВОК ── */
  body.mode-call .app-header {
    position: fixed !important;
    top: 16px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: auto !important;
    height: 48px !important;
    padding: 0 !important;
    gap: 8px !important;
    margin: 0 !important;
    z-index: 22000 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-wrap: nowrap !important;
    white-space: nowrap !important;
    /* Прозрачный контейнер — каждый дочерний островок рисует себя сам */
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }

  body.mode-call .call-timer {
    font-size: 14px !important;
    font-weight: 600 !important;
    color: var(--color-primary-dim) !important;
    font-variant-numeric: tabular-nums !important;
  }

  body.mode-call .header-separator:not(.hidden) {
    display: block !important;
    width: 1px !important;
    height: 16px !important;
    background: rgba(255, 255, 255, 0.18) !important;
    margin: 0 !important;
  }

  body.mode-call .participant-badge:not(.hidden) {
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    color: var(--color-text-muted) !important;
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    animation: none !important;
  }

  body.mode-call .participant-badge svg {
    width: 15px !important;
    height: 15px !important;
  }

  body.mode-call .header-invite-btn:not(.hidden) {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 34px !important;
    height: 34px !important;
    padding: 0 !important;
    margin-left: 2px !important;
    border-radius: 50% !important;
    background: rgba(208, 188, 255, 0.1) !important;
    border: 1px solid rgba(208, 188, 255, 0.2) !important;
  }

  body.mode-call .invite-text {
    display: none !important;
  }

  body.mode-call .app-header-right {
    display: none !important;
  }

  /* ══════════════════════════════════════════════
     НИЖНЯЯ ПАНЕЛЬ — КНОПКИ СТРОГО ПО ЦЕНТРУ
     Только для не-call режима; mode-call управляется ниже через body.mode-call
  ══════════════════════════════════════════════ */

  body:not(.mode-call) .controls-panel:not(.hidden) {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    transform: none !important;
    opacity: 1 !important;
    width: 100% !important;
    max-width: none !important;

    /* ✅ ЦЕНТРИРОВАНИЕ ГРУППЫ КНОПОК */
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    flex-wrap: nowrap !important;
    gap: 16px !important;

    padding: 20px 24px calc(30px + env(safe-area-inset-bottom, 0px)) !important;
    margin: 0 !important;

    background: linear-gradient(to top,
        rgba(8, 7, 14, 1.0) 0%,
        rgba(8, 7, 14, 0.92) 40%,
        rgba(8, 7, 14, 0.55) 70%,
        rgba(8, 7, 14, 0.0) 100%) !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    z-index: 1000 !important;
  }

  /* Скрыть screen share и flip на мобилке (только вне звонка — в звонке скрывается через IS_MOBILE в JS) */
  body:not(.mode-call) .controls-panel .share-dropdown,
  body:not(.mode-call) .controls-panel #shareBtn,
  body:not(.mode-call) .controls-panel #stopShareBtn {
    display: none !important;
  }

  body:not(.mode-call) .controls-panel #flipCameraBtn {
    display: none !important;
  }

  /* ── Все кнопки одинакового размера ── */
  body:not(.mode-call) .controls-panel:not(.hidden) .control-btn {
    width: 64px !important;
    height: 64px !important;
    border-radius: 50% !important;
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transform: none !important;
    margin: 0 !important;
  }

  body:not(.mode-call) .controls-panel:not(.hidden) .control-btn span {
    display: none !important;
  }

  /* ── МИК: пилюля ── */
  body:not(.mode-call) .controls-panel:not(.hidden) .mic-dropdown {
    height: 64px !important;
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
    display: flex !important;
    align-items: stretch !important;
    border-radius: var(--radius-full) !important;
    overflow: visible !important;
    padding: 0 !important;
    gap: 0 !important;
    margin: 0 !important;
    background-color: var(--color-surface-high) !important;
    color: var(--color-text-bright) !important;
  }

  body:not(.mode-call) .controls-panel:not(.hidden) .mic-dropdown:has(.muted) {
    background: rgba(239, 68, 68, 0.24) !important;
    box-shadow: inset 0 0 0 1.5px rgba(239, 68, 68, 0.55) !important;
    color: #ff8080 !important;
  }
}

body:not(.mode-call) .controls-panel:not(.hidden) .mic-main-btn {
  width: 64px !important;
  height: 100% !important;
  border-radius: var(--radius-full) 0 0 100px !important;
  background: transparent !important;
  color: inherit !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
  box-shadow: none !important;
  transform: none !important;
  position: relative !important;
  overflow: hidden !important;
}

body:not(.mode-call) .controls-panel:not(.hidden) .mic-dropdown-toggle {
  width: 28px !important;
  height: 100% !important;
  border-radius: 0 100px 100px 0 !important;
  background: rgba(0, 0, 0, 0.1) !important;
  border-left: 1px solid rgba(0, 0, 0, 0.12) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  margin: 0 !important;
  color: inherit !important;
  flex-shrink: 0 !important;
}

body:not(.mode-call) .controls-panel:not(.hidden) .mic-dropdown-toggle svg {
  width: 14px !important;
  height: 14px !important;
}

/* ── ЗАВЕРШИТЬ: красная пилюля ── */
body:not(.mode-call) .controls-panel:not(.hidden) #hangBtn {
  width: 74px !important;
  height: 64px !important;
  border-radius: var(--radius-full) !important;
  background: var(--color-error-solid) !important;
  color: var(--color-text-bright) !important;
  box-shadow: 0 6px 20px rgba(192, 57, 43, 0.4) !important;
}

body:not(.mode-call) .controls-panel:not(.hidden) #hangBtn svg {
  width: 26px !important;
  height: 26px !important;
  fill: #fff !important;
}

/* ── КАМЕРА ── */
/* На мобилке camera-dropdown выглядит как обычная круглая кнопка.
     wrapper несёт цвет фона, #cameraBtn — прозрачный */
body:not(.mode-call) .controls-panel:not(.hidden) .camera-dropdown {
  height: 52px !important;
  width: 52px !important;
  background-color: var(--color-secondary-container) !important;
  background: var(--color-secondary-container) !important;
  border-radius: 50% !important;
  flex-shrink: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* Скрыть стрелку выбора камеры на мобилке */
body:not(.mode-call) .controls-panel:not(.hidden) #cameraDropdownToggle {
  display: none !important;
}

body:not(.mode-call) .controls-panel:not(.hidden) #cameraBtn {
  width: 100% !important;
  height: 100% !important;
  border-radius: 50% !important;
  background: transparent !important;
  color: var(--color-secondary-on) !important;
}

body:not(.mode-call) .controls-panel:not(.hidden) .camera-dropdown:has(#cameraBtn.sharing-active) {
  background-color: var(--color-primary-container) !important;
  background: var(--color-primary-container) !important;
}

body:not(.mode-call) .controls-panel:not(.hidden) #cameraBtn.camera-off {
  color: var(--color-text-muted) !important;
}

body:not(.mode-call) .controls-panel:not(.hidden) .camera-dropdown:has(#cameraBtn.cam-unavailable) {
  background-color: var(--color-outline-variant) !important;
  opacity: 0.6 !important;
}

/* ── Dropdown меню микрофона ── */
.mic-dropdown-menu:not(.hidden) {
  position: fixed !important;
  bottom: calc(94px + env(safe-area-inset-bottom, 0px)) !important;
  left: 16px !important;
  right: 16px !important;
  width: auto !important;
  transform: none !important;
  border-radius: 24px !important;
  background: var(--color-bg) !important;
  border: 1px solid rgba(255, 255, 255, 0.09) !important;
  box-shadow: 0 -4px 40px rgba(0, 0, 0, 0.6) !important;
  padding: 20px !important;
  animation: mMenuUp 0.28s cubic-bezier(0.2, 0, 0, 1) !important;
}

@keyframes mMenuUp {
  from {
    opacity: 0;
    transform: translateY(14px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.participant-banner:not(.hidden) {
  bottom: calc(110px + env(safe-area-inset-bottom, 0px)) !important;
  left: 16px !important;
  right: 16px !important;
  max-width: none !important;
}

/* Маленькие телефоны */
@media (max-width: 390px) {
  body:not(.mode-call) .controls-panel:not(.hidden) {
    gap: 12px !important;
    padding-left: 16px !important;
    padding-right: 16px !important;
  }

  body:not(.mode-call) .controls-panel:not(.hidden) .control-btn {
    width: 58px !important;
    height: 58px !important;
  }

  body:not(.mode-call) .controls-panel:not(.hidden) .mic-dropdown {
    height: 58px !important;
  }

  body:not(.mode-call) .controls-panel:not(.hidden) .mic-main-btn {
    width: 58px !important;
  }

  body:not(.mode-call) .controls-panel:not(.hidden) #hangBtn {
    width: 68px !important;
    height: 58px !important;
  }
}

/* ================================================================
   CO-WATCH YOUTUBE PANEL  (extras-youtube.js)
   ================================================================ */

/* ── Panel shell ── */
.ytcw-panel {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--md-sys-color-background, #0f0d13);
  z-index: 31000;
  transform: translateX(100%);
  transition: transform 0.38s cubic-bezier(0.2, 0, 0, 1);
  overscroll-behavior: contain;
}

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

.ytcw-panel.ytcw-panel--visible {
  transform: translateX(0);
}

/* ── Header ── */
.ytcw-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px 12px;
  background: var(--color-surface-container);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.ytcw-back-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}

.ytcw-back-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.ytcw-back-btn svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.ytcw-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text);
  flex: 1;
  min-width: 0;
}

.ytcw-yt-icon {
  width: 20px;
  height: 20px;
  fill: var(--color-youtube);
  flex-shrink: 0;
}

/* Sync dot (top-right) */
.ytcw-sync-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.2);
  transition: background 0.3s, box-shadow 0.3s;
}

.ytcw-sync-dot--idle {
  background: rgba(255, 255, 255, 0.18);
}

.ytcw-sync-dot--loading {
  background: var(--color-warning);
  animation: ytcwPulse 1s ease-in-out infinite;
}

.ytcw-sync-dot--ok {
  background: var(--color-success);
  box-shadow: 0 0 6px rgba(74, 222, 128, 0.5);
}

.ytcw-sync-dot--warn {
  background: var(--color-warning);
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.5);
}

.ytcw-sync-dot--bad {
  background: var(--color-error-solid);
  animation: ytcwPulse 0.8s ease-in-out infinite;
}

@keyframes ytcwPulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.4;
  }
}

/* ── URL bar ── */
.ytcw-url-bar {
  padding: 12px 16px;
  background: var(--color-surface-container);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.ytcw-url-field {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  overflow: hidden;
  gap: 0;
  transition: border-color 0.2s;
}

.ytcw-url-field:focus-within {
  border-color: var(--color-primary);
  background: rgba(208, 188, 255, 0.05);
}

.ytcw-url-prefix-icon {
  width: 20px;
  height: 20px;
  fill: var(--color-youtube);
  flex-shrink: 0;
  margin-left: 14px;
}

.ytcw-url-input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--color-text);
  font-size: 13px;
  padding: 11px 10px 11px 8px;
  outline: none;
  min-width: 0;
}

.ytcw-url-input::placeholder {
  color: rgba(202, 196, 208, 0.4);
}

.ytcw-load-btn {
  width: 44px;
  height: 44px;
  border: none;
  background: transparent;
  color: var(--color-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  transition: background 0.15s, color 0.15s;
}

.ytcw-load-btn:hover {
  background: rgba(208, 188, 255, 0.12);
  color: var(--color-text-bright);
}

.ytcw-load-btn:active {
  background: rgba(208, 188, 255, 0.2);
}

.ytcw-load-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* Load spinner */
.ytcw-load-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(208, 188, 255, 0.3);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: ytcwSpin 0.7s linear infinite;
}

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

/* ── Player area ── */
.ytcw-player-area {
  flex: 1;
  position: relative;
  background: #09080b;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  min-height: 0;
}

/* Placeholder */
.ytcw-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: rgba(202, 196, 208, 0.4);
  text-align: center;
  padding: 32px 24px;
  width: 100%;
}

.ytcw-placeholder svg {
  width: 56px;
  height: 56px;
  fill: rgba(255, 0, 0, 0.25);
}

.ytcw-placeholder p {
  font-size: 15px;
  font-weight: 500;
  color: rgba(202, 196, 208, 0.55);
  line-height: 1.5;
  margin: 0;
}

.ytcw-hint-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
}

.ytcw-hint-list span {
  font-size: 11px;
  color: rgba(202, 196, 208, 0.3);
  font-family: monospace;
  background: rgba(255, 255, 255, 0.04);
  padding: 3px 10px;
  border-radius: 6px;
}

/* Player container fills the area, 16:9 */
.ytcw-player-container {
  position: absolute;
  inset: 0;
}

.ytcw-player-container:empty {
  display: none;
}

.ytcw-player-container>div,
.ytcw-player-container iframe {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

/* Fullscreen button */
.ytcw-fs-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: none;
  background: rgba(0, 0, 0, 0.55);
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, opacity 0.2s;
  opacity: 0;
  z-index: 2;
}

.ytcw-player-area:hover .ytcw-fs-btn {
  opacity: 1;
}

.ytcw-fs-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* CSS-fallback fullscreen for iOS */
.ytcw-player-area--fs {
  position: fixed !important;
  inset: 0 !important;
  z-index: 99999 !important;
}

/* ── Status bar ── */
.ytcw-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 16px;
  background: var(--color-surface-container);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
  min-height: 48px;
}

/* Drift pill */
.ytcw-drift-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(202, 196, 208, 0.7);
  transition: background 0.2s, border-color 0.2s;
}

.ytcw-drift-pill svg {
  width: 13px;
  height: 13px;
  fill: currentColor;
}

.ytcw-drift-pill.ytcw-drift-ok {
  background: rgba(74, 222, 128, 0.1);
  border-color: rgba(74, 222, 128, 0.35);
  color: var(--color-success);
}

.ytcw-drift-pill.ytcw-drift-warn {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.35);
  color: var(--color-warning);
}

.ytcw-drift-pill.ytcw-drift-bad {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.35);
  color: var(--color-error-solid);
}

/* Peer pill */
.ytcw-peer-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: rgba(202, 196, 208, 0.6);
  margin-left: auto;
}

.ytcw-peer-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: background 0.3s;
}

.ytcw-peer-dot--online {
  background: var(--color-success);
  box-shadow: 0 0 5px rgba(74, 222, 128, 0.5);
}

.ytcw-peer-dot--wait {
  background: var(--color-warning);
  animation: ytcwPulse 1.2s ease-in-out infinite;
}

.ytcw-peer-dot--offline {
  background: rgba(255, 255, 255, 0.2);
}

/* ── Incoming video invite toast ── */
.ytcw-invite-toast {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 64px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--color-surface-toast);
  border: 1px solid rgba(208, 188, 255, 0.25);
  border-radius: 16px;
  padding: 12px 12px 12px 14px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
  transform: translateY(20px);
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s;
  z-index: 2;
}

.ytcw-invite-toast--visible {
  transform: translateY(0);
  opacity: 1;
}

.ytcw-invite-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(255, 0, 0, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ytcw-invite-icon svg {
  width: 20px;
  height: 20px;
  fill: var(--color-youtube);
}

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

.ytcw-invite-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
}

.ytcw-invite-sub {
  font-size: 11px;
  color: rgba(202, 196, 208, 0.55);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ytcw-invite-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.ytcw-invite-btn {
  padding: 7px 13px;
  border-radius: var(--radius-full);
  border: none;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.ytcw-invite-accept {
  background: var(--color-primary);
  color: var(--color-primary-on);
}

.ytcw-invite-accept:hover {
  background: var(--color-secondary-on);
}

.ytcw-invite-decline {
  background: rgba(255, 255, 255, 0.08);
  color: var(--color-text-muted);
}

.ytcw-invite-decline:hover {
  background: rgba(255, 255, 255, 0.14);
}

/* ── Shake animation (bad URL) ── */
.ytcw-shake {
  animation: ytcwShake 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes ytcwShake {

  0%,
  100% {
    transform: translateX(0);
  }

  15% {
    transform: translateX(-5px);
  }

  30% {
    transform: translateX(5px);
  }

  45% {
    transform: translateX(-4px);
  }

  60% {
    transform: translateX(4px);
  }

  75% {
    transform: translateX(-2px);
  }

  90% {
    transform: translateX(2px);
  }
}

/* ── Mobile safe area ── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .ytcw-status-bar {
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }
}

/* ── Extras panel: enable YouTube item ── */
.extras-item.extras-item--yt {
  pointer-events: auto !important;
  opacity: 1 !important;
  cursor: pointer !important;
}

.extras-item.extras-item--yt:hover {
  background: rgba(255, 0, 0, 0.06) !important;
}

.extras-item.extras-item--yt .extras-item-icon {
  background: rgba(255, 0, 0, 0.1) !important;
  color: var(--color-youtube) !important;
}

/* ================================================================
   CAMERA DROPDOWN (desktop + mobile picker)
   ================================================================ */

/* Wrapper — same pattern as .mic-dropdown */
/* Camera dropdown — styled as pill, same pattern as .mic-dropdown */
.camera-dropdown {
  position: relative;
  display: flex !important;
  align-items: stretch;
  padding: 0 !important;
  gap: 1px;
  overflow: visible !important;
  border-radius: 16px !important;
  background-color: var(--color-secondary-container) !important;
  color: var(--color-secondary-on) !important;
  transition: transform 0.2s ease, background-color 0.2s ease !important;
  box-shadow: none !important;
  height: 56px !important;
}

.camera-dropdown:hover {
  filter: brightness(1.08);
}

/* Camera active state */
.camera-dropdown:has(#cameraBtn.sharing-active) {
  background-color: var(--color-primary-container) !important;
  box-shadow:
    0 0 0 2px rgba(208, 188, 255, 0.50),
    0 4px 18px rgba(79, 55, 139, 0.38) !important;
}

.camera-dropdown:has(#cameraBtn.sharing-active) #cameraBtn {
  color: var(--color-primary-dim) !important;
}

/* Camera unavailable / off state */
.camera-dropdown:has(#cameraBtn.cam-unavailable) {
  background-color: var(--color-outline-variant) !important;
  opacity: 0.55;
}

#cameraBtn {
  position: relative;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: transparent !important;
  width: 56px !important;
  height: 100% !important;
  border-radius: 16px 4px 4px 16px !important;
  margin: 0 !important;
  color: inherit !important;
  box-shadow: none !important;
  transform: none !important;
  padding: 0 !important;
  border: none !important;
}

/* When dropdown arrow is hidden, full pill */
.camera-dropdown:not(.has-toggle) #cameraBtn {
  border-radius: 16px !important;
  width: 56px !important;
}

/* The small arrow toggle shown only on desktop */
#cameraDropdownToggle {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-direction: row !important;
  gap: 0 !important;
  min-width: 32px !important;
  width: 32px !important;
  height: 100% !important;
  border-radius: 4px 16px 16px 4px !important;
  background: rgba(0, 0, 0, 0.15) !important;
  color: inherit !important;
  padding: 0 !important;
  margin: 0 !important;
  box-shadow: none !important;
  border-left: 1px solid rgba(0, 0, 0, 0.15) !important;
  border-top: none !important;
  border-right: none !important;
  border-bottom: none !important;
}

#cameraDropdownToggle svg.dropdown-arrow {
  width: 16px !important;
  height: 16px !important;
  transition: transform 0.2s;
}

#cameraDropdownToggle.open svg.dropdown-arrow {
  transform: rotate(180deg);
}

/* Camera device dropdown menu */
.camera-dropdown-menu {
  position: absolute;
  bottom: calc(100% + 14px);
  left: 50%;
  transform: translateX(-50%);
  min-width: 220px;
  background: var(--color-surface-card);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg, 14px);
  padding: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
  z-index: 1001;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.camera-dropdown-menu::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 7px solid transparent;
  border-top-color: var(--color-surface-card);
}

/* Camera unavailable state */
#cameraBtn.cam-unavailable {
  opacity: 0.5;
  cursor: not-allowed;
}

#cameraBtn .cam-icon-off {
  /* SVG with exclamation badge */
}

.cam-no-devices-text {
  font-size: 12px;
  color: var(--color-text-muted, #888);
  text-align: center;
  padding: 4px 0;
}

/* ================================================================
   MOBILE CAMERA PICKER MODAL
   ================================================================ */

.mobile-cam-picker-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 9999;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.mobile-cam-picker-overlay.hidden {
  display: none;
}

.mobile-cam-picker-modal {
  background: var(--color-surface-card, #1a1a2e);
  border-radius: 24px 24px 16px 16px;
  padding: 20px 20px calc(20px + env(safe-area-inset-bottom, 0px));
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: slideUpModal 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes slideUpModal {
  from {
    transform: translateY(100%);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.mobile-cam-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mobile-cam-picker-header h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  color: var(--color-text-bright);
}

.mobile-cam-picker-close {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--color-text-muted, #aaa);
  padding: 0;
}

.mobile-cam-picker-close svg {
  width: 16px;
  height: 16px;
}

/* Preview */
.mobile-cam-preview-wrap {
  position: relative;
  background: var(--color-bg);
  border-radius: 14px;
  overflow: hidden;
  aspect-ratio: 4/3;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mobile-cam-preview-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
  /* mirror front cam by default */
}

.mobile-cam-preview-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: rgba(255, 255, 255, 0.4);
  font-size: 13px;
  pointer-events: none;
}

.mobile-cam-preview-placeholder.hidden {
  display: none;
}

/* Camera option buttons */
.mobile-cam-picker-options {
  display: flex;
  gap: 10px;
}

.mobile-cam-option-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid transparent;
  border-radius: 14px;
  color: var(--color-text-muted, #aaa);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.18s;
}

.mobile-cam-option-btn.active {
  border-color: var(--color-primary);
  background: rgba(208, 188, 255, 0.12);
  color: var(--color-primary);
}

/* Start button */
.mobile-cam-start-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 15px;
  background: var(--color-primary, #8b5cf6);
  border: none;
  border-radius: 14px;
  color: var(--color-text-bright);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}

.mobile-cam-start-btn:active {
  opacity: 0.85;
}

/* ================================================================
   DESKTOP CAMERA PREVIEW MODAL
   ================================================================ */

.desktop-cam-preview-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.desktop-cam-preview-overlay.hidden {
  display: none;
}

.desktop-cam-preview-modal {
  background: var(--color-surface-card, #1E1F22);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 24px;
  width: 420px;
  max-width: 92vw;
  display: flex;
  flex-direction: column;
  gap: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7);
  animation: desktopCamPreviewIn 0.28s cubic-bezier(0.2, 0, 0, 1);
}

@keyframes desktopCamPreviewIn {
  from {
    opacity: 0;
    transform: scale(0.94) translateY(12px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.desktop-cam-preview-header {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--color-text, #E6E0E9);
}

.desktop-cam-preview-header span {
  font-size: 16px;
  font-weight: 600;
  flex: 1;
}

.desktop-cam-preview-hint {
  width: 100%;
  font-size: 12px;
  color: var(--color-text-muted, #CAC4D0);
  margin: 4px 0 0;
  line-height: 1.5;
}

.desktop-cam-preview-video-wrap {
  width: 100%;
  aspect-ratio: 16/9;
  background: var(--color-bg);
  border-radius: 12px;
  overflow: hidden;
  position: relative;
}

.desktop-cam-preview-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
  transform: scaleX(-1);
  /* mirror for natural selfie view */
}

.desktop-cam-preview-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.desktop-cam-preview-btn {
  padding: 10px 20px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: all 0.18s ease;
}

.desktop-cam-preview-btn--cancel {
  background: rgba(255, 255, 255, 0.07);
  color: var(--color-text-muted, #CAC4D0);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.desktop-cam-preview-btn--cancel:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--color-text, #E6E0E9);
}

.desktop-cam-preview-btn--confirm {
  background: var(--color-primary-container);
  color: var(--color-secondary-on);
}

.desktop-cam-preview-btn--confirm:hover {
  background: var(--color-primary-dim);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(103, 80, 164, 0.4);
}

/* 🌟 MODERN MATERIAL 3 CALL UI (CONSOLIDATED) 🌟 */

/* ── 1. HEADER ISLANDS ── */
body.mode-call .app-header:not(.hidden) {
  position: fixed !important;
  top: 24px !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  height: 56px !important;
  width: auto !important;
  display: inline-flex !important;
  gap: 12px !important;
  padding: 0 !important;
  margin: 0 !important;
  z-index: 22000;
}

body.mode-call .main-island,
body.mode-call .header-extras-btn {
  background: var(--color-surface-high) !important;
  border-radius: var(--radius-full) !important;
  box-shadow: 0 4px 8px 3px rgba(0, 0, 0, 0.15), 0 1px 3px rgba(0, 0, 0, 0.3) !important;
  height: 56px !important;
  display: flex !important;
  align-items: center !important;
  padding: 0 24px !important;
  transition: background 0.2s ease, transform 0.2s ease !important;
}

body.mode-call .header-extras-btn {
  width: 56px !important;
  padding: 0 !important;
  justify-content: center !important;
  color: var(--color-secondary-on) !important;
}

/* Keep extras button as icon-only in call mode across all viewport states */
body.mode-call #headerExtrasBtn {
  width: 40px !important;
  min-width: 40px !important;
  height: 40px !important;
  padding: 0 !important;
  justify-content: center !important;
}

body.mode-call #headerExtrasBtn .invite-text {
  display: none !important;
}

body.mode-call #headerExtrasBtn .invite-icon-box {
  width: 20px !important;
  height: 20px !important;
  margin: 0 !important;
}

body.mode-call .main-island:hover,
body.mode-call .header-extras-btn:hover {
  background: color-mix(in srgb, var(--color-surface-high) 92%, var(--color-text-bright) 8%) !important;
  transform: none !important;
}

/* ── 2. BOTTOM CONTROLS PANEL ── */
body.mode-call .controls-panel:not(.hidden) {
  position: fixed !important;
  bottom: 32px !important;
  left: 50% !important;
  right: auto !important;
  transform: translateX(-50%) !important;
  width: auto !important;
  max-width: calc(100vw - 32px) !important;
  background: var(--color-surface-container) !important;
  border-radius: var(--radius-full) !important;
  padding: 12px 16px !important;
  gap: 12px !important;
  box-shadow: 0 4px 8px 3px rgba(0, 0, 0, 0.15), 0 1px 3px rgba(0, 0, 0, 0.3) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-wrap: nowrap !important;
  z-index: 21000;
  backdrop-filter: none !important;
}

/* ── 3. INDIVIDUAL BUTTONS ── */
body.mode-call .control-btn:not(.hidden) {
  width: 56px !important;
  height: 56px !important;
  border-radius: var(--radius-full) !important;
  background: var(--color-secondary-container) !important;
  color: var(--color-secondary-on) !important;
  border: none !important;
  transition: background 0.2s ease, transform 0.1s ease !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  flex-shrink: 0;
}

body.mode-call .control-btn:hover {
  background: color-mix(in srgb, var(--color-secondary-container) 92%, var(--color-secondary-on) 10%) !important;
}

body.mode-call .control-btn:active {
  transform: scale(0.95) !important;
}

/* Exception: End Call (Hang Up) */
body.mode-call #hangBtn {
  width: 80px !important;
  background: var(--color-error-solid) !important;
  color: #FFFFFF !important;
}

body.mode-call #hangBtn:hover {
  background: color-mix(in srgb, var(--color-error-solid) 90%, black 10%) !important;
}

/* ── 4. SPLIT BUTTONS (MIC & CAMERA) ── */
body.mode-call .mic-dropdown:not(.hidden),
body.mode-call .camera-dropdown:not(.hidden) {
  display: flex !important;
  height: 56px !important;
  background: var(--color-secondary-container) !important;
  border-radius: var(--radius-full) !important;
  /* FIX: overflow:hidden clipped the absolutely-positioned dropdown menu.
     Use clip-path for the pill shape so the menu can overflow freely. */
  overflow: visible !important;
  clip-path: none !important;
  gap: 0 !important;
  transition: transform 0.1s ease !important;
}

/* Clip inner buttons to pill shape so hover bg doesn't bleed outside rounded corners */
body.mode-call .camera-dropdown #cameraBtn {
  border-radius: var(--radius-full) 0 0 var(--radius-full) !important;
}
body.mode-call #cameraDropdownToggle {
  border-radius: 0 var(--radius-full) var(--radius-full) 0 !important;
}
/* When only the main button is visible (no toggle), full pill */
body.mode-call .camera-dropdown:not(.has-toggle) #cameraBtn {
  border-radius: var(--radius-full) !important;
}

body.mode-call .mic-main-btn,
body.mode-call .camera-dropdown #cameraBtn {
  width: 64px !important;
  height: 100% !important;
  background: transparent !important;
  color: inherit !important;
  margin: 0 !important;
  padding: 0 !important;
}

body.mode-call .mic-dropdown-toggle,
body.mode-call #cameraDropdownToggle {
  width: 38px !important;
  height: 100% !important;
  background: transparent !important;
  color: inherit !important;
  border-left: 1px solid color-mix(in srgb, var(--color-secondary-on) 12%, transparent) !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Hover effects for components of split buttons */
body.mode-call .mic-main-btn:hover,
body.mode-call #cameraBtn:hover,
body.mode-call .mic-dropdown-toggle:hover,
body.mode-call #cameraDropdownToggle:hover {
  background: color-mix(in srgb, var(--color-secondary-on) 8%, transparent) !important;
}

/* Special state: Sharing Active */
body.mode-call .camera-dropdown:has(#cameraBtn.sharing-active),
body.mode-call #stopShareBtn {
  background: var(--color-primary-container) !important;
  color: var(--color-primary-on) !important;
}

/* Special state: Muted / Off */
body.mode-call .control-btn.muted,
body.mode-call .mic-dropdown:has(.muted),
body.mode-call #cameraBtn.camera-off,
body.mode-call #cameraBtn.cam-unavailable {
  background: var(--color-error-bg) !important;
  color: var(--color-error-solid) !important;
}

/* ── 5. DROPDOWNS & MENUS ── */
body.mode-call .mic-dropdown-menu,
body.mode-call .camera-dropdown-menu,
body.mode-call .share-quality-dropdown {
  background: var(--color-surface-container-high) !important;
  border-radius: 28px !important;
  padding: 16px !important;
  border: none !important;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.3) !important;
  min-width: 260px !important;
  z-index: 30000 !important;
}

/* ── 6. PARTICIPANT TOOLTIP ── */
body.mode-call .participant-tooltip {
  top: calc(100% + 12px) !important;
  background: var(--color-surface-container-high) !important;
  border-radius: 28px !important;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.3) !important;
  padding: 16px !important;
  z-index: 25000 !important;
}

/* ── 7. MOBILE ADAPTATION ── */
@media (max-width: 768px) {
  body.mode-call .controls-panel:not(.hidden) {
    bottom: max(16px, env(safe-area-inset-bottom)) !important;
    padding: 8px !important;
    gap: 8px !important;
    border-radius: 32px !important;
  }

  body.mode-call .control-btn,
  body.mode-call .mic-dropdown,
  body.mode-call .camera-dropdown {
    height: 48px !important;
  }

  body.mode-call .control-btn {
    width: 48px !important;
  }

  body.mode-call .mic-main-btn,
  body.mode-call #cameraBtn {
    width: 52px !important;
  }

  body.mode-call .mic-dropdown-toggle,
  body.mode-call #cameraDropdownToggle {
    width: 34px !important;
  }

  body.mode-call #hangBtn {
    width: 68px !important;
  }
}
body.mode-call .mic-main-btn,
body.mode-call .camera-dropdown #cameraBtn {
  width: 64px !important;
  height: 100% !important;
  background: transparent !important;
  color: inherit !important;
  margin: 0 !important;
  padding: 0 !important;
}
body.mode-call .camera-dropdown #cameraBtn:hover {
  background: color-mix(in srgb, var(--color-secondary-container) 92%, var(--color-secondary-on) 8%) !important;
}

/* Правая стрелочка */
body.mode-call .mic-dropdown-toggle:not(.hidden),
body.mode-call #cameraDropdownToggle:not(.hidden) {
  width: 32px !important;
  border-radius: 0 var(--radius-full) var(--radius-full) 0 !important;
  background: var(--color-secondary-container) !important;
  color: var(--color-secondary-on) !important;
  margin: 0 !important;
  border: none !important;
  border-left: 1px solid color-mix(in srgb, var(--color-secondary-on) 12%, transparent) !important;
}

body.mode-call .mic-dropdown-toggle:hover,
body.mode-call #cameraDropdownToggle:hover {
  background: color-mix(in srgb, var(--color-secondary-container) 92%, var(--color-secondary-on) 8%) !important;
  color: var(--color-secondary-on) !important;
}

/* Share / Hangup circles */
body.mode-call #shareBtn,
body.mode-call #stopShareBtn {
  background: var(--color-secondary-container) !important;
  border-radius: var(--radius-full) !important;
}

body.mode-call #hangBtn {
  background: var(--color-error-solid) !important;
  border-radius: var(--radius-full) !important;
}

/* Убиреам hover-морфинг всей группы */
body.mode-call .mic-dropdown:hover,
body.mode-call .camera-dropdown:hover {
  filter: none !important;
}


/* ── 5. ЦВЕТОВЫЕ СОСТОЯНИЯ (ACTIVE, MUTED, DANGER) ── */

/* Выключено (Muted) - M3 Error Container */
body.mode-call .control-btn.muted,
body.mode-call .mic-dropdown.muted,
body.mode-call .camera-dropdown:has(.cam-unavailable),
body.mode-call .camera-dropdown:has(.camera-off) {
  background: var(--color-error-bg) !important;
  color: var(--color-error-solid) !important;
  box-shadow: none !important;
}

/* Приглушаем внутренние кнопки, когда весь контейнер красный */
body.mode-call .mic-dropdown.muted .control-btn,
body.mode-call .camera-dropdown:has(.camera-off) .control-btn,
body.mode-call .camera-dropdown:has(.cam-unavailable) .control-btn {
  background: transparent !important;
  color: var(--color-error-solid) !important;
}

body.mode-call .control-btn.muted:hover,
body.mode-call .mic-dropdown.muted:hover,
body.mode-call .camera-dropdown:has(.camera-off):hover,
body.mode-call .camera-dropdown:has(.cam-unavailable):hover {
  background: color-mix(in srgb, var(--color-error-bg) 92%, var(--color-error-solid) 8%) !important;
}

/* Кнопка сброса (Hang Up) - M3 Error */
body.mode-call #hangBtn {
  width: 80px !important;
  background: var(--color-error-solid) !important;
  color: var(--color-text-bright) !important;
  /* или --color-error-on */
}

body.mode-call #hangBtn:hover {
  background: color-mix(in srgb, var(--color-error-solid) 92%, #000 8%) !important;
}

/* Активный Screen Share (M3 Primary Container) */
body.mode-call #stopShareBtn {
  background: var(--color-primary-container) !important;
  color: var(--color-primary-dim) !important;
}


/* ── 6. ВЫПАДАЮЩИЕ МЕНЮ (M3 Elevated Surface) ── */
body.mode-call .mic-dropdown-menu,
body.mode-call .camera-dropdown-menu,
body.mode-call .share-quality-dropdown {
  background: var(--color-surface-container-high) !important;
  border-radius: 24px !important;
  padding: 16px !important;
  border: none !important;
  box-shadow: 0 8px 24px 4px rgba(0, 0, 0, 0.15), 0 2px 6px 0 rgba(0, 0, 0, 0.3) !important;
  backdrop-filter: none !important;
}

/* M3 Select Inputs внутри меню */
body.mode-call .dropdown-select,
body.mode-call .sqd-select {
  border-radius: 12px !important;
  background-color: var(--color-surface-highest) !important;
  border: none !important;
  padding: 14px 16px !important;
  color: var(--color-text) !important;
}

body.mode-call .dropdown-select:hover,
body.mode-call .sqd-select:hover {
  background-color: color-mix(in srgb, var(--color-surface-highest) 95%, var(--color-text) 5%) !important;
}


/* ── 7. МОБИЛЬНАЯ АДАПТАЦИЯ (COMPACT M3) ── */
@media (max-width: 768px) {
  body.mode-call .controls-panel:not(.hidden) {
    bottom: max(16px, env(safe-area-inset-bottom)) !important;
    padding: 8px 12px !important;
    gap: 8px !important;
    width: auto !important;
    max-width: calc(100vw - 32px) !important;
    border-radius: 32px !important;
  }

  /* Уменьшаем кнопки до 48px для мобилок */
  body.mode-call .control-btn {
    width: 48px !important;
    height: 48px !important;
  }

  body.mode-call .mic-dropdown,
  body.mode-call .camera-dropdown {
    height: 48px !important;
  }

  body.mode-call .mic-main-btn,
  body.mode-call #cameraBtn {
    width: 48px !important;
    border-radius: 24px 0 0 24px !important;
  }

  body.mode-call .mic-dropdown-toggle:not(.hidden),
  body.mode-call #cameraDropdownToggle:not(.hidden) {
    width: 32px !important;
    border-radius: 0 24px 24px 0 !important;
    display: flex !important; /* На десктопной мобилке (планшете) стрелочка может быть полезна */
  }

  body.mode-call #hangBtn {
    width: 64px !important;
  }

  /* Мобильная шапка */
  body.mode-call .app-header {
    top: 16px !important;
    gap: 8px !important;
  }

  body.mode-call .main-island {
    height: 40px !important;
    padding: 0 16px !important;
  }

  body.mode-call .header-extras-btn {
    width: 40px !important;
    height: 40px !important;
  }
}

/* Keep mobile call chrome stable in windowed/fullscreen landscape on touch devices */
@media (hover: none) and (pointer: coarse) {
  body.mode-call .app-header:not(.hidden) {
    position: fixed !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    top: calc(16px + env(safe-area-inset-top, 0px)) !important;
    gap: 8px !important;
    height: 48px !important;
    width: auto !important;
    padding: 0 !important;
  }

  body.mode-call .main-island {
    height: 48px !important;
    padding: 0 16px !important;
  }

  body.mode-call #headerExtrasBtn:not(.hidden) {
    width: 48px !important;
    height: 48px !important;
    min-width: 48px !important;
    padding: 0 !important;
    justify-content: center !important;
  }

  body.mode-call #headerExtrasBtn .invite-text {
    display: none !important;
  }

  body.mode-call #headerExtrasBtn .invite-icon-box {
    margin: 0 !important;
    width: 22px !important;
    height: 22px !important;
  }

  body.mode-call .controls-panel:not(.hidden) {
    bottom: calc(16px + env(safe-area-inset-bottom, 0px)) !important;
  }
}