:root {
  --bg: #08090c;
  --surface: #0e1117;
  --surface2: #141923;
  --surface3: #1b2230;
  --border: #232a38;
  --border-hi: #343f54;
  --text: #eef1f7;
  --muted: #8b95a8;
  --subtle: #646f84;
  --accent: #7c5cff;
  --accent-hi: #947bff;
  --cyan: #22d3ee;
  --ok: #22c55e;
  --warn: #f59e0b;
  --err: #ef4444;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Inter", "PingFang SC", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 13.5px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
a { color: #9ecbff; text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, .mono { font-family: var(--mono); }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 10px 20px; background: rgba(8, 9, 12, 0.88); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--text); font-weight: 700; font-size: 14.5px; letter-spacing: -0.02em; }
.brand:hover { text-decoration: none; }
.brand img { width: 24px; height: 24px; border-radius: 6px; }
.origin-pill {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 999px;
  background: linear-gradient(135deg, rgba(124,92,255,0.22), rgba(34,211,238,0.16));
  border: 1px solid rgba(124,92,255,0.45); color: #d8ccff;
}
.family-nav { display: flex; align-items: center; gap: 2px; background: var(--surface); border: 1px solid var(--border); border-radius: 9px; padding: 2px; }
.family-nav a { color: var(--muted); font-size: 12px; font-weight: 500; padding: 4px 9px; border-radius: 7px; }
.family-nav a:hover { color: var(--text); text-decoration: none; background: var(--surface2); }
.family-nav a.active { background: var(--surface3); color: var(--text); font-weight: 600; }

.container { max-width: 1220px; margin: 0 auto; padding: 20px 20px 72px; }
.container.narrow { max-width: 820px; }

.btn, button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--surface2); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 12px; font-size: 12.5px; font-weight: 500; cursor: pointer;
  transition: border-color 0.14s, background 0.14s, filter 0.14s;
}
.btn:hover, button:hover { border-color: var(--border-hi); background: var(--surface3); text-decoration: none; }
.btn.primary, button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover, button.primary:hover { filter: brightness(1.08); background: var(--accent-hi); }
.btn.green, button.green { background: #16a34a; border-color: #16a34a; color: #fff; font-weight: 600; }
.btn.green:hover, button.green:hover { filter: brightness(1.08); }
.btn.cyan, button.cyan { background: rgba(34,211,238,0.12); border-color: rgba(34,211,238,0.4); color: #67e8f9; font-weight: 600; }
.btn.cyan:hover, button.cyan:hover { background: rgba(34,211,238,0.2); }
.btn.danger, button.danger { border-color: rgba(239,68,68,0.45); color: #fca5a5; background: rgba(239,68,68,0.08); }
.btn.danger:hover, button.danger:hover { background: rgba(239,68,68,0.18); }
.btn.sm, button.sm { padding: 4px 9px; font-size: 12px; border-radius: 7px; }
button:disabled { opacity: 0.48; cursor: not-allowed; }

input, textarea, select {
  background: #0a0d13; color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 10px; font-size: 13px; font-family: inherit;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); }
textarea.code-edit { width: 100%; min-height: 360px; font-family: var(--mono); font-size: 12.5px; line-height: 1.55; tab-size: 2; resize: vertical; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; margin-bottom: 14px; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.card-h h2, .card-h h3 { margin: 0; font-size: 15px; font-weight: 650; letter-spacing: -0.015em; }
.muted { color: var(--muted); }
.sub { color: var(--muted); font-size: 12px; }

.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600; border: 1px solid var(--border); background: var(--surface2); color: var(--muted);
}
.badge.pub { color: #86efac; border-color: rgba(34,197,94,0.35); background: rgba(34,197,94,0.1); }
.badge.priv { color: #fcd34d; border-color: rgba(245,158,11,0.35); background: rgba(245,158,11,0.1); }
.badge.open { color: #86efac; border-color: rgba(34,197,94,0.38); background: rgba(34,197,94,0.12); }
.badge.merged { color: #d8b4fe; border-color: rgba(168,85,247,0.4); background: rgba(168,85,247,0.14); }
.badge.closed { color: #fca5a5; border-color: rgba(239,68,68,0.38); background: rgba(239,68,68,0.12); }
.badge.cyan { color: #67e8f9; border-color: rgba(34,211,238,0.35); background: rgba(34,211,238,0.1); }

.hero {
  background: radial-gradient(circle at 80% 10%, rgba(124,92,255,0.14), transparent 50%),
              radial-gradient(circle at 15% 80%, rgba(34,211,238,0.09), transparent 45%),
              var(--surface);
  border: 1px solid var(--border); border-radius: 16px; padding: 28px 28px; margin-bottom: 20px;
}
.hero h1 { margin: 8px 0 10px; font-size: 28px; line-height: 1.15; letter-spacing: -0.035em; }
.hero p { margin: 0; max-width: 680px; color: var(--muted); font-size: 14.5px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.hero-code {
  margin-top: 18px; background: #07090d; border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px; font-family: var(--mono); font-size: 12px; color: #cbd5e1; overflow-x: auto;
}

.grid-2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 12px; }
.repo-card {
  display: flex; flex-direction: column; justify-content: space-between; gap: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 15px 16px;
  transition: border-color 0.14s, transform 0.14s;
}
.repo-card:hover { border-color: var(--border-hi); }
.repo-card-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.repo-card-title a { font-weight: 650; font-size: 14.5px; color: var(--text); }
.repo-card-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }

.repo-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.repo-crumb { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 19px; font-weight: 700; letter-spacing: -0.02em; }
.repo-crumb a { color: #9ecbff; }
.repo-crumb .sep { color: var(--subtle); font-weight: 400; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; flex-wrap: wrap; }
.tab {
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px; color: var(--muted);
  font-weight: 500; font-size: 13px; border-bottom: 2px solid transparent; cursor: pointer;
}
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { color: var(--text); font-weight: 650; border-bottom-color: var(--accent); }
.tab .cnt { font-size: 11px; padding: 1px 6px; border-radius: 999px; background: var(--surface2); color: var(--muted); }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.tree-table { width: 100%; border-collapse: collapse; }
.tree-table tr { border-top: 1px solid #191f2c; }
.tree-table tr:first-child { border-top: none; }
.tree-table tr:hover td { background: rgba(124, 92, 255, 0.045); }
.tree-table td { padding: 8px 12px; vertical-align: middle; }
.tree-icon { width: 22px; color: var(--muted); }
.tree-name { font-family: var(--mono); font-size: 12.8px; }
.tree-size { text-align: right; color: var(--subtle); font-family: var(--mono); font-size: 11.5px; }

.code-viewer { background: #090b10; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.code-viewer-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 9px 14px; background: var(--surface2); border-bottom: 1px solid var(--border);
}
.code-lines { overflow-x: auto; padding: 10px 0; font-family: var(--mono); font-size: 12.2px; line-height: 1.6; }
.code-line { display: flex; padding: 0 14px; white-space: pre; }
.code-line:hover { background: rgba(255,255,255,0.03); }
.code-ln { width: 46px; flex-shrink: 0; color: var(--subtle); text-align: right; padding-right: 14px; user-select: none; }
.code-src { color: #dbe2f0; }

.diff-box { background: #090b10; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; margin-top: 10px; }
.diff-line { display: block; padding: 0 12px; font-family: var(--mono); font-size: 12px; line-height: 1.55; white-space: pre; }
.diff-add { background: rgba(34,197,94,0.12); color: #86efac; }
.diff-del { background: rgba(239,68,68,0.12); color: #fca5a5; }
.diff-hunk { background: rgba(59,130,246,0.12); color: #93c5fd; }
.diff-hdr { background: var(--surface2); color: #e2e8f0; font-weight: 600; padding: 4px 12px; border-top: 1px solid var(--border); }

.md { font-size: 14px; line-height: 1.7; color: #dbe2f0; }
.md h1, .md h2, .md h3 { margin: 16px 0 8px; color: var(--text); border-bottom: 1px solid #1d2433; padding-bottom: 5px; }
.md pre { background: #07090d; border: 1px solid var(--border); border-radius: 8px; padding: 12px; overflow-x: auto; font-size: 12.2px; }
.md code { background: var(--surface2); padding: 1px 5px; border-radius: 5px; font-size: 12.3px; }
.md pre code { background: none; padding: 0; }
.md ul { padding-left: 20px; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 5px; color: #cbd5e1; }
.field input[type="text"], .field input[type="password"], .field input[type="url"], .field select, .field textarea { width: 100%; }
.row-inline { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.check-row { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; color: #cbd5e1; }

.alert { padding: 11px 14px; border-radius: 10px; border: 1px solid var(--border); margin-bottom: 12px; font-size: 13px; }
.alert.warn { background: rgba(245,158,11,0.09); border-color: rgba(245,158,11,0.35); color: #fcd34d; }
.alert.ok { background: rgba(34,197,94,0.09); border-color: rgba(34,197,94,0.35); color: #86efac; }
.alert.err { background: rgba(239,68,68,0.1); border-color: rgba(239,68,68,0.38); color: #fca5a5; }

.clone-popover {
  background: var(--surface2); border: 1px solid var(--border-hi); border-radius: 12px; padding: 14px;
  margin-bottom: 14px;
}
.copy-row { display: flex; gap: 6px; margin-top: 6px; }
.copy-row input { flex: 1; font-family: var(--mono); font-size: 12px; }

.toast {
  position: fixed; right: 20px; bottom: 20px; z-index: 99; display: none;
  background: var(--surface2); border: 1px solid var(--accent); color: var(--text);
  padding: 10px 14px; border-radius: 10px; box-shadow: 0 14px 36px rgba(0,0,0,0.55); font-size: 13px;
}
