* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: #f5f5f7;
  color: #1e1e1e;
}

.chat-app {
  max-width: 720px;
  margin: 40px auto;
  padding: 24px;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
}

h1 {
  margin: 0 0 16px;
  font-size: 24px;
}

.chat-box {
  height: 420px;
  padding: 16px;
  border: 1px solid #e1e1e8;
  border-radius: 10px;
  overflow-y: auto;
  background: #fafafa;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.message {
  max-width: 70%;
  padding: 10px 12px;
  border-radius: 12px;
  line-height: 1.4;
  font-size: 14px;
  word-break: break-word;
}

.message.me {
  align-self: flex-end;
  background: #0067d6;
  color: #ffffff;
}

.message.partner {
  align-self: flex-start;
  background: #e6e6eb;
  color: #1e1e1e;
}

.message.system {
  align-self: center;
  background: #fff7d1;
  color: #6b5400;
  font-size: 13px;
}

.chat-form {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 10px;
  margin-top: 16px;
}

#message-input {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #c9c9d2;
  font-size: 14px;
}

button {
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  background: #0067d6;
  color: #ffffff;
  font-size: 14px;
  cursor: pointer;
}

button.secondary {
  background: #444a59;
}

.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: 8px;
  background: #1f8b4c;
  color: #ffffff;
  font-size: 14px;
  cursor: pointer;
  user-select: none;
}

.file-button input {
  display: none;
}

.message img {
  max-width: 240px;
  border-radius: 10px;
  display: block;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

@media (max-width: 600px) {
  .chat-box {
    height: 320px;
  }

  .chat-form {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
  }

  #message-input {
    grid-column: 1 / -1;
  }
}
