:root {
  color-scheme: light;
  --bg: #f6f7fb;
  --panel: #ffffff;
  --thread: #f8fafc;
  --text: #0f172a;
  --muted: #475569;
  --line: #dce3ee;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --assistant: #eef2f7;
  --user: #2563eb;
  --ok: #166534;
  --err: #991b1b;
  --radius-lg: 16px;
  --radius-md: 12px;
  --shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100dvh;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top right, #edf4ff 0%, #f4f7fc 45%, var(--bg) 100%);
  line-height: 1.45;
}

a {
  color: inherit;
}

button,
input,
textarea {
  font: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid #e2e8f0;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
}

.site-header-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.brand {
  text-decoration: none;
  font-size: 1.08rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.header-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.brand-meta {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.creator-link {
  color: var(--accent);
  font-weight: 700;
}

.free-pill {
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1e3a8a;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.76rem;
  font-weight: 700;
  white-space: nowrap;
}

.app-shell {
  max-width: 1160px;
  margin: 0 auto;
  padding: 12px;
  display: grid;
  gap: 12px;
  align-items: start;
}

.chat-panel,
.card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.chat-panel {
  display: grid;
  grid-template-rows: auto auto minmax(280px, 1fr) auto auto auto;
  overflow: hidden;
  min-height: 72dvh;
}

.chat-header {
  padding: 14px 14px 12px;
  border-bottom: 1px solid var(--line);
}

.chat-header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(1.3rem, 4.8vw, 1.92rem);
  line-height: 1.14;
  letter-spacing: -0.01em;
}

.chat-subtitle {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.93rem;
}

.ghost-button {
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #334155;
  border-radius: 10px;
  min-height: 36px;
  padding: 0 12px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.ghost-button:hover {
  background: #f8fafc;
}

.prompt-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  scrollbar-width: thin;
}

.prompt-chip {
  border: 1px solid #d4def3;
  background: #f8fbff;
  color: #1f3b86;
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 0.81rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.prompt-chip:hover {
  background: #eef5ff;
}

.chat-thread {
  padding: 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--thread);
}

.message-row {
  display: flex;
}

.message-row.assistant {
  justify-content: flex-start;
}

.message-row.user {
  justify-content: flex-end;
}

.message-bubble {
  max-width: min(92%, 760px);
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 0.94rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

.message-row.assistant .message-bubble {
  background: var(--assistant);
  border: 1px solid #dbe4f1;
}

.message-row.user .message-bubble {
  background: var(--user);
  color: #fff;
}

.message-row.typing .message-bubble {
  color: #475569;
  font-style: italic;
}

.chat-composer {
  border-top: 1px solid var(--line);
  padding: 10px 12px 12px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: end;
  background: #fff;
}

#chat-input {
  width: 100%;
  min-height: 44px;
  max-height: 180px;
  border: 1px solid #c6d4e7;
  border-radius: var(--radius-md);
  background: #fff;
  color: inherit;
  padding: 10px 12px;
  resize: none;
}

#chat-input:focus {
  outline: 2px solid rgba(37, 99, 235, 0.22);
  border-color: #3b82f6;
}

.primary-button {
  border: 0;
  border-radius: var(--radius-md);
  min-height: 44px;
  padding: 0 14px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

#chat-send-button {
  min-width: 74px;
}

.primary-button:hover:enabled {
  background: var(--accent-hover);
}

.primary-button:disabled {
  opacity: 0.72;
  cursor: wait;
}

.chat-status {
  margin: 8px 14px 0;
  min-height: 1.2em;
  color: var(--muted);
  font-size: 0.86rem;
}

.chat-disclaimer {
  margin: 4px 14px 12px;
  color: #64748b;
  font-size: 0.8rem;
}

.side-panel {
  display: grid;
  gap: 12px;
}

.card {
  padding: 14px;
}

.panel-title {
  margin: 0;
  font-size: 1.01rem;
  line-height: 1.25;
}

.panel-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.87rem;
}

.species-list {
  margin: 10px 0 0;
  padding-left: 18px;
  color: var(--muted);
}

.species-list li + li {
  margin-top: 5px;
}

.form-intro {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

#waitlist-form {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

#waitlist-form label {
  margin-top: 5px;
  font-size: 0.86rem;
  font-weight: 700;
}

#waitlist-form input {
  width: 100%;
  min-height: 42px;
  border: 1px solid #c5d4e8;
  border-radius: 10px;
  background: #fff;
  color: inherit;
  padding: 10px 11px;
}

#waitlist-form input:focus {
  outline: 2px solid rgba(37, 99, 235, 0.2);
  border-color: #3b82f6;
}

#submit-button {
  margin-top: 8px;
  width: 100%;
}

#form-message {
  margin: 7px 0 0;
  min-height: 1.2em;
  font-size: 0.88rem;
}

#form-message.success {
  color: var(--ok);
}

#form-message.error {
  color: var(--err);
}

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

@media (min-width: 940px) {
  .site-header-inner {
    padding-left: 18px;
    padding-right: 18px;
  }

  .app-shell {
    grid-template-columns: minmax(0, 1fr) 332px;
    padding: 14px 18px 18px;
  }

  .chat-panel {
    min-height: calc(100dvh - 92px);
  }

  .chat-thread {
    min-height: calc(100dvh - 354px);
  }

  .side-panel {
    position: sticky;
    top: 70px;
  }

  .message-bubble {
    max-width: min(84%, 720px);
  }
}

@media (max-width: 640px) {
  .site-header-inner {
    align-items: flex-start;
    flex-direction: column;
  }

  .header-right {
    justify-content: flex-start;
  }

  .chat-header-top {
    flex-direction: column;
    align-items: stretch;
  }

  #chat-input,
  #waitlist-form input {
    font-size: 16px;
  }

  .chat-panel {
    min-height: 68dvh;
  }
}
