:root {
  --paper: #f8f5ee;
  --paper-deep: #eee9df;
  --ink: #20231f;
  --muted: #777b71;
  --line: #ded9ce;
  --green: #b8d887;
  --green-deep: #28452a;
  --orange: #f27c4f;
  --white: #fffdf9;
  --shadow: 0 22px 70px rgba(42, 38, 27, 0.1), 0 3px 12px rgba(42, 38, 27, 0.06);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 12% 16%, rgba(184, 216, 135, 0.23), transparent 24rem),
    radial-gradient(circle at 88% 84%, rgba(242, 124, 79, 0.11), transparent 28rem),
    var(--paper);
}

button,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

.page-shell {
  width: min(1180px, calc(100% - 48px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 30px 0 22px;
  display: flex;
  flex-direction: column;
}

.site-header,
.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-header {
  padding-bottom: 30px;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.wordmark-mark {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  color: var(--green-deep);
  background: var(--green);
  border-radius: 10px 10px 10px 3px;
}

.wordmark-mark svg {
  width: 24px;
  height: 24px;
}

.header-note,
.connection-status,
.chat-footer,
.site-footer {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.02em;
}

.header-note {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  display: inline-block;
  background: #83ad4d;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(131, 173, 77, 0.13);
}

.main-grid {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(280px, 0.78fr) minmax(440px, 1.22fr);
  align-items: center;
  gap: clamp(50px, 9vw, 126px);
  padding: 35px 0 65px;
}

.intro {
  max-width: 455px;
  padding-bottom: 8px;
}

.eyebrow {
  margin: 0 0 24px;
  color: var(--orange);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.18em;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 500px;
  margin-bottom: 23px;
  font-size: clamp(48px, 6vw, 77px);
  font-weight: 650;
  letter-spacing: -0.075em;
  line-height: 0.95;
}

h1 em {
  color: var(--orange);
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
  letter-spacing: -0.09em;
}

.intro-copy {
  max-width: 370px;
  margin-bottom: 44px;
  color: #5e625a;
  font-size: 16px;
  line-height: 1.65;
}

.feature-list {
  border-top: 1px solid var(--line);
}

.feature-item {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 12px;
  padding: 17px 0 16px;
  border-bottom: 1px solid var(--line);
}

.feature-number {
  color: var(--orange);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  line-height: 1.5;
}

.feature-item strong,
.feature-item span {
  display: block;
}

.feature-item strong {
  margin-bottom: 4px;
  font-size: 12px;
  letter-spacing: -0.01em;
}

.feature-item div span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.intro-note {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  margin: 27px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.spark {
  color: var(--orange);
  font-size: 15px;
  line-height: 1;
}

.chat-card {
  width: 100%;
  max-width: 640px;
  min-height: 760px;
  justify-self: end;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: rgba(255, 253, 249, 0.88);
  border: 1px solid rgba(222, 217, 206, 0.95);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 30px 24px;
  border-bottom: 1px solid var(--line);
}

.assistant-identity {
  display: flex;
  align-items: center;
  gap: 12px;
}

.assistant-avatar {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  color: var(--green-deep);
  background: var(--green);
  border-radius: 14px 14px 14px 4px;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: -0.08em;
}

.chat-header h2 {
  margin: 0 0 2px;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.chat-header p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.icon-button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 11px;
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease;
}

.icon-button:hover,
.icon-button:focus-visible {
  color: var(--ink);
  background: var(--paper-deep);
  border-color: #c4bfb2;
}

.icon-button svg {
  width: 17px;
  height: 17px;
}

.connection-status {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 30px;
  font-size: 13px;
  border-bottom: 1px solid rgba(222, 217, 206, 0.7);
}

.connection-status.is-busy .status-dot {
  background: var(--orange);
  box-shadow: 0 0 0 4px rgba(242, 124, 79, 0.13);
  animation: pulse 1.2s ease-in-out infinite;
}

.connection-status.is-error .status-dot {
  background: #c34b46;
  box-shadow: 0 0 0 4px rgba(195, 75, 70, 0.12);
}

.messages {
  flex: 1;
  min-height: 400px;
  max-height: 485px;
  overflow-y: auto;
  padding: 32px 30px 24px;
  scroll-behavior: smooth;
}

.message {
  width: fit-content;
  max-width: 90%;
  margin-bottom: 24px;
  animation: message-in 220ms ease-out both;
}

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

.message--assistant {
  color: var(--ink);
}

.message-label {
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.message-label span {
  margin-left: 4px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.message p {
  margin: 0;
  padding: 16px 18px;
  font-size: 16px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.message--assistant p {
  background: var(--paper-deep);
  border-radius: 4px 16px 16px 16px;
}

.message--user p {
  background: var(--green-deep);
  border-radius: 16px 4px 16px 16px;
}

.message--error p {
  color: #8d3f3b;
  background: #f7e6e0;
}

.typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 18px;
}

.typing i {
  width: 5px;
  height: 5px;
  display: block;
  background: var(--muted);
  border-radius: 50%;
  animation: typing 900ms infinite ease-in-out;
}

.typing i:nth-child(2) {
  animation-delay: 120ms;
}

.typing i:nth-child(3) {
  animation-delay: 240ms;
}

.quick-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  padding: 0 30px 20px;
}

.quick-prompts button {
  padding: 9px 13px;
  color: #5e625a;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease;
}

.quick-prompts button:hover,
.quick-prompts button:focus-visible {
  color: var(--green-deep);
  background: #eef5e4;
  border-color: #c5d8aa;
}

.composer {
  padding: 0 30px 21px;
}

.input-wrap {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  padding: 13px 13px 13px 18px;
  background: var(--white);
  border: 1px solid #cec8bb;
  border-radius: 18px;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.input-wrap:focus-within {
  border-color: #9ab96b;
  box-shadow: 0 0 0 4px rgba(184, 216, 135, 0.18);
}

textarea {
  width: 100%;
  min-height: 24px;
  max-height: 105px;
  resize: none;
  padding: 3px 0;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 16px;
  line-height: 1.55;
}

textarea::placeholder {
  color: #a1a096;
}

.send-button {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--green-deep);
  background: var(--green);
  border: 0;
  border-radius: 11px;
  transition: transform 160ms ease, background 160ms ease, opacity 160ms ease;
}

.send-button:hover:not(:disabled),
.send-button:focus-visible:not(:disabled) {
  background: #a7cb70;
  transform: translateY(-1px);
}

.send-button:disabled,
.quick-prompts button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.send-button svg {
  width: 20px;
  height: 20px;
}

.composer-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 2px 0;
  color: #a0a096;
  font-size: 11px;
}

.chat-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 17px 30px 22px;
  font-size: 12px;
  border-top: 1px solid rgba(222, 217, 206, 0.7);
}

.chat-footer > span:first-child {
  max-width: none;
  line-height: 1.4;
}

.site-footer {
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.site-footer a {
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

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

@keyframes pulse {
  0%,
  100% { opacity: 1; }
  50% { opacity: 0.45; }
}

@keyframes typing {
  0%,
  60%,
  100% { transform: translateY(0); opacity: 0.45; }
  30% { transform: translateY(-3px); opacity: 1; }
}

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

@media (max-width: 820px) {
  .main-grid {
    grid-template-columns: 1fr;
    gap: 46px;
    padding-top: 28px;
  }

  .intro {
    max-width: 620px;
  }

  h1 {
    max-width: 560px;
    font-size: clamp(47px, 11vw, 73px);
  }

  .intro-copy {
    margin-bottom: 30px;
  }

  .chat-card {
    max-width: none;
    min-height: 720px;
    justify-self: stretch;
  }
}

@media (max-width: 520px) {
  .page-shell {
    width: min(100% - 28px, 440px);
    padding-top: 20px;
  }

  .site-header {
    padding-bottom: 17px;
  }

  .header-note {
    display: none;
  }

  .main-grid {
    gap: 32px;
    padding: 22px 0 42px;
  }

  .eyebrow {
    margin-bottom: 20px;
  }

  h1 {
    margin-bottom: 17px;
    font-size: clamp(44px, 14vw, 64px);
  }

  .intro-copy {
    margin-bottom: 28px;
    font-size: 14px;
  }

  .chat-card {
    min-height: 680px;
    border-radius: 20px;
  }

  .chat-header,
  .connection-status,
  .messages,
  .quick-prompts,
  .composer,
  .chat-footer {
    padding-left: 17px;
    padding-right: 17px;
  }

  .messages {
    max-height: 400px;
  }

  .quick-prompts {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .quick-prompts::-webkit-scrollbar {
    display: none;
  }

  .quick-prompts button {
    white-space: nowrap;
  }

  .composer-meta span:last-child {
    display: none;
  }

  .chat-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 9px;
  }

  .chat-footer > span:first-child {
    max-width: none;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
  }
}

@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;
  }
}
