:root {
  --background: #ffffff;
  --foreground: #10213d;
  --surface: #ffffff;
  --surface-alt: #f7f9fb;
  --muted: #526071;
  --border: #e7ebf0;
  --primary: #142743;
  --lime: #358a38;
  --lime-soft: #e9f6ea;
  --shadow-sm: 0 1px 2px rgba(16, 33, 61, 0.06);
  --shadow-lg: 0 18px 56px rgba(16, 33, 61, 0.15);
  --display: "Space Grotesk", "Inter", system-ui, sans-serif;
  --body: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
}

html[data-theme="dark"] {
  --background: #071121;
  --foreground: #f4f7fb;
  --surface: #0d1a2c;
  --surface-alt: #081526;
  --muted: #a5b2c4;
  --border: #1f3047;
  --primary: #43c351;
  --lime: #43c351;
  --lime-soft: rgba(67, 195, 81, 0.14);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.28);
  --shadow-lg: 0 18px 56px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html {
  color: var(--foreground);
  background: var(--background);
  font-family: var(--body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(760px 420px at 88% -10%, rgba(53, 138, 56, 0.16), transparent 62%),
    var(--background);
}

button,
textarea {
  font: inherit;
}

.chat-section {
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(260px, 0.5fr) minmax(440px, 0.86fr);
  align-items: center;
  gap: clamp(28px, 5vw, 72px);
  padding: clamp(20px, 5vw, 72px);
}

.section-copy {
  max-width: 460px;
}

.section-copy__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

h1 {
  margin: 18px 0 0;
  font-family: var(--display);
  font-size: clamp(40px, 6vw, 76px);
  font-weight: 600;
  line-height: 0.96;
  letter-spacing: 0;
  text-wrap: balance;
}

.theme-toggle {
  flex: 0 0 auto;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 14px;
  color: var(--foreground);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.chat-shell {
  width: 100%;
  height: min(82dvh, 780px);
  min-height: 620px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 28px;
  background: var(--surface);
  color: var(--foreground);
  box-shadow: var(--shadow-lg);
}

.chat-shell__bar {
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 18px;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
  font-weight: 800;
}

.chat-shell__bar > div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-shell__tag {
  border-radius: 999px;
  padding: 5px 9px;
  color: var(--lime);
  background: var(--lime-soft);
  font-size: 11px;
  font-weight: 700;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 0 6px rgba(53, 138, 56, 0.16);
}

.chat-log {
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  background:
    radial-gradient(460px 260px at 90% 0%, rgba(53, 138, 56, 0.08), transparent 70%),
    var(--surface-alt);
}

.message {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  max-width: 100%;
}

.message--user {
  align-self: flex-end;
}

.message--assistant {
  align-self: flex-start;
}

.message__avatar {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #ffffff;
  background: linear-gradient(135deg, #142743, #358a38);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 800;
}

.message div {
  max-width: min(580px, calc(100vw - 100px));
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 12px 14px;
  color: var(--foreground);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.message--user div {
  color: #ffffff;
  border-color: transparent;
  background: #142743;
}

html[data-theme="dark"] .message--user div {
  color: #071121;
  background: var(--lime);
}

.message p {
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
}

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.composer textarea {
  width: 100%;
  min-height: 48px;
  max-height: 120px;
  resize: none;
  border: 1px solid var(--border);
  border-radius: 16px;
  outline: none;
  padding: 13px 14px;
  color: var(--foreground);
  background: var(--surface-alt);
}

.composer textarea::placeholder {
  color: var(--muted);
}

.composer textarea:focus {
  border-color: rgba(53, 138, 56, 0.72);
  box-shadow: 0 0 0 4px rgba(53, 138, 56, 0.14);
}

.composer button {
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 16px;
  color: #ffffff;
  background: var(--lime);
  cursor: pointer;
}

html[data-theme="dark"] .composer button {
  color: #071121;
}

.composer button:disabled {
  opacity: 0.55;
  cursor: progress;
}

.composer svg {
  width: 20px;
  height: 20px;
}

.composer path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

.not-found main {
  width: min(100%, 680px);
  min-height: 100vh;
  display: grid;
  align-content: center;
  gap: 14px;
  margin: 0 auto;
  padding: 32px;
}

@media (max-width: 920px) {
  .chat-section {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .section-copy {
    max-width: none;
  }

  .chat-shell {
    height: 72dvh;
    min-height: 560px;
  }
}

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

  .section-copy__top {
    align-items: flex-start;
    flex-direction: column;
  }

  .chat-shell {
    min-height: 540px;
    border-radius: 22px;
  }
}

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