:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --ink: #1d242c;
  --muted: #8a94a3;
  --line: #d9e0e7;
  --accent: #0c7c75;
  --accent-hover: #08645f;
  --shadow: 0 18px 50px rgba(25, 34, 44, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  overflow-x: hidden;
  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 {
  font: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

.page {
  display: grid;
  align-content: start;
  justify-items: center;
  min-height: 100vh;
  padding: clamp(28px, 12vh, 120px) 16px 32px;
}

.question-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  width: min(760px, 100%);
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.question-box textarea {
  width: 100%;
  min-height: 48px;
  max-height: 140px;
  resize: vertical;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  padding: 12px 10px;
  line-height: 1.45;
}

.question-box textarea::placeholder {
  color: var(--muted);
  opacity: 1;
}

.question-box button {
  min-width: 92px;
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 800;
}

.question-box button:hover,
.question-box button:focus-visible {
  background: var(--accent-hover);
}

.answer-area {
  width: min(760px, 100%);
  margin-top: 16px;
}

.message {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 16px;
  line-height: 1.6;
  box-shadow: 0 10px 28px rgba(25, 34, 44, 0.08);
}

.message + .message {
  margin-top: 10px;
}

.message.user {
  background: #eef5f5;
}

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

.message.is-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #5d6875;
}

.spinner {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  border: 2px solid #d9e0e7;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

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

@media (max-width: 560px) {
  .question-box {
    grid-template-columns: 1fr;
  }

  .question-box button {
    width: 100%;
  }
}
