:root {
  --paper: #f3efe6;
  --surface: #fffcf6;
  --ink: #1c1914;
  --muted: #6b645a;
  --line: #e4ddd0;
  --accent: #0c5f56;
  --accent-2: #d7efe8;
  --danger: #8b2e2e;
  --shadow: 0 1px 0 rgba(28, 25, 20, 0.04);
  --serif: "Fraunces", "Times New Roman", serif;
  --sans: "IBM Plex Sans", "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.top {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.4rem 1.2rem;
  align-items: baseline;
  padding: 1.1rem 2rem 1rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 5;
}
.brand {
  font-family: var(--serif);
  font-size: 1.45rem;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.brand-sub { margin: 0; color: var(--muted); font-size: 0.82rem; }
.top nav { display: flex; gap: 1.1rem; font-size: 0.92rem; }
.top nav a[aria-current="page"] { color: var(--ink); font-weight: 600; text-decoration: none; border-bottom: 2px solid var(--accent); }
main { max-width: 1080px; margin: 0 auto; padding: 2.4rem 1.5rem 4rem; }
.hero h1, .slide h2 {
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin: 0.2rem 0 0.8rem;
}
.hero h1 { font-size: clamp(2rem, 4.5vw, 3.1rem); max-width: 18ch; }
.hero.tight h1 { font-size: clamp(1.6rem, 3vw, 2.3rem); }
.kicker { text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.72rem; color: var(--muted); margin: 0 0 0.6rem; }
.lede { font-size: 1.12rem; color: #3f3a34; max-width: 46rem; }
.lede em { font-family: var(--serif); }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem; margin: 2.4rem 0; }
.split article, .slide, .pin-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.3rem 1.4rem;
  box-shadow: var(--shadow);
}
.split h2, .slide h2 { font-size: 1.35rem; }
.plain { margin: 0; padding-left: 1.1rem; }
.plain li { margin: 0.45rem 0; }
.loop { display: grid; gap: 0.6rem; padding: 0; list-style: none; }
.loop li {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.85rem 1rem;
}
.cta-row { display: flex; gap: 0.8rem; margin-top: 2rem; flex-wrap: wrap; }
.btn {
  display: inline-flex;
  align-items: center;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 999px;
  padding: 0.65rem 1.15rem;
  font: 600 0.95rem var(--sans);
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { text-decoration: none; filter: brightness(1.05); }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.shot { margin: 1.4rem 0; }
.shot img {
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--line);
  display: block;
  background: var(--surface);
}
.toc {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 1.2rem 0 2rem;
  position: sticky;
  top: 4.2rem;
  background: color-mix(in srgb, var(--paper) 92%, white);
  padding: 0.4rem 0;
  z-index: 4;
}
.toc a {
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font-size: 0.78rem;
  text-decoration: none;
  background: var(--surface);
}
.toc a.skip { opacity: 0.4; }
.slide { margin: 0 0 1.1rem; }
.detail { margin: 0 0 0.7rem; }
.chip {
  display: inline-block;
  border: 1px solid var(--line);
  background: var(--accent-2);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: none;
  margin: 0.15rem 0.15rem 0 0;
}
.chip:hover { text-decoration: none; border-color: var(--accent); }
.chip.danger { background: #f6e4e0; }
.pin-form { display: grid; gap: 0.45rem; max-width: 16rem; }
.pin-form input {
  font: 1.15rem var(--sans);
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.err { color: var(--danger); }
.chat-shell {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 1.2rem;
  height: calc(100vh - 9.5rem);
  min-height: 26rem;
  align-items: stretch;
}
.chat-main {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}
.transcript-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.btn.small { padding: 0.35rem 0.8rem; font-size: 0.82rem; }
.new-chat {
  position: absolute;
  top: 0.7rem;
  right: 0.85rem;
  z-index: 2;
}
.transcript {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 2.8rem 1.1rem 1.1rem;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  scroll-behavior: smooth;
}
.bubble {
  max-width: 42rem;
  padding: 0.8rem 0.95rem;
  border-radius: 14px;
  border: 1px solid var(--line);
}
.bubble p { margin: 0; }
.bubble .reply { white-space: pre-line; font-size: 1.02rem; line-height: 1.6; }
.bubble.user {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.bubble.bot { background: #fff; }
.gates { display: flex; flex-wrap: wrap; gap: 0.3rem; margin: 0.55rem 0 0.2rem; }
.gate {
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 6px;
  padding: 0.18rem 0.4rem;
  background: var(--paper);
  color: var(--muted);
}
.think {
  margin-top: 0.55rem;
  border-top: 1px solid var(--line);
  padding-top: 0.4rem;
  color: var(--muted);
  font-size: 0.84rem;
}
.think summary { cursor: pointer; font-weight: 600; color: #4a453e; }
.live-tag {
  display: inline-block;
  font-weight: 600;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-2);
  border-radius: 999px;
  padding: 0.1rem 0.45rem;
  margin-left: 0.4rem;
}
.think pre {
  white-space: pre-wrap;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 0.78rem;
  margin: 0.4rem 0 0;
}
.rail {
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0.9rem 1rem;
}
.rail-toggle > summary {
  cursor: pointer;
  list-style: none;
}
.rail-toggle > summary::-webkit-details-marker { display: none; }
.rail-body { margin-top: 0.3rem; }
.rail-kicker, .rail-group {
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0.6rem 0 0.35rem;
}
.rail-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.3rem;
}
.rail-row .chip { margin: 0; }
.composer {
  flex-shrink: 0;
  display: flex;
  gap: 0.6rem;
  padding: 0.9rem 0 0;
  background: var(--paper);
}
.composer input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.7rem 1rem;
  font: 1rem var(--sans);
  background: #fff;
}
.foot { padding: 1rem 2rem 2rem; color: var(--muted); font-size: 0.82rem; }
.sr { position: absolute; left: -9999px; }
.waiting { color: var(--accent); font-weight: 500; }
.bubble.pending .reply { color: var(--muted); }
.thinking-dots span {
  display: inline-block;
  animation: thinkPulse 1.2s ease-in-out infinite;
  opacity: 0.2;
}
.thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes thinkPulse {
  0%, 80%, 100% { opacity: 0.2; }
  40% { opacity: 1; }
}
@media (max-width: 860px) {
  .top { grid-template-columns: 1fr; }
  .split { grid-template-columns: 1fr; }
  .hero h1 { max-width: none; }
  .chat-shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 0;
  }
  .chat-main { height: 62vh; }
  .rail { height: auto; max-height: 40vh; }
}
