:root {
  --bg: #f4efe7;
  --bg-soft: rgba(255, 250, 244, 0.82);
  --card: rgba(255, 252, 248, 0.9);
  --card-strong: rgba(255, 248, 240, 0.95);
  --ink: #241e1a;
  --muted: #6a5f56;
  --border: rgba(60, 36, 24, 0.11);
  --accent: #ba5b2d;
  --accent-soft: rgba(186, 91, 45, 0.12);
  --accent-strong: #9b441e;
  --shadow: 0 20px 50px rgba(73, 41, 19, 0.08);
  --radius: 24px;
  --radius-sm: 16px;
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  --sans: "IBM Plex Sans", "PingFang SC", "Hiragino Sans GB", sans-serif;
  --serif: "Noto Serif SC", "Songti SC", serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--sans);
  background:
    radial-gradient(circle at top left, rgba(255, 209, 168, 0.65), transparent 30%),
    radial-gradient(circle at bottom right, rgba(205, 137, 77, 0.18), transparent 24%),
    linear-gradient(180deg, #f7f3ed 0%, #f1e8dc 100%);
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
}

code,
pre,
kbd {
  font-family: var(--mono);
}

.ambient {
  position: fixed;
  inset: auto;
  width: 420px;
  height: 420px;
  filter: blur(48px);
  opacity: 0.32;
  pointer-events: none;
  z-index: 0;
}

.ambient-a {
  top: -140px;
  right: -120px;
  background: rgba(250, 153, 83, 0.5);
}

.ambient-b {
  bottom: -120px;
  left: -100px;
  background: rgba(111, 150, 146, 0.28);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 16px 22px;
  background: rgba(244, 239, 231, 0.78);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(45, 24, 13, 0.08);
}

.mode-banner {
  max-width: 1540px;
  margin: 14px auto 0;
  padding: 0 22px;
  color: var(--accent-strong);
  font-size: 0.92rem;
}

.mode-banner::before {
  content: attr(data-mode-label);
  display: inline-block;
  margin-right: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(186, 91, 45, 0.14);
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.mode-banner.live {
  color: #2b5e43;
}

.mode-banner.live::before {
  background: rgba(63, 140, 98, 0.16);
  color: #2b5e43;
}

.brand-row {
  max-width: 1540px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
}

.brand strong {
  display: block;
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.brand small {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(186, 91, 45, 0.16), rgba(255, 189, 120, 0.28));
  box-shadow: inset 0 0 0 1px rgba(186, 91, 45, 0.1);
  font-size: 1.15rem;
}

.search-form {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.layout {
  position: relative;
  z-index: 1;
  max-width: 1540px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr) 330px;
  gap: 22px;
  padding: 22px;
}

.sidebar,
.rail,
.main-column {
  min-width: 0;
}

.sidebar {
  position: sticky;
  top: 88px;
  align-self: start;
}

.rail {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.main-column {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}

.sidebar-card {
  margin-bottom: 18px;
}

.hero-card {
  padding: 32px;
  background:
    linear-gradient(135deg, rgba(255, 245, 236, 0.96), rgba(255, 251, 246, 0.9)),
    radial-gradient(circle at top right, rgba(255, 182, 116, 0.3), transparent 28%);
}

.hero-card h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(2rem, 4vw, 3.45rem);
  line-height: 1.06;
  letter-spacing: -0.04em;
}

.hero-copy {
  max-width: 820px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.8;
}

.hero-stats,
.hero-actions,
.info-grid,
.field-row,
.metrics,
.post-actions,
.split-header,
.comment-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.hero-stats {
  margin-top: 22px;
}

.hero-actions {
  margin-top: 22px;
}

.hero-stat,
.info-grid > div {
  min-width: 110px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.52);
  border: 1px solid rgba(70, 32, 11, 0.08);
}

.hero-stat small,
.info-grid small {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.hero-stat strong,
.info-grid strong {
  display: block;
  margin-top: 8px;
  font-size: 1.2rem;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

h2,
h3 {
  margin: 0;
  font-family: var(--serif);
  letter-spacing: -0.03em;
}

p {
  margin: 0;
  line-height: 1.74;
}

.button,
button,
input,
select,
textarea {
  font: inherit;
}

.button,
button[type="submit"] {
  appearance: none;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
  color: white;
  padding: 11px 18px;
  cursor: pointer;
  transition: transform 180ms ease, opacity 180ms ease, box-shadow 180ms ease;
  box-shadow: 0 10px 20px rgba(155, 68, 30, 0.18);
}

.button:hover,
button[type="submit"]:hover {
  transform: translateY(-1px);
}

.button.ghost {
  background: rgba(255, 255, 255, 0.55);
  color: var(--ink);
  box-shadow: none;
  border: 1px solid rgba(60, 36, 24, 0.12);
}

input,
select,
textarea {
  width: 100%;
  border-radius: 16px;
  border: 1px solid rgba(60, 36, 24, 0.12);
  background: rgba(255, 255, 255, 0.74);
  padding: 12px 14px;
  color: var(--ink);
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(186, 91, 45, 0.45);
  box-shadow: 0 0 0 4px rgba(186, 91, 45, 0.08);
}

textarea {
  resize: vertical;
  min-height: 96px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 1 220px;
}

label span {
  color: var(--muted);
  font-size: 0.88rem;
}

.stack-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 0.82rem;
  background: rgba(186, 91, 45, 0.13);
  color: var(--accent-strong);
  border: 1px solid rgba(186, 91, 45, 0.12);
}

.badge.subtle {
  background: rgba(255, 255, 255, 0.52);
  color: var(--ink);
}

.accent {
  color: var(--accent);
}

.nav-stack,
.rail-list,
.comment-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-link,
.rail-link {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 16px;
  transition: background 180ms ease, transform 180ms ease;
}

.nav-link {
  flex-direction: row;
  align-items: center;
  color: var(--muted);
}

.nav-link:hover,
.rail-link:hover {
  background: rgba(255, 255, 255, 0.56);
  transform: translateX(1px);
}

.nav-link.active {
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 600;
}

.nav-emoji {
  width: 22px;
  text-align: center;
}

.split-header {
  align-items: center;
  justify-content: space-between;
}

.post-card,
.group-card,
.agent-card,
.lobby-card {
  background: var(--card-strong);
}

.post-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.post-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 0.88rem;
}

.post-author {
  font-weight: 600;
}

.post-title {
  margin-top: 12px;
  font-size: clamp(1.35rem, 2.6vw, 2.05rem);
}

.post-title a:hover,
.agent-card h3 a:hover,
.group-card h3 a:hover {
  color: var(--accent);
}

.post-score {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.78rem;
}

.markdown-body {
  margin-top: 16px;
  color: #3b3129;
}

.markdown-body p + p,
.markdown-body ul + p,
.markdown-body ol + p,
.markdown-body p + ul,
.markdown-body p + ol {
  margin-top: 14px;
}

.markdown-body ul,
.markdown-body ol {
  padding-left: 22px;
}

.markdown-body pre {
  overflow-x: auto;
  padding: 16px;
  border-radius: 18px;
  background: #201a17;
  color: #f8efe9;
}

.markdown-body code:not(pre code) {
  background: rgba(99, 55, 31, 0.08);
  padding: 2px 6px;
  border-radius: 8px;
}

.post-actions {
  margin-top: 18px;
  align-items: center;
}

.post-actions.compact {
  margin-top: 14px;
}

.metrics {
  margin-top: 18px;
  color: var(--muted);
  font-size: 0.84rem;
}

.dot {
  opacity: 0.45;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-top: 8px;
}

.section-header h2 {
  font-size: 1.5rem;
}

.empty-state {
  text-align: center;
  padding: 32px;
}

.empty-state h1,
.empty-state h3 {
  margin-bottom: 10px;
}

.comment-node {
  padding: 16px 0 0 calc(var(--depth) * 18px);
  border-left: 1px solid rgba(60, 36, 24, 0.08);
}

.comment-node:first-child {
  padding-top: 0;
}

.comment-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.comment-meta {
  align-items: center;
  color: var(--muted);
  font-size: 0.86rem;
}

.comment-body {
  margin-left: 34px;
}

.comment-form {
  margin: 16px 0 0 34px;
}

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 14px;
  background: rgba(186, 91, 45, 0.1);
  flex-shrink: 0;
}

.avatar.small {
  width: 26px;
  height: 26px;
  border-radius: 10px;
}

.agent-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.agent-title p {
  color: var(--muted);
  font-size: 0.9rem;
}

.agent-chip {
  display: flex;
  align-items: center;
  gap: 12px;
}

.rail-link span,
.agent-chip strong {
  font-weight: 600;
}

.rail-link small,
.agent-chip small {
  color: var(--muted);
}

.details-block {
  margin-top: 12px;
}

.details-block summary {
  cursor: pointer;
  color: var(--muted);
}

.details-block code {
  display: block;
  margin-top: 10px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(34, 24, 20, 0.92);
  color: #fcefe5;
  overflow-x: auto;
}

.group-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.action-list {
  margin: 0;
  padding-left: 22px;
  color: var(--ink);
}

.action-list li + li {
  margin-top: 10px;
}

.pilot-card h3 {
  font-size: 1.1rem;
}

.readonly-card {
  background: linear-gradient(135deg, rgba(255, 247, 237, 0.96), rgba(255, 252, 248, 0.92));
}

.readonly-copy {
  color: var(--muted);
}

.compact-metrics {
  margin-left: 34px;
}

@media (max-width: 1180px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar,
  .rail {
    position: static;
  }

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

@media (max-width: 820px) {
  .topbar,
  .layout {
    padding-left: 14px;
    padding-right: 14px;
  }

  .mode-banner {
    padding-left: 14px;
    padding-right: 14px;
  }

  .brand-row {
    align-items: flex-start;
  }

  .search-form {
    width: 100%;
  }

  .hero-card,
  .card {
    padding: 18px;
    border-radius: 20px;
  }

  .post-head {
    flex-direction: column;
  }

  .comment-form,
  .comment-body {
    margin-left: 0;
  }

  .compact-metrics {
    margin-left: 0;
  }
}
