* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background:
    linear-gradient(rgba(11, 14, 19, 0.75), rgba(17, 23, 35, 0.82)),
    url('/bg.jpg') center center / cover no-repeat fixed;
  color: #ffffff;
}

.container {
  max-width: 760px;
  margin: 0 auto;
  padding: 16px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1 {
  margin: 0;
  font-size: 28px;
  letter-spacing: 0.5px;
}

.subtitle {
  color: #b8c0cc;
  margin: 8px 0 20px;
}

.card {
  background: rgba(24, 30, 40, 0.50);
  padding: 20px;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border: 1px solid #2a3342;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

input {
  padding: 14px;
  border-radius: 10px;
  border: 1px solid #384254;
  background: rgba(17, 21, 28, 0.82);
  color: white;
  font-size: 16px;
  outline: none;
}

input:focus {
  border-color: #5d8cff;
}

button {
  padding: 12px 16px;
  border: none;
  border-radius: 10px;
  background: #2f6fed;
  color: white;
  font-size: 16px;
  cursor: pointer;
}

button:hover {
  opacity: 0.95;
}

.error {
  color: #ff8c8c;
  min-height: 20px;
  margin: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding: 10px 2px 4px;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.logout-btn {
  background: #3b4556;
  flex-shrink: 0;
}

.chat-box {
  background: rgba(24, 30, 40, 0.96);
  border-radius: 16px;
  padding: 14px;
  min-height: 420px;
  max-height: calc(100vh - 210px);
  overflow-y: auto;
  margin-bottom: 14px;
  border: 1px solid #2a3342;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.message {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #252d3a;
  max-width: 82%;
  width: fit-content;
}

.message.self {
  background: #2f6fed;
  margin-left: auto;
}

.message .meta {
  font-size: 12px;
  opacity: 0.8;
  margin-bottom: 5px;
}

.message-form {
  display: flex;
  gap: 10px;
  align-items: center;
}

.message-form input {
  flex: 1;
}

/* Login page fixes */
.login-container {
  justify-content: center;
  align-items: center;
}

.login-header {
  margin-bottom: 18px;
  width: 100%;
  max-width: 420px;
  text-align: center;
}

.login-card {
  width: 100%;
  max-width: 420px;
}

@media (max-width: 640px) {
  .container {
    padding: 12px;
  }

  h1 {
    font-size: 24px;
  }

  .topbar {
    margin-bottom: 12px;
  }

  .chat-box {
    min-height: 360px;
    max-height: calc(100vh - 190px);
    padding: 12px;
  }

  .message {
    max-width: 90%;
    font-size: 15px;
  }

  .message-form {
    gap: 8px;
  }

  .message-form input,
  button {
    font-size: 16px;
  }

  .login-header,
  .login-card {
    max-width: 100%;
  }
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
  -webkit-text-fill-color: #ffffff !important;
  color: #ffffff !important;
  caret-color: #ffffff !important;
  border: 1px solid #384254 !important;
  -webkit-box-shadow: 0 0 0 1000px rgba(17, 21, 28, 0.1) inset !important;
  box-shadow: 0 0 0 1000px rgba(17, 21, 28, 0.1) inset !important;
  background-color: transparent !important;
  transition: background-color 999999s ease-in-out 0s;
}