@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Instrument+Serif:ital@0;1&family=Satoshi:wght@400;500;700;900&display=swap');

:root {
  --bg: #06090b;
  --surface: #0c1014;
  --surface-2: #111920;
  --border: #1a2530;
  --border-bright: #253040;
  --text: #f0f4f8;
  --text-muted: #8899aa;
  --text-dim: #556677;
  --accent: #00f5ff;
  --accent-dim: rgba(0, 245, 255, 0.10);
  --accent-glow: rgba(0, 245, 255, 0.25);
  --red: #ff4d6a;
  --red-dim: rgba(255, 77, 106, 0.12);
  --amber: #f59e0b;
  --amber-dim: rgba(245, 158, 11, 0.12);
  --blue: #3b82f6;
  --blue-dim: rgba(59, 130, 246, 0.12);
  --purple: #a855f7;
  --purple-dim: rgba(168, 85, 247, 0.12);
  --green: #7CC243;
  --green-dim: rgba(124, 194, 67, 0.12);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Satoshi', sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at 30% 20%, rgba(0, 245, 255, 0.03) 0%, transparent 60%),
              radial-gradient(ellipse at 70% 80%, rgba(0, 245, 255, 0.02) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.025'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9999;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  z-index: 1;
}

/* ── TOP BAR ── */
.topbar {
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 1;
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo-img { height: 32px; width: auto; }
.topbar-user {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 12px;
}
.topbar-user a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 11px;
}
.topbar-user a:hover { color: var(--text-muted); }

/* ── HERO ── */
.hero {
  padding: 80px 0 64px;
  position: relative;
  z-index: 1;
}
.hero-eyebrow {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  color: var(--accent);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.hero-eyebrow::before {
  content: '';
  width: 28px;
  height: 1px;
  background: var(--accent);
}
.hero h1 {
  font-family: 'Instrument Serif', serif;
  font-size: clamp(36px, 5vw, 64px);
  font-weight: 400;
  line-height: 1.1;
  max-width: 820px;
  margin-bottom: 24px;
  letter-spacing: -0.02em;
}
.hero h1 em {
  font-style: italic;
  color: var(--accent);
  text-shadow: 0 0 40px rgba(0, 245, 255, 0.3);
}
.hero-sub {
  font-size: 17px;
  color: var(--text-muted);
  max-width: 560px;
  line-height: 1.6;
  margin-bottom: 40px;
}

/* ── SCAN INPUT ── */
.scan-input-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 24px;
  max-width: 600px;
}
.scan-input-row {
  display: flex;
  align-items: stretch;
  gap: 0;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.btn-scan {
  flex-shrink: 0;
}
@media (max-width: 580px) {
  .btn-scan {
    width: 100%;
    justify-content: center;
    margin-top: 1px;
  }
}
.scan-prefix {
  font-family: 'DM Mono', monospace;
  font-size: 14px;
  color: var(--text-dim);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-right: none;
  padding: 11px 12px;
  white-space: nowrap;
  flex-shrink: 0;
}
.scan-input {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: 'DM Mono', monospace;
  font-size: 14px;
  padding: 11px 12px;
  outline: none;
  transition: border-color 0.2s;
}
.scan-input:focus { border-color: var(--accent); }
.scan-input.error { border-color: var(--red); animation: shake 0.3s ease; }
.scan-input::placeholder { color: var(--text-dim); }
@keyframes shake {
  0%,100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}
.btn-scan {
  background: var(--accent);
  color: var(--bg);
  border: none;
  padding: 12px 24px;
  font-family: 'Satoshi', sans-serif;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn-scan:hover:not(:disabled) {
  background: #33f7ff;
  box-shadow: 0 0 24px rgba(0, 245, 255, 0.3);
}
.btn-scan:disabled { opacity: 0.6; cursor: not-allowed; }
.scan-hint {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--text-dim);
}
.scan-rate-note {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 8px;
}
.scan-error {
  font-size: 13px;
  color: var(--red);
  margin-top: 10px;
  display: none;
}
.scan-error.visible { display: block; }

/* ── LOADING SPINNER ── */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(6,9,11,0.3);
  border-top-color: var(--bg);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── RATE LIMIT CARD ── */
.rate-limit-card {
  background: var(--red-dim);
  border: 1px solid rgba(255,77,106,0.3);
  padding: 16px 20px;
  margin-top: 16px;
  display: none;
}
.rate-limit-card.visible { display: block; }
.rate-limit-card p { font-size: 14px; color: var(--text-muted); margin-bottom: 12px; }

/* ── BUTTONS ── */
.btn-github {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--text);
  color: var(--bg);
  border: none;
  padding: 11px 22px;
  font-family: 'Satoshi', sans-serif;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
}
.btn-github:hover {
  background: #ffffff;
  box-shadow: 0 0 20px rgba(240,244,248,0.2);
}
.btn-github svg { flex-shrink: 0; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 10px 20px;
  font-family: 'Satoshi', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
}
.btn-secondary:hover {
  background: var(--accent-dim);
  box-shadow: 0 0 16px rgba(0,245,255,0.15);
}

/* ── SECTION LABEL ── */
.section-label {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── DIRECTORY CARDS ── */
.directory-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
}
.dir-card {
  background: var(--surface);
  padding: 16px 20px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 16px;
  text-decoration: none;
  transition: background 0.15s;
}
.dir-card:hover { background: var(--surface-2); }
.dir-card-name {
  font-family: 'DM Mono', monospace;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 4px;
}
.dir-card-name span { color: var(--text-dim); }
.dir-card-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.tool-pill {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  padding: 2px 8px;
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(0,245,255,0.2);
}
.dir-card-findings {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
}
.dir-card-confidence {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  min-width: 80px;
}
.conf-label {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  color: var(--text);
}
.conf-track {
  width: 80px;
  height: 3px;
  background: var(--border-bright);
  border-radius: 2px;
  overflow: hidden;
}
.conf-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.4s ease;
}
.conf-fill.high { background: var(--green); }
.conf-fill.mid  { background: var(--accent); }
.conf-fill.low  { background: var(--amber); }
.conf-caption {
  font-size: 10px;
  color: var(--text-dim);
  white-space: nowrap;
}
.dir-empty {
  padding: 48px 24px;
  text-align: center;
  color: var(--text-dim);
  font-size: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.load-more-wrap { margin-top: 16px; text-align: center; }

/* ── RESULT PAGE ── */
.result-header {
  padding: 48px 0 32px;
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 1;
}
.result-repo-name {
  font-family: 'DM Mono', monospace;
  font-size: 22px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.result-repo-name a { color: var(--text-muted); text-decoration: none; }
.result-repo-name a:hover { color: var(--accent); }
.result-repo-name span { color: var(--text-dim); }
.result-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.result-badge {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  padding: 3px 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.result-timestamp { font-size: 13px; color: var(--text-dim); }

/* ── SUMMARY STRIP ── */
.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  margin: 32px 0;
}
@media (max-width: 640px) { .summary-strip { grid-template-columns: repeat(2, 1fr); } }
.metric-card {
  background: var(--surface);
  padding: 20px;
}
.metric-label {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}
.metric-value {
  font-family: 'Instrument Serif', serif;
  font-size: 32px;
  line-height: 1;
  color: var(--text);
}
.metric-value.red { color: var(--red); }
.metric-value.amber { color: var(--amber); }
.metric-value.accent { color: var(--accent); }
.metric-sub {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 4px;
}

/* ── ACCORDION ── */
.accordion { border: 1px solid var(--border); }
.accordion-row {
  border-bottom: 1px solid var(--border);
}
.accordion-row:last-child { border-bottom: none; }
.accordion-trigger {
  width: 100%;
  background: var(--surface);
  border: none;
  padding: 18px 20px;
  display: grid;
  grid-template-columns: 20px 1fr auto 24px;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}
.accordion-trigger:hover { background: var(--surface-2); }
.accordion-trigger.open { background: var(--surface-2); }
.sev-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.sev-critical { background: var(--red); box-shadow: 0 0 8px rgba(255,77,106,0.5); }
.sev-high     { background: var(--amber); box-shadow: 0 0 8px rgba(245,158,11,0.5); }
.sev-info     { background: var(--blue); box-shadow: 0 0 8px rgba(59,130,246,0.5); }
.sev-gap      { background: var(--purple); box-shadow: 0 0 8px rgba(168,85,247,0.5); }

.accordion-title-group { min-width: 0; }
.accordion-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}
.accordion-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  font-family: 'DM Mono', monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sev-badge {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  padding: 3px 8px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex-shrink: 0;
}
.badge-critical { background: var(--red-dim); color: var(--red); border: 1px solid rgba(255,77,106,0.25); }
.badge-high     { background: var(--amber-dim); color: var(--amber); border: 1px solid rgba(245,158,11,0.25); }
.badge-info     { background: var(--blue-dim); color: var(--blue); border: 1px solid rgba(59,130,246,0.25); }
.badge-gap      { background: var(--purple-dim); color: var(--purple); border: 1px solid rgba(168,85,247,0.25); }

.accordion-chevron {
  color: var(--text-dim);
  transition: transform 0.25s;
  flex-shrink: 0;
}
.accordion-trigger.open .accordion-chevron { transform: rotate(90deg); }

.accordion-body {
  display: none;
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 24px;
}
.accordion-body.open { display: block; }

/* ── PATH PILLS ── */
.path-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.path-pill {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  padding: 4px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.path-pill.sensitive {
  background: var(--red-dim);
  border-color: rgba(255,77,106,0.3);
  color: var(--red);
}

/* ── REFUSAL GAP COMPONENT ── */
.refusal-gap { padding: 4px 0; }
.refusal-gap p {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 16px;
}
.refusal-gap p:last-of-type { margin-bottom: 0; }
.refusal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--border);
  margin: 24px 0;
}
@media (max-width: 560px) { .refusal-grid { grid-template-columns: 1fr; } }
.refusal-col {
  background: var(--surface);
  padding: 20px;
}
.refusal-col-title {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 12px;
}
.refusal-col.visible .refusal-col-title { color: var(--green); }
.refusal-col.hidden .refusal-col-title  { color: var(--red); }
.refusal-col ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.refusal-col ul li {
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}
.refusal-col.visible ul li::before { content: '●'; color: var(--green); font-size: 8px; }
.refusal-col.hidden ul li::before  { content: '○'; color: var(--red); font-size: 8px; }

.refusal-cta {
  background: var(--purple-dim);
  border: 1px solid rgba(168,85,247,0.3);
  padding: 20px;
  margin-top: 8px;
}
.refusal-cta p {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.6;
}

/* ── AUTH GATE ── */
.gate-wrapper { position: relative; }
.gate-blur {
  filter: blur(5px);
  pointer-events: none;
  user-select: none;
}
.gate-overlay {
  position: relative;
  z-index: 10;
  margin: 40px auto;
  max-width: 480px;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 40px;
  text-align: center;
}
.gate-overlay h2 {
  font-family: 'Instrument Serif', serif;
  font-size: 26px;
  font-weight: 400;
  margin-bottom: 12px;
}
.gate-overlay p {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 28px;
  line-height: 1.6;
}

/* ── UPGRADE CARD ── */
.upgrade-card {
  background: linear-gradient(135deg, rgba(0,245,255,0.04) 0%, transparent 60%);
  border: 1px solid rgba(0,245,255,0.2);
  padding: 32px;
  margin-top: 32px;
  text-align: center;
}
.upgrade-card h3 {
  font-family: 'Instrument Serif', serif;
  font-size: 22px;
  font-weight: 400;
  margin-bottom: 8px;
}
.upgrade-card p {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 24px;
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.6;
}

/* ── LOADING STATE ── */
.loading-state {
  padding: 80px 24px;
  text-align: center;
  color: var(--text-dim);
}
.loading-state .spinner {
  width: 32px;
  height: 32px;
  border-width: 3px;
  border-color: var(--border);
  border-top-color: var(--accent);
  margin: 0 auto 16px;
}
.loading-state p { font-family: 'DM Mono', monospace; font-size: 13px; color: var(--text-dim); }

/* ── CALLBACK PAGE ── */
.callback-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
}
.callback-card {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 48px;
  text-align: center;
  max-width: 420px;
  width: 100%;
}
.callback-card h2 { font-size: 20px; margin-bottom: 12px; }
.callback-card p { font-size: 14px; color: var(--text-muted); line-height: 1.6; }
.callback-card .spinner {
  width: 28px;
  height: 28px;
  border-width: 3px;
  border-color: var(--border);
  border-top-color: var(--accent);
  margin: 0 auto 20px;
}

/* ── MISC ── */
.divider { height: 1px; background: var(--border); margin: 48px 0; position: relative; z-index: 1; }

a { color: inherit; }

.gh-icon { display: inline-flex; vertical-align: middle; }
