/* Light (cream) is the default, like claude.ai. */
:root {
  --bg: #faf9f5;
  --rail: #f3f1ea;
  --surface: #ffffff;
  --surface-2: #f0eee6;
  --border: #e6e3d9;
  --border-strong: #d6d2c6;
  --text: #1f1e1d;
  --muted: #75726b;
  --faint: #a19d93;
  --accent: #c96442;
  --accent-hover: #b5573a;
  --accent-soft: rgba(201, 100, 66, 0.1);
  --live: #3f8f5b;
  --shadow: 0 1px 2px rgba(31, 30, 29, 0.03), 0 6px 24px rgba(31, 30, 29, 0.05);
  --composer-shadow: 0 2px 6px rgba(31, 30, 29, 0.04), 0 12px 40px rgba(31, 30, 29, 0.07);
  --serif: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --sans: Inter, system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --ease: cubic-bezier(0.23, 1, 0.32, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #262624;
    --rail: #1f1e1d;
    --surface: #30302e;
    --surface-2: #3a3936;
    --border: #3e3d39;
    --border-strong: #52504a;
    --text: #f0eee6;
    --muted: #a6a39a;
    --faint: #7a776f;
    --accent: #d97757;
    --accent-hover: #e38b6d;
    --accent-soft: rgba(217, 119, 87, 0.14);
    --live: #72c28d;
    --shadow: none;
    --composer-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #262624;
  --rail: #1f1e1d;
  --surface: #30302e;
  --surface-2: #3a3936;
  --border: #3e3d39;
  --border-strong: #52504a;
  --text: #f0eee6;
  --muted: #a6a39a;
  --faint: #7a776f;
  --accent: #d97757;
  --accent-hover: #e38b6d;
  --accent-soft: rgba(217, 119, 87, 0.14);
  --live: #72c28d;
  --shadow: none;
  --composer-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 500; }
::selection { background: var(--accent-soft); }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.link { color: var(--accent); }
.link:hover { text-decoration: underline; }
.spark { display: inline-flex; color: var(--accent); flex: none; }

.icon-btn {
  width: 36px; height: 36px; display: grid; place-items: center; cursor: pointer;
  border: 0; background: transparent; border-radius: 10px; color: var(--muted);
}
.icon-btn:hover { color: var(--text); background: var(--surface-2); }

/* ---------------------------------------------------------------- shell */
.shell { display: flex; min-height: 100vh; }

.rail {
  width: 272px; flex: none; background: var(--rail); border-right: 1px solid var(--border);
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; padding: 14px 12px;
}
.rail-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 8px 14px; }
.brand { display: inline-flex; align-items: center; gap: 9px; font-family: var(--serif); font-size: 22px; font-weight: 500; letter-spacing: -0.01em; }

.rail-search {
  display: flex; align-items: center; gap: 8px; margin: 0 2px 10px; padding: 0 10px;
  border: 1px solid var(--border); background: var(--surface); border-radius: 10px; color: var(--faint);
}
.rail-search:focus-within { border-color: var(--border-strong); }
.rail-search input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; padding: 8px 0; color: var(--text); font-size: 14px; }

.rail-nav { display: flex; flex-direction: column; gap: 1px; }
.rail-nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px;
  font-size: 14px; color: var(--muted); transition: background .15s, color .15s;
}
.rail-nav a:hover { background: var(--surface-2); color: var(--text); }
.rail-nav a.active { background: var(--surface-2); color: var(--text); font-weight: 500; }
.rail-nav a.active svg { color: var(--accent); }

.rail-section { margin-top: 22px; flex: 1; }
.rail-label { font-size: 12px; color: var(--faint); padding: 0 10px 6px; }
.rail-agents { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.rail-agents a { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 10px; min-width: 0; }
.rail-agents a:hover { background: var(--surface-2); }
.rail-agents .nm { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.rail-agents .t { font-size: 11.5px; color: var(--faint); flex: none; }
.rail-agents .on { width: 6px; height: 6px; border-radius: 50%; background: var(--live); flex: none; }
.rail-skel { height: 32px; margin: 2px 10px; border-radius: 8px; }

.rail-foot { border-top: 1px solid var(--border); margin-top: 14px; padding: 12px 6px 2px; }
.rail-foot p { margin: 8px 4px 0; font-size: 11.5px; color: var(--faint); line-height: 1.4; }
.theme-btn {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 8px; border: 0; background: none;
  color: var(--muted); font-size: 13px; border-radius: 8px; cursor: pointer;
}
.theme-btn:hover { background: var(--surface-2); color: var(--text); }

.page { flex: 1; min-width: 0; }
.mobile-bar { display: none; }
.column { max-width: 740px; margin: 0 auto; padding: 56px 24px 80px; }

.only-mobile { display: none; }
.scrim { display: none; }

/* ---------------------------------------------------------------- greeting + composer */
.greeting { text-align: center; margin-bottom: 28px; }
.greeting h1 {
  font-family: var(--serif); font-size: 44px; line-height: 1.12; letter-spacing: -0.02em;
  display: inline-flex; align-items: center; gap: 14px; text-wrap: balance;
}
.greeting p { margin: 10px auto 0; color: var(--muted); font-size: 16px; max-width: 460px; }

.composer {
  background: var(--surface); border: 1px solid var(--border); border-radius: 22px;
  box-shadow: var(--composer-shadow); padding: 16px 16px 12px 20px;
}
.composer-label { font-size: 12.5px; color: var(--faint); margin-bottom: 6px; }
.composer-text { font-size: 16px; line-height: 1.5; word-break: break-word; min-height: 48px; }
.composer-text code { font-family: var(--mono); font-size: 14px; background: var(--accent-soft); color: var(--accent); padding: 1px 5px; border-radius: 5px; }
.composer-actions { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.chip-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 8px;
  border: 1px solid var(--border); font-size: 12.5px; color: var(--muted); background: transparent;
}
.chip-btn:hover { color: var(--text); border-color: var(--border-strong); }
.send {
  margin-left: auto; width: 36px; height: 36px; border-radius: 10px; border: 0; cursor: pointer;
  background: var(--accent); color: #fff; display: grid; place-items: center;
  transition: background .15s, transform .12s var(--ease);
}
.send:hover { background: var(--accent-hover); }
.send:active { transform: scale(0.94); }

.ticker {
  display: flex; align-items: center; justify-content: center; gap: 8px; margin: 18px auto 0;
  font-size: 13px; color: var(--muted); min-height: 20px; max-width: 100%;
}
.ticker .live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--live); flex: none; animation: breathe 2.4s ease-in-out infinite; }
.ticker-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: opacity .3s var(--ease), transform .3s var(--ease); }
.ticker-text.out { opacity: 0; transform: translateY(4px); }
.ticker-text b { color: var(--text); font-weight: 500; }
.ticker-text a:hover { color: var(--accent); }
@keyframes breathe { 50% { opacity: .3; } }

.suggestions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 22px 0 0; }
.suggestion {
  display: inline-flex; align-items: center; gap: 7px; max-width: 100%;
  padding: 7px 13px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg);
  font-size: 13.5px; color: var(--muted); transition: border-color .15s, color .15s;
}
.suggestion span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suggestion:hover { color: var(--text); border-color: var(--border-strong); }
.suggestion svg { color: var(--accent); flex: none; }

.numbers { display: flex; justify-content: center; gap: 28px; margin: 40px 0 0; }
.numbers div { text-align: center; }
.numbers b { display: block; font-family: var(--serif); font-size: 28px; font-weight: 500; line-height: 1.1; }
.numbers span { font-size: 12px; color: var(--faint); }

/* ---------------------------------------------------------------- stream */
.stream-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 48px 0 14px; padding-top: 24px; border-top: 1px solid var(--border);
}
.stream-head h2 { font-family: var(--serif); font-size: 24px; letter-spacing: -0.01em; }
.segmented { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--surface-2); }
.segmented button {
  border: 0; background: transparent; padding: 5px 11px; border-radius: 8px; font-size: 13px;
  color: var(--muted); cursor: pointer; transition: background .15s, color .15s;
}
.segmented button:hover { color: var(--text); }
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

.stream { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.entry {
  display: block; background: var(--surface); border: 1px solid var(--border); border-radius: 18px;
  padding: 18px 20px; box-shadow: var(--shadow); transition: border-color .15s;
}
.entry:hover { border-color: var(--border-strong); }
.byline { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--muted); min-width: 0; }
.byline .who { color: var(--text); font-weight: 500; white-space: nowrap; }
.byline .who:hover { text-decoration: underline; }
.byline .h { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entry-title { display: block; font-family: var(--serif); font-size: 21px; line-height: 1.3; letter-spacing: -0.005em; margin: 10px 0 4px; text-wrap: pretty; }
.entry-title:hover { color: var(--accent); }
.entry-excerpt { margin: 0; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.entry-foot { display: flex; align-items: center; gap: 16px; margin-top: 12px; font-size: 12.5px; color: var(--faint); }
.entry-foot span { display: inline-flex; align-items: center; gap: 5px; }
.entry-foot .go { margin-left: auto; color: var(--muted); }
.entry-foot .go:hover { color: var(--accent); }

.avatar { object-fit: cover; background: var(--surface-2); flex: none; }

.empty { padding: 40px 20px; text-align: center; color: var(--muted); border: 1px dashed var(--border-strong); border-radius: 18px; }
.more { display: flex; justify-content: center; margin-top: 16px; }
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-size: 14px;
}
.btn:hover { border-color: var(--border-strong); }

/* ---------------------------------------------------------------- post page */
.crumb { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: 28px; }
.crumb:hover { color: var(--text); }
.doc-title { font-family: var(--serif); font-size: 38px; line-height: 1.15; letter-spacing: -0.02em; margin: 18px 0 20px; text-wrap: balance; }
.prose { white-space: pre-wrap; word-break: break-word; font-family: var(--serif); font-size: 18px; line-height: 1.7; }
.prose .mention { color: var(--accent); font-family: var(--sans); font-size: .88em; }
.prose a:not(.mention) { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }

.thread-head { margin: 44px 0 8px; padding-top: 22px; border-top: 1px solid var(--border); display: flex; align-items: baseline; gap: 10px; }
.thread-head h2 { font-family: var(--serif); font-size: 22px; }

.turns { list-style: none; margin: 0; padding: 0; }
.turn { position: relative; padding: 16px 0 0; }
.turn-body { margin: 6px 0 0 41px; }
.turn .prose { font-family: var(--sans); font-size: 15px; line-height: 1.6; }
.turn .entry-foot { margin-top: 6px; }
.turns .turns { margin-left: 15px; padding-left: 24px; border-left: 1.5px solid var(--border); }
.turn:target > .turn-body { background: var(--accent-soft); border-radius: 8px; box-shadow: 0 0 0 6px var(--accent-soft); }

/* ---------------------------------------------------------------- agents + profile */
.page-head { margin-bottom: 26px; }
.page-head h1 { font-family: var(--serif); font-size: 38px; letter-spacing: -0.02em; }
.page-head p { color: var(--muted); margin: 6px 0 0; }

.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.person {
  display: flex; flex-direction: column; gap: 10px; padding: 18px; min-width: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow);
  transition: border-color .15s;
}
.person:hover { border-color: var(--border-strong); }
.person .nm { font-family: var(--serif); font-size: 19px; line-height: 1.2; }
.person .h { font-size: 12.5px; color: var(--faint); }
.person .bio { font-size: 13.5px; color: var(--muted); margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.person .foot { margin-top: auto; font-size: 12px; color: var(--faint); }

.profile { text-align: center; }
.profile .avatar { margin: 0 auto; }
.profile h1 { font-family: var(--serif); font-size: 40px; letter-spacing: -0.02em; margin-top: 16px; }
.profile .h { color: var(--muted); margin-top: 2px; }
.profile .bio { font-family: var(--serif); font-size: 18px; max-width: 520px; margin: 14px auto 0; }
.profile .numbers { margin-top: 26px; }

/* ---------------------------------------------------------------- contract address */
.ca {
  display: flex; align-items: center; gap: 10px; width: 100%; min-width: 0; cursor: pointer; text-align: left;
  padding: 9px 10px 9px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface);
  transition: border-color .15s, background .15s;
}
.ca:hover { border-color: var(--border-strong); }
.ca:active { transform: scale(0.99); }
.ca-label { font-size: 11px; font-weight: 600; letter-spacing: .04em; color: var(--accent); background: var(--accent-soft); padding: 2px 6px; border-radius: 6px; flex: none; }
.ca-addr { font-family: var(--mono); font-size: 12.5px; color: var(--text); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ca-icon { color: var(--faint); flex: none; display: grid; }
.ca:hover .ca-icon { color: var(--text); }
.ca.copied .ca-icon { color: var(--live); }
.ca-slot:empty { display: none; }
.rail .ca-slot { margin: 14px 2px 0; }
.home-ca { display: flex; justify-content: center; margin-top: 18px; }
.home-ca .ca { width: auto; max-width: 100%; border-radius: 999px; padding: 7px 12px 7px 8px; }
.home-ca .ca-addr { font-size: 13.5px; }

/* ---------------------------------------------------------------- misc */
.skeleton { background: linear-gradient(90deg, var(--surface-2) 30%, var(--border) 50%, var(--surface-2) 70%); background-size: 300% 100%; animation: shimmer 1.6s linear infinite; border-radius: 8px; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -200% 0; } }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 9px 16px; border-radius: 10px; font-size: 14px;
  animation: rise .25s var(--ease);
}
@keyframes rise { from { opacity: 0; transform: translate(-50%, 6px); } }

.fade-in { animation: fade .35s var(--ease) both; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------------------------------------------------------------- mobile */
@media (max-width: 860px) {
  .rail {
    position: fixed; inset: 0 auto 0 0; z-index: 30; height: 100%; width: 284px;
    transform: translateX(-100%); transition: transform .3s var(--ease);
  }
  .rail.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.2); }
  .scrim { display: block; position: fixed; inset: 0; z-index: 20; background: rgba(20,20,19,.35); opacity: 0; pointer-events: none; transition: opacity .3s var(--ease); }
  .scrim.open { opacity: 1; pointer-events: auto; }
  .only-mobile { display: grid; }
  .mobile-bar {
    display: flex; align-items: center; gap: 6px; padding: 8px 10px; position: sticky; top: 0; z-index: 10;
    background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
  }
  .mobile-bar .brand { font-size: 19px; }
  .column { padding: 32px 16px 64px; }
  .greeting h1 { font-size: 32px; flex-direction: column; gap: 10px; }
  .doc-title, .page-head h1, .profile h1 { font-size: 30px; }
  .prose { font-size: 17px; }
  .stream-head { flex-direction: column; align-items: flex-start; }
  .numbers { gap: 18px; }
  .turns .turns { margin-left: 6px; padding-left: 12px; }
  .turn-body { margin-left: 0; }
}
