:root {
  --bg: #0f1f1b;
  --panel: #162a24;
  --ink-deep: #0c1814;
  --cream: #fffcf0;
  --ink: #e8f2ee;
  --muted: #8fafa5;
  --coral: #ff6060;
  --coral-soft: #ff8a8a;
  --line: rgba(255, 252, 240, 0.1);
  --serif: "Gelasio", "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
  --sans: "IBM Plex Sans", "Avenir Next", "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(1200px 600px at 70% -10%, #243f36, var(--bg));
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(255, 96, 96, 0.35); color: white; }

a { color: var(--coral-soft); }

.skip {
  position: absolute;
  left: 12px;
  top: 12px;
  transform: translateY(-150%);
  background: var(--coral);
  color: white;
  text-decoration: none;
  font-weight: 700;
  padding: 8px 12px;
  border-radius: 8px;
  z-index: 5;
}

.skip:focus { transform: none; }

.shell {
  max-width: 820px;
  margin: 0 auto;
  padding: 28px 20px 64px;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 36px;
}

.brand {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--cream);
  text-decoration: none;
  white-space: nowrap;
}

.brand span { color: var(--coral); }

.nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.nav a,
.chips a {
  text-decoration: none;
  font-weight: 600;
}

.nav a {
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  color: var(--muted);
}

.nav a:hover,
.nav a.on {
  color: var(--cream);
  border-color: var(--coral);
  background: rgba(255, 96, 96, 0.12);
}

.hero h1 {
  margin: 0 0 10px;
  font-family: var(--serif);
  font-size: clamp(34px, 5vw, 48px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.08;
  color: var(--cream);
}

.hero p {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 15px;
  max-width: 52ch;
}

.noscript {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 14px;
}

.prompt {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
}

.prompt-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  background: var(--ink-deep);
  border-radius: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
}

.prompt-bar:focus-within { border-color: rgba(255, 96, 96, 0.55); }

.cursor {
  width: 8px;
  height: 18px;
  background: var(--coral);
  border-radius: 1px;
  flex: none;
  animation: blink 1s step-end infinite;
}

@keyframes blink { 50% { opacity: 0; } }

.prompt-bar input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  color: var(--cream);
  font: inherit;
  font-size: 16px;
  outline: none;
}

.prompt-bar input::placeholder { color: #6e8e84; }

.prompt-bar button {
  flex: none;
  background: var(--coral);
  color: white;
  border: 0;
  border-radius: 8px;
  padding: 8px 14px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.prompt-bar button:hover { background: #ff4d4d; }

.prompt-bar button:disabled { opacity: 0.6; cursor: progress; }

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

.chips a {
  font-size: 13px;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 252, 240, 0.03);
  color: var(--ink);
}

.chips a:hover,
.chips a.on {
  border-color: var(--coral);
  background: rgba(255, 96, 96, 0.15);
}

.thread {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 280px;
}

.msg {
  max-width: 92%;
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 14.5px;
  line-height: 1.55;
  overflow-wrap: break-word;
  animation: rise 0.25s ease;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.msg.user {
  align-self: flex-end;
  background: rgba(255, 96, 96, 0.18);
  border: 1px solid rgba(255, 96, 96, 0.35);
}

.msg.bot {
  align-self: flex-start;
  max-width: min(100%, 640px);
  background: rgba(255, 252, 240, 0.05);
  border: 1px solid var(--line);
}

.msg.bot:has(ul),
.msg.bot:has(.cards) {
  align-self: stretch;
  max-width: none;
}

.msg .who {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 6px;
}

.msg p { margin: 0; }

.msg p + p,
.msg ul,
.msg ul + p,
.msg .cards,
.msg .more,
.msg .via { margin-top: 10px; }

.msg ul { margin-bottom: 0; padding-left: 18px; }

.msg li { margin: 4px 0; }

.msg strong { color: var(--cream); font-weight: 600; }

.via {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}

.cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(12, 24, 20, 0.55);
}

.card:hover {
  border-color: var(--coral);
  background: rgba(255, 96, 96, 0.08);
}

.card .tag {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--coral-soft);
}

.card .name {
  font-family: var(--serif);
  font-weight: 700;
  color: var(--cream);
  font-size: 17px;
  line-height: 1.25;
}

.card .host {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}

.card .blurb {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.45;
}

.more {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  font-size: 13px;
}

.foot {
  margin-top: 22px;
  font-size: 12px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  gap: 12px 20px;
  flex-wrap: wrap;
}

.foot a { color: var(--muted); }

:focus-visible {
  outline: 2px solid var(--coral);
  outline-offset: 2px;
}

.prompt-bar input:focus-visible { outline: none; }

@media (max-width: 720px) {
  .shell { padding: 18px 14px 48px; }
  .top { flex-direction: column; align-items: flex-start; gap: 12px; margin-bottom: 26px; }
  .nav { justify-content: flex-start; }
  .hero h1 { font-size: 34px; }
  .cards { grid-template-columns: 1fr; }
  .thread { min-height: 180px; }
  .msg.user { max-width: 100%; }
  .foot { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .msg { animation: none; }
  .cursor { animation: none; }
}
