:root {
  color-scheme: light;
  --bg: #f7f4ee;
  --panel: #ffffff;
  --text: #18212f;
  --muted: #596574;
  --line: #d8d2c7;
  --accent: #1f6f78;
  --accent-dark: #154f56;
  --user: #e5f2f4;
  --assistant: #f2eee6;
  --error: #8a1f1f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

.app-shell {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
}

.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.site-header__inner,
.chat-shell {
  width: min(100%, 920px);
  margin: 0 auto;
  padding: 18px;
}

.brand {
  margin: 0;
  font-size: 1.5rem;
  line-height: 1.2;
}

.tagline {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.chat-shell {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 14px;
}

.chat-log {
  min-height: 420px;
  max-height: calc(100vh - 220px);
  overflow-y: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.message {
  width: fit-content;
  max-width: min(76ch, 100%);
  margin: 0 0 12px;
  padding: 12px 14px;
  border-radius: 8px;
  line-height: 1.45;
}

.message__label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.message--assistant {
  background: var(--assistant);
}

.message--user {
  margin-left: auto;
  background: var(--user);
}

.message--error {
  color: var(--error);
}

.chat-form {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
}

.chat-input {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
}

.button {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

.button:hover,
.button:focus {
  background: var(--accent-dark);
}

.button--secondary {
  background: var(--panel);
  color: var(--accent);
}

.button--secondary:hover,
.button--secondary:focus {
  background: #eef6f7;
  color: var(--accent-dark);
}

.release-footer {
  width: min(100%, 920px);
  margin: 0 auto;
  padding: 0 18px 14px;
  color: var(--muted);
  font-size: 0.75rem;
  text-align: right;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

  .chat-form {
    grid-template-columns: 1fr;
  }
}
