/* ===== ПЕРЕМЕННЫЕ И БАЗОВЫЕ СТИЛИ ===== */
    :root {
      --ios-blue: #007AFF;
      --ios-green: #34C759;
      --ios-red: #FF3B30;
      --ios-orange: #FF9500;
      --ios-purple: #AF52DE;
      --ios-pink: #FF2D55;
      --glass-bg: rgba(255,255,255,0.24);
      --glass-border: rgba(255,255,255,0.42);
      --text-primary: #ffffff;
      --text-secondary: rgba(255,255,255,0.75);
      --blur: blur(20px);
      --radius: 20px;
      --transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    }

    * { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
    button, a, input[type="button"], input[type="submit"] { touch-action: manipulation; }
    button, a { cursor: pointer; }

    html {
      height: 100%;
      background: #C8E8FF;
      overflow: auto;
      -webkit-text-size-adjust: 100%;
    }
    
    body {
      min-height: 100vh;
      margin: 0;
      overflow-x: hidden;
      position: relative;
	  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
	  color: var(--text-primary);
      background:
        /* Верхний левый голубой свет */
        radial-gradient(
            circle at 0% 0%,
            rgba(153, 218, 245, 0.55) 0%,
            rgba(153, 218, 245, 0.28) 25%,
            transparent 55%
        ),
        /* Верхний правый насыщенный синий */
        radial-gradient(
            circle at 100% 0%,
            rgba(68, 118, 255, 0.88) 0%,
            rgba(68, 118, 255, 0.35) 30%,
            transparent 62%
        ),
        /* Нижний левый мятный */
        radial-gradient(
            circle at 0% 100%,
            rgba(99, 216, 202, 0.65) 0%,
            rgba(99, 216, 202, 0.32) 25%,
            transparent 55%
        ),
        /* Основа */
        linear-gradient(
            135deg,
            #e9f3fb 0%,
            #edf5fd 50%,
            #e9f0fb 100%
        );
      background-attachment: fixed;
    }

    /* ===== ФОН ===== */
    
	/* Светящийся шарик слева снизу */
	body::before {
      content: "";
      position: fixed;
      left: 70px;
      bottom: 60px;
      width: 80px;
      height: 80px;
      border-radius: 50%;
      background:
        radial-gradient(
            circle,
            rgba(255,255,255,0.95) 0%,
            rgba(255,255,255,0.45) 35%,
            rgba(255,255,255,0.12) 55%,
            transparent 75%
        );
      filter: blur(10px);
      pointer-events: none;
      z-index: 0;
    }
	
	/* Фирменные лучи как в иконке */
	body::after {
      content: "";
      position: fixed;
      right: -260px;
      bottom: -240px;
      width: 1100px;
      height: 900px;
      pointer-events: none;
      background:
        linear-gradient(
            -32deg,
            transparent 30%,
            rgba(255,255,255,0.02) 40%,
            rgba(255,255,255,0.22) 47%,
            rgba(255,255,255,0.38) 50%,
            rgba(255,255,255,0.18) 53%,
            rgba(255,255,255,0.05) 58%,
            transparent 68%
        );
      filter: blur(22px);
      opacity: 0.85;
      transform: rotate(-6deg);
      z-index: 0;
    }
	
	/* ===== НАВИГАЦИЯ (ПК) ===== */
    .top-nav {
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      z-index: 1100;
      display: flex;
      align-items: center;
      justify-content: center;
      padding-top: max(12px, env(safe-area-inset-top));
      background: transparent;
    }
    .top-nav-inner {
      width: 100%;
      max-width: 860px;
      padding: 12px 24px;
      display: flex;
      align-items: center;
      justify-content: space-between;
    }

    /* ===== НАВИГАЦИЯ (МОБИЛЬНАЯ) ===== */
    .top-nav-mobile {
      display: none;
    }
    .mobile-menu-overlay {
      display: none;
      pointer-events: none;
    }
    @media screen and (max-width: 1024px), screen and (max-width: 1366px) and (orientation: landscape) {
	  #switch-cam-btn { display: flex !important; }
	  .tablet-refresh-btn { display: inline-flex !important; }
	  .chat-glass-wrapper .chat-header {
		padding-top: 12px !important;
	  }
	}
    @media screen and (max-width: 768px) {
      .top-nav { display: none !important; }
      .top-nav-mobile {
        display: flex;
        align-items: center;
        justify-content: space-between;
        position: fixed;
        top: 0; left: 0; right: 0;
        z-index: 1100;
        padding: calc(max(16px, env(safe-area-inset-top)) + 8px) 16px 10px;
        border-bottom: none;
      }
      .top-nav-mobile .brand-logo {
        font-size: 17px;
        font-family: 'Trebuchet MS', 'Gill Sans', Arial, Helvetica, sans-serif;
        letter-spacing: 3px;
        font-weight: 700;
      }
      .hamburger {
        display: flex;
        flex-direction: column;
        gap: 5px;
        cursor: pointer;
        padding: 4px;
      }
      .hamburger span {
        display: block;
        width: 22px;
        height: 2px;
        background: #fff;
        border-radius: 2px;
        transition: all 0.3s;
      }
      .mobile-menu-overlay {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 1200;
        background: rgba(0,0,0,0.5);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s;
      }
      .mobile-menu-overlay.open {
        opacity: 1;
        pointer-events: all;
      }
      .mobile-menu-panel {
        position: fixed;
        top: calc(max(44px, env(safe-area-inset-top)) + 28px);
        right: 12px;
        width: 220px;
        height: auto;
        background: rgba(30, 15, 70, 0.85);
        backdrop-filter: blur(40px) saturate(180%);
        -webkit-backdrop-filter: blur(40px) saturate(180%);
        border: 1px solid rgba(255,255,255,0.12);
        border-radius: 18px;
        display: flex;
        flex-direction: column;
        padding: 10px 10px 12px;
        gap: 4px;
        transform: scale(0.92) translateY(-10px);
        opacity: 0;
        pointer-events: none;
        transition: transform 0.25s cubic-bezier(0.4,0,0.2,1), opacity 0.25s;
        z-index: 1200;
        box-shadow: 0 8px 40px rgba(0,0,0,0.45);
      }
      .mobile-menu-overlay.open .mobile-menu-panel {
        transform: scale(1) translateY(0);
        opacity: 1;
        pointer-events: all;
      }
      .mobile-menu-close { display: none; }
      .mobile-menu-item:first-of-type { margin-top: 0; }
      .mobile-menu-item {
        color: rgba(255,255,255,0.8);
        font-size: 15px;
        font-weight: 500;
        padding: 12px 14px;
        border: none;
        border-radius: 12px;
        cursor: pointer;
        background: rgba(255,255,255,0.06);
        text-align: left;
        font-family: inherit;
        transition: background 0.2s;
        display: flex;
        align-items: center;
        width: 100%;
      }
      .mobile-menu-item:active { background: rgba(123,82,255,0.25); }
      .mobile-menu-register {
        margin-top: 16px;
        background: linear-gradient(135deg, #7B52FF, #FF4DAE);
        color: #fff;
        border: none;
        border-radius: 14px;
        padding: 13px;
        font-size: 15px;
        font-weight: 700;
        font-family: inherit;
        cursor: pointer;
        width: 100%;
      }
      #home-screen {
        padding-top: 8px !important;
      }
      #home-screen .app-logo {
        margin-top: 100px !important;
      }
    }

    .brand-logo {
      font-family: 'Calibri', 'Gill Sans', 'Trebuchet MS', sans-serif;
      font-size: 22px;
      font-weight: 700;
      letter-spacing: 2px;
      color: #fff;
      text-shadow: 0 2px 16px rgba(123,82,255,0.6);
      line-height: 1;
      user-select: none;
    }

    @media screen and (min-width: 769px) and (max-width: 1366px) {
      .brand-logo {
        font-family: 'Trebuchet MS', 'Gill Sans', sans-serif;
        font-size: 20px;
        font-weight: 400 !important;
        letter-spacing: 3px;
        white-space: nowrap;
      }
      .contacts-sidebar { display: none !important; }
    }
    .btn-register {
      background: linear-gradient(135deg, #7B52FF, #FF4DAE);
      color: #fff;
      border: none;
      border-radius: 12px;
      padding: 7px 16px;
      font-size: 13px;
      font-weight: 700;
      font-family: inherit;
      cursor: pointer;
      box-shadow: 0 4px 16px rgba(123,82,255,0.4);
      transition: box-shadow 0.25s ease, background 0.25s ease;
      white-space: nowrap;
    }
    .btn-register:hover {
      background: linear-gradient(135deg, #6040EE, #EE3A9E);
      box-shadow: 0 8px 40px rgba(123,82,255,0.65);
    }
    .btn-register:active { opacity: 0.9; }

    @-webkit-keyframes bgShift {
      0% { -webkit-filter: hue-rotate(0deg) brightness(1); }
      50% { -webkit-filter: hue-rotate(15deg) brightness(1.05); }
      100% { -webkit-filter: hue-rotate(-10deg) brightness(0.95); }
    }

    @keyframes bgShift {
      0% { filter: hue-rotate(0deg) brightness(1); }
      50% { filter: hue-rotate(15deg) brightness(1.05); }
      100% { filter: hue-rotate(-10deg) brightness(0.95); }
    }

    /* ===== ОБЩИЕ СТИЛИ ЭКРАНОВ ===== */
    .screen {
      position: fixed;
      inset: 0;
      z-index: 10;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      transition: var(--transition);
      opacity: 0;
      pointer-events: none;
      transform: scale(0.97);
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
      scrollbar-width: none;
      -ms-overflow-style: none;
    }
    
    .screen::-webkit-scrollbar { display: none; }
    input[type=number]::-webkit-inner-spin-button,
    input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
    input[type=number] { -moz-appearance: textfield; }
    #register-screen::-webkit-scrollbar,
    #login-screen::-webkit-scrollbar,
    #forgot-screen::-webkit-scrollbar,
    #profile-screen::-webkit-scrollbar { display: none !important; width: 0 !important; }
    #register-screen, #login-screen, #forgot-screen, #profile-screen {
      scrollbar-width: none !important;
      -ms-overflow-style: none !important;
    }
    .screen.active {
      opacity: 1;
      pointer-events: all;
      transform: scale(1);
    }

    /* ===== ГЛАВНЫЙ ЭКРАН ===== */
    #home-screen {
      padding: 20px 20px 32px;
      padding-top: 56px;
      gap: 14px;
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
      justify-content: center;
      align-items: center;
    }

    @media screen and (max-width: 768px) {
      #home-screen { padding-top: 60px !important; padding-bottom: 80px !important; justify-content: flex-start !important; align-items: center !important; }
      #landing-view { padding-top: 16px !important; }
      #landing-view { padding-top: 20px !important; }
      #dashboard-view { max-width: 100% !important; padding: 0 4px 20px; }
      #register-screen, #login-screen, #forgot-screen {
        justify-content: flex-start;
        padding: 100px 16px 40px;
      }
      #profile-screen {
        justify-content: flex-start;
        padding: 90px 16px 40px;
      }
      #terms-screen, #privacy-screen, #about-screen {
        justify-content: flex-start;
        align-items: center;
        padding: 90px 12px 40px;
      }
      #landing-view > div:first-child > div:first-child { font-size: 32px !important; }
      #chat-screen { left: 0 !important; right: 0 !important; max-width: 100% !important; padding: 3px !important; }
	  .chat-glass-wrapper { margin: 3px !important; }
      .chat-header { padding-top: max(3px, env(safe-area-inset-top)) !important; }
    }
    
    #home-screen .glass-card,
    #home-screen .actions-card,
    #home-screen .app-logo,
    #home-screen .encrypt-badge,
    #home-screen .copyright-footer {
      max-width: 400px;
      width: 100%;
    }

    .app-logo {
      text-align: center;
      margin-bottom: 8px;
      flex-shrink: 0;
    }

    .logo-icon {
      width: 90px;
      height: 90px;
      margin: 0 auto 14px;
      border-radius: 24px;
      background: linear-gradient(145deg, rgba(255,255,255,0.2), rgba(255,255,255,0.05));
      border: 1.5px solid rgba(255,255,255,0.3);
      backdrop-filter: var(--blur);
      -webkit-backdrop-filter: var(--blur);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 48px;
      box-shadow: 0 20px 60px rgba(120,80,255,0.4), 0 0 0 1px rgba(255,255,255,0.1);
      animation: logoPulse 4s ease-in-out infinite;
      flex-shrink: 0;
    }
    @keyframes logoPulse {
      0%,100% { box-shadow: 0 20px 60px rgba(120,80,255,0.4), 0 0 0 1px rgba(255,255,255,0.1); }
      50% { box-shadow: 0 20px 80px rgba(255,80,150,0.5), 0 0 0 1px rgba(255,255,255,0.2); }
    }

    .app-title {
      font-size: 34px;
      font-weight: 800;
      letter-spacing: -0.5px;
      background: linear-gradient(135deg, #fff 0%, rgba(200,180,255,1) 50%, rgba(255,180,220,1) 100%);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      background-clip: text;
    }
    .app-subtitle {
      font-size: 16px;
      color: rgba(8,30,80,0.60);
      margin-top: 6px;
      font-weight: 400;
    }

    /* ===== СТЕКЛЯННЫЕ КАРТОЧКИ ===== */
    .glass-card {
      background: var(--glass-bg);
      border: 1.5px solid var(--glass-border);
      backdrop-filter: var(--blur);
      -webkit-backdrop-filter: var(--blur);
      border-radius: var(--radius);
      padding: 20px;
      width: 100%;
      max-width: 400px;
      flex-shrink: 0;
      box-shadow: 0 8px 32px rgba(0,0,0,0.12);
    }

    .glass-card label {
      display: block;
      font-size: 13px;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 1px;
      color: var(--text-secondary);
      margin-bottom: 10px;
    }

    .glass-input {
	  width: 100%;
	  background: rgba(255,255,255,0.35);
	  border: 1.5px solid rgba(255,255,255,0.5);
	  border-radius: 14px;
	  padding: 14px 16px;
	  color: rgba(8, 30, 80, 0.7) !important;
	  font-size: 17px;
	  font-family: inherit;
	  font-weight: 500;
	  outline: none;
	  transition: var(--transition);
	}
	.glass-input::placeholder {
	  color: rgba(8, 30, 80, 0.4) !important;
	}
	
	#add-contact-input::placeholder {
      color: rgba(255,255,255,0.6) !important;
    }
	
	.glass-input:focus {
	  border-color: rgba(120,80,255,0.7);
	  background: rgba(255,255,255,0.12);
	  box-shadow: 0 0 0 3px rgba(120,80,255,0.2);
	}

    /* ===== КНОПКИ ===== */
    .actions-card {
      background: var(--glass-bg);
      border: 1.5px solid var(--glass-border);
      backdrop-filter: var(--blur);
      -webkit-backdrop-filter: var(--blur);
      border-radius: var(--radius);
      padding: 20px;
      width: 100%;
      max-width: 400px;
      display: flex;
      flex-direction: column;
      gap: 12px;
      flex-shrink: 0;
    }

    .btn {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 10px;
      padding: 16px 24px;
      border-radius: 16px;
      border: none;
      font-size: 17px;
      font-weight: 700;
      font-family: inherit;
      cursor: pointer;
      transition: var(--transition);
      position: relative;
      overflow: hidden;
    }
    .btn::after {
      content: '';
      position: absolute;
      inset: 0;
      background: rgba(255,255,255,0);
      transition: background 0.2s;
    }
    .btn:active::after { background: rgba(255,255,255,0.1); }
    .btn:active { transform: scale(0.97); }

    .btn-primary {
      background: linear-gradient(135deg, #7B52FF, #FF4DAE);
      color: #fff;
      box-shadow: 0 8px 30px rgba(123,82,255,0.4);
      transition: filter 0.3s ease, box-shadow 0.3s ease, transform 0.2s ease;
    }
    .btn-primary:hover {
      filter: brightness(1.15);
      box-shadow: 0 12px 40px rgba(123,82,255,0.6);
      transform: translateY(-2px);
    }
    .btn-secondary {
      background: linear-gradient(135deg, rgba(0,180,255,0.7), rgba(0,120,200,0.7));
      color: #fff;
      box-shadow: 0 8px 30px rgba(0,180,255,0.3);
      transition: filter 0.3s ease, box-shadow 0.3s ease, transform 0.2s ease;
    }
    .btn-secondary:hover {
      filter: brightness(1.15);
      box-shadow: 0 12px 40px rgba(0,180,255,0.5);
      transform: translateY(-2px);
    }

    .btn-outline {
      background: rgba(255,255,255,0.08);
      border: 1.5px solid rgba(255,255,255,0.2);
      color: #fff;
    }
    .btn-outline:hover { background: rgba(255,255,255,0.14); }

    .btn-ghost {
      background: transparent;
      color: var(--text-secondary);
      font-size: 15px;
    }

    .divider {
      display: flex;
      align-items: center;
      gap: 12px;
      color: var(--text-secondary);
      font-size: 13px;
    }
    .divider::before, .divider::after {
      content: '';
      flex: 1;
      height: 1px;
      background: rgba(255,255,255,0.15);
    }

    /* ===== МОДАЛЬНЫЕ ОКНА ===== */
    .modal-overlay {
      position: fixed;
      inset: 0;
      z-index: 100;
      background: rgba(0,0,0,0.5);
      backdrop-filter: blur(10px);
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 20px;
      opacity: 0;
      pointer-events: none;
      transition: var(--transition);
    }
    .modal-overlay.open {
      opacity: 1;
      pointer-events: all;
    }
    .modal-sheet {
      background: rgba(30,20,60,0.95);
      border: 1.5px solid rgba(255,255,255,0.2);
      backdrop-filter: var(--blur);
      border-radius: 28px;
      padding: 28px 24px;
      width: 100%;
      max-width: 400px;
      transform: scale(0.95);
      transition: var(--transition);
    }
    .modal-overlay.open .modal-sheet {
      transform: scale(1);
    }
    .modal-title {
      font-size: 22px;
      font-weight: 700;
      margin-bottom: 20px;
      text-align: center;
    }

    /* ===== ЭКРАН ЧАТА ===== */
    #chat-screen {
	  padding: 16px !important;
      flex-direction: column;
      justify-content: flex-start;
      align-items: stretch;
      background: transparent;
      max-width: 680px;
      margin: 0 auto;
      inset: 0;
      left: calc(50% - min(340px, 50%));
      right: calc(50% - min(340px, 50%));
    }

    .chat-header {
	  background: linear-gradient(135deg, rgba(100, 200, 255, 0.25), rgba(150, 220, 255, 0.2));
	  backdrop-filter: blur(20px);
	  -webkit-backdrop-filter: blur(20px);
	  border: 1.5px solid rgba(255, 255, 255, 0.55);
	  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
	  border-radius: 20px 20px 0 0;
	  padding: 14px 18px;
	  padding-top: max(14px, env(safe-area-inset-top));
	  display: flex;
	  align-items: center;
	  gap: 12px;
	  z-index: 20;
	  flex-shrink: 0;
	  margin: 0;
	  box-shadow: none;
	}

    .chat-back-btn {
      background: rgba(0,150,200,0.12);
      border: none;
      color: rgba(0,100,160,0.8);
      border-radius: 50%;
      width: 36px;
      height: 36px;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      font-size: 24px;
      flex-shrink: 0;
      transition: var(--transition);
    }
    .chat-back-btn:active { background: rgba(255,255,255,0.2); transform: scale(0.92); }

    .chat-peer-info {
      flex: 1;
      min-width: 0;
    }
    .chat-peer-name {
      font-size: 16px;
      font-weight: 700;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      color: rgba(0,60,120,0.85);
    }
    .peer-status {
      font-size: 12px;
      display: flex;
      align-items: center;
      gap: 5px;
      margin-top: 1px;
    }
    .status-dot {
      width: 7px;
      height: 7px;
      border-radius: 50%;
      background: #aaa;
      flex-shrink: 0;
      transition: background 0.4s;
    }
    .status-dot.online { background: var(--ios-green); box-shadow: 0 0 6px var(--ios-green); }
    .status-dot.offline { background: #666; }
    .status-text { color: rgba(8,30,80,0.55); }

    .header-actions {
      display: flex;
      gap: 8px;
      flex-shrink: 0;
    }
    .header-btn {
      background: rgba(0,150,200,0.12);
      border: none;
      color: rgba(0,100,160,0.8);
      border-radius: 50%;
      width: 36px;
      height: 36px;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      font-size: 16px;
      transition: var(--transition);
    }
    .header-btn:active { background: rgba(255,255,255,0.2); transform: scale(0.92); }
    .header-btn.active { background: var(--ios-green); }

    /* ===== ИНФОРМАЦИЯ О ВСТРЕЧЕ ===== */
    .meeting-info-bar {
      background: transparent;
      border: none;
      padding: 6px 20px;
      font-size: 12px;
      color: var(--text-secondary);
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 16px;
      flex-shrink: 0;
    }
    .meeting-number-display {
      font-weight: 700;
      color: rgba(180,160,255,1);
      letter-spacing: 2px;
      font-size: 15px;
    }

    /* ===== СООБЩЕНИЯ ===== */
    .messages-container {
	  flex: 1;
	  overflow-y: auto;
	  padding: 20px 16px;
	  display: flex;
	  flex-direction: column;
	  gap: 10px;
	  overscroll-behavior: contain;
	  align-items: stretch;
	  background: rgba(255, 255, 255, 0.35);
	  backdrop-filter: blur(20px);
	  -webkit-backdrop-filter: blur(20px);
	  border: 1.5px solid rgba(255, 255, 255, 0.55);
	  border-top: none;
	  border-bottom: none;
	  margin: 0;
	  box-shadow: none;
	  scroll-behavior: auto !important;
      -webkit-overflow-scrolling: touch;
	}
	
	/* Отключаем "умную" прокрутку Safari */
    .messages-container::-webkit-scrollbar {
      display: none;
    }
    .messages-container::-webkit-scrollbar { width: 4px; }
    .messages-container::-webkit-scrollbar-track { background: transparent; }
    .messages-container::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 2px; }

    /* ===== БАЛЛОНЫ СООБЩЕНИЙ ===== */
    .message-row {
      display: flex;
      align-items: flex-end;
      gap: 8px;
      animation: msgIn 0.3s cubic-bezier(0.34,1.56,0.64,1);
      justify-content: flex-start;
      width: 100%;
    }
    .message-row.mine {
      justify-content: flex-end;
      flex-direction: row-reverse;
    }
    @keyframes msgIn {
      from { opacity: 0; transform: translateY(12px) scale(0.95); }
      to { opacity: 1; transform: translateY(0) scale(1); }
    }

    .avatar-small {
      width: 28px;
      height: 28px;
      border-radius: 50%;
      background: linear-gradient(135deg, #7B52FF, #FF4DAE);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 12px;
      font-weight: 700;
      flex-shrink: 0;
    }

    .bubble, .bubble *, .bubble p, .bubble span, .bubble div {
      -webkit-touch-callout: none;
      -webkit-user-select: none;
      user-select: none;
    }
    .bubble {
      -webkit-touch-callout: none;
      -webkit-user-select: none;
      user-select: none;
      max-width: 88%;
      width: fit-content;
      padding: 10px 14px;
      border-radius: 18px;
      font-size: 15px;
      line-height: 1.45;
      word-break: normal;
      overflow-wrap: anywhere;
      white-space: normal;
      position: relative;
      -webkit-user-select: none;
      user-select: none;
      -webkit-touch-callout: none;
    }
    .bubble.theirs {
      background: linear-gradient(135deg, rgba(20,160,220,0.85), rgba(10,200,160,0.8));
      border: 1px solid rgba(255,255,255,0.1);
      border-bottom-left-radius: 4px;
      border-bottom-color: transparent;
      border-left-color: transparent;
      position: relative;
    }
    .bubble.mine {
      background: linear-gradient(135deg, #7B52FF, #9B60FF);
      border-bottom-right-radius: 4px;
      color: #fff;
      margin-left: auto;
    }
    .bubble-time {
      font-size: 10px;
      color: rgba(255,255,255,0.45);
      margin-top: 4px;
      text-align: right;
    }
    .bubble.theirs .bubble-time { text-align: left; }
    .msg-ticks { display: inline-flex; align-items: center; margin-left: 3px; font-size: 11px; color: rgba(255,255,255,0.4); vertical-align: middle; }
    .msg-ticks.read { color: #4FC3F7 !important; }

    .bubble-img {
      -webkit-touch-callout: none;
      -webkit-user-select: none;
      -webkit-tap-highlight-color: transparent;
      width: 100%;
      max-width: 220px;
      height: auto;
      max-height: 260px;
      border-radius: 0;
      display: block;
      object-fit: cover;
      cursor: zoom-in;
      transition: none;
    }
    .bubble-img:hover { }

    .bubble.image-bubble {
      padding: 0;
      max-width: 60%;
      overflow: hidden;
      line-height: 0;
    }
    .bubble.image-bubble .bubble-time { display: none; }
    .bubble.mine.video-bubble {
      border-radius: 18px !important;
      -webkit-mask-image: -webkit-radial-gradient(white, black);
      transform: translateZ(0);
    }
    .bubble.theirs.video-bubble {
      border-radius: 18px !important;
      -webkit-mask-image: -webkit-radial-gradient(white, black);
      transform: translateZ(0);
    }

    .system-message {
      text-align: center;
      color: rgba(255,255,255,0.45);
      font-size: 12px;
      padding: 6px 16px;
      background: rgba(255,255,255,0.05);
      border-radius: 12px;
      margin: 4px auto;
      max-width: 80%;
    }
	
	.date-separator {
	  display: flex;
	  align-items: center;
	  justify-content: center;
	  margin: 14px 0 8px;
	  pointer-events: none;
	  user-select: none;
	}
	.date-separator span {
	  background: rgba(0, 0, 0, 0.18);
	  backdrop-filter: blur(8px);
	  -webkit-backdrop-filter: blur(8px);
	  color: #fff;
	  font-size: 12px;
	  font-weight: 500;
	  padding: 4px 12px;
	  border-radius: 20px;
	  letter-spacing: 0.2px;
	}

    .typing-indicator {
      display: none;
      align-items: center;
      gap: 4px;
      padding: 10px 14px;
      background: rgba(255,255,255,0.1);
      border-radius: 18px;
      border-bottom-left-radius: 0px 6px;
      max-width: 70px;
    }
    .typing-indicator.visible { display: flex; }
    .typing-dot {
      width: 7px; height: 7px;
      border-radius: 50%;
      background: rgba(255,255,255,0.5);
      animation: typingBounce 1.2s infinite;
    }
    .typing-dot:nth-child(2) { animation-delay: 0.2s; }
    .typing-dot:nth-child(3) { animation-delay: 0.4s; }
    @keyframes typingBounce {
      0%,60%,100% { transform: translateY(0); }
      30% { transform: translateY(-5px); }
    }

    /* ===== ПАНЕЛЬ ВВОДА СООБЩЕНИЯ ===== */
    .chat-input-bar {
	  background: rgba(255, 255, 255, 0.35);
	  backdrop-filter: blur(20px);
	  -webkit-backdrop-filter: blur(20px);
	  border: 1.5px solid rgba(255, 255, 255, 0.55);
	  border-top: none;
	  border-radius: 0 0 20px 20px;
	  padding: 12px 16px;
	  padding-bottom: max(18px, env(safe-area-inset-bottom));
	  display: flex;
	  align-items: center;
	  gap: 10px;
	  flex-shrink: 0;
	  margin: 0;
	  box-shadow: none;
	}

    .chat-input-inner {
      display: flex;
      align-items: center;
      gap: 8px;
      background: rgba(255,255,255,0.35);
      backdrop-filter: blur(20px);
      -webkit-backdrop-filter: blur(20px);
      border: 1px solid rgba(255,255,255,0.12);
      border-radius: 28px;
      padding: 8px 12px;
      flex: 1;
      box-shadow: 0 4px 24px rgba(0,0,0,0.3);
    }

    .attach-btn {
      background: transparent;
      border: none;
      color: rgba(255,255,255,0.85);
      border-radius: 50%;
      width: 32px;
      height: 32px;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      font-size: 18px;
      flex-shrink: 0;
      transition: var(--transition);
    }
    .attach-btn:hover { color: rgba(255,255,255,0.9); }
    .attach-btn:active { background: rgba(255,255,255,0.2); }

    .message-input-wrap {
      flex: 1;
      min-width: 0;
      position: relative;
    }

    .message-input {
      width: 100%;
      background: transparent;
      border: none;
      padding: 6px 8px;
      color: rgba(0, 0, 0, 0.7);
      font-size: 16px;
      font-family: inherit;
      outline: none;
      resize: none;
      min-height: 36px;
      max-height: 200px;
      overflow-y: auto;
	  scrollbar-width: none;
      -ms-overflow-style: none;
      -webkit-touch-callout: none;
      line-height: 1.5;
      box-sizing: border-box;
      -webkit-appearance: none;
      appearance: none;
      border-radius: 0;
    }
	.message-input::placeholder {
	  color: rgba(0,0,0,0.35);
	}
    .message-input:focus {
      background: transparent;
    }
	.message-input::-webkit-scrollbar { display: none; }

    .send-btn {
      background: linear-gradient(135deg, #7B52FF, #FF4DAE);
      border: none;
      color: #fff;
      border-radius: 50%;
      width: 34px;
      height: 34px;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      font-size: 16px;
      flex-shrink: 0;
      transition: var(--transition);
      box-shadow: 0 4px 15px rgba(123,82,255,0.4);
    }
    .send-btn:active { transform: scale(0.9); }
    .send-btn:disabled { opacity: 0.4; cursor: not-allowed; }

    /* ===== ПАНЕЛЬ РЕДАКТИРОВАНИЯ ===== */
    .edit-bar {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 6px 12px;
      margin: 0 12px;
      background: transparent;
      box-sizing: border-box;
      border-left: 1px solid rgba(255,255,255,0.15);
      border-right: 1px solid rgba(255,255,255,0.15);
      animation: slideUp 0.15s ease;
    }

    @keyframes slideUp { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:translateY(0); } }
    .edit-bar-icon {
      color: rgba(0,0,0,0.35);
      flex-shrink: 0;
    }
    .edit-bar-content {
      flex: 1;
      min-width: 0;
    }
    .edit-bar-label {
      font-size: 11px;
      font-weight: 500;
      color: rgba(0,0,0,0.4);
      margin-bottom: 1px;
      text-transform: uppercase;
      letter-spacing: 0.5px;
    }
    .edit-bar-text {
      font-size: 13px;
      color: rgba(0,0,0,0.6);
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .edit-bar-cancel {
      background: transparent;
      border: none;
      color: rgba(0,0,0,0.35);
      cursor: pointer;
      padding: 4px;
      border-radius: 50%;
      width: 28px;
      height: 28px;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: background 0.2s;
      flex-shrink: 0;
    }
    .edit-bar-cancel:hover { background: rgba(255,255,255,0.1); color: #fff; }

    /* ===== ЭКРАН ВИДЕОЗВОНКА ===== */
    #video-screen {
      background: #000;
      z-index: 50;
      justify-content: flex-end;
    }

    #remote-video {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      object-fit: cover;
      background: #111;
    }

    .video-placeholder {
      position: absolute;
      inset: 0;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      background: linear-gradient(135deg, #1a0a3a, #0a1a3a);
      gap: 16px;
      color: rgba(255,255,255,0.5);
      font-size: 16px;
    }
    .video-avatar-large {
      width: 100px;
      height: 100px;
      border-radius: 50%;
      background: linear-gradient(135deg, #7B52FF, #FF4DAE);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 42px;
      font-weight: 700;
      box-shadow: 0 0 60px rgba(123,82,255,0.5);
    }

    #local-video { transform: scaleX(-1); }
    #local-video.no-mirror { transform: scaleX(1); }
    #local-video {
	  position: absolute;
	  bottom: 130px;
	  right: 16px;
	  width: 130px;
	  height: auto;
	  aspect-ratio: 9 / 16;
	  border-radius: 18px;
	  object-fit: cover;
	  object-position: center center;
	  border: none;
	  box-shadow: 0 4px 24px rgba(0,0,0,0.6), 0 0 0 2px rgba(255,255,255,0.25), 0 0 0 3px rgba(123,82,255,0.3);
	  background: #222;
	  z-index: 60;
	  cursor: pointer;
	  display: none;    /* скрыт до соединения */
	  opacity: 0;
	  transform: scale(0.7);
	  transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.34,1.56,0.64,1);
	}
	#local-video.pip-visible {
	  display: block;
	  opacity: 1;
	  transform: scale(1);
	}

	/* ===== РЕЖИМ SWAP: local-video становится большим, remote-video – маленьким ===== */
	#video-screen.swapped #remote-video {
	  position: absolute !important;
	  bottom: 130px !important;
	  right: 16px !important;
	  width: 130px !important;
	  height: auto !important;
	  aspect-ratio: 9 / 16 !important;
	  border-radius: 18px !important;
	  object-fit: cover !important;
	  z-index: 70 !important;
	  box-shadow: 0 4px 24px rgba(0,0,0,0.6), 0 0 0 2px rgba(255,255,255,0.25), 0 0 0 3px rgba(123,82,255,0.3);
	  background: #111;
	  inset: auto !important;
	}

	#video-screen.swapped #local-video {
	  position: absolute !important;
	  inset: 0 !important;
	  width: 100% !important;
	  height: 100% !important;
	  object-fit: cover !important;
	  border-radius: 0 !important;
	  box-shadow: none !important;
	  z-index: 55 !important;
	  transform: scaleX(-1) !important;   /* зеркалирование фронталки */
	  aspect-ratio: unset !important;
	  background: #000;
	}

	/* ===== Self-preview: полноэкранный предпросмотр своей камеры ===== */
	#self-preview {
	  position: absolute;
	  inset: 0;
	  width: 100%;
	  height: 100%;
	  object-fit: cover;
	  background: #000;
	  z-index: 55;           /* выше video-placeholder, но ниже remote-video */
	  transform: scaleX(-1); /* зеркалирование как у local-video */
	}

	/* Активное состояние – показываем */
	#self-preview.active {
	  display: block !important;
	}

    /* ===== КНОПКИ УПРАВЛЕНИЯ ВИДЕО ===== */
    .video-controls {
      position: relative;
      z-index: 70;
      padding: 20px 24px;
      padding-bottom: max(20px, env(safe-area-inset-bottom));
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 24px;
      background: linear-gradient(to top, rgba(0,0,0,0.75) 0%, transparent 100%);
      width: 100%;
    }

    .video-btn {
      width: 58px;
      height: 58px;
      border-radius: 50%;
      border: none;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: var(--transition);
      position: relative;
      background: rgba(255,255,255,0.15);
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
      color: #fff;
      flex-shrink: 0;
    }
    .video-btn:active { transform: scale(0.88); }
    .video-btn span { display: none; }
    .video-btn svg { flex-shrink: 0; }

    .video-btn-mute { background: rgba(255,255,255,0.15); }
    .video-btn-mute.muted { background: var(--ios-orange); }

    .video-btn-cam { background: rgba(255,255,255,0.15); }
    .video-btn-cam.off { background: var(--ios-orange); }

    .video-btn-end {
      background: var(--ios-red);
      box-shadow: 0 6px 24px rgba(255,59,48,0.45);
    }

    .video-btn-flip { background: rgba(255,255,255,0.15); }
    .video-btn-screen { background: rgba(255,255,255,0.15); }
    .video-btn-screen.active { background: var(--ios-green); box-shadow: 0 6px 24px rgba(52,199,89,0.45); }
    .video-btn-chat { background: rgba(255,255,255,0.15); }

    /* ===== ВЕРХНЯЯ ПАНЕЛЬ ВИДЕО ===== */
    .video-top-bar {
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      z-index: 70;
      padding: 16px;
      padding-top: max(16px, env(safe-area-inset-top));
      display: flex;
      align-items: center;
      justify-content: space-between;
      background: linear-gradient(to bottom, rgba(0,0,0,0.7) 0%, transparent 100%);
    }

    .video-peer-name {
      font-size: 18px;
      font-weight: 700;
    }

    .call-duration {
      font-size: 14px;
      color: rgba(255,255,255,0.7);
      background: rgba(0,0,0,0.4);
      padding: 4px 12px;
      border-radius: 20px;
    }

    .video-quality-badge {
      font-size: 12px;
      background: rgba(52,199,89,0.2);
      border: 1px solid rgba(52,199,89,0.4);
      color: var(--ios-green);
      padding: 3px 10px;
      border-radius: 12px;
    }

    /* ===== TOAST-УВЕДОМЛЕНИЯ ===== */
    .toast {
      position: fixed;
      top: 60px;
      left: 50%;
      transform: translateX(-50%) translateY(-20px);
      background: rgba(30,20,60,0.95);
      border: 1px solid rgba(255,255,255,0.2);
      backdrop-filter: blur(20px);
      color: #fff;
      padding: 12px 20px;
      border-radius: 16px;
      font-size: 14px;
      font-weight: 600;
      z-index: 999;
      opacity: 0;
      transition: all 0.4s cubic-bezier(0.34,1.56,0.64,1);
      white-space: nowrap;
      max-width: 90vw;
      text-align: center;
    }
    .toast.show {
      opacity: 1;
      transform: translateX(-50%) translateY(0);
    }

    /* ===== СПИННЕР ===== */
    .spinner {
      width: 40px;
      height: 40px;
      border: 3px solid rgba(255,255,255,0.1);
      border-top-color: #7B52FF;
      border-radius: 50%;
      animation: spin 0.8s linear infinite;
    }
    @keyframes spin { to { transform: rotate(360deg); } }

    /* ===== КОПИРОВАНИЕ НОМЕРА ===== */
    .copy-badge {
      background: rgba(255,255,255,0.08);
      border: 1px solid rgba(255,255,255,0.15);
      border-radius: 10px;
      padding: 8px 12px;
      font-size: 13px;
      color: var(--text-secondary);
      display: flex;
      align-items: center;
      justify-content: space-between;
      cursor: pointer;
      margin-top: 12px;
      gap: 8px;
      transition: var(--transition);
    }
    .copy-badge:active { background: rgba(255,255,255,0.14); }
    .copy-badge strong { color: #fff; font-size: 20px; letter-spacing: 4px; font-weight: 800; }

    /* ===== ФУТЕР ===== */
    .copy-link {
      color: rgba(255,255,255,0.45);
      text-decoration: underline;
      text-decoration-color: rgba(255,255,255,0.2);
      transition: color 0.2s;
    }
    .copy-link:hover { color: rgba(255,255,255,0.7); }

    .copyright-footer {
      text-align: center;
      font-size: 11px;
      color: rgba(8,30,80,0.45);
      letter-spacing: 0.3px;
      font-weight: 400;
      padding: 8px 0 16px;
      width: 100%;
      max-width: 400px;
      flex-shrink: 0;
    }

    /* ===== ЗНАЧОК ШИФРОВАНИЯ ===== */
    .encrypt-badge {
      display: flex;
      align-items: center;
      gap: 6px;
      font-size: 11px;
      color: rgba(0,140,80,0.85);
      justify-content: center;
      flex-shrink: 0;
    }

    /* ===== АДАПТИВНОСТЬ ВИДЕО ===== */
    @media (orientation: landscape) {
      #local-video {
	  width: 60px;
	  height: auto;
	  aspect-ratio: 9 / 16;
      bottom: 75px;
      right: 12px;
      border-radius: 12px !important;
      }
      .video-controls {
      padding: 12px 24px;
      }
    }

    @media (max-width: 480px) {
      #local-video {
	  width: 100px !important;
	  height: auto !important;
	  aspect-ratio: 9 / 16 !important;
      bottom: 110px !important;
      right: 12px !important;
      border-radius: 14px !important;
      }
    }

    /* ===== СКРЫТЫЕ ЭЛЕМЕНТЫ ===== */
    #file-input { display: none; }

    /* ===== ЮРИДИЧЕСКИЕ ЭКРАНЫ ===== */
    .legal-box {
      width: 100%;
      max-width: 680px;
      max-height: calc(100vh - 140px);
      overflow-y: auto;
      background: rgba(255,255,255,0.06);
      backdrop-filter: blur(20px);
      -webkit-backdrop-filter: blur(20px);
      border: 1px solid rgba(255,255,255,0.1);
      border-radius: 24px;
      padding: 40px 36px;
      display: flex;
      flex-direction: column;
      gap: 20px;
      margin: 70px auto 20px;
      scrollbar-width: thin;
      scrollbar-color: rgba(123,82,255,0.4) transparent;
    }
    .legal-box::-webkit-scrollbar { width: 5px; }
    .legal-box::-webkit-scrollbar-track { background: transparent; margin: 12px; }
    .legal-box::-webkit-scrollbar-thumb { background: rgba(123,82,255,0.4); border-radius: 10px; }
    .legal-title {
      font-size: 26px;
      font-weight: 700;
      color: rgba(8,30,80,0.90);
    }
    .legal-date {
      font-size: 13px;
      color: rgba(8,30,80,0.45);
      margin-top: -12px;
    }
    .legal-section-title {
      font-size: 16px;
      font-weight: 700;
      color: rgba(8, 30, 80, 0.7);
      margin-top: 8px;
    }
    .legal-text {
      font-size: 14px;
      color: rgba(8,30,80,0.75);
      line-height: 1.7;
    }
    .legal-text ul {
      padding-left: 20px;
      margin: 8px 0;
    }
    .legal-text ul li {
      margin-bottom: 4px;
    }
    @media (max-width: 768px) {
      .legal-box { padding: 24px 18px; }
    }

    /* ===== ЭКРАНЫ АУТЕНТИФИКАЦИИ ===== */
    .auth-box {
      width: 100%;
      max-width: 400px;
      background: rgba(255,255,255,0.07);
      backdrop-filter: blur(20px);
      -webkit-backdrop-filter: blur(20px);
      border: 1px solid rgba(255,255,255,0.12);
      border-radius: 24px;
      padding: 32px 28px;
      display: flex;
      flex-direction: column;
      gap: 16px;
      flex-shrink: 0;
      margin: auto;
    }
    .auth-title {
      font-size: 24px;
      font-weight: 700;
      color: rgba(8, 30, 80, 0.7) !important;
      text-align: center;
      margin-bottom: 4px;
    }
    .auth-subtitle {
      font-size: 14px;
      color: rgba(8, 30, 80, 0.6) !important;
      text-align: center;
      margin-top: -8px;
    }
    .auth-field {
      display: flex;
      flex-direction: column;
      gap: 6px;
    }
    .auth-label {
      font-size: 12px;
      font-weight: 600;
      color: rgba(8, 30, 80, 0.7) !important;
      letter-spacing: 0.8px;
      text-transform: uppercase;
    }
    .auth-input {
	  background: rgba(255,255,255,0.08);
	  border: 1px solid rgba(255,255,255,0.12);
	  border-radius: 12px;
	  padding: 13px 16px;
	  color: rgba(0,0,0,0.85) !important;  /* тёмный текст вместо белого */
	  font-size: 15px;
	  font-family: inherit;
	  outline: none;
	  transition: border-color 0.2s;
	  width: 100%;
	  box-sizing: border-box;
	}
	.auth-input::placeholder {
	  color: rgba(0,0,0,0.45);  /* тёмный плейсхолдер */
	}
	.auth-input:focus {
	  border-color: rgba(123,82,255,0.6);
	  background: rgba(255,255,255,0.15);
    }
    
	/* ===== ПРОСМОТР ПАРОЛЯ ПРИ ВВОДЕ ===== */
    .pass-wrap {
      position: relative;
      display: flex;
      align-items: center;
    }
    .pass-wrap .auth-input {
      padding-right: 46px;
    }
    .pass-toggle {
      position: absolute;
      right: 14px;
      top: 50%;
      transform: translateY(-50%);
      background: none;
      border: none;
      cursor: pointer;
      padding: 4px;
      display: flex;
      align-items: center;
      justify-content: center;
      opacity: 0.35;
	  filter: invert(1);
      transition: opacity 0.2s;
      -webkit-tap-highlight-color: transparent;
      touch-action: manipulation;
    }
    .pass-toggle:hover,
    .pass-toggle:focus { opacity: 0.35; filter: invert(1); outline: none; }
    .pass-toggle svg { display: block; }
    /* Иконка "глаз закрыт" — скрыта по умолчанию */
    .pass-toggle .eye-off { display: none; }
    .pass-toggle.visible .eye-on  { display: none; }
    .pass-toggle.visible .eye-off { display: block; }

    /* ===== КОНТЕКСТНОЕ МЕНЮ СООБЩЕНИЙ ===== */
    .msg-menu-overlay {
      position: fixed; inset: 0; z-index: 1000;
      background: rgba(0,0,0,0.2);
      animation: fadeIn 0.15s ease;
    }
    .msg-menu {
      background: rgba(242,242,247,0.15);
      border: none;
      backdrop-filter: blur(40px) saturate(180%);
      -webkit-backdrop-filter: blur(40px) saturate(180%);
      -webkit-touch-callout: none;
      -webkit-user-select: none;
      user-select: none;
      border-radius: 14px;
      padding: 0;
      width: 190px;
      box-shadow: 0 4px 30px rgba(0,0,0,0.15), 0 0 0 0.5px rgba(255,255,255,0.4);
      animation: scaleIn 0.22s cubic-bezier(0.34,1.56,0.64,1);
      -webkit-touch-callout: none;
      -webkit-user-select: none;
      user-select: none;
      overflow: hidden;
    }
    .msg-menu-text {
      font-size: 12px; color: rgba(255,255,255,0.4);
      padding: 10px 16px 8px;
      -webkit-touch-callout: none;
      -webkit-user-select: none;
      user-select: none;
      white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
      -webkit-touch-callout: none;
      -webkit-user-select: none;
      user-select: none; text-overflow: ellipsis;
      letter-spacing: 0.3px;
      -webkit-touch-callout: none;
      -webkit-user-select: none;
      user-select: none;
    }
    .msg-menu-btn {
      display: flex; align-items: center; gap: 12px;
      width: 100%; padding: 13px 16px;
      background: none; border: none;
      color: rgba(255,255,255,0.75); font-size: 15px; cursor: pointer;
      transition: background 0.1s; text-align: left; font-family: inherit;
    }
    .msg-menu-btn:last-child { border-bottom: none; }
    .msg-menu-btn:active { background: rgba(255,255,255,0.08); }
    .msg-menu-btn .btn-icon { width: 20px; text-align: center; opacity: 0.5; flex-shrink:0; }
    
    .bubble textarea::-webkit-scrollbar { width: 3px; }
    .bubble textarea::-webkit-scrollbar-track { background: transparent; }
    .bubble textarea::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.3); border-radius: 3px; }

    @keyframes bubbleBounce {
      0% { transform: scale(1); }
      40% { transform: scale(1.06); }
      70% { transform: scale(0.97); }
      100% { transform: scale(1); }
    }
    .bubble-bounce { animation: bubbleBounce 0.35s cubic-bezier(0.34,1.56,0.64,1); }

    /* ===== НЕПРОЧИТАННЫЕ СООБЩЕНИЯ (точка) ===== */
    .unread-pulse {
      position: absolute;
      top: -2px;
      right: -2px;
      width: 14px;
      height: 14px;
      background: linear-gradient(135deg, #FF3B30, #FF6B6B);
      border-radius: 50%;
      border: 2px solid rgba(13,10,35,1);
      animation: pulse-ring 1.5s ease-out infinite;
      z-index: 10;
    }
    @keyframes pulse-ring {
      0% { box-shadow: 0 0 0 0 rgba(255,59,48,0.7); }
      70% { box-shadow: 0 0 0 8px rgba(255,59,48,0); }
      100% { box-shadow: 0 0 0 0 rgba(255,59,48,0); }
    }

    /* ===== ДАТА-ПИКЕР ===== */
    .date-picker-modal {
      position: fixed; inset: 0; z-index: 9500;
      background: rgba(0,0,0,0.75);
      backdrop-filter: blur(12px);
      display: flex; align-items: center; justify-content: center;
      padding: 20px;
    }
    .date-picker-inner {
      background: rgba(18,12,45,0.98);
      border: 1px solid rgba(123,82,255,0.3);
      border-radius: 28px;
      padding: 24px 20px 28px;
      width: 100%; max-width: 380px;
      box-shadow: 0 20px 60px rgba(0,0,0,0.5);
      animation: scaleIn 0.2s ease;
    }
    @keyframes voicePulse {
      0%, 100% { opacity: 1; transform: scale(1); }
      50% { opacity: 0.4; transform: scale(0.8); }
    }
    @keyframes scaleIn { from { transform: scale(0.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
    .date-picker-header {
      display: flex; justify-content: space-between; align-items: center;
      margin-bottom: 20px;
    }
    .date-picker-cols {
      display: flex; gap: 8px; height: 200px; overflow: hidden; position: relative;
    }
    .date-picker-cols::before, .date-picker-cols::after {
      content: ''; position: absolute; left: 0; right: 0; height: 72px; z-index: 2; pointer-events: none;
    }
    .date-picker-cols::before { top: 0; background: linear-gradient(to bottom, rgba(18,12,45,0.98), transparent); }
    .date-picker-cols::after { bottom: 0; background: linear-gradient(to top, rgba(18,12,45,0.98), transparent); }
    .date-picker-col {
      flex: 1; overflow-y: auto; scroll-snap-type: y mandatory;
      scrollbar-width: none; -ms-overflow-style: none;
    }
    .date-picker-col::-webkit-scrollbar { display: none; }
    .date-picker-col-item {
      height: 44px; display: flex; align-items: center; justify-content: center;
      scroll-snap-align: center; color: rgba(255,255,255,0.4);
      font-size: 15px; cursor: pointer; transition: all 0.15s;
      border-radius: 10px;
    }
    .date-picker-col-item.selected {
      color: #fff; font-size: 17px; font-weight: 600;
      background: rgba(123,82,255,0.2); border: 1px solid rgba(123,82,255,0.4);
    }
    .date-picker-selector {
      position: absolute; top: 50%; left: 0; right: 0;
      height: 44px; transform: translateY(-50%);
      border-top: 1px solid rgba(123,82,255,0.3);
      border-bottom: 1px solid rgba(123,82,255,0.3);
      pointer-events: none; z-index: 1;
    }

    select.auth-input {
      appearance: none;
      -webkit-appearance: none;
      background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='rgba(255,255,255,0.4)' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
      background-repeat: no-repeat;
      background-position: right 12px center;
      padding-right: 32px;
      cursor: pointer;
    }
    select.auth-input option {
      background: #1a0f3a;
      color: #fff;
    }

    .auth-input:focus {
      border-color: rgba(123,82,255,0.6);
      background: rgba(255,255,255,0.11);
    }
    .auth-btn {
      background: linear-gradient(135deg, #7B52FF, #FF4DAE);
      color: #fff;
      border: none;
      border-radius: 14px;
      padding: 15px;
      font-size: 16px;
      font-weight: 700;
      font-family: inherit;
      cursor: pointer;
      width: 100%;
      box-shadow: 0 8px 30px rgba(123,82,255,0.35);
      transition: opacity 0.2s;
    }
    .auth-btn:hover { opacity: 0.9; }
    .auth-btn:disabled { opacity: 0.5; cursor: not-allowed; }
    .auth-link {
      text-align: center;
      font-size: 14px;
      color: rgba(8, 30, 80, 0.6);
    }
    .auth-link a {
      color: rgba(8, 30, 80, 0.7);
      text-decoration: none;
      font-weight: 600;
    }
    .auth-link a:hover {
      text-decoration: underline;
    }

    /* ===== КАЛЕНДАРЬ ===== */
    @media screen and (min-width: 900px) {
      /* calendar shown via JS */
    }
    .cal-day-header {
      font-size: 11px;
      font-weight: 600;
      color: rgba(0,0,0,0.4);
      text-align: center;
      padding: 0 0 4px;
      letter-spacing: 0.3px;
    }
    .cal-day-header.weekend { color: rgba(180,0,0,0.4); }
    .cal-day {
      font-size: 14px;
      color: rgba(0,0,0,0.6);
      text-align: center;
      padding: 3px 0;
      border-radius: 6px;
      cursor: pointer;
      position: relative;
      transition: background 0.15s, color 0.15s;
      user-select: none;
    }
    .cal-day:hover { background: rgba(255,255,255,0.1); color: #fff; }
    .cal-day.today {
      background: rgba(123,82,255,0.35);
      color: #fff;
      font-weight: 700;
      box-shadow: 0 0 0 1.5px rgba(123,82,255,0.6);
    }
    .cal-day.has-event::after {
      content: '';
      display: block;
      width: 4px; height: 4px;
      border-radius: 50%;
      background: #FF4DAE;
      margin: 2px auto 0;
    }
    .cal-day.selected {
      background: rgba(123,82,255,0.55);
      color: #fff;
    }
    .cal-day.weekend { color: rgba(180,0,0,0.55); }
    .cal-day.other-month { color: rgba(0,0,0,0.2); cursor: default; }
    .cal-day.other-month:hover { background: none; }
    .cal-grid {
      display: grid;
      grid-template-columns: repeat(7, 1fr);
      column-gap: 4px;   /* отступы только между колонками */
      row-gap: 1px;      /* высота строк не меняется */
    }
    .cal-event-item {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 6px 10px;
      background: rgba(123,82,255,0.15);
      border-radius: 10px;
      font-size: 15px;
      color: rgba(255,255,255,0.8);
    }
    .cal-event-dot {
      width: 6px; height: 6px;
      border-radius: 50%;
      background: #FF4DAE;
      flex-shrink: 0;
    }
    .cal-event-delete {
      margin-left: auto;
      background: none;
      border: none;
      color: rgba(255,255,255,0.3);
      cursor: pointer;
      font-size: 22px;
      padding: 0 2px;
      line-height: 1;
    }
    .cal-event-delete:hover { color: rgba(255,80,80,0.8); }
    .cal-add-input {
      width: 100%;
      box-sizing: border-box;
      background: rgba(123,82,255,0.35);
	  box-shadow: 0 0 0 1.5px rgba(123,82,255,0.6);
      border: 1px solid rgba(255,255,255,0.12);
      border-radius: 10px;
      padding: 8px 12px;
      color: #fff;
      font-size: 13px;
      font-family: inherit;
      outline: none;
      margin-top: 8px;
    }
.cal-add-input::placeholder { color: rgba(0,0,0,0.5); }
    .cal-add-input:focus { border-color: rgba(123,82,255,0.5); }

    .auth-error {
      background: rgba(255,59,48,0.15);
      border: 1px solid rgba(255,59,48,0.3);
      border-radius: 10px;
      padding: 10px 14px;
      color: #FF6B6B;
      font-size: 13px;
      text-align: center;
      display: none;
    }
    .auth-success {
      background: rgba(52,199,89,0.15);
      border: 1px solid rgba(52,199,89,0.3);
      border-radius: 10px;
      padding: 10px 14px;
      color: #4CD964;
      font-size: 13px;
      text-align: center;
      display: none;
    }
    .recaptcha-wrap {
      display: flex;
      justify-content: center;
    }

    /* ===== ЭКРАН ПРОФИЛЯ ===== */
    .profile-header {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 12px;
      padding-bottom: 16px;
      border-bottom: 1px solid rgba(255,255,255,0.08);
    }
    .avatar-wrap {
      position: relative;
      width: 88px;
      height: 88px;
      cursor: pointer;
    }
    .avatar-img {
      width: 88px;
      height: 88px;
      border-radius: 50%;
      object-fit: cover;
      background: linear-gradient(135deg, #7B52FF, #FF4DAE);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 32px;
      font-weight: 700;
      color: #fff;
      border: 3px solid rgba(255,255,255,0.2);
    }
    .avatar-edit {
      position: absolute;
      bottom: 0; right: 0;
      width: 28px; height: 28px;
      background: linear-gradient(135deg, #7B52FF, #FF4DAE);
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 13px;
      border: 2px solid rgba(13,13,43,1);
    }
    .profile-name {
      font-size: 20px;
      font-weight: 700;
      color: #fff;
    }
    .profile-email {
      font-size: 13px;
      color: rgba(255,255,255,0.4);
      margin-top: -8px;
    }
    .profile-field {
      display: flex;
      flex-direction: column;
      gap: 6px;
    }
    .profile-section-title {
      font-size: 11px;
      font-weight: 700;
      color: rgba(255,255,255,0.35);
      letter-spacing: 1px;
      text-transform: uppercase;
      margin-top: 4px;
    }
    .profile-logout {
      background: rgba(255,59,48,0.15);
      border: 1px solid rgba(255,59,48,0.25);
      color: #FF6B6B;
      border-radius: 14px;
      padding: 13px;
      font-size: 15px;
      font-weight: 600;
      font-family: inherit;
      cursor: pointer;
      width: 100%;
      margin-top: 8px;
    }

    /* ===== КОНТАКТЫ (САЙДБАР) ===== */
    .contacts-sidebar {
      position: fixed;
      right: 16px;
      top: 50%;
      transform: translateY(-50%);
      display: flex;
      flex-direction: column;
      gap: 10px;
      z-index: 150;
    }
    @media (max-width: 768px) {
      .contacts-sidebar { display: none !important; }
    }
    .contact-bubble {
      position: relative;
      width: 58px;
      height: 58px;
      border-radius: 50%;
      cursor: pointer;
      transition: transform 0.2s;
      -webkit-touch-callout: none;
      -webkit-user-select: none;
      user-select: none;
    }
    .contact-bubble img {
      pointer-events: none;
      -webkit-user-drag: none;
    }
    .contact-bubble:hover { transform: scale(1.1); }
    @keyframes cardBounce { 0%,100%{transform:scale(1)} 40%{transform:scale(0.96)} 70%{transform:scale(1.03)} }
    .contact-bubble-img {
       width: 58px;
       height: 58px;
       border-radius: 50%;
       object-fit: cover;
       background: linear-gradient(135deg, #7B52FF, #FF4DAE);
       display: flex;
       align-items: center;
       justify-content: center;
       font-size: 22px;
       font-weight: 700;
       color: #ffffff !important;
       border: 3px solid transparent;
       text-shadow: 0 1px 2px rgba(0,0,0,0.2);
    }
    .contact-bubble.online .contact-bubble-img {
      border-color: #34C759;
      box-shadow: 0 0 0 2px rgba(52,199,89,0.3);
    }
    .contact-bubble.offline .contact-bubble-img {
      border-color: #FF3B30;
      box-shadow: 0 0 0 2px rgba(255,59,48,0.3);
    }
    .contact-tooltip {
      position: absolute;
      right: 60px;
      top: 50%;
      transform: translateY(-50%);
      background: rgba(30,20,60,0.95);
      color: #fff;
      padding: 6px 10px;
      border-radius: 8px;
      font-size: 12px;
      white-space: nowrap;
      pointer-events: none;
      opacity: 0;
      transition: opacity 0.2s;
      -webkit-user-select: none;
      user-select: none;
    }
    .contact-bubble:hover .contact-tooltip { opacity: 1; }

    /* ===== ВХОДЯЩИЙ ЗВОНОК (ОВЕРЛЕЙ) ===== */
    .incoming-call-overlay {
      position: fixed;
      inset: 0;
      z-index: 99998;
      background: rgba(0,0,0,0.75);
      backdrop-filter: blur(16px);
      -webkit-backdrop-filter: blur(16px);
      display: none;
      align-items: center;
      justify-content: center;
    }
    .incoming-call-box {
      background: rgba(20,10,50,0.7);
      backdrop-filter: blur(30px);
      -webkit-backdrop-filter: blur(30px);
      border: 1px solid rgba(255,255,255,0.15);
      border-radius: 32px;
      padding: 36px 32px;
      text-align: center;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 18px;
      width: 300px;
      box-shadow: 0 20px 60px rgba(0,0,0,0.5);
      animation: callSlideIn 0.4s cubic-bezier(0.34,1.56,0.64,1);
    }
    @keyframes callSlideIn {
      from { opacity:0; transform: translateY(-40px) scale(0.9); }
      to   { opacity:1; transform: translateY(0) scale(1); }
    }
    .incoming-call-avatar {
      width: 80px; height: 80px;
      border-radius: 50%;
      background: linear-gradient(135deg, #7B52FF, #FF4DAE);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 30px;
      font-weight: 700;
      color: #fff;
      animation: pulse 1.5s infinite;
    }
    @keyframes pulse {
      0%,100% { box-shadow: 0 0 0 0 rgba(123,82,255,0.5); }
      50% { box-shadow: 0 0 0 16px rgba(123,82,255,0); }
    }
    .incoming-call-name { font-size: 20px; font-weight: 700; color: #fff; }
    .incoming-call-status { font-size: 14px; color: rgba(255,255,255,0.5); }
    .incoming-call-btns { display: flex; gap: 20px; margin-top: 8px; }
    .call-accept-btn {
      width: 68px; height: 68px; border-radius: 50%;
      background: linear-gradient(135deg,#34C759,#28A745);
      border: none; cursor: pointer; font-size: 26px;
      display: flex; align-items: center; justify-content: center;
      box-shadow: 0 4px 20px rgba(52,199,89,0.5);
      transition: transform 0.2s;
    }
    .call-accept-btn:hover { transform: scale(1.1); }
    .call-reject-btn {
      width: 68px; height: 68px; border-radius: 50%;
      background: linear-gradient(135deg,#FF3B30,#CC2020);
      border: none; cursor: pointer; font-size: 26px;
      display: flex; align-items: center; justify-content: center;
      box-shadow: 0 4px 20px rgba(255,59,48,0.5);
      transition: transform 0.2s;
    }
    .call-reject-btn:hover { transform: scale(1.1); }

    @media (max-width: 768px) {
      .contact-bubble-img {
      width: 44px;
      height: 44px;
      font-size: 15px;
      color: #ffffff !important;
      }
    }
  
    /* ===== КАРТОЧКИ ФУНКЦИЙ ===== */
    .feature-cards {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 20px;
      width: 100%;
    }
    .feature-card {
      background: rgba(255,255,255,0.07);
      border: 1px solid rgba(255,255,255,0.1);
      border-radius: 16px;
      padding: 24px 16px;
      text-align: center;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
    }
    .feature-icon { font-size: 32px; margin-bottom: 10px; }
    .feature-title { color: rgba(8,30,80,0.85); font-weight: 600; font-size: 15px; }
    .feature-sub { color: rgba(8, 30, 80, 0.55); font-size: 13px; margin-top: 4px; }

    @media (max-width: 768px) {
      .feature-cards { gap: 10px; }
      .feature-card { padding: 14px 8px; aspect-ratio: 1; }
      .feature-icon { font-size: 22px; margin-bottom: 6px; }
      .feature-title { font-size: 11px; }
      .feature-sub { font-size: 10px; margin-top: 2px; }
      .legal-box { max-height: 88vh; overflow-y: auto; margin: 0; border-radius: 20px; width: 100%; }
    }
    @keyframes audioCallPulse {
      0%,100% { box-shadow: 0 0 0 3px rgba(123,82,255,0.3), 0 0 0 8px rgba(123,82,255,0.08); }
      50%      { box-shadow: 0 0 0 6px rgba(123,82,255,0.5), 0 0 0 14px rgba(123,82,255,0.15); }
    }

    .bubble.mine {
      background: linear-gradient(135deg, #0077FF 0%, #00C48C 100%) !important;
    }

    .btn-primary {
      background: linear-gradient(135deg, #0077FF 0%, #00C48C 100%) !important;
      box-shadow: 0 8px 28px rgba(0,140,220,0.40) !important;
    }
    .btn-primary:hover {
      box-shadow: 0 12px 36px rgba(0,140,220,0.55) !important;
    }

    .send-btn {
      background: linear-gradient(135deg, #0077FF 0%, #00C48C 100%) !important;
      box-shadow: 0 4px 14px rgba(0,140,200,0.40) !important;
    }

    @keyframes logoPulse {
      0%,100% { box-shadow: 0 20px 60px rgba(0,140,220,0.45), 0 0 0 1px rgba(255,255,255,0.15); }
      50%      { box-shadow: 0 20px 80px rgba(0,200,160,0.50), 0 0 0 1px rgba(255,255,255,0.25); }
    }

    .app-title {
      background: linear-gradient(135deg, #fff 0%, rgba(180,230,255,1) 50%, rgba(180,255,230,1) 100%) !important;
      -webkit-background-clip: text !important;
      -webkit-text-fill-color: transparent !important;
      background-clip: text !important;
    }

    .meeting-number-display { color: rgba(100,210,255,1) !important; }
    a[href][target="_blank"][rel] { color: #5AC8FA; }
    ::-webkit-scrollbar-thumb { background: rgba(0,120,220,0.20) !important; border-radius: 4px; }
    ::-webkit-scrollbar-thumb:hover { background: rgba(0,120,220,0.35) !important; }
	
	/* Сужаем пузырь сообщения под ширину превью */
	.bubble .link-preview-card {
      display: block;
      max-width: 280px;
    }

    /* Родительский пузырь будет подстраиваться под контент */
   .bubble {
      max-width: 88%;
      width: fit-content;
    }

   /* Для сообщений с превью — ограничиваем ширину */
   .bubble:has(> .link-preview-card) {
      max-width: 320px;
   }
   
   /* Общая стеклянная обёртка чата */
	.chat-glass-wrapper {
	  background: rgba(255, 255, 255, 0.35);
	  backdrop-filter: blur(20px);
	  -webkit-backdrop-filter: blur(20px);
	  border: 1.5px solid rgba(255, 255, 255, 0.55);
	  border-radius: 24px;
	  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
	  display: flex;
	  flex-direction: column;
	  overflow: hidden;
	  flex: 1;
	  margin: 16px;
	}
	
	/* Убираем фоны и границы у внутренних блоков */
	.chat-glass-wrapper .chat-header,
	.chat-glass-wrapper .messages-container,
	.chat-glass-wrapper .chat-input-bar,
	.chat-glass-wrapper .meeting-info-bar,
	.chat-glass-wrapper .edit-bar,
	.chat-glass-wrapper #select-bar {
	  background: transparent !important;
	  backdrop-filter: none !important;
	  border: none !important;
	  border-radius: 0 !important;
	  margin: 0 !important;
	  box-shadow: none !important;
	}

	/* Шапка с лёгким голубым градиентом */
	.chat-glass-wrapper .chat-header {
	  background: linear-gradient(135deg, rgba(100, 200, 255, 0.2), rgba(150, 220, 255, 0.1)) !important;
	  border-bottom: 1px solid rgba(255, 255, 255, 0.2) !important;
	}

	/* Панель ввода — верхняя граница */
	.chat-glass-wrapper .chat-input-bar {
	  border-top: none !important;
	}
	
	/* Онлайн плашка - ПК (ширина > 1024px) - правый верхний угол */
	#connection-status {
	  position: fixed;
	  top: 0;
	  right: 0;
	  padding: 4px 12px;
	  font-size: 12px;
	  border-radius: 0 0 0 12px;
	  z-index: 9999;
	  background: rgba(255, 255, 255, 0.25);
	  backdrop-filter: blur(8px);
	  -webkit-backdrop-filter: blur(8px);
	  color: rgba(8, 30, 80, 0.85);
	  font-weight: 600;
	  border-bottom: 1px solid rgba(255, 255, 255, 0.4);
	  border-left: 1px solid rgba(255, 255, 255, 0.4);
	}

	/* Телефоны и планшеты (ширина ≤ 1024px) - правый нижний угол без отступов */
	@media screen and (max-width: 1024px) {
	  #connection-status {
		top: auto !important;
		bottom: 0 !important;
		right: 0 !important;
		left: auto !important;
		padding: 4px 12px;
		font-size: 12px;
		border-radius: 12px 0 0 0 !important;
		z-index: 9999;
		background: rgba(255, 255, 255, 0.25);
		backdrop-filter: blur(8px);
		-webkit-backdrop-filter: blur(8px);
		color: rgba(8, 30, 80, 0.85);
		font-weight: 600;
		border: none !important;
		border-top: 1px solid rgba(255, 255, 255, 0.4) !important;
		border-left: 1px solid rgba(255, 255, 255, 0.4) !important;
	  }
	}
	
	/* Стеклянные плашки календаря */
	#calendar-widget {
      background: rgba(255,255,255,0.22);
      backdrop-filter: blur(30px);
      -webkit-backdrop-filter: blur(30px);
      border: 1px solid rgba(255,255,255,0.38);
      border-radius: 34px;
      box-shadow:
        0 25px 60px rgba(68,118,255,0.08),
        inset 0 1px 0 rgba(255,255,255,0.55);
      padding: 30px;
    }