* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: #f6f0d7;
  background: radial-gradient(circle at top, #263548 0, #101722 38rem, #070a0f 100%);
  font-family: Arial, sans-serif;
}

#chat-container {
  display: flex;
  width: min(920px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 42px 0 32px;
  flex-direction: column;
}

.chat-header {
  display: flex;
  margin-bottom: 24px;
  align-items: flex-start;
  gap: 20px;
}

.home-link {
  padding: 9px 12px;
  color: #ffd85a;
  font-size: 14px;
  font-weight: bold;
  text-decoration: none;
  border: 1px solid rgba(255, 216, 90, 0.55);
  border-radius: 8px;
}

.home-link:hover,
.home-link:focus-visible {
  color: #ffffff;
  background: rgba(255, 216, 90, 0.18);
}

.eyebrow {
  margin: 0 0 6px;
  color: #971f28;
  font-size: 11px;
  font-weight: bold;
  letter-spacing: 0.18em;
}

.chat-header h1 {
  margin: 0;
  color: #ffffff;
  font-size: clamp(30px, 6vw, 50px);
  letter-spacing: 0.03em;
  text-shadow: 0 0 20px rgba(110, 213, 255, 0.3);
}

#user-container {
  margin-bottom: 14px;
}

#user-container label {
  display: block;
  margin: 0 0 7px;
  color: #d5e2ed;
  font-size: 14px;
  font-weight: bold;
}

#user-container label span {
  color: #9caebe;
  font-weight: normal;
}

#username-input,
#message-input {
  width: 100%;
  padding: 13px 15px;
  color: #ffffff;
  font: inherit;
  font-size: 16px;
  border: 1px solid rgba(120, 213, 255, 0.35);
  border-radius: 9px;
  outline: none;
  background: rgba(4, 10, 17, 0.72);
}

#username-input:focus,
#message-input:focus {
  border-color: #ffd85a;
  box-shadow: 0 0 0 3px rgba(255, 216, 90, 0.15);
}

#messages {
  min-height: 280px;
  margin-bottom: 14px;
  padding: 16px;
  flex: 1;
  overflow-y: auto;
  border: 1px solid rgba(120, 213, 255, 0.35);
  border-radius: 14px;
  background: rgba(4, 10, 17, 0.76);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.04);
}

.message {
  width: fit-content;
  max-width: min(78%, 660px);
  margin: 0 0 10px;
  padding: 10px 13px;
  color: #ecf4fa;
  line-height: 1.4;
  overflow-wrap: anywhere;
  border: 1px solid rgba(120, 213, 255, 0.18);
  border-radius: 5px 13px 13px;
  background: linear-gradient(145deg, rgba(46, 85, 115, 0.7), rgba(18, 33, 51, 0.82));
}

#input-container {
  display: flex;
  gap: 10px;
}

#message-input {
  flex: 1;
}

#send-button {
  padding: 0 25px;
  color: #201308;
  font: inherit;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  border: 0;
  border-radius: 9px;
  background: #ffd85a;
}

#send-button:hover,
#send-button:focus-visible {
  background: #fff0a7;
}

#chat-status {
  min-height: 20px;
  margin: 8px 2px 0;
  color: #e4767c;
  font-size: 14px;
}

@media (max-width: 600px) {
  #chat-container {
    width: min(100% - 24px, 560px);
    padding: 28px 0 20px;
  }

  .chat-header {
    margin-bottom: 18px;
    gap: 12px;
  }

  .home-link {
    padding: 7px 9px;
    font-size: 13px;
  }

  #messages {
    min-height: 230px;
    padding: 12px;
  }

  .message {
    max-width: 90%;
  }
}

@media (max-width: 420px) {
  .chat-header {
    display: block;
  }

  .home-link {
    display: inline-block;
    margin-bottom: 14px;
  }

  #input-container {
    flex-direction: column;
  }

  #send-button {
    min-height: 46px;
  }
}
