* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--public-text);
}

.page {
  min-height: 100vh;
  padding: 24px 12px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.chat-wrap {
  width: 100%;
  max-width: 720px;
}

.chat-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.chat-header h1 {
  margin: 0 0 6px;
  font-size: 32px;
  line-height: 1.1;
}

.chat-header p {
  margin: 0;
  opacity: .9;
}

.live-badge {
  background: var(--primary);
  color: var(--button-text);
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: bold;
  white-space: nowrap;
}

.chat-form, .disabled-box {
  background: var(--card);
  color: var(--text);
  padding: 18px;
  border-radius: 18px;
  box-shadow: 0 14px 40px rgba(0,0,0,.18);
  margin-bottom: 18px;
}

.chat-form input,
.chat-form textarea {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  padding: 13px 14px;
  font-size: 16px;
  margin-bottom: 12px;
  outline: none;
}

.chat-form textarea {
  min-height: 95px;
  resize: vertical;
}

.chat-form input:focus,
.chat-form textarea:focus {
  border-color: var(--primary);
}

button {
  border: 0;
  background: var(--primary);
  color: var(--button-text);
  padding: 12px 16px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: bold;
  font-size: 15px;
}

button:hover {
  filter: brightness(.95);
}

#formStatus {
  display: block;
  margin-top: 10px;
  color: var(--text);
}

.messages-title {
  font-weight: bold;
  margin: 18px 0 10px;
  font-size: 18px;
}

.messages {
  display: grid;
  gap: 12px;
}

.message-card, .empty {
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 16px;
  padding: 14px;
  backdrop-filter: blur(8px);
}

.message-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.message-top span {
  font-size: 12px;
  opacity: .8;
  white-space: nowrap;
}

.message-card p {
  margin: 0;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

@media (max-width: 520px) {
  .chat-header {
    flex-direction: column;
  }

  .chat-header h1 {
    font-size: 26px;
  }
}
