:root {
  color-scheme: light;
  --paper: #f4efe6;
  --ink: #2b241c;
  --muted: #6e6256;
  --line: #e2d8c8;
  --card: #fffaf3;
  --accent: #8d4b32;
  --accent-dark: #6f3824;
  --user: #f3e1d4;
  --assistant: #fffaf3;
  --danger: #8d2f2f;
  --shadow: 0 10px 30px rgba(70, 48, 28, 0.08);
  font-family: "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
}

body {
  min-height: 100dvh;
}

button, input, textarea {
  font: inherit;
  color: inherit;
}

.app {
  width: min(480px, 100%);
  min-height: 100dvh;
  margin: 0 auto;
  padding: calc(16px + env(safe-area-inset-top)) 16px calc(12px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}

.chat {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.brand {
  font-size: 2rem;
  line-height: 1;
  margin: 12px 0 4px;
  letter-spacing: -0.03em;
}

.lede, .hint, .subtitle {
  color: var(--muted);
  line-height: 1.4;
}

.people {
  display: grid;
  gap: 12px;
  margin: 24px 0;
}

.person, .primary, .tool, .send {
  border: 0;
  cursor: pointer;
}

.person {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  text-align: left;
  background: var(--card);
  border: 2px solid transparent;
  border-radius: 18px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.person.selected {
  border-color: var(--accent);
}

.person strong {
  font-size: 1.35rem;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.field span {
  font-size: 0.95rem;
}

input[type="password"], textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: white;
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 1.05rem;
}

textarea {
  min-height: 64px;
  resize: vertical;
}

.primary, .send {
  background: var(--accent);
  color: white;
  border-radius: 999px;
  padding: 14px 18px;
  min-height: 52px;
}

.primary {
  width: 100%;
  font-size: 1.1rem;
}

.primary:disabled, .send:disabled, .tool:disabled {
  opacity: 0.55;
  cursor: wait;
}

.error {
  color: var(--danger);
  min-height: 1.2em;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.linkish {
  background: transparent;
  border: 0;
  color: var(--accent-dark);
  padding: 8px 0;
  cursor: pointer;
}

.thread {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 16px 0;
  flex: 1;
}

.bubble {
  max-width: 92%;
  padding: 12px 14px;
  border-radius: 18px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.bubble.user {
  align-self: flex-end;
  background: var(--user);
}

.bubble.assistant {
  align-self: flex-start;
  background: var(--assistant);
  border: 1px solid var(--line);
}

.bubble img {
  display: block;
  width: min(100%, 240px);
  border-radius: 12px;
  margin-bottom: 8px;
}

.bubble a {
  color: var(--accent-dark);
}

.composer {
  position: sticky;
  bottom: 0;
  display: grid;
  gap: 10px;
  padding: 12px 0 calc(8px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, var(--paper) 18%);
}

.tools {
  display: flex;
  gap: 8px;
}

.tool {
  flex: 1;
  min-height: 48px;
  border-radius: 14px;
  background: white;
  border: 1px solid var(--line);
}

.tool.recording {
  background: #f8d7d2;
  border-color: var(--danger);
  color: var(--danger);
}

.row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.row textarea {
  flex: 1;
}

.hidden-input {
  display: none;
}
