:root {
  color-scheme: light;
  --bg: #ffffff;
  --canvas: #f6f8fa;
  --text: #24292f;
  --muted: #57606a;
  --border: #d0d7de;
  --border-muted: #d8dee4;
  --blue: #0969da;
  --green: #2da44e;
  --green-dark: #1a7f37;
  --yellow: #bf8700;
  --header: #24292f;
  --header-muted: #8c959f;
  --shadow: 0 8px 24px rgba(140, 149, 159, 0.2);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

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

a:hover {
  text-decoration: underline;
}

svg {
  display: block;
  fill: currentColor;
}

.site-header {
  color: #ffffff;
  background: var(--header);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: 1280px;
  min-height: 64px;
  margin: 0 auto;
  padding: 12px 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 10px;
  color: #ffffff;
  font-weight: 700;
}

.brand:hover {
  text-decoration: none;
}

.brand img {
  width: 32px;
  height: 32px;
}

.search {
  display: flex;
  align-items: center;
  flex: 1 1 360px;
  max-width: 560px;
  min-width: 180px;
  gap: 8px;
  min-height: 34px;
  padding: 0 10px;
  color: var(--header-muted);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 6px;
}

.search svg {
  width: 16px;
  height: 16px;
}

.search input {
  width: 100%;
  min-width: 0;
  color: #ffffff;
  background: transparent;
  border: 0;
  outline: 0;
  font: inherit;
}

.search input::placeholder {
  color: #c9d1d9;
}

.global-nav {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 16px;
  font-weight: 600;
}

.global-nav a {
  color: #ffffff;
}

.repo-heading {
  background: var(--canvas);
  border-bottom: 1px solid var(--border);
}

.repo-heading-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px 24px 14px;
}

.repo-title-line {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 8px;
}

.repo-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  color: var(--muted);
}

h1 {
  display: flex;
  align-items: baseline;
  min-width: 0;
  gap: 6px;
  margin: 0;
  font-size: 20px;
  font-weight: 400;
  line-height: 1.2;
}

h1 a,
h1 strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

h1 strong {
  font-weight: 600;
}

h1 span {
  color: var(--muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 7px;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}

.repo-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.button,
.green-button,
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 32px;
  padding: 5px 12px;
  color: var(--text);
  background: var(--canvas);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-weight: 600;
  white-space: nowrap;
}

.button svg {
  width: 16px;
  height: 16px;
  color: var(--muted);
}

.button span {
  margin-left: 2px;
  color: var(--muted);
  font-weight: 500;
}

.button:hover,
.green-button:hover,
.primary-button:hover {
  text-decoration: none;
  filter: brightness(0.97);
}

.green-button,
.primary-button {
  color: #ffffff;
  background: var(--green);
  border-color: var(--green-dark);
}

.repo-tabs {
  display: flex;
  align-items: center;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 16px;
  overflow-x: auto;
}

.repo-tabs a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 48px;
  padding: 0 12px;
  color: var(--text);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}

.repo-tabs a.active {
  border-bottom-color: #fd8c73;
  font-weight: 600;
}

.repo-tabs svg {
  width: 16px;
  height: 16px;
  color: var(--muted);
}

.repo-tabs span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  color: var(--text);
  background: rgba(175, 184, 193, 0.2);
  border-radius: 999px;
  font-size: 12px;
}

.page-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 296px;
  gap: 24px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px;
}

.content-column {
  min-width: 0;
}

.network-panel {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(320px, 1.2fr);
  align-items: center;
  gap: 20px;
  margin-bottom: 16px;
  padding: 24px;
  background: linear-gradient(180deg, #ffffff, #f6f8fa);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.network-copy {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green-dark);
  font-weight: 700;
}

.network-copy h2 {
  margin: 0;
  max-width: 650px;
  font-size: 30px;
  line-height: 1.16;
  letter-spacing: 0;
}

.network-copy p:not(.eyebrow) {
  margin: 14px 0 0;
  max-width: 560px;
  color: var(--muted);
  font-size: 16px;
}

.network-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 20px;
}

.secondary-link {
  color: var(--text);
  font-weight: 600;
}

.network-image {
  width: 100%;
  height: auto;
  min-width: 0;
  border: 1px solid var(--border-muted);
  border-radius: 8px;
}

.code-card,
.readme-card,
.roadmap-card,
.catalog-card {
  margin-bottom: 16px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.code-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
}

.code-toolbar h2 {
  flex: 1 1 auto;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}

.branch-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 5px 12px;
  color: var(--text);
  background: var(--canvas);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-weight: 600;
}

.branch-button svg {
  width: 16px;
  height: 16px;
  color: var(--muted);
}

.commit-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 16px;
  background: #ddf4ff;
  border-top: 1px solid #b6e3ff;
  border-bottom: 1px solid #b6e3ff;
}

.commit-line div {
  min-width: 0;
}

.commit-line strong {
  margin-right: 6px;
}

.commit-line span {
  color: var(--muted);
}

.file-list {
  display: grid;
}

.file-row {
  display: grid;
  grid-template-columns: 22px minmax(150px, 1fr) minmax(140px, 1.5fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  color: var(--text);
  border-top: 1px solid var(--border-muted);
}

.file-row:hover {
  background: var(--canvas);
  text-decoration: none;
}

.file-icon {
  position: relative;
  width: 16px;
  height: 14px;
}

.file-icon.folder::before {
  position: absolute;
  inset: 4px 0 0;
  content: "";
  background: #54aeff;
  border-radius: 2px;
}

.file-icon.folder::after {
  position: absolute;
  top: 1px;
  left: 1px;
  width: 8px;
  height: 5px;
  content: "";
  background: #54aeff;
  border-radius: 2px 2px 0 0;
}

.file-icon.file {
  border: 1px solid #8c959f;
  border-radius: 2px;
}

.file-icon.file::before {
  position: absolute;
  top: -1px;
  right: -1px;
  width: 5px;
  height: 5px;
  content: "";
  background: #ffffff;
  border-left: 1px solid #8c959f;
  border-bottom: 1px solid #8c959f;
}

.file-name {
  color: var(--blue);
  font-weight: 600;
}

.file-note,
.file-row time {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.readme-header {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border-muted);
}

.readme-header svg {
  width: 16px;
  height: 16px;
  color: var(--muted);
}

.readme-header h2 {
  margin: 0;
  font-size: 14px;
}

.readme-body {
  padding: 28px 32px 32px;
}

.readme-body h3 {
  margin: 0 0 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-muted);
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: 0;
}

.readme-body > p {
  max-width: 820px;
  color: var(--muted);
  font-size: 16px;
}

.readme-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 20px;
}

.readme-grid article {
  min-width: 0;
  padding: 4px 0 4px 14px;
  border-left: 3px solid var(--border-muted);
}

.readme-grid h4 {
  margin: 0 0 6px;
  font-size: 15px;
}

.readme-grid p {
  margin: 0;
  color: var(--muted);
}

pre {
  overflow-x: auto;
  margin: 20px 0 0;
  padding: 16px;
  color: #c9d1d9;
  background: #24292f;
  border-radius: 6px;
  font-size: 13px;
}

code {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
}

.roadmap-list {
  display: grid;
  gap: 0;
}

.roadmap-list div {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 10px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-muted);
}

.roadmap-list div:last-child {
  border-bottom: 0;
}

.roadmap-list span {
  width: 12px;
  height: 12px;
  margin-top: 5px;
  border: 2px solid var(--green);
  border-radius: 50%;
}

.catalog-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-muted);
}

.catalog-toolbar p {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
}

.catalog-toolbar span {
  flex: 0 0 auto;
  color: var(--muted);
  font-weight: 600;
}

.catalog-list {
  display: grid;
}

.catalog-empty {
  padding: 18px 16px;
  color: var(--muted);
}

.catalog-item {
  display: grid;
  gap: 8px;
  padding: 16px;
  border-bottom: 1px solid var(--border-muted);
  scroll-margin-top: 80px;
  border-radius: 6px;
}

.catalog-item:last-child {
  border-bottom: 0;
}

/* Flash a repository card when arrived at via a deep link from the client. */
.catalog-item-highlight {
  animation: catalog-flash 2.4s ease-out 1;
}

@keyframes catalog-flash {
  0%,
  40% {
    background: rgba(45, 164, 78, 0.16);
    box-shadow: inset 0 0 0 1px var(--green);
  }
  100% {
    background: transparent;
    box-shadow: inset 0 0 0 1px transparent;
  }
}

.catalog-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.catalog-item h3 {
  margin: 0;
  color: var(--blue);
  font-size: 16px;
  line-height: 1.3;
}

.catalog-item p {
  margin: 0;
  color: var(--muted);
}

.catalog-status {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  color: var(--green-dark);
  background: #dafbe1;
  border: 1px solid #aceebb;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.catalog-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  color: var(--muted);
  font-size: 12px;
}

.catalog-clone {
  overflow: hidden;
  max-width: 100%;
  padding: 8px 10px;
  color: var(--muted);
  background: var(--canvas);
  border: 1px solid var(--border-muted);
  border-radius: 6px;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 12px ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
}

.catalog-clone:hover {
  color: var(--blue);
  text-decoration: none;
}

.sidebar {
  min-width: 0;
}

.side-section {
  padding: 0 0 18px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border-muted);
}

.side-section h2 {
  margin: 0 0 8px;
  font-size: 16px;
}

.side-section p {
  margin: 0 0 12px;
  color: var(--text);
}

.link-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 600;
}

.link-row svg {
  width: 16px;
  height: 16px;
  color: var(--muted);
}

.topics {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.topics a {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  color: var(--blue);
  background: #ddf4ff;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.topics a:hover {
  color: #ffffff;
  background: var(--blue);
  text-decoration: none;
}

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

.stats div {
  padding: 10px;
  background: var(--canvas);
  border: 1px solid var(--border-muted);
  border-radius: 6px;
}

.stats dt {
  color: var(--muted);
  font-size: 12px;
}

.stats dd {
  margin: 2px 0 0;
  font-size: 18px;
  font-weight: 700;
}

.mini-list {
  display: grid;
  gap: 8px;
}

.mini-list a {
  display: grid;
  grid-template-columns: 14px 1fr;
  align-items: start;
  gap: 7px;
  color: var(--text);
}

.status {
  width: 10px;
  height: 10px;
  margin-top: 6px;
  border-radius: 50%;
}

.status.open {
  background: var(--green);
}

.status.closed {
  background: #8250df;
}

.status.review {
  background: var(--yellow);
}

.clone-box {
  display: grid;
  gap: 6px;
}

.clone-box span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.clone-box input {
  width: 100%;
  min-height: 34px;
  padding: 6px 8px;
  color: var(--muted);
  background: var(--canvas);
  border: 1px solid var(--border);
  border-radius: 6px;
  font: 12px ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
}

.clients-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.clients-dot {
  width: 10px;
  height: 10px;
  flex: none;
  border-radius: 50%;
  background: var(--muted);
}

.clients-dot.online {
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(45, 164, 78, 0.18);
}

.clients-note {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

/* --- Room chat --- */
.chat-log {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  height: 200px;
  overflow-y: auto;
  padding: 8px;
  background: var(--canvas);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
}

.chat-empty {
  color: var(--muted);
  font-size: 12px;
  margin: auto;
  text-align: center;
}

.chat-msg {
  display: grid;
  gap: 1px;
}

.chat-author {
  font-weight: 600;
  font-size: 12px;
  color: var(--green-dark);
}

.chat-msg-self .chat-author {
  color: var(--muted);
}

.chat-text {
  color: var(--text);
  word-break: break-word;
}

.chat-system {
  color: var(--muted);
  font-size: 12px;
  font-style: italic;
}

.chat-compose {
  margin-top: 8px;
  display: grid;
  gap: 6px;
}

.chat-name,
.chat-input {
  min-height: 32px;
  padding: 6px 8px;
  color: var(--text);
  background: var(--canvas);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
}

.chat-name:focus,
.chat-input:focus {
  outline: none;
  border-color: var(--green);
}

.chat-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
}

.chat-send {
  padding: 6px 12px;
  color: #fff;
  background: var(--green);
  border: 1px solid var(--green-dark);
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
}

.chat-send:hover {
  background: var(--green-dark);
}

.chat-status {
  color: var(--muted);
  font-size: 11px;
}

@media (max-width: 980px) {
  .header-inner,
  .repo-heading-inner {
    flex-wrap: wrap;
  }

  .global-nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
  }

  .repo-actions {
    width: 100%;
    overflow-x: auto;
  }

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

  .network-panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .header-inner {
    padding: 12px 16px;
  }

  .search {
    order: 3;
    flex-basis: 100%;
    max-width: none;
  }

  .repo-heading-inner {
    padding: 18px 16px 12px;
  }

  h1 {
    font-size: 18px;
  }

  .page-grid {
    padding: 16px;
  }

  .network-panel {
    padding: 18px;
  }

  .network-copy h2 {
    font-size: 24px;
  }

  .file-row {
    grid-template-columns: 22px minmax(0, 1fr) auto;
    padding: 10px 12px;
  }

  .file-note {
    grid-column: 2 / -1;
    white-space: normal;
  }

  .readme-body {
    padding: 22px 18px;
  }

  .readme-grid,
  .stats {
    grid-template-columns: 1fr;
  }

  .catalog-toolbar,
  .catalog-item-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .code-toolbar {
    flex-wrap: wrap;
  }

  .code-toolbar h2 {
    order: 3;
    flex-basis: 100%;
  }
}

@media (max-width: 480px) {
  .brand span {
    display: none;
  }

  .button,
  .green-button,
  .primary-button,
  .branch-button {
    padding-right: 10px;
    padding-left: 10px;
  }

  .repo-tabs {
    padding: 0 8px;
  }

  .commit-line {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .file-row {
    grid-template-columns: 22px minmax(0, 1fr);
  }

  .file-row time {
    grid-column: 2 / -1;
  }
}
