:root {
  --bg: #f5efe1;
  --bg-accent: #ead8b5;
  --panel: rgba(255, 251, 242, 0.82);
  --panel-strong: rgba(255, 251, 242, 0.96);
  --ink: #1d2a31;
  --muted: #5a6b71;
  --line: rgba(29, 42, 49, 0.14);
  --user: #1d2a31;
  --user-ink: #fffaf0;
  --assistant: #fff7ea;
  --shadow: 0 28px 80px rgba(41, 35, 22, 0.14);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.6), transparent 32rem),
    linear-gradient(145deg, var(--bg) 0%, var(--bg-accent) 100%);
}

body {
  padding: 24px;
}

.shell {
  max-width: 1100px;
  margin: 0 auto;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: end;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 12px;
  color: var(--muted);
}

h1 {
  margin: 0;
  font-size: clamp(34px, 5vw, 58px);
  line-height: 0.95;
}

.subhead {
  max-width: 48rem;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 18px;
}

.status-card,
.auth-panel,
.chat-card {
  backdrop-filter: blur(18px);
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.status-card {
  min-width: 260px;
  padding: 16px 18px;
  border-radius: 22px;
}

.status-row {
  display: flex;
  justify-content: space-between;
  gap: 18px;
}

.status-row + .status-row {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.label {
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.value {
  font-weight: 700;
  text-align: right;
}

.auth-panel {
  margin-bottom: 18px;
  border-radius: 18px;
  padding: 16px 18px;
}

.auth-panel label {
  display: block;
  font-size: 13px;
  margin-bottom: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.auth-row {
  display: flex;
  gap: 10px;
}

.chat-card {
  border-radius: 28px;
  overflow: hidden;
}

.messages {
  min-height: 58vh;
  max-height: 68vh;
  overflow: auto;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.message {
  max-width: min(760px, 88%);
  padding: 16px 18px 18px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--assistant);
}

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

.message.pending {
  opacity: 0.72;
}

.message-meta {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: inherit;
  opacity: 0.7;
  margin-bottom: 10px;
}

.message-text {
  white-space: pre-wrap;
  line-height: 1.55;
  word-break: break-word;
  font-size: 18px;
}

.composer-wrap {
  border-top: 1px solid var(--line);
  background: var(--panel-strong);
  padding: 18px;
}

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

.composer-actions {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

textarea,
input,
button {
  font: inherit;
}

textarea,
input {
  width: 100%;
  border-radius: 16px;
  border: 1px solid var(--line);
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
}

textarea {
  resize: vertical;
  min-height: 92px;
}

button {
  border: none;
  border-radius: 999px;
  padding: 12px 20px;
  background: #c56f42;
  color: white;
  font-weight: 700;
  cursor: pointer;
}

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

.tiny,
.hint {
  color: var(--muted);
  font-size: 14px;
}

.error {
  border-radius: 14px;
  padding: 12px 14px;
  background: #fce7df;
  color: #7f2f16;
  border: 1px solid rgba(127, 47, 22, 0.16);
}

.hidden {
  display: none;
}

@media (max-width: 760px) {
  body {
    padding: 14px;
  }

  .hero {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .status-card {
    min-width: 0;
  }

  .messages {
    min-height: 52vh;
    max-height: 62vh;
    padding: 18px 16px;
  }

  .message {
    max-width: 100%;
  }

  .message-text {
    font-size: 16px;
  }

  .auth-row,
  .composer-actions {
    flex-direction: column;
    align-items: stretch;
  }
}
