:root {
  --bg: #f3f7f8;
  --card: #ffffff;
  --ink: #102326;
  --muted: #53707a;
  --primary: #0b7c6b;
  --primary-ink: #f6fffd;
  --border: #cfe0e6;
  --shadow: 0 16px 35px rgba(10, 34, 38, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: "Avenir Next", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--ink);
  overflow: hidden;
  background:
    radial-gradient(circle at 0% 0%, #d9ecff 0%, transparent 36%),
    radial-gradient(circle at 100% 100%, #d3ffe4 0%, transparent 40%),
    linear-gradient(180deg, #f7fafb 0%, var(--bg) 100%);
}

.app {
  max-width: 920px;
  height: min(860px, calc(100vh - 3rem));
  margin: 1.5rem auto 0;
  padding: 1rem 1rem 1.2rem;
  display: flex;
  flex-direction: column;
}

.hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.hero h1 {
  margin: 0;
  font-size: 2.1rem;
}

.hero p {
  color: var(--muted);
  margin: 0.35rem 0 0;
}

.pill {
  margin-top: 0.3rem;
  border: 1px solid #b8ddd4;
  background: #e7faf5;
  color: #195f54;
  border-radius: 999px;
  padding: 0.3rem 0.65rem;
  font-size: 0.85rem;
  font-weight: 600;
}

.chat {
  margin-top: 1rem;
  flex: 1;
  min-height: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem 1rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
  overflow-y: auto;
  box-shadow: var(--shadow);
}

.message {
  max-width: 75ch;
  padding: 0.78rem 0.95rem;
  border-radius: 12px;
  white-space: pre-wrap;
  line-height: 1.45;
  animation: messageIn 180ms ease-out;
}

.message.user {
  margin-left: auto;
  background: #e4f4ff;
  border: 1px solid #c7e6fb;
}

.message.assistant {
  background: #f2fffa;
  border: 1px solid #caefe3;
}

.composer {
  margin-top: 0.95rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 0.75rem;
  display: grid;
  gap: 0.7rem;
}

textarea {
  width: 100%;
  resize: none;
  min-height: 62px;
  max-height: 180px;
  padding: 0.82rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  font: inherit;
  line-height: 1.45;
}

textarea:focus {
  outline: 2px solid #b5dfd7;
  border-color: #87cdbf;
}

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

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

button {
  border: 0;
  border-radius: 11px;
  padding: 0.72rem 1rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  background: var(--primary);
  color: var(--primary-ink);
  transition: transform 120ms ease, opacity 120ms ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.6;
  cursor: default;
}

@media (max-width: 720px) {
  .app {
    height: calc(100vh - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    margin: 0;
    padding: calc(0.65rem + env(safe-area-inset-top)) 0.65rem
      calc(0.65rem + env(safe-area-inset-bottom));
  }

  .hero {
    flex-direction: column;
  }

  .hero h1 {
    font-size: 1.8rem;
  }

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

  button {
    width: 100%;
  }
}

@keyframes messageIn {
  from {
    transform: translateY(4px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
