:root {
  --bg: #050505;
  --panel: #0d0c09;
  --panel-2: #14120c;
  --border: #26211a;
  --text: #f2efe6;
  --muted: #938d7e;
  --gold: #c4a44a;
  --gold-bright: #f2d67a;
  --gold-deep: #8a7430;
  --glow: rgba(196, 164, 74, 0.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-bright); }

/* ---------- nav ---------- */
.nav {
  border-bottom: 1px solid var(--border);
  background: rgba(5, 5, 5, 0.8);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.nav-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
}
.brand {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.3px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand-mark { font-size: 20px; }

/* ---------- hero ---------- */
main { max-width: 1120px; margin: 0 auto; padding: 0 24px 80px; }

.hero {
  position: relative;
  padding: 96px 0 48px;
  text-align: center;
  overflow: hidden;
}
.dust {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}
.hero-inner { position: relative; z-index: 1; }

.title {
  font-size: clamp(40px, 8vw, 80px);
  line-height: 1.02;
  font-weight: 900;
  letter-spacing: -0.03em;
  margin: 0 0 20px;
}
.gold {
  color: var(--gold);
  background: linear-gradient(100deg, #8a7430 0%, #f2d67a 25%, #c4a44a 50%, #f2d67a 75%, #8a7430 100%);
  background-size: 220% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 5s linear infinite;
  text-shadow: 0 0 60px var(--glow);
}
@keyframes shimmer {
  0% { background-position: 0% center; }
  100% { background-position: 220% center; }
}

.sub {
  color: var(--muted);
  font-size: 19px;
  margin: 0 0 40px;
}
.sub strong { color: var(--text); font-weight: 700; }

/* ---------- search ---------- */
.search { max-width: 620px; margin: 0 auto; }
.search-box {
  display: flex;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 8px 8px 8px 20px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search-box:focus-within {
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(196, 164, 74, 0.18), 0 0 40px rgba(196, 164, 74, 0.12);
}
.at { color: var(--muted); font-size: 22px; margin-right: 8px; }
#username {
  flex: 1;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--text);
  font-size: 22px;
  padding: 12px 0;
  min-width: 0;
}
#username::placeholder { color: #4a463c; }
.btn {
  background: linear-gradient(180deg, #e2c46a 0%, var(--gold) 100%);
  color: #0a0803;
  border: 0;
  border-radius: 13px;
  padding: 13px 28px;
  font-size: 17px;
  font-weight: 800;
  cursor: pointer;
  transition: filter 0.15s, transform 0.06s, box-shadow 0.2s;
  box-shadow: 0 2px 12px rgba(196, 164, 74, 0.25);
}
.btn:hover { filter: brightness(1.08); box-shadow: 0 4px 22px rgba(196, 164, 74, 0.4); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: default; filter: none; }
.btn.ghost {
  background: transparent;
  color: var(--gold);
  border: 1px solid var(--gold-deep);
  box-shadow: none;
  font-size: 14px;
  padding: 10px 20px;
}
.btn.ghost:hover { background: rgba(196, 164, 74, 0.08); box-shadow: none; }

.nsfw {
  display: inline-block;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}
.nsfw input { accent-color: var(--gold); margin-right: 6px; vertical-align: middle; }

.hint {
  color: #6d6859;
  font-size: 13px;
  margin-top: 18px;
  letter-spacing: 0.2px;
}
.error {
  color: #e0705a;
  margin-top: 16px;
  font-size: 14px;
}

/* ---------- scan ---------- */
.scan { padding-top: 20px; }
.scan-stage {
  position: relative;
  height: 440px;
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
  background: radial-gradient(ellipse at center, #0c0a06 0%, #050505 70%);
}
.constellation {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.scan-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 2;
}
.stats {
  display: flex;
  gap: 64px;
  text-align: center;
}
.stat { display: flex; flex-direction: column; }
.stat-num {
  font-size: clamp(40px, 8vw, 72px);
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.stat-num.gold {
  color: var(--gold-bright);
  text-shadow: 0 0 40px rgba(242, 214, 122, 0.5);
}
.stat-label {
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-top: 8px;
}
.progress {
  width: 60%;
  max-width: 480px;
  height: 4px;
  background: #1c1912;
  border-radius: 4px;
  margin-top: 28px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--gold-deep), var(--gold-bright));
  border-radius: 4px;
  transition: width 0.2s ease;
  box-shadow: 0 0 12px rgba(242, 214, 122, 0.6);
}
.scan-note {
  color: var(--muted);
  font-size: 14px;
  margin-top: 20px;
  text-align: center;
}

.live-feed {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
  margin-top: 24px;
}

/* ---------- cards ---------- */
.card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 13px 15px;
  color: var(--text);
  transition: border-color 0.18s, transform 0.08s, box-shadow 0.18s;
  animation: pop-in 0.35s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}
.card:hover {
  border-color: var(--gold);
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(196, 164, 74, 0.15);
}
@keyframes pop-in {
  from { opacity: 0; transform: translateY(10px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 18px;
  color: #0a0803;
  background: var(--gold);
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-body { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.site-name {
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.site-url {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.arrow { color: var(--muted); font-size: 15px; }

/* ---------- results ---------- */
.results { padding-top: 24px; }
.summary {
  font-size: 16px;
  color: var(--muted);
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.summary strong { color: var(--gold-bright); }
.summary .count-badge {
  display: inline-block;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px 12px;
  margin-left: 8px;
  font-size: 13px;
  color: var(--text);
}
.summary .count-badge.found { border-color: rgba(196, 164, 74, 0.5); color: var(--gold-bright); }
.results-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}
.empty {
  color: var(--muted);
  padding: 28px 0;
  text-align: center;
  font-size: 15px;
}

/* ---------- mode toggle ---------- */
.mode-toggle {
  display: inline-flex;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 4px;
  gap: 4px;
  margin-bottom: 16px;
}
.mode-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.18s ease;
}
.mode-btn:hover { color: var(--text); }
.mode-btn.active {
  background: var(--gold-bright);
  color: #151209;
}
.mode-btn.active:hover { color: #151209; }

/* ---------- handle chips ---------- */
.handles {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
}
.handle-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 13px;
  font-size: 13px;
  color: var(--text);
  transition: all 0.25s ease;
}
.handle-chip .chip-at { color: var(--muted); }
.handle-chip.done {
  border-color: rgba(196, 164, 74, 0.6);
  color: var(--gold-bright);
}
.handle-chip.done::after { content: " \2713"; color: var(--gold-bright); }

/* ---------- grouped results (name mode) ---------- */
#grid.grouped { display: block; }
.group { margin-bottom: 38px; }
.group-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.group-handle { color: var(--gold-bright); font-weight: 600; font-size: 17px; }
.group-count { color: var(--muted); font-size: 13px; }

/* ---------- thesis ---------- */
.thesis {
  margin-top: 24px;
  padding: 44px 32px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: linear-gradient(180deg, var(--panel) 0%, var(--bg) 100%);
}
.thesis-title {
  font-size: clamp(26px, 4vw, 36px);
  font-weight: 900;
  letter-spacing: -0.02em;
  margin: 0 0 20px;
  color: var(--text);
}
.thesis-title .dot { color: var(--gold); }
.thesis-body {
  max-width: 720px;
  margin: 0 auto;
  text-align: left;
}
.thesis-body p {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.65;
  margin: 0 0 16px;
}
.thesis-body p strong { color: var(--gold-bright); font-weight: 700; }
.thesis-body p:last-child { margin-bottom: 0; }
.thesis-kicker {
  color: var(--text);
  font-size: 17px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}

/* ---------- footer ---------- */
.footer {
  border-top: 1px solid var(--border);
  padding: 24px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.footer p { margin: 0; }

@media (max-width: 600px) {
  .hero { padding-top: 60px; }
  .scan-stage { height: 380px; }
  .stats { gap: 36px; }
  .grid, .live-feed { grid-template-columns: 1fr 1fr; }
}

/* Master List / Repos */
.nav-link {
  color: var(--gold);
  margin-left: 20px;
  font-size: 14px;
}
.nav-link:hover {
  color: var(--gold-bright);
}

.repos {
  max-width: 900px;
  margin: 60px auto;
  padding: 0 20px;
}
.repos .thesis-title {
  text-align: center;
}
.repo-list {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 12px;
}
.repo-list li {
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 12px 16px;
  border-radius: 4px;
}
.repo-list a {
  font-weight: 600;
}
.repo-list li:hover {
  border-color: var(--gold);
}
