:root {
  --bg1: #0b0b10;
  --bg2: #12001f;
  --bg3: #1a0020;

  --pink: #ff4fa3;
  --purple: #7a5cff;

  --panel: rgba(255,255,255,0.06);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: "Segoe UI", Arial;
  background: linear-gradient(135deg, var(--bg1), var(--bg2), var(--bg3));
  color: white;
}

/* HEADER */
header {
  padding: 14px;
  text-align: center;
  background: rgba(0,0,0,0.4);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

h1 {
  font-size: 18px;
  background: linear-gradient(90deg, var(--pink), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* CHAT */
.chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  padding: 12px;
}

/* MESSAGES */
#messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border-radius: 14px;
  background: var(--panel);
}

/* MESSAGE */
.message {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 16px;
  word-break: break-word;
}

.message.user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--purple), var(--pink));
  border-bottom-right-radius: 6px;
}

.message.other {
  align-self: flex-start;
  background: rgba(255,255,255,0.10);
  border-bottom-left-radius: 6px;
}

.username {
  font-size: 12px;
  opacity: 0.7;
  margin-bottom: 4px;
}

.time {
  font-size: 10px;
  opacity: 0.5;
  margin-top: 5px;
  text-align: right;
}

/* INPUT */
.input-area {
  display: flex;
  gap: 10px;
  padding: 10px 0;
  flex-shrink: 0;
}

#text {
  flex: 1;
  padding: 14px;
  border-radius: 999px;
  border: none;
  outline: none;
  background: rgba(255,255,255,0.08);
  color: white;
}

button {
  padding: 0 20px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  color: white;
  background: linear-gradient(90deg, var(--pink), var(--purple));
}

/* LOGIN */
#login {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.login-box {
  width: 320px;
  padding: 30px;
  border-radius: 16px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  text-align: center;
}

#name {
  width: 100%;
  padding: 12px;
  margin-top: 10px;
  border-radius: 10px;
  border: none;
  background: rgba(0,0,0,0.4);
  color: white;
}