* {
  box-sizing: border-box;
}

html, body {
  height: 100dvh;
  margin: 0;
  font-family: Arial, sans-serif;
  background: #e5ddd5;
  display: flex;
  flex-direction: column;
  user-select: none;
  outline: none;
}

#toolbar {
  width: 100vw;
  display: flex;
  background: #075e54;
  color: white;
}

#toolbar div {
  width: 50%;
  padding: 5px;
}

#title {
  padding: 10px;
  font-weight: bold;
}

#status {
  font-size: 18px;
  font-weight: bold;
}

#state {
  font-size: 13px;
  opacity: 0.9;
}

#chatScreen {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  padding-bottom: 70px;
}

#chat {
  flex: 1;
  padding: 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

.msg {
  max-width: 75%;
  padding: 10px 14px;
  margin: 4px 0;
  border-radius: 10px;
  word-wrap: break-word;
  word-break: break-word;
  font-size: 16px;
  line-height: 1.4;
}

.me {
  align-self: flex-end;
  background: #dcf8c6;
}

.peer {
  align-self: flex-start;
  background: white;
}

#inputArea {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: flex-end;
  padding: 10px;
  background: #f0f0f0;
  border-top: 1px solid #ccc;
  z-index: 10;
  transition: transform 0.2s ease;
}

#messageInput {
  flex: 1;
  padding: 10px 15px;
  border: none;
  border-radius: 20px;
  font-size: 18px;
  outline: none;
  resize: none;
  max-height: 120px;
  overflow-y: auto;
  line-height: 1.4;
}

.sendButton {
  flex: none;
  align-self: flex-end;
  background: #075e54;
  color: white;
  border: none;
  padding: 0 16px;
  margin-left: 8px;
  border-radius: 50%;
  font-size: 20px;
  height: 45px;
  min-width: 45px;
}

.loginButton {
  margin-top: 15px;
  padding: 10px 20px;
  font-size: 16px;
  background: #075e54;
  color: white;
  border: none;
  border-radius: 10px;
  cursor: pointer;
}

#loginScreen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100dvh;
  background: #e5ddd5;
}

#nameInput, #roomInput {
  padding: 10px;
  font-size: 16px;
  border-radius: 10px;
  border: none;
  width: 80%;
  max-width: 300px;
  margin-bottom: 10px;
}

button:focus {
  outline: 2px solid #4CAF50;
}
