:root {
  color-scheme: light;
  --bg: #eef2ff;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --border: #dbe3ef;
  --text-main: #111827;
  --text-muted: #64748b;
  --brand: #2563eb;
  --brand-soft: #dbeafe;
  --bubble-in: #f1f5f9;
  --bubble-out: #dbeafe;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", "Segoe UI", Arial, sans-serif;
  background: radial-gradient(circle at top, #dbeafe 0%, var(--bg) 45%, #f8fafc 100%);
  color: var(--text-main);
}

.chat-shell {
  width: min(880px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: var(--surface);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

.chat-header {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #ffffff 0%, var(--surface-soft) 100%);
}

.chat-header h1 {
  margin: 0 0 6px;
  font-size: 24px;
  line-height: 1.2;
}

.chat-header p {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
}

.messages {
  padding: 16px;
  overflow-y: auto;
  background: linear-gradient(180deg, #fcfdff 0%, #f8fafc 100%);
}

.msg {
  width: fit-content;
  max-width: min(78%, 640px);
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  background: var(--bubble-in);
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}

.msg.self {
  margin-left: auto;
  border-color: #bfd8ff;
  background: var(--bubble-out);
}

.composer {
  border-top: 1px solid var(--border);
  background: #fff;
  padding: 12px;
}

.row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.row:last-child {
  margin-bottom: 0;
}

#messageInput {
  flex: 1;
}

input,
button {
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
}

input {
  min-width: 0;
}

button {
  background: #fff;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

button:hover {
  border-color: #93c5fd;
  background: #f8fbff;
}

#sendButton {
  border-color: #93c5fd;
  background: var(--brand-soft);
}

#sendButton:hover {
  background: #cfe2ff;
}

.emoji-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.emoji-panel.hidden {
  display: none;
}

.emoji-item {
  min-width: 42px;
  padding: 8px 10px;
}

small {
  color: var(--text-muted);
}

@media (max-width: 768px) {
  .chat-shell {
    border-left: 0;
    border-right: 0;
    box-shadow: none;
  }

  .chat-header h1 {
    font-size: 22px;
  }

  .msg {
    max-width: 90%;
  }
}
