:root {
  --bg: #f6f7f4;
  --panel: #ffffff;
  --ink: #1f2523;
  --muted: #68736f;
  --line: #dbe2df;
  --user: #23675a;
  --assistant: #f1e8e1;
  --accent: #b84f62;
  --accent-strong: #94394b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
textarea,
select {
  font: inherit;
}

.app {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 20px;
}

.chat-shell {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  width: min(980px, 100%);
  height: min(860px, calc(100vh - 40px));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 22px 60px rgba(22, 35, 31, 0.12);
}

.chat-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 16px 18px;
}

h1,
p {
  margin: 0;
}

h1 {
  font-size: 22px;
}

.chat-header p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
}

.chat-header a {
  color: var(--accent-strong);
  font-weight: 700;
  text-decoration: none;
}

.settings {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 14px;
}

label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

label span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

select {
  min-height: 42px;
  padding: 8px 10px;
}

textarea {
  resize: none;
  padding: 11px 12px;
  line-height: 1.45;
}

textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(184, 79, 98, 0.15);
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  padding: 18px;
}

.message {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.message.user {
  align-items: flex-end;
}

.bubble {
  max-width: min(700px, 86%);
  border-radius: 8px;
  padding: 12px 14px;
  line-height: 1.58;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.assistant .bubble {
  background: var(--assistant);
}

.user .bubble {
  background: var(--user);
  color: #fff;
}

.message-note {
  margin-top: 5px;
  color: var(--accent-strong);
  font-size: 12px;
}

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 86px;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding: 14px;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 800;
}

button:hover {
  background: var(--accent-strong);
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

@media (max-width: 700px) {
  .app {
    padding: 0;
  }

  .chat-shell {
    width: 100%;
    height: 100vh;
    border: 0;
    border-radius: 0;
  }

  .chat-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .settings,
  .composer {
    grid-template-columns: 1fr;
  }
}
