  * { box-sizing: border-box; margin: 0; padding: 0; }

  body {
    font-family: "Poppins", sans-serif;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    padding: 10px;
    background: linear-gradient(270deg, #5563DE, #74ABE2, #8E54E9);
    background-size: 600% 600%;
    animation: gradientAnimation 20s ease infinite;
    transition: background 0.6s ease;
  }

  @keyframes gradientAnimation {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
  }

  /* 🌗 Theme Toggle */
  .theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #ffffff33;
    border: none;
    color: #fff;
    padding: 10px 14px;
    font-size: 0.9rem;
    border-radius: 30px;
    cursor: pointer;
    backdrop-filter: blur(8px);
    transition: 0.3s, transform 0.2s;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
  }
  .theme-toggle:hover {
    background: #ffffff55;
    transform: scale(1.05);
  }

  /* 🌟 Chat Container */
  .chat-container {
    width: 440px;
    max-width: 100%;
    height: 640px;
    max-height: 95vh;
    background: rgba(255, 255, 255, 0.18);
    border-radius: 25px;
    backdrop-filter: blur(20px);
    box-shadow: 0 8px 35px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    transition: 0.4s ease;
    transform: scale(0.95);
    opacity: 0;
    animation: popIn 0.5s forwards;
  }

  @keyframes popIn {
    to { transform: scale(1); opacity: 1; }
  }

  /* 🌈 Header */
  .chat-header {
    background: linear-gradient(90deg, #5563DE, #8E54E9);
    color: #fff;
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 1.1rem;
    letter-spacing: 0.3px;
    position: relative;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  /* Header Buttons */
  .btn-group {
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .header-btn {
    background: rgba(255, 255, 255, 0.25);
    border: none;
    color: #fff;
    font-size: 0.8rem;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
  }
  .header-btn:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: translateY(-1px);
  }

  /* 💡 Help Commands */
  .commands-panel {
    display: none;
    flex-wrap: wrap;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    padding: 8px;
    gap: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  }
  .commands-panel span {
    background: rgba(255, 255, 255, 0.3);
    padding: 5px 10px;
    border-radius: 12px;
    cursor: pointer;
    color: #fff;
    font-size: 0.8rem;
    transition: 0.25s;
  }
  .commands-panel span:hover {
    background: rgba(255, 255, 255, 0.5);
  }

  /* 💬 Chat Box */
  .chat-box {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
  }

  .message {
    max-width: 78%;
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 0.9rem;
    line-height: 1.4;
    position: relative;
    animation: fadeSlide 0.3s ease;
    word-wrap: break-word;
  }
  .sent {
    align-self: flex-end;
    background: #5563DE;
    color: #fff;
    border-bottom-right-radius: 6px;
    box-shadow: 0 2px 6px rgba(79,70,229,0.4);
  }
  .received {
    align-self: flex-start;
    background: #f4f4f4;
    color: #333;
    border-bottom-left-radius: 6px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  }
  .timestamp {
    font-size: 0.7rem;
    opacity: 0.6;
    margin-top: 3px;
    text-align: right;
  }

  @keyframes fadeSlide {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
  }

  /* ✏️ Input Section */
  .chat-input {
    display: flex;
    border-top: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.1);
    padding: 10px;
  }
  .chat-input input {
    flex: 1;
    border: none;
    outline: none;
    border-radius: 25px;
    padding: 10px 14px;
    font-size: 0.95rem;
    background: rgba(255, 255, 255, 0.9);
  }
  .chat-input button {
    margin-left: 10px;
    background: #5563DE;
    border: none;
    color: white;
    border-radius: 50%;
    width: 42px;
    height: 42px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: 0.3s;
  }
  .chat-input button:hover {
    background: #3841b3;
    transform: scale(1.1);
  }

  /* 🌙 Dark Mode */
  body.dark {
    background: linear-gradient(270deg, #0f2027, #203a43, #2c5364);
  }
  body.dark .chat-container { background: rgba(255,255,255,0.1); }
  body.dark .chat-header { background: linear-gradient(90deg, #1e293b, #3b82f6); }
  body.dark .received {
    background: #2a2a2a;
    color: #eee;
    box-shadow: 0 2px 6px rgba(255,255,255,0.1);
  }
  body.dark .sent {
    background: #3b82f6;
    box-shadow: 0 2px 6px rgba(59,130,246,0.5);
  }

  /* 💭 Typing Indicator */
  .typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.2);
    width: fit-content;
    animation: fadeIn 0.3s ease;
  }
  .typing-dot {
    width: 6px;
    height: 6px;
    background: #555;
    border-radius: 50%;
    animation: blink 1s infinite;
  }
  .typing-dot:nth-child(2) { animation-delay: 0.2s; }
  .typing-dot:nth-child(3) { animation-delay: 0.4s; }

  @keyframes blink { 0%,80%,100%{opacity:0.3;} 40%{opacity:1;} }
  @keyframes fadeIn { from{opacity:0;} to{opacity:1;} }

  /* 📱 Responsive Design */
  @media (max-width: 600px) {
    .chat-container { width: 95%; height: 90vh; border-radius: 15px; }
    .chat-header { font-size: 1rem; padding: 12px; }
    .header-btn { padding: 5px 8px; font-size: 0.75rem; }
    .chat-input input { font-size: 0.85rem; }
    .chat-input button { width: 38px; height: 38px; font-size: 1rem; }
    .theme-toggle { top: 10px; right: 10px; padding: 8px 12px; font-size: 0.85rem; }
  }

  @media (max-width: 400px) {
    .chat-header { flex-direction: column; align-items: flex-start; gap: 5px; }
    .btn-group { align-self: flex-end; }
    .commands-panel span { font-size: 0.75rem; padding: 4px 8px; }
    .theme-toggle { top: 8px; right: 8px; padding: 6px 10px; font-size: 0.8rem; }
  }