:root {
  color-scheme: light;
  --ink: #17212b;
  --muted: #647181;
  --paper: #ffffff;
  --canvas: #f4f1ea;
  --line: #dcd7cc;
  --orange: #f48120;
  --orange-dark: #c95500;
  --navy: #14233a;
  --answer: #f8fafc;
  --shadow: 0 20px 60px rgba(44, 35, 24, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 8%, rgba(244, 129, 32, 0.2), transparent 26rem),
    radial-gradient(circle at 88% 88%, rgba(79, 139, 255, 0.12), transparent 30rem),
    var(--canvas);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body::before,
body::after {
  position: fixed;
  z-index: -1;
  color: rgba(255, 255, 255, 0.58);
  font-size: clamp(5rem, 12vw, 9rem);
  content: "☁";
  filter: drop-shadow(0 12px 22px rgba(20, 35, 58, 0.06));
  pointer-events: none;
}

body::before {
  top: 9%;
  right: -2rem;
  transform: rotate(8deg);
}

body::after {
  bottom: 6%;
  left: -2.5rem;
  transform: rotate(-7deg) scale(0.8);
}

button,
textarea {
  font: inherit;
}

.app-shell {
  width: min(860px, calc(100% - 32px));
  margin: 0 auto;
  padding: 56px 0 28px;
}

.hero {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 26px;
}

.brand-mark {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 16px;
  color: white;
  background: linear-gradient(145deg, #ff9b3d, var(--orange-dark));
  box-shadow: 0 10px 24px rgba(201, 85, 0, 0.25);
  font-size: 1.85rem;
  font-weight: 800;
  animation: cloud-float 4s ease-in-out infinite;
}

.eyebrow {
  display: flex;
  gap: 7px;
  align-items: center;
  margin: 1px 0 5px;
  color: var(--orange-dark);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #25a766;
  box-shadow: 0 0 0 5px rgba(37, 167, 102, 0.13);
}

h1 {
  margin: 0;
  color: var(--navy);
  font-size: clamp(2rem, 5vw, 3.2rem);
  letter-spacing: -0.045em;
  line-height: 1;
}

.subtitle {
  max-width: 650px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.55;
}

.hero-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.hero-chips span {
  padding: 6px 10px;
  border: 1px solid rgba(220, 215, 204, 0.9);
  border-radius: 999px;
  color: #4c5865;
  background: rgba(255, 255, 255, 0.72);
  font-size: 0.76rem;
  font-weight: 700;
  backdrop-filter: blur(8px);
}

.chat-card {
  overflow: hidden;
  border: 1px solid rgba(220, 215, 204, 0.9);
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.messages {
  min-height: 350px;
  max-height: 58vh;
  overflow-y: auto;
  padding: 26px;
  background:
    radial-gradient(circle at 12px 12px, rgba(244, 129, 32, 0.06) 1.5px, transparent 1.5px) 0 0 / 24px 24px,
    linear-gradient(180deg, #fff, #fdfcf9);
}

.message {
  width: fit-content;
  max-width: min(680px, 88%);
  margin-bottom: 20px;
  padding: 15px 17px;
  border-radius: 17px;
  line-height: 1.55;
  animation: message-pop 240ms ease-out both;
}

.message p {
  margin: 0;
  white-space: pre-line;
}

.assistant-message {
  border: 1px solid #e2e7ed;
  border-bottom-left-radius: 5px;
  background: var(--answer);
  box-shadow: 0 8px 20px rgba(20, 35, 58, 0.05);
}

.user-message {
  margin-left: auto;
  border-bottom-right-radius: 5px;
  color: white;
  background: var(--navy);
}

.error-message {
  border-color: #f0c9be;
  background: #fff4f1;
}

.message-label,
.source-heading {
  margin-bottom: 6px;
  color: inherit;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  opacity: 0.72;
  text-transform: uppercase;
}

.source-block {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #dfe5ec;
}

.source-list {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 20px;
}

.source-list a {
  color: #9d4500;
  font-weight: 650;
  text-underline-offset: 3px;
}

.source-list a:hover {
  color: var(--orange-dark);
  text-decoration-thickness: 2px;
}

.suggestion-heading {
  padding: 0 26px 9px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.suggestions {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 26px 16px;
}

.suggestion {
  flex: 0 0 auto;
  padding: 8px 12px;
  border: 1px solid #ddd6ca;
  border-radius: 999px;
  color: #344250;
  background: white;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 650;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.suggestion:hover,
.suggestion:focus-visible {
  border-color: var(--orange);
  outline: none;
  box-shadow: 0 6px 14px rgba(201, 85, 0, 0.1);
  transform: translateY(-2px);
}

.composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 18px 22px 12px;
  border-top: 1px solid var(--line);
  background: #fbfaf7;
}

textarea {
  width: 100%;
  min-height: 56px;
  max-height: 180px;
  resize: vertical;
  padding: 14px 15px;
  border: 1px solid #cfc9bd;
  border-radius: 14px;
  color: var(--ink);
  background: white;
  line-height: 1.4;
}

textarea:focus {
  border-color: var(--orange);
  outline: 3px solid rgba(244, 129, 32, 0.16);
}

#send-button {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  min-width: 88px;
  padding: 0 19px;
  border: 0;
  border-radius: 14px;
  color: white;
  background: var(--orange-dark);
  cursor: pointer;
  font-weight: 800;
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

#send-button:hover {
  background: #a94700;
  box-shadow: 0 8px 18px rgba(169, 71, 0, 0.2);
  transform: translateY(-1px);
}

#send-button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.composer-footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 0 23px 18px;
  color: var(--muted);
  background: #fbfaf7;
  font-size: 0.78rem;
}

.text-button {
  padding: 0;
  border: 0;
  color: var(--orange-dark);
  background: transparent;
  cursor: pointer;
  font-weight: 700;
}

footer {
  max-width: 680px;
  margin: 18px auto 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
  text-align: center;
}

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

@keyframes cloud-float {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-5px) rotate(2deg); }
}

@keyframes message-pop {
  from { opacity: 0; transform: translateY(7px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 620px) {
  .app-shell {
    width: min(100% - 20px, 860px);
    padding-top: 28px;
  }

  .hero {
    gap: 12px;
  }

  .brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 13px;
    font-size: 0.85rem;
  }

  .messages {
    min-height: 320px;
    padding: 18px;
  }

  .suggestions {
    padding-inline: 18px;
  }

  .suggestion-heading {
    padding-inline: 18px;
  }

  .composer {
    grid-template-columns: 1fr;
    padding-inline: 15px;
  }

  #send-button {
    min-height: 46px;
  }

  .composer-footer {
    align-items: flex-start;
    padding-inline: 16px;
  }
}
