:root {
  --ink: #17211d;
  --muted: #5e6a63;
  --paper: #f8f4e8;
  --panel: #fffdf6;
  --line: #d8d0bd;
  --accent: #0f766e;
  --accent-ink: #f4fffb;
  --user: #e7f2ef;
  --assistant: #f5ead1;
  --shadow: 0 24px 70px rgba(47, 42, 31, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  background:
    radial-gradient(circle at 18% 12%, rgba(15, 118, 110, 0.18), transparent 28rem),
    linear-gradient(135deg, #d7e4db 0%, var(--paper) 44%, #eadfca 100%);
}

.shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.panel {
  width: min(920px, 100%);
  height: min(760px, calc(100vh - 48px));
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: color-mix(in srgb, var(--panel) 94%, white);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 246, 0.72);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(1.45rem, 2.6vw, 2.25rem);
  letter-spacing: 0;
}

.status {
  min-width: 86px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.86rem;
  text-align: center;
  white-space: nowrap;
}

.messages {
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 24px;
}

.message {
  width: min(72ch, 88%);
  padding: 14px 16px;
  border: 1px solid rgba(23, 33, 29, 0.08);
  border-radius: 8px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.message p {
  margin: 0;
}

.message.user {
  align-self: flex-end;
  background: var(--user);
}

.message.assistant {
  align-self: flex-start;
  background: var(--assistant);
}

.message.error {
  background: #fee2e2;
  color: #7f1d1d;
}

.composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 18px;
  border-top: 1px solid var(--line);
  background: rgba(248, 244, 232, 0.76);
}

textarea {
  width: 100%;
  resize: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px 14px;
  color: var(--ink);
  background: white;
  font: 1rem/1.4 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  outline: none;
}

textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

button {
  min-width: 96px;
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  color: var(--accent-ink);
  background: var(--accent);
  font-weight: 700;
  cursor: pointer;
}

button:disabled {
  opacity: 0.55;
  cursor: wait;
}

@media (max-width: 640px) {
  .shell {
    padding: 0;
  }

  .panel {
    height: 100vh;
    border-radius: 0;
    border: 0;
  }

  .topbar {
    align-items: flex-start;
    padding: 18px;
  }

  .messages {
    padding: 18px;
  }

  .message {
    width: 100%;
  }

  .composer {
    grid-template-columns: 1fr;
  }

  button {
    min-height: 44px;
  }
}
