:root {
  color-scheme: light;
  --bg: #ffffff;
  --ink: #111111;
  --muted: #5f6368;
  --line: #e5e7eb;
  --panel: #f6f8fa;
  --code: #0d1117;
  --code-text: #e6edf3;
  --blue: #0969da;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
}

a {
  color: var(--blue);
  text-decoration: none;
}

.wrap {
  width: min(980px, calc(100% - 32px));
  margin: 0 auto;
}

.topbar {
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.nav {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.92rem;
}

nav a {
  color: var(--muted);
}

nav a.github-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  color: var(--ink);
}

.github-link svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.visitor-count {
  display: flex;
  align-items: baseline;
  gap: 0.38rem;
  min-width: 0;
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
}

.visitor-count span:first-child {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.intro {
  padding: 4rem 0 2.5rem;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(3rem, 9vw, 5.8rem);
  line-height: 1;
}

h2 {
  margin-bottom: 0.75rem;
  font-size: 2rem;
  line-height: 1.15;
}

h3 {
  margin-top: 1.5rem;
  margin-bottom: 0.45rem;
  font-size: 1.05rem;
}

p + p {
  margin-top: 0.8rem;
}

.lede {
  margin-top: 0.8rem;
  color: var(--ink);
  font-size: 1.45rem;
}

.intro p:not(.lede),
.section > p,
.source-note,
.status,
.setup-head p {
  color: var(--muted);
}

.intro-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.4rem;
}

.agent-note {
  margin-top: 0.75rem;
  font-size: 0.95rem;
}

.button,
button {
  border: 1px solid var(--ink);
  border-radius: 6px;
  background: var(--ink);
  color: white;
  min-height: 38px;
  padding: 0.55rem 0.75rem;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 650;
  cursor: pointer;
}

.button.secondary,
button.secondary {
  border-color: var(--line);
  background: white;
  color: var(--ink);
}

.section {
  padding: 2rem 0;
  border-top: 1px solid var(--line);
}

pre,
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

p code {
  white-space: nowrap;
}

pre {
  margin: 0.8rem 0 1rem;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  border-radius: 6px;
  background: var(--code);
  color: var(--code-text);
  padding: 1rem;
  font-size: 0.9rem;
}

.instruction-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin: 1rem 0 0.75rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.rules-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0 0.75rem;
}

.download-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 54px;
  padding: 0.65rem 0.8rem;
  border-left: 1px solid var(--line);
  background: #fff;
}

.download-id {
  flex: 1 1 auto;
  min-width: 0;
  line-height: 1.25;
}

.download-row:first-child {
  border-left: 0;
}

.download-row h3 {
  margin-top: 0;
  margin-bottom: 0.18rem;
  font-size: 0.95rem;
}

.download-row p {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.84rem;
}

.download-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 0.3rem;
  justify-content: flex-end;
}

.download-actions button {
  min-height: 30px;
  padding: 0.32rem 0.52rem;
  font-size: 0.82rem;
}

.repo-head {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-top: 1.5rem;
}

.repo-head h3 {
  margin: 0;
}

.repo-head .button {
  min-height: 32px;
  padding: 0.36rem 0.6rem;
  font-size: 0.84rem;
}

.rules-file {
  max-height: 500px;
}

.setup-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
}

.status {
  margin-top: 0.4rem;
  font-size: 0.92rem;
}

.setup-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
  gap: 1rem;
  margin-top: 1rem;
}

.setup-card {
  min-width: 0;
  height: 560px;
  display: flex;
  flex-direction: column;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.setup-card h3 {
  flex: 0 0 1.65rem;
  margin-top: 0;
  line-height: 1.35;
}

.setup-card p {
  color: var(--muted);
}

#setup .setup-card p {
  flex: 0 0 6.4rem;
}

#agents .setup-card p {
  flex: 0 0 2rem;
}

.setup-actions {
  flex: 0 0 38px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.5rem;
  margin-top: 1rem;
}

.setup-card pre {
  flex: 0 0 230px;
  height: 230px;
  margin-top: 1rem;
  margin-bottom: 0;
  overflow: auto;
  font-size: 0.78rem;
}

.source-links,
.source-note {
  margin-top: 0.8rem;
  font-size: 0.9rem;
}

.source-links {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 0.4rem 0.7rem;
  flex: 0 0 5.2rem;
  margin-top: 0.8rem;
  overflow: auto;
  color: var(--muted);
}

.source-links span {
  flex-basis: 100%;
  font-weight: 650;
}

.source-links a {
  font-size: 0.86rem;
}

@media (max-width: 900px) {
  .instruction-grid,
  .setup-cards {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .nav {
    height: auto;
    min-height: 56px;
    flex-wrap: wrap;
    align-content: center;
    padding: 0.65rem 0;
  }

  nav {
    width: 100%;
    overflow-x: auto;
  }

  .intro {
    padding-top: 3rem;
  }

  .download-row {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .download-row:first-child {
    border-top: 0;
  }

  .setup-head {
    display: block;
  }

  .setup-head button {
    margin-top: 1rem;
  }

  .setup-card {
    height: 540px;
  }

  #setup .setup-card p {
    flex-basis: 7.2rem;
  }

  #agents .setup-card p {
    flex-basis: 2.4rem;
  }

  .repo-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.6rem;
  }
}
