
    * {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
      -webkit-tap-highlight-color: transparent;
    }

    :root {
      --primary-color: #075E54;
      --secondary-color: #128C7E;
      --accent-color: #25D366;
      --sent-bg: #DCF8C6;
      --received-bg: #FFFFFF;
      --bg-color: #ECE5DD;
      --header-bg: #075E54;
      --input-bg: #F0F0F0;
      --text-dark: #303030;
      --text-light: #667781;
      --border-color: #E9EDEF;
      --shadow: rgba(0, 0, 0, 0.1);
    }

    body {
      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
      background: var(--bg-color);
      height: 100vh;
      height: 100dvh;
      overflow: hidden;
      position: fixed;
      width: 100%;
    }

    .container {
      width: 100%;
      height: 100vh;
      height: 100dvh;
      display: flex;
      flex-direction: column;
      background: var(--bg-color);
      position: relative;
    }

    /* Header */
    .header {
      background: var(--header-bg);
      color: white;
      padding: 8px 12px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      box-shadow: 0 1px 2px var(--shadow);
      flex-shrink: 0;
      min-height: 56px;
    }

    .header-left {
      display: flex;
      align-items: center;
      gap: 8px;
      flex: 1;
      min-width: 0;
    }

    .app-logo {
      width: 36px;
      height: 36px;
      border-radius: 50%;
      background: white;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 20px;
      flex-shrink: 0;
    }

    .chat-info {
      flex: 1;
      min-width: 0;
    }

    .chat-title {
      font-size: 16px;
      font-weight: 600;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .chat-subtitle {
      font-size: 12px;
      opacity: 0.8;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .header-actions {
      display: flex;
      gap: 8px;
      align-items: center;
    }

    .icon-btn {
      background: transparent;
      border: none;
      color: white;
      padding: 8px;
      cursor: pointer;
      font-size: 20px;
      display: flex;
      align-items: center;
      justify-content: center;
      border-radius: 50%;
      transition: background 0.2s;
      flex-shrink: 0;
    }

    .icon-btn:active {
      background: rgba(255, 255, 255, 0.1);
    }

    .user-badge {
      position: relative;
    }

    .unread-badge {
      position: absolute;
      top: -4px;
      right: -4px;
      background: #FF3B30;
      color: white;
      font-size: 10px;
      font-weight: 700;
      min-width: 16px;
      height: 16px;
      border-radius: 8px;
      display: none;
      align-items: center;
      justify-content: center;
      padding: 0 4px;
      border: 2px solid var(--header-bg);
    }

    /* Sidebar */
    .sidenav {
      position: fixed;
      top: 0;
      right: -100%;
      width: 85%;
      max-width: 320px;
      height: 100%;
      background: white;
      box-shadow: -2px 0 8px var(--shadow);
      transition: right 0.3s ease;
      z-index: 1000;
      display: flex;
      flex-direction: column;
    }

    .sidenav.open {
      right: 0;
    }

    .overlay {
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: rgba(0, 0, 0, 0.4);
      display: none;
      z-index: 999;
    }

    .overlay.show {
      display: block;
    }

    .sidenav-header {
      background: var(--header-bg);
      color: white;
      padding: 16px;
      display: flex;
      justify-content: space-between;
      align-items: center;
    }

    .sidenav-title {
      font-size: 18px;
      font-weight: 600;
    }

    .close-btn {
      background: transparent;
      border: none;
      color: white;
      font-size: 24px;
      cursor: pointer;
      padding: 4px;
      line-height: 1;
    }

    .logout-btn {
      background: #FF3B30;
      color: white;
      border: none;
      padding: 10px 16px;
      margin: 12px 16px;
      border-radius: 8px;
      cursor: pointer;
      font-weight: 600;
      font-size: 14px;
    }

    .group-chat-btn {
      background: var(--accent-color);
      color: white;
      padding: 14px 16px;
      margin: 12px 16px;
      border-radius: 8px;
      cursor: pointer;
      font-weight: 600;
      display: flex;
      align-items: center;
      gap: 8px;
      border: none;
      width: calc(100% - 32px);
    }

    .user-list-container {
      flex: 1;
      overflow-y: auto;
    }

    .user-list-header {
      padding: 12px 16px;
      background: #F7F8FA;
      font-size: 13px;
      font-weight: 600;
      color: var(--text-light);
      text-transform: uppercase;
      letter-spacing: 0.5px;
    }

    #user-list {
      list-style: none;
    }

    #user-list li {
      padding: 12px 16px;
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 12px;
      border-bottom: 1px solid var(--border-color);
      position: relative;
      transition: background 0.2s;
    }

    #user-list li:active {
      background: #F7F8FA;
    }

    #user-list li.active {
      background: #E7F5EC;
    }

    .user-avatar {
      width: 40px;
      height: 40px;
      border-radius: 50%;
      background: var(--secondary-color);
      color: white;
      display: flex;
      align-items: center;
      justify-content: center;
      font-weight: 600;
      flex-shrink: 0;
    }

    .user-info {
      flex: 1;
      min-width: 0;
    }

    .user-name {
      font-weight: 500;
      color: var(--text-dark);
      font-size: 16px;
    }

    .user-unread-badge {
      background: var(--accent-color);
      color: white;
      font-size: 11px;
      font-weight: 700;
      min-width: 20px;
      height: 20px;
      border-radius: 10px;
      display: none;
      align-items: center;
      justify-content: center;
      padding: 0 6px;
    }

    /* Chat Box */
    .chat-box {
      flex: 1;
      overflow-y: auto;
      overflow-x: hidden;
      padding: 8px;
      background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="300" height="300" opacity="0.03"><path d="M150 0 L300 150 L150 300 L0 150 Z" fill="%23000000"/></svg>');
      background-size: 200px;
      -webkit-overflow-scrolling: touch;
      overscroll-behavior: contain;
    }

    .chat-box::-webkit-scrollbar {
      width: 0;
    }

    .welcome-screen {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      height: 100%;
      padding: 24px;
      text-align: center;
    }

    .welcome-icon {
      font-size: 64px;
      margin-bottom: 16px;
    }

    .welcome-title {
      font-size: 22px;
      font-weight: 600;
      color: var(--text-dark);
      margin-bottom: 8px;
    }

    .welcome-subtitle {
      font-size: 14px;
      color: var(--text-light);
    }

    /* Messages */
    .message {
      margin-bottom: 4px;
      display: flex;
      animation: slideUp 0.2s ease-out;
    }

    @keyframes slideUp {
      from {
        opacity: 0;
        transform: translateY(10px);
      }
      to {
        opacity: 1;
        transform: translateY(0);
      }
    }

    .message.sent {
      justify-content: flex-end;
    }

    .message.received {
      justify-content: flex-start;
    }

    .message-bubble {
      max-width: 80%;
      padding: 6px 8px;
      border-radius: 8px;
      word-wrap: break-word;
      position: relative;
    }

    .message.sent .message-bubble {
      background: var(--sent-bg);
      border-bottom-right-radius: 2px;
    }

    .message.received .message-bubble {
      background: var(--received-bg);
      border-bottom-left-radius: 2px;
      box-shadow: 0 1px 2px var(--shadow);
    }

    .message-sender {
      font-size: 12px;
      font-weight: 600;
      margin-bottom: 2px;
      display: block;
    }

    .message-text {
      font-size: 14px;
      line-height: 1.4;
      color: var(--text-dark);
      word-break: break-word;
    }

    .message-time {
      font-size: 10px;
      color: var(--text-light);
      margin-top: 2px;
      text-align: right;
      display: block;
    }

    /* Input Box */
    .input-box {
      padding: 8px;
      background: white;
      border-top: 1px solid var(--border-color);
      display: flex;
      gap: 6px;
      align-items: flex-end;
      flex-shrink: 0;
    }

    .input-box input {
      flex: 1;
      padding: 10px 14px;
      border: 1px solid var(--border-color);
      border-radius: 20px;
      font-size: 15px;
      background: var(--input-bg);
      outline: none;
      min-width: 0;
      resize: none;
      max-height: 100px;
    }

    .input-box input:focus {
      background: white;
      border-color: var(--secondary-color);
    }

    .send-btn {
      width: 44px;
      height: 44px;
      padding: 0;
      background: var(--accent-color);
      color: white;
      border: none;
      border-radius: 50%;
      cursor: pointer;
      font-size: 20px;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      transition: transform 0.1s;
    }

    .send-btn:active {
      transform: scale(0.95);
    }

    .join-btn {
      padding: 12px 24px;
      background: var(--accent-color);
      color: white;
      border: none;
      border-radius: 20px;
      cursor: pointer;
      font-weight: 600;
      font-size: 15px;
      flex-shrink: 0;
    }

    /* Privacy Banner */
    .privacy-banner {
      background: linear-gradient(90deg, var(--secondary-color), var(--primary-color));
      color: white;
      padding: 6px 12px;
      text-align: center;
      font-size: 11px;
      font-weight: 500;
      display: none;
    }

    .footer-info {
      background: #F7F8FA;
      padding: 12px 16px;
      text-align: center;
      font-size: 10px;
      color: var(--text-light);
      line-height: 1.4;
    }

    .footer-info a {
      color: var(--secondary-color);
      text-decoration: none;
    }

    /* Desktop styles */
    @media (min-width: 768px) {
      body {
        display: flex;
        justify-content: center;
        align-items: center;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
      }

      .container {
        max-width: 500px;
        height: 95vh;
        border-radius: 12px;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
        overflow: hidden;
      }

      .privacy-banner {
        display: block;
      }

      .sidenav {
        max-width: 360px;
      }
    }

    /* Keyboard visible state */
    @media (max-height: 500px) {
      .header {
        min-height: 48px;
        padding: 6px 12px;
      }

      .chat-title {
        font-size: 14px;
      }

      .chat-subtitle {
        font-size: 11px;
      }
    }


    /* Call Modal */
.call-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.call-modal-content {
  background: white;
  padding: 30px;
  border-radius: 20px;
  text-align: center;
  max-width: 400px;
  animation: slideUp 0.3s ease;
}

.call-icon {
  font-size: 64px;
  margin-bottom: 20px;
}

.call-modal h3 {
  margin: 0 0 10px 0;
  font-size: 24px;
  color: #1e293b;
}

.call-modal p {
  margin: 0 0 30px 0;
  color: #64748b;
  font-size: 16px;
}

.call-modal-buttons {
  display: flex;
  gap: 15px;
  justify-content: center;
}

.accept-call-btn, .reject-call-btn {
  padding: 12px 30px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.accept-call-btn {
  background: #10b981;
  color: white;
}

.accept-call-btn:hover {
  background: #059669;
  transform: scale(1.05);
}

.reject-call-btn {
  background: #ef4444;
  color: white;
}

.reject-call-btn:hover {
  background: #dc2626;
  transform: scale(1.05);
}

/* Call UI */
.call-ui {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000;
  z-index: 9999;
  display: flex;
  flex-direction: column;
}

.call-container {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.call-header {
  padding: 20px;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: white;
}

#call-status {
  font-size: 18px;
  font-weight: 600;
}

.end-call-btn {
  background: #ef4444;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 25px;
  font-weight: 600;
  cursor: pointer;
}

.end-call-btn:hover {
  background: #dc2626;
}

.video-container {
  flex: 1;
  position: relative;
  background: #000;
}

.remote-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.local-video {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 150px;
  height: 200px;
  object-fit: cover;
  border-radius: 12px;
  border: 2px solid white;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.call-controls {
  padding: 30px;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  gap: 20px;
}

.control-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.control-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Mobile responsive */
@media (max-width: 768px) {
  .local-video {
    width: 100px;
    height: 133px;
    top: 10px;
    right: 10px;
  }

  .call-controls {
    padding: 20px;
  }

  .control-btn {
    width: 50px;
    height: 50px;
    font-size: 20px;
  }
}