:root {
  color-scheme: dark;
  --bg-0: #020306;
  --bg-1: #060a10;
  --surface: rgba(8, 12, 18, 0.62);
  --surface-strong: rgba(12, 17, 26, 0.84);
  --surface-soft: rgba(255, 255, 255, 0.04);
  --border: rgba(201, 213, 225, 0.16);
  --border-strong: rgba(201, 213, 225, 0.25);
  --text: #eef2f7;
  --muted: rgba(223, 230, 239, 0.62);
  --muted-strong: rgba(223, 230, 239, 0.78);
  --accent: #b8d4ff;
  --accent-soft: rgba(184, 212, 255, 0.12);
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: Inter, "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(40, 59, 93, 0.22), transparent 36%),
    radial-gradient(circle at bottom, rgba(25, 33, 49, 0.18), transparent 40%),
    linear-gradient(180deg, var(--bg-1), var(--bg-0));
  overflow: hidden;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at center, transparent 36%, rgba(0, 0, 0, 0.22) 100%);
  pointer-events: none;
  z-index: 1;
}

.starfield {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

.page-shell {
  position: relative;
  z-index: 2;
  min-height: 100dvh;
  padding: 40px 20px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
}

.hero {
  width: min(92vw, 860px);
  text-align: center;
}

.hero-subtitle {
  margin: 0 0 8px;
  font-size: 0.72rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--muted);
}

.hero-title {
  margin: 0;
  font-size: clamp(3rem, 8vw, 4.8rem);
  line-height: 0.92;
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  font-weight: 600;
}

.hero-copy {
  width: min(92%, 600px);
  margin: 14px auto 0;
  font-size: clamp(0.98rem, 1.8vw, 1.08rem);
  line-height: 1.7;
  color: var(--muted);
}

.chat-shell {
  width: min(92vw, 860px);
  height: min(76vh, 760px);
  min-height: 540px;
  display: grid;
  grid-template-rows: auto auto 1fr auto auto;
  border: 1px solid var(--border);
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 12%),
    var(--surface);
  backdrop-filter: blur(20px) saturate(120%);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.chat-shell__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 24px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.chat-shell__eyebrow {
  margin: 0 0 4px;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.chat-shell__header h2 {
  margin: 0;
  font-size: clamp(1.4rem, 3vw, 1.8rem);
  font-weight: 600;
}

.chat-shell__notice {
  margin: 0;
  padding: 12px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.025);
  color: rgba(223, 230, 239, 0.56);
  font-size: 0.82rem;
  line-height: 1.5;
}

.status-pill {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(184, 212, 255, 0.16);
  background: rgba(184, 212, 255, 0.08);
  color: var(--muted-strong);
  font-size: 0.84rem;
}

.status-pill[data-mode="memory"] {
  border-color: rgba(184, 212, 255, 0.22);
  background: rgba(184, 212, 255, 0.1);
}

.status-pill[data-mode="local-preview"] {
  border-color: rgba(215, 226, 245, 0.14);
  background: rgba(255, 255, 255, 0.06);
}

.status-pill[data-mode="error"] {
  border-color: rgba(255, 214, 168, 0.22);
  background: rgba(255, 214, 168, 0.08);
}

.status-pill__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 18px rgba(184, 212, 255, 0.8);
}

.status-pill[data-mode="local-preview"] .status-pill__dot {
  background: rgba(223, 230, 239, 0.85);
  box-shadow: 0 0 12px rgba(223, 230, 239, 0.5);
}

.status-pill[data-mode="error"] .status-pill__dot {
  background: #ffd9a8;
  box-shadow: 0 0 14px rgba(255, 217, 168, 0.6);
}

.messages {
  padding: 22px 24px 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

.message {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(88%, 640px);
  animation: message-in 320ms ease;
}

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

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

.message__meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(223, 230, 239, 0.5);
}

.message__bubble {
  padding: 15px 18px;
  border-radius: 16px;
  line-height: 1.65;
  font-size: 0.98rem;
}

.message--assistant .message__bubble {
  background:
    linear-gradient(180deg, rgba(184, 212, 255, 0.08), rgba(255, 255, 255, 0.04)),
    rgba(16, 23, 33, 0.92);
  border: 1px solid rgba(184, 212, 255, 0.11);
}

.message--user .message__bubble {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.04)),
    rgba(25, 31, 41, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.starter-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px 24px 18px;
}

.prompt-chip {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted-strong);
  padding: 10px 14px;
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  transition:
    border-color 160ms ease,
    background-color 160ms ease,
    transform 160ms ease;
}

.prompt-chip:hover,
.prompt-chip:focus-visible {
  border-color: rgba(184, 212, 255, 0.28);
  background: rgba(184, 212, 255, 0.08);
  transform: translateY(-1px);
  outline: none;
}

.composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  padding: 18px 24px 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: linear-gradient(180deg, transparent, rgba(3, 5, 8, 0.2));
}

.composer__input {
  resize: none;
  min-height: 56px;
  max-height: 168px;
  width: 100%;
  padding: 16px 18px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: var(--surface-strong);
  color: var(--text);
  font: inherit;
  line-height: 1.5;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background-color 160ms ease;
}

.composer__input::placeholder {
  color: rgba(223, 230, 239, 0.42);
}

.composer__input:focus {
  outline: none;
  border-color: rgba(184, 212, 255, 0.28);
  background: rgba(14, 20, 28, 0.94);
  box-shadow: 0 0 0 4px rgba(184, 212, 255, 0.08);
}

.composer__send {
  width: 56px;
  height: 56px;
  border: 1px solid rgba(184, 212, 255, 0.2);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(184, 212, 255, 0.22), rgba(184, 212, 255, 0.08)),
    rgba(15, 20, 27, 0.9);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.composer__send:hover,
.composer__send:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(184, 212, 255, 0.34);
  box-shadow: 0 10px 32px rgba(90, 120, 170, 0.2);
  outline: none;
}

.composer__send:disabled {
  opacity: 0.55;
  cursor: wait;
  transform: none;
  box-shadow: none;
}

.composer__send svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

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

.typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(223, 230, 239, 0.55);
  animation: pulse 1.1s infinite ease-in-out;
}

.typing span:nth-child(2) {
  animation-delay: 0.16s;
}

.typing span:nth-child(3) {
  animation-delay: 0.32s;
}

.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 message-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%,
  80%,
  100% {
    opacity: 0.35;
    transform: scale(0.92);
  }

  40% {
    opacity: 1;
    transform: scale(1);
  }
}

@media (max-width: 720px) {
  body {
    overflow: auto;
  }

  .page-shell {
    justify-content: flex-start;
    padding-top: 28px;
    padding-bottom: 20px;
  }

  .hero {
    width: min(100%, 760px);
  }

  .hero-copy {
    width: min(100%, 540px);
    font-size: 0.96rem;
    line-height: 1.6;
  }

  .chat-shell {
    width: min(100%, 760px);
    min-height: 72dvh;
    height: auto;
  }

  .chat-shell__header {
    align-items: flex-start;
    flex-direction: column;
  }

  .messages,
  .chat-shell__notice,
  .starter-prompts,
  .composer {
    padding-left: 18px;
    padding-right: 18px;
  }

  .composer {
    grid-template-columns: 1fr;
  }

  .composer__send {
    width: 100%;
  }

  .message {
    max-width: 100%;
  }
}
