* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, Arial, sans-serif;
  color: #f5f7fb;
  background:
    radial-gradient(circle at top left, rgba(64, 130, 255, 0.35), transparent 35%),
    radial-gradient(circle at bottom right, rgba(170, 80, 255, 0.25), transparent 35%),
    #080b12;
}

.app {
  width: min(920px, 100%);
  height: 100vh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding: 18px;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 22px;
  background: rgba(14, 19, 31, 0.78);
  backdrop-filter: blur(16px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}

.chat-header h1 {
  margin: 0;
  font-size: 26px;
  letter-spacing: -0.04em;
}

.chat-header p {
  margin: 4px 0 0;
  color: #9ca8c0;
  font-size: 14px;
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(58, 255, 156, 0.1);
  color: #6dffb2;
  border: 1px solid rgba(109, 255, 178, 0.2);
  font-size: 14px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6dffb2;
  box-shadow: 0 0 12px #6dffb2;
}

.messages {
  flex: 1;
  overflow-y: auto;
  margin: 16px 0;
  padding: 18px;
  border-radius: 22px;
  background: rgba(14, 19, 31, 0.62);
  border: 1px solid rgba(255,255,255,0.08);
}

.message {
  max-width: 78%;
  margin-bottom: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255,255,255,0.075);
  border: 1px solid rgba(255,255,255,0.07);
  animation: pop 0.15s ease-out;
  word-wrap: break-word;

  transform: translateY(6px);
  opacity: 0;
  animation: fadeIn 0.2s ease forwards;
}

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

.online-box {
  position: relative;
}

.user-list {
  position: absolute;
  right: 0;
  top: 48px;
  width: 190px;
  max-height: 240px;
  overflow-y: auto;
  padding: 10px;
  border-radius: 16px;
  background: rgba(14, 19, 31, 0.96);
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 20px 50px rgba(0,0,0,0.35);
  display: none;
  z-index: 10;
}

.online-box:hover .user-list {
  display: block;
}

.user-item {
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 14px;
  color: #dbe4ff;
}

.user-item:hover {
  background: rgba(255,255,255,0.08);
}

@media (max-width: 600px) {
  .user-list {
    right: 0;
    width: 170px;
  }
}

.composer {
  position: relative;
}

.emoji-button {
  width: 44px;
  min-width: 44px;
  height: 44px;
  border: none;
  background: transparent;
  font-size: 22px;
  cursor: pointer;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, transform 0.1s ease;
}

.emoji-button:hover {
  background: rgba(255,255,255,0.08);
}

.emoji-button:active {
  transform: scale(0.92);
}

.emoji-picker {
  position: absolute;
  left: 12px;
  bottom: 74px;
  width: 280px;
  max-height: 220px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  padding: 12px;
  border-radius: 18px;
  background: rgba(14, 19, 31, 0.98);
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 24px 70px rgba(0,0,0,0.45);
  z-index: 20;
}

.emoji-picker.hidden {
  display: none;
}

.emoji-item {
  border: none;
  background: transparent;
  font-size: 22px;
  cursor: pointer;
  padding: 8px;
  border-radius: 10px;
}

.emoji-item:hover {
  background: rgba(255,255,255,0.1);
}

@media (max-width: 600px) {
  .emoji-picker {
    left: 10px;
    width: calc(100vw - 20px);
    grid-template-columns: repeat(8, 1fr);
  }

  .emoji-button {
    width: 44px;
    min-width: 44px;
  }
}

.message.mine {
  margin-left: auto;
  background: linear-gradient(135deg, #326dff, #7b4dff);
}

.message-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
}

.username {
  font-weight: 700;
  font-size: 14px;
}

.time {
  font-size: 11px;
  color: rgba(255,255,255,0.58);
}

.body {
  line-height: 1.4;
  font-size: 15px;
}

.composer {
  display: flex;
  gap: 10px;
  padding: 12px;
  border-radius: 22px;
  background: rgba(14, 19, 31, 0.86);
  border: 1px solid rgba(255,255,255,0.1);
  backdrop-filter: blur(16px);
}

.composer input {
  flex: 1;
  border: none;
  outline: none;
  color: white;
  background: rgba(255,255,255,0.08);
  border-radius: 16px;
  padding: 14px 16px;
  font-size: 16px;
}

.composer button,
.modal-card button {
  border: none;
  cursor: pointer;
  color: white;
  font-weight: 700;
  border-radius: 16px;
  padding: 14px 18px;
  background: linear-gradient(135deg, #326dff, #7b4dff);
}

.composer .emoji-button {
  background: transparent;
  padding: 0;
  color: inherit;
}

.composer .emoji-button:hover {
  background: rgba(255,255,255,0.08);
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(10px);
}

.modal.hidden {
  display: none;
}

.modal-card {
  width: min(420px, 100%);
  padding: 24px;
  border-radius: 24px;
  background: #111827;
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 30px 90px rgba(0,0,0,0.45);
}

.modal-card h2 {
  margin: 0 0 8px;
}

.modal-card p {
  margin: 0 0 18px;
  color: #9ca8c0;
}

.modal-card input {
  width: 100%;
  margin-bottom: 12px;
  padding: 14px 16px;
  border: none;
  outline: none;
  border-radius: 16px;
  color: white;
  background: rgba(255,255,255,0.08);
  font-size: 16px;
}

.modal-card button {
  width: 100%;
}

.typing {
  height: 20px;
  font-size: 13px;
  color: #9ca8c0;
  padding-left: 6px;
}

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

@media (max-width: 600px) {
  .app {
    padding: 10px;
  }

  .chat-header {
    border-radius: 18px;
    padding: 14px;
  }

  .chat-header h1 {
    font-size: 22px;
  }

  .messages {
    padding: 12px;
    border-radius: 18px;
  }

  .message {
    max-width: 90%;
  }

  .composer {
    border-radius: 18px;
  }

  .composer button {
    padding: 14px;
  }
}