* {
  box-sizing: border-box;
}

body {
  font-family: Arial, sans-serif;
  background: radial-gradient(circle at top, #1f2937, #050505);
  color: white;
  margin: 0;
  padding: 0;
}

.join-box,
.chat-box {
  width: min(94vw, 760px);
  margin: clamp(16px, 6vh, 60px) auto;
  background: rgba(20, 20, 20, 0.92);
  padding: clamp(16px, 3vw, 28px);
  border-radius: 18px;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.65);
  border: 1px solid #333;
}

h1 {
  font-size: clamp(36px, 8vw, 48px);
  margin: 0 0 6px;
  letter-spacing: 1px;
}

h2 {
  margin: 0 0 14px;
  font-size: clamp(22px, 4vw, 28px);
}

p {
  color: #bdbdbd;
}

input {
  width: 100%;
  max-width: 100%;
  display: block;
  padding: clamp(14px, 3vw, 18px);
  border: none;
  border-radius: 10px;
  background: #111;
  color: white;
  font-size: clamp(16px, 3vw, 20px);
  font-family: Arial, sans-serif;
  margin: 0 0 10px 0;
}

input:focus {
  outline: 2px solid #4f8cff;
  outline-offset: 0;
}

button {
  width: 100%;
  padding: clamp(14px, 3vw, 18px);
  margin-top: 8px;
  cursor: pointer;
  border: none;
  border-radius: 10px;
  background: #4f8cff;
  color: white;
  font-size: clamp(16px, 3vw, 20px);
  font-weight: bold;
}

button:hover {
  background: #6fa1ff;
}

.hidden {
  display: none;
}

.room-layout {
  display: flex;
  gap: 14px;
  align-items: stretch;
}

.chat-panel {
  flex: 1;
  min-width: 0;
  background: #050505;
  border: 1px solid #222;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#messages {
  height: clamp(300px, 55vh, 520px);
  overflow-y: auto;
  padding: 12px;
  font-size: clamp(16px, 2.5vw, 19px);
}

#messages div {
  padding: 8px 0;
  border-bottom: 1px solid #1c1c1c;
  overflow-wrap: anywhere;
}

.send-row {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid #1c1c1c;
  background: #050505;
  align-items: center;
}

.send-row input {
  flex: 1;
  min-width: 0;
  height: 50px;
  padding: 0 16px;
  margin: 0;
  background: #111;
  border: none;
  border-radius: 10px;
  color: white;
  font-size: clamp(16px, 3vw, 20px);
}

.send-row button {
  width: 74px;
  min-width: 74px;
  height: 50px;
  padding: 0;
  margin: 0;
  border-radius: 10px;
  align-self: stretch;
  font-size: 16px;
}

.users-panel {
  width: clamp(120px, 22vw, 160px);
  background: #0a0a0a;
  border-radius: 12px;
  padding: 12px;
  border: 1px solid #222;
}

.users-panel h3 {
  margin: 0 0 10px;
  text-align: center;
  font-size: clamp(15px, 2.5vw, 18px);
}

#userList {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

#userList div {
  padding: 6px 10px;
  border: 1px solid #1c1c1c;
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  text-align: center;
  white-space: nowrap;
}

.username {
  font-weight: bold;
}

.system-message {
  color: #999;
  font-style: italic;
  opacity: 1;
  overflow: hidden;
  max-height: 60px;
  padding: 8px 0;
  margin: 0;
  border-bottom: 1px solid #1c1c1c;
  transition:
    opacity 1.2s ease,
    max-height 1.2s ease,
    padding 1.2s ease,
    margin 1.2s ease,
    border-width 1.2s ease;
}

.system-message.removing,
#messages .system-message.removing {
  opacity: 0;
  max-height: 0;
  height: 0;
  min-height: 0;
  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  overflow: hidden;
}

#typingIndicator {
  min-height: 22px;
  padding: 0 14px 8px;
  font-size: 14px;
  color: #888;
  font-style: italic;
  transition: opacity 0.2s ease;
}

.sound-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #aaa;
  font-size: clamp(14px, 2.5vw, 17px);
  margin-top: 12px;
}

.sound-row input {
  width: auto;
  margin: 0;
}

.room-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.burn-btn {
  background: #8b1e1e;
  flex: 1;
  margin: 0;
}

.burn-btn:hover {
  background: #b32626;
}

.leave-btn {
  background: #2a2a2a;
  flex: 1;
  margin: 0;
}

.leave-btn:hover {
  background: #444;
}

.footer {
  text-align: center;
  color: #666;
  font-size: 12px;
  margin-top: 14px;
}

.version {
  display: block;
  margin-top: 4px;
  color: #555;
  font-size: 11px;
}

.send-row input::-webkit-search-decoration,
.send-row input::-webkit-search-cancel-button,
.send-row input::-webkit-search-results-button,
.send-row input::-webkit-search-results-decoration {
  display: none;
}

@media (max-width: 700px) {
  .room-layout {
    flex-direction: column;
  }

  .users-panel {
    width: 100%;
    order: 2;
  }

  .chat-panel {
    order: 1;
  }

  .send-row {
    flex-direction: row;
    align-items: center;
  }

  .send-row button {
    width: 90px;
    min-width: 90px;
  }
}

#roomTitle {
  font-size: 20px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #e5e7eb;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.read-receipt {
  border-bottom: none !important;
  padding: 4px 0 0 0 !important;
  margin: 0;
  color: #777;
  font-size: 12px;
  font-style: italic;
}

.hidden {
  display: none !important;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  z-index: 9999;

  display: flex;
  justify-content: center;
  align-items: center;
}

.modal-content {
  background: #1f2937;
  color: white;
  width: 90%;
  max-width: 420px;
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 10px 30px rgba(0,0,0,.45);
}

#qrCode {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 18px auto;
}

#qrCode img,
#qrCode canvas {
  background: white;
  padding: 12px;
  border-radius: 16px;
  border: 2px solid rgba(255,255,255,0.12);
  box-shadow: 0 8px 20px rgba(0,0,0,.35);
}

.modal-content h3 {
  margin-top: 0;
  text-align: center;
}

#inviteText {
  width: 100%;
  height: 130px;
  border-radius: 12px;
  border: none;
  padding: 12px;
  resize: none;
  margin: 14px 0;
  box-sizing: border-box;
}

.modal-buttons {
  display: flex;
  gap: 10px;
}

.modal-buttons button {
  flex: 1;
}

/* ROOM ACTION BUTTONS */

.room-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.room-actions button {
  height: 38px;
  padding: 0 14px;
  border: none;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  font-size: 13px;
  cursor: pointer;
  transition: 0.2s ease;
  width: auto;
  white-space: nowrap;
  margin: 0;
}

/* Invite */
.invite-btn {
  background: #2563eb;
  color: white;
}

.invite-btn:hover {
  background: #1d4ed8;
}

/* Burn Room */
.burn-btn {
  background: #8b1e1e;
  color: white;
  font-weight: bold;
}

.burn-btn:hover {
  background: #b91c1c;
}

/* Leave */
.leave-btn {
  background: #2d3748;
  color: white;
}

.leave-btn:hover {
  background: #4a5568;
}

.about-row {
  text-align: center;
  margin-top: 14px;
}

.about-link {
  color: #8fb4ff;
  text-decoration: none;
  font-size: 14px;
  transition: color 0.2s ease;
}

.about-link:visited {
  color: #8fb4ff;
}

.about-link:hover {
  color: #b6d0ff;
  text-decoration: underline;
}

.manage-modal {
  max-width: 320px;
  text-align: center;
}

.owner-action-btn {
  width: 100%;
  margin-top: 10px;
  padding: 12px;
  border: none;
  border-radius: 12px;
  background: rgba(255,255,255,0.08);
  color: white;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.owner-action-btn:hover {
  background: rgba(255,255,255,0.14);
  transform: translateY(-1px);
}

.danger-action:hover {
  background: rgba(255,80,80,0.18);
}

.cancel-action {
  opacity: 0.8;
}

.cancel-action:hover {
  opacity: 1;
}

.ban-message-box {
  width: 100%;
  height: 46px;
  min-height: 46px;
  max-height: 46px;
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.06);
  color: white;
  resize: none;
  overflow: hidden;
  box-sizing: border-box;
  font-size: 14px;
  outline: none;
  transition: all 0.18s ease;
}

.ban-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 10px;
}

.ban-section .ban-message-box {
  margin-top: 0;
  margin-bottom: 0;
}

.ban-section #banUserBtn {
  margin-top: 0;
}