:root {
  --ink: #12160f;
  --paper: #f2f4ee;
  --pine: #1a4735;
  --pine-deep: #0f2f23;
  --pine-ink: #f4f8f4;
  --muted: #5c6558;
  --line: rgba(18, 22, 15, 0.12);
  --display: "Newsreader", Georgia, serif;
  --sans: "Sora", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

.field-bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(900px 520px at 92% -8%, rgba(26, 71, 53, 0.2), transparent 60%),
    radial-gradient(700px 480px at -5% 110%, rgba(92, 74, 56, 0.1), transparent 55%),
    linear-gradient(155deg, #e9ede3 0%, var(--paper) 45%, #dde5d6 100%);
}
.grain {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.45'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

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

.shell {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.35rem clamp(1.5rem, 5vw, 3.5rem);
  animation: rise 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.brand {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.35rem;
  letter-spacing: -0.03em;
  color: var(--ink);
  text-decoration: none;
}
.top nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1.25rem;
  align-items: center;
  justify-content: flex-end;
}
.top nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
}
.top nav a:hover { color: var(--ink); }
.top nav a.cta {
  color: var(--pine-ink);
  background: var(--pine);
  padding: 0.5rem 0.95rem;
  border-radius: 2px;
}

.land {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: center;
  padding: clamp(1.5rem, 4vh, 2.5rem) clamp(1.5rem, 5vw, 3.5rem) clamp(2rem, 5vh, 3rem);
  animation: rise 0.85s 0.05s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.land-copy { max-width: 34rem; }
.land .name {
  font-family: var(--display);
  font-size: clamp(3.8rem, 11vw, 7.2rem);
  font-weight: 600;
  letter-spacing: -0.05em;
  line-height: 0.88;
  margin: 0 0 1.15rem;
}
.land .line {
  font-family: var(--display);
  font-size: clamp(1.35rem, 2.6vw, 1.75rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin: 0 0 0.85rem;
  max-width: 16ch;
}
.land .note {
  margin: 0 0 1.75rem;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.55;
  max-width: 30rem;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  align-items: center;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.82rem 1.25rem;
  border-radius: 2px;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.92rem;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), background 0.2s;
}
.btn:hover { transform: translateY(-2px); }
.btn-fill { background: var(--pine); color: var(--pine-ink); }
.btn-fill:hover { background: var(--pine-deep); }
.btn-line {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.stage {
  position: relative;
  min-height: 22rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background:
    linear-gradient(160deg, rgba(255,255,255,0.55), rgba(255,255,255,0.18));
  padding: 1.25rem 1.35rem;
  overflow: hidden;
  animation: rise 1s 0.12s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.stage::before {
  content: "";
  position: absolute;
  inset: auto -20% -40% 30%;
  height: 80%;
  background: radial-gradient(circle, rgba(26, 71, 53, 0.18), transparent 65%);
  pointer-events: none;
}
.stage-label {
  position: relative;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--pine);
  margin: 0 0 0.85rem;
}
.term {
  position: relative;
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.55;
  color: #dce6d8;
  background: #141810;
  border-radius: 3px;
  padding: 1rem 1.1rem;
  min-height: 14rem;
  white-space: pre-wrap;
}
.term .dim { color: #7f8a78; }
.term .ok { color: #7dcea0; }

.foot-bar {
  padding: 0.95rem clamp(1.5rem, 5vw, 3.5rem) 1.35rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.78rem;
}
.foot-bar a { color: inherit; }

/* Connect */
.connect-shell .land {
  grid-template-columns: 1fr;
  padding-bottom: 0.5rem;
  flex: 0;
}
.connect-shell .land .name {
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  margin-bottom: 0.45rem;
}
.connect-shell .land .line {
  font-size: clamp(1.15rem, 2vw, 1.4rem);
  max-width: 24ch;
}
.live {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1.1rem;
  margin-top: 1rem;
  font-size: 0.82rem;
  color: var(--muted);
}
.live b { color: var(--pine); font-weight: 600; }
.live b.bad { color: #8a3b12; }

.flow {
  width: min(40rem, 100%);
  margin: 0 auto;
  padding: 0 clamp(1.5rem, 5vw, 3.5rem) 3.5rem;
}
.step {
  padding: 1.5rem 0;
  border-top: 1px solid var(--line);
  animation: rise 0.65s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.step-num {
  margin: 0 0 0.35rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--pine);
}
.step h2 {
  font-family: var(--display);
  font-size: 1.4rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin: 0 0 0.3rem;
}
.step .hint {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}
.field { margin-bottom: 0.7rem; }
.field label {
  display: block;
  margin-bottom: 0.3rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.field input,
.field select {
  width: 100%;
  padding: 0.72rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.55);
  font: inherit;
  color: var(--ink);
}
.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.msg {
  margin: 0.6rem 0 0;
  min-height: 1.15em;
  font-size: 0.86rem;
  color: var(--pine);
}
.msg.err { color: #8a3b12; }
.list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 15rem;
  overflow: auto;
}
.list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.88rem;
}
.list code { font-family: var(--mono); font-size: 0.78rem; }
.list button {
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 2px;
  padding: 0.35rem 0.65rem;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}
.list button:hover { border-color: var(--pine); color: var(--pine); }
.tag {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.tag.on { color: var(--pine); }
.split-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.chat-box { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chat-box input { flex: 1 1 12rem; }
.chat-out {
  margin: 0.8rem 0 0;
  padding: 1rem 1.05rem;
  background: #141810;
  color: #e4ece0;
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.45;
  border-radius: 3px;
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 4.2rem;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0 0 0.5rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 0.5rem;
}
.tab {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.5rem 0.85rem;
  border-radius: 2px;
  cursor: pointer;
}
.tab:hover { color: var(--ink); }
.tab.active {
  color: var(--pine-ink);
  background: var(--pine);
}
.chip-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 0.45rem;
}
.chip-grid li {
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.4);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.chip-grid strong {
  font-size: 0.88rem;
  font-weight: 600;
}
.chip-grid span {
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.35;
}
.stat-row {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1.1rem;
  font-size: 0.9rem;
  color: var(--muted);
}
.stat-row b { color: var(--ink); }
.repo-card {
  padding: 1.25rem 0;
  border-top: 1px solid var(--line);
}
.repo-card.archived { opacity: 0.78; }
.stack-flow { max-width: 52rem; }
.stack-flow .hint a { color: var(--pine); }

/* Marketplace (bot templates) */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
.market-shell .market-hero {
  padding-bottom: 0;
}
.market-shell .market-title {
  font-size: clamp(2.8rem, 8vw, 4.5rem);
  margin-bottom: 0;
}
.market-chrome {
  padding: 0 clamp(1.5rem, 5vw, 3.5rem) 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 64rem;
  width: 100%;
  margin: 0 auto;
}
.market-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.85rem;
  align-items: center;
}
.market-cats a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  padding: 0.35rem 0;
  border-bottom: 2px solid transparent;
}
.market-cats a:hover { color: var(--ink); }
.market-cats a.is-on {
  color: var(--pine);
  border-bottom-color: var(--pine);
}
.market-search {
  max-width: 28rem;
  margin: 0;
}
.market-search input {
  width: 100%;
  padding: 0.72rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.55);
  font: inherit;
  color: var(--ink);
}
.market-body {
  width: min(64rem, 100%);
  margin: 0 auto;
  padding: 0 clamp(1.5rem, 5vw, 3.5rem) 3.5rem;
}
.market-section {
  padding: 1.75rem 0 0.5rem;
  border-top: 1px solid var(--line);
  animation: rise 0.65s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.market-sec-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.market-sec-head h2 {
  font-family: var(--display);
  font-size: 1.45rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin: 0;
}
.view-all {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--pine);
  text-decoration: none;
}
.view-all:hover { text-decoration: underline; }
.feat-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}
.feat-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1.1rem 1rem;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.45);
  text-decoration: none;
  color: inherit;
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s;
}
.feat-card:hover {
  transform: translateY(-2px);
  border-color: var(--pine);
}
.feat-name {
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 500;
  letter-spacing: -0.02em;
}
.feat-by {
  font-size: 0.82rem;
  color: var(--muted);
}
.bot-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
.bot-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.15rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.4);
}
.bot-name {
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin: 0 0 0.4rem;
  line-height: 1.25;
}
.bot-by {
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
}
.bot-desc {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--muted);
}
.bot-add {
  align-self: flex-start;
  padding: 0.55rem 1rem;
  font-size: 0.82rem;
}

@media (max-width: 860px) {
  .land { grid-template-columns: 1fr; }
  .stage { min-height: 16rem; order: -1; }
  .feat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bot-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .split-2 { grid-template-columns: 1fr; }
  .top nav a:not(.cta):not([href*="marketplace"]) { display: none; }
  .feat-row { grid-template-columns: 1fr 1fr; }
}
