:root {
  --theme-color: #5865f2;
  --theme-text: #ffffff;
  --bg-image: url("bg.png");
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;

  font-family: Arial, sans-serif;
  color: white;
}

body {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* BACKGROUND */
body::before {
  content: "";

  position: fixed;
  inset: 0;

  background:
    linear-gradient(rgba(0,0,0,0.65), rgba(0,0,0,0.65)),
    var(--bg-image) center/cover no-repeat;

  filter: blur(3px) brightness(0.45);
  transform: scale(1.05);

  z-index: -1;
}

/* TOPBAR */
.topbar {
  height: 60px;
  flex-shrink: 0;

  display: flex;
  align-items: center;
  justify-content: space-between;

  padding: 0 16px;

  background: rgba(18,18,18,0.9);
  border-bottom: 1px solid #2a2a2a;
}

.rooms {
  display: flex;
  gap: 8px;
}

.rooms button {
  background: var(--theme-color);
  color: var(--theme-text);
}

#roomTitle {
  font-weight: bold;
  color: var(--theme-color);
}

/* CHAT */
#messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;

  padding: 16px;

  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* MESSAGE */
.message {
  display: flex;
  gap: 10px;
  max-width: 750px;
  width: fit-content;
}

.message > img {
  width: 40px;
  height: 40px;
  border-radius: 12px;
}

/* MESSAGE BOX */
.message-content {
  background: rgba(25,25,25,0.9);
  border: 1px solid #2b2b2b;
  border-radius: 14px;

  padding: 10px;

  display: flex;
  flex-direction: column;
  gap: 6px;
}

.username {
  font-weight: bold;
  color: var(--theme-color);
}

.text {
  word-break: break-word;
  line-height: 1.4;
}

/* REPLY */
.reply {
  background: rgba(255,255,255,0.05);

  border-left: 3px solid var(--theme-color);

  padding: 6px 8px;
  border-radius: 8px;

  font-size: 13px;
  color: #ccc;

  max-width: 300px;
  overflow: hidden;
}

/* IMAGE */
.chat-image {
  max-width: 320px;
  max-height: 320px;
  width: auto;
  height: auto;
  border-radius: 12px;
  display: block;
}

/* REPLY BAR */
#replyBar {
  display: none;

  align-items: center;
  gap: 10px;

  padding: 10px 14px;

  background: rgba(30,30,30,0.95);
  border-top: 1px solid #2a2a2a;
}

#replyUser {
  color: var(--theme-color);
  font-weight: bold;
}

/* INPUT */
.input-area {
  flex-shrink: 0;

  display: flex;
  gap: 10px;
  align-items: center;

  padding: 12px;
  background: rgba(18,18,18,0.9);
  border-top: 1px solid #2a2a2a;
}

input {
  flex: 1;
  padding: 12px;
  border-radius: 10px;

  background: #222;
  border: 1px solid #333;
  color: white;
}

input:focus {
  outline: none;
  border-color: var(--theme-color);
}

button {
  background: var(--theme-color);
  color: var(--theme-text);

  border: none;

  padding: 8px 12px;
  border-radius: 8px;

  cursor: pointer;
}

button:hover {
  filter: brightness(1.1);
}

/* UPLOAD BUTTON */
.upload-btn {
  width: 42px;
  height: 42px;

  display: flex;
  align-items: center;
  justify-content: center;

  background: var(--theme-color);
  color: var(--theme-text);

  border-radius: 12px;
  cursor: pointer;

  font-size: 24px;
  flex-shrink: 0;
}

/* LOGIN */
#loginModal {
  position: fixed;
  inset: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  background: rgba(0,0,0,0.75);
  z-index: 9999;
}

#loginBox {
  width: 320px;
  background: #1b1b1b;

  border: 1px solid #2b2b2b;
  border-radius: 18px;

  padding: 22px;
}

#loginError {
  color: #ff6b6b;
}

/* SCROLLBAR */
#messages::-webkit-scrollbar {
  width: 10px;
}

#messages::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15);
  border-radius: 999px;
}

/* MOBILE */
@media (max-width: 700px) {
  .topbar {
    flex-direction: column;
    height: auto;
    padding: 10px;
    gap: 8px;
  }

  .rooms {
    flex-wrap: wrap;
    justify-content: center;
  }

  .message {
    max-width: 100%;
  }

  .chat-image {
    max-width: 220px;
  }
}