@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,600;9..144,700&family=JetBrains+Mono:wght@400;500;600;700;800&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,400&display=swap');

/* ------------------------------------------------------------------ */
/* Variables                                                            */
/* ------------------------------------------------------------------ */
:root {
  --blue: #2563eb;
  --blue-mid: #3b82f6;
  --blue-pale: #eff6ff;
  --white: #ffffff;
  --bg: #f4f8ff;
  --text: #0f172a;
  --sub: #334155;
  --muted: #64748b;
  --border: rgba(37,99,235,.13);
  --border-soft: rgba(0,0,0,.07);
  --nav-h: 70px;

  --score-high-bg: rgba(22,163,74,.09);
  --score-high-color: #16a34a;
  --score-high-border: rgba(22,163,74,.22);
  --score-mid-bg: rgba(217,119,6,.09);
  --score-mid-color: #d97706;
  --score-mid-border: rgba(217,119,6,.22);
  --score-low-bg: rgba(100,116,139,.07);
  --score-low-color: var(--muted);
  --score-low-border: rgba(100,116,139,.15);
}

/* ------------------------------------------------------------------ */
/* Reset                                                                */
/* ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  scroll-behavior: smooth;
  background: radial-gradient(ellipse at top, #c7dbff 0%, #ddeeff 35%, #f4f8ff 70%, #ffffff 100%);
  background-attachment: fixed;
  min-height: 100%;
}
body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: transparent;
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select { font-family: inherit; }

/* ------------------------------------------------------------------ */
/* Cursor glow                                                          */
/* ------------------------------------------------------------------ */
#cursor-glow {
  position: fixed;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(37,99,235,.07) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
  transform: translate(-50%, -50%);
  transition: opacity .3s;
}

/* ------------------------------------------------------------------ */
/* Layout                                                               */
/* ------------------------------------------------------------------ */
.container {
  max-width: 1152px;
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  z-index: 1;
}
.section { padding: 80px 0; }

/* ------------------------------------------------------------------ */
/* Navigation                                                           */
/* ------------------------------------------------------------------ */
.nav-wrapper {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  height: var(--nav-h);
  border-bottom: 1px solid transparent;
  transition: background .3s, border-color .3s, box-shadow .3s;
}
.nav-wrapper.scrolled {
  background: rgba(255,255,255,.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-color: rgba(37,99,235,.10);
  box-shadow: 0 1px 24px rgba(37,99,235,.07);
}
.nav-glow {
  position: absolute;
  top: -60%; left: 50%;
  transform: translateX(-50%);
  width: 760px; height: 260px;
  background: radial-gradient(ellipse, rgba(37,99,235,.10) 0, transparent 72%);
  pointer-events: none;
}
.nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 32px;
}
.nav-logo { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.logo-mark {
  width: 32px; height: 32px; background: var(--blue); border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'JetBrains Mono', monospace; font-weight: 800; font-size: .9rem; color: #fff;
}
.logo-text {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700; font-size: .95rem; letter-spacing: .08em; color: var(--text);
}
.logo-sub { color: var(--blue); margin-left: 4px; }
.nav-links { display: flex; align-items: center; gap: 28px; flex: 1; }
.nav-link { font-size: .875rem; color: var(--muted); transition: color .2s; }
.nav-link:hover { color: var(--text); }
.nav-link.active { color: var(--blue); }
.nav-status {
  display: flex; align-items: center; gap: 8px;
  margin-left: auto; flex-shrink: 0;
  background: rgba(37,99,235,.06);
  border: 1px solid rgba(37,99,235,.14);
  border-radius: 100px; padding: 5px 14px;
}
.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #16a34a; flex-shrink: 0;
}
.status-dot.running { background: #d97706; animation: pulse-dot 1.2s ease-in-out infinite; }
.status-dot.error   { background: #dc2626; }
@keyframes pulse-dot { 0%,100%{opacity:1} 50%{opacity:.4} }
.status-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: .75rem; font-weight: 500; color: var(--muted);
}
.nav-line {
  position: absolute; bottom: -1px; left: 0; right: 0; height: 1px;
  background: linear-gradient(to right, transparent, rgba(37,99,235,.4), transparent);
  opacity: 0; transition: opacity .3s;
}
.nav-wrapper.scrolled .nav-line { opacity: 1; }

/* ------------------------------------------------------------------ */
/* Hero                                                                 */
/* ------------------------------------------------------------------ */
.hero-section {
  min-height: 52vh;
  display: flex; align-items: center;
  padding: calc(var(--nav-h) + 60px) 0 60px;
  position: relative; overflow: hidden;
}
.hero-bg { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.dot-grid { position: absolute; inset: 0; }
.glow-orb {
  position: absolute; border-radius: 50%;
  filter: blur(100px);
  animation: pulse-glow 7s ease-in-out infinite;
}
.glow-orb-red   { width:480px; height:480px; background:rgba(37,99,235,.14); top:-100px; left:5%; }
.glow-orb-pink  { width:360px; height:360px; background:rgba(96,165,250,.10); bottom:-80px; right:8%; animation-delay:-3s; }
@keyframes pulse-glow { 0%,100%{opacity:.9;transform:scale(1)} 50%{opacity:.5;transform:scale(1.06)} }

.hero-section .container { text-align: center; }
.hero-label {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: .75rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  color: var(--blue);
  background: rgba(37,99,235,.08);
  border: 1px solid rgba(37,99,235,.20);
  border-radius: 100px; padding: 5px 14px; margin-bottom: 24px;
}
.hero-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(2rem, 6vw, 4rem); font-weight: 700;
  line-height: 1.1; letter-spacing: -.01em; margin-bottom: 20px;
  color: var(--text);
}
.hero-word { display: inline-block; margin-right: .25em; }
.hero-word-accent { color: var(--blue); }
.hero-sub {
  font-size: clamp(.95rem, 1.5vw, 1.1rem); color: var(--muted);
  max-width: 540px; margin: 0 auto 40px; line-height: 1.65;
}
.hero-stats {
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.75);
  border: 1px solid rgba(37,99,235,.14);
  border-radius: 14px; padding: 20px 36px;
  box-shadow: 0 4px 24px rgba(37,99,235,.08);
}
.stat-item { display: flex; flex-direction: column; align-items: center; padding: 0 28px; }
.stat-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(1.6rem,3vw,2.2rem); font-weight: 700; color: var(--text);
}
.stat-label { font-size: .75rem; color: var(--muted); margin-top: 2px; letter-spacing: .04em; }
.stat-divider { width: 1px; height: 40px; background: rgba(37,99,235,.12); }

/* ------------------------------------------------------------------ */
/* Section headers                                                      */
/* ------------------------------------------------------------------ */
.section-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: .7rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  color: var(--blue); margin-bottom: 12px;
}
.section-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(1.6rem, 3.5vw, 2.4rem); font-weight: 700;
  margin-bottom: 40px; color: var(--text);
}

/* ------------------------------------------------------------------ */
/* Cards — shared base                                                  */
/* ------------------------------------------------------------------ */
.brief-card, .control-card, .console-card, .result-card, .results-stat {
  background: var(--white);
  border: 1px solid var(--border-soft);
  box-shadow: 0 2px 16px rgba(37,99,235,.06);
}

/* ------------------------------------------------------------------ */
/* Research brief                                                       */
/* ------------------------------------------------------------------ */
.brief-card {
  border-radius: 16px; padding: 32px 36px;
  display: flex; flex-direction: column; gap: 28px;
}
.brief-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.brief-field  { display: flex; flex-direction: column; gap: 10px; }
.brief-field-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: .75rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); display: flex; align-items: center; gap: 8px;
}
.brief-field-icon { color: var(--blue); }
.brief-textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border-soft);
  border-radius: 10px; color: var(--text);
  padding: 14px 16px;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: .9rem; line-height: 1.65;
  resize: none; min-height: 110px; overflow: hidden;
  outline: none; transition: border-color .2s, box-shadow .2s;
}
.brief-textarea::placeholder { color: rgba(100,116,139,.45); }
.brief-textarea:focus {
  border-color: rgba(37,99,235,.45);
  box-shadow: 0 0 0 3px rgba(37,99,235,.08);
}
.brief-textarea.valid {
  border-color: rgba(22,163,74,.36);
}
.brief-textarea.invalid {
  border-color: rgba(220,38,38,.52);
  box-shadow: 0 0 0 3px rgba(220,38,38,.08);
}
.brief-char-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: .68rem; color: rgba(100,116,139,.45); align-self: flex-end;
}
.brief-field-message {
  min-height: 16px;
  font-size: .74rem;
  line-height: 1.35;
  color: rgba(100,116,139,.72);
}
.brief-field-message.error { color: #dc2626; }
.brief-field-message.ok { color: #15803d; }
.brief-actions {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
  padding-top: 4px; border-top: 1px solid var(--border-soft);
}
.brief-hint { font-size: .78rem; color: rgba(100,116,139,.5); transition: color .2s; }
.brief-hint.saved { color: #16a34a; }
.brief-hint.error { color: #dc2626; }

/* ------------------------------------------------------------------ */
/* Control section                                                      */
/* ------------------------------------------------------------------ */
.control-card {
  border-radius: 16px; padding: 36px 40px;
  display: flex; flex-direction: column; gap: 32px;
}
.control-block { display: flex; flex-direction: column; gap: 14px; }
.control-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: .75rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.source-actions {
  display: flex; align-items: center; gap: 6px;
  font-family: 'DM Sans', sans-serif; font-size: .8rem;
  letter-spacing: 0; text-transform: none; font-weight: 400;
}
.label-sep { color: rgba(0,0,0,.18); }
.link-btn { color: var(--blue); font-size: .8rem; opacity: .8; transition: opacity .15s; }
.link-btn:hover { opacity: 1; }
.add-source-btn { font-weight: 700; }

.type-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.type-tab {
  font-family: 'JetBrains Mono', monospace;
  font-size: .8rem; font-weight: 500; color: var(--muted);
  background: var(--bg); border: 1px solid var(--border-soft);
  border-radius: 8px; padding: 9px 20px; transition: all .2s;
}
.type-tab:hover { color: var(--text); border-color: rgba(37,99,235,.25); }
.type-tab.active {
  background: rgba(37,99,235,.10);
  border-color: rgba(37,99,235,.35);
  color: var(--blue);
}

/* Sources grid */
.sources-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px,1fr)); gap: 8px; }
.source-toggle {
  display: flex; align-items: center; gap: 9px;
  font-family: 'JetBrains Mono', monospace;
  font-size: .78rem; font-weight: 500; color: var(--muted);
  background: var(--bg); border: 1px solid var(--border-soft);
  border-radius: 8px; padding: 9px 14px; min-height: 44px;
  cursor: pointer; transition: all .2s; user-select: none;
}
.source-toggle:hover { border-color: rgba(37,99,235,.30); color: var(--text); }
.source-toggle.active {
  background: rgba(37,99,235,.08);
  border-color: rgba(37,99,235,.32);
  color: var(--blue);
}
.source-toggle.custom-source {
  border-style: dashed;
}
.source-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: rgba(100,116,139,.3); flex-shrink: 0; transition: background .2s;
}
.source-toggle.active .source-dot { background: var(--blue); }

/* Settings */
.settings-row { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-end; }
.setting-item { display: flex; flex-direction: column; gap: 7px; }
.setting-item.setting-toggle { flex-direction: row; align-items: center; gap: 12px; }
.setting-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: .7rem; font-weight: 500; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted);
}
.setting-input {
  width: 90px;
  background: var(--bg); border: 1px solid var(--border-soft);
  border-radius: 8px; color: var(--text);
  padding: 8px 12px; font-size: .9rem;
  transition: border-color .2s, box-shadow .2s; outline: none;
}
.setting-input:focus {
  border-color: rgba(37,99,235,.45);
  box-shadow: 0 0 0 3px rgba(37,99,235,.09);
}
.stepper-input::-webkit-outer-spin-button,
.stepper-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper-input { -moz-appearance: textfield; }

.stepper {
  display: flex; align-items: center;
  background: var(--bg); border: 1px solid var(--border-soft);
  border-radius: 8px; overflow: hidden;
  transition: border-color .2s, box-shadow .2s;
}
.stepper:focus-within {
  border-color: rgba(37,99,235,.45);
  box-shadow: 0 0 0 3px rgba(37,99,235,.09);
}
.stepper-btn {
  flex-shrink: 0; width: 36px; height: 38px;
  background: transparent; color: var(--muted);
  font-size: 1.1rem; font-family: 'JetBrains Mono', monospace;
  border: none; cursor: pointer;
  transition: color .15s, background .15s;
  display: flex; align-items: center; justify-content: center; user-select: none;
}
.stepper-btn:hover { color: var(--text); background: rgba(37,99,235,.06); }
.stepper-btn:active { background: rgba(37,99,235,.12); color: var(--blue); }
.stepper .stepper-input {
  width: 56px; background: transparent; border: none;
  border-left: 1px solid var(--border-soft);
  border-right: 1px solid var(--border-soft);
  border-radius: 0; text-align: center; padding: 8px 4px; box-shadow: none;
}
.setting-select {
  background: var(--bg); border: 1px solid var(--border-soft);
  border-radius: 8px; color: var(--text);
  padding: 8px 12px; font-size: .875rem;
  transition: border-color .2s; outline: none; cursor: pointer;
}
.setting-select:focus { border-color: rgba(37,99,235,.45); }
.setting-select option { background: var(--white); color: var(--text); }

/* Toggle switch */
.toggle-switch { position: relative; display: inline-block; width: 42px; height: 23px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; cursor: pointer; inset: 0;
  background: rgba(100,116,139,.18);
  border: 1px solid rgba(100,116,139,.25);
  border-radius: 100px; transition: .2s;
}
.toggle-slider::before {
  content: ''; position: absolute;
  width: 17px; height: 17px; left: 2px; top: 2px;
  background: var(--white); border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0,0,0,.15); transition: .2s;
}
input:checked + .toggle-slider { background: rgba(37,99,235,.18); border-color: rgba(37,99,235,.45); }
input:checked + .toggle-slider::before { background: var(--blue); transform: translateX(19px); }

/* Actions */
.control-actions {
  display: flex; align-items: center; gap: 12px;
  justify-content: flex-end; flex-wrap: wrap;
  padding-top: 4px; border-top: 1px solid var(--border-soft);
}

/* ------------------------------------------------------------------ */
/* Buttons                                                              */
/* ------------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: 'JetBrains Mono', monospace; font-weight: 500;
  border-radius: 8px; transition: all .2s; cursor: pointer; white-space: nowrap;
}
.btn-primary {
  background: var(--blue); color: #fff;
  font-size: .9rem; padding: 10px 22px;
}
.btn-primary:hover:not(:disabled) {
  background: #1d4ed8;
  transform: translateY(-1px) scale(1.02);
  box-shadow: 0 6px 24px rgba(37,99,235,.30);
}
.btn-primary:disabled { opacity: .55; cursor: not-allowed; }
.btn-lg { padding: 13px 30px; font-size: .95rem; }
.btn-outline {
  background: transparent; color: var(--muted);
  font-size: .875rem; padding: 10px 18px;
  border: 1px solid var(--border-soft);
}
.btn-outline:hover { color: var(--text); border-color: rgba(37,99,235,.30); }
.btn-icon { width: 15px; height: 15px; flex-shrink: 0; }
.spin { animation: spin-anim .8s linear infinite; }
@keyframes spin-anim { to { transform: rotate(360deg); } }
.hidden { display: none !important; }

/* ------------------------------------------------------------------ */
/* Console / log  (stays dark — terminal aesthetic)                    */
/* ------------------------------------------------------------------ */
.console-card {
  border-radius: 14px; overflow: hidden;
  background: #0b1120;
  border: 1px solid rgba(37,99,235,.18);
  box-shadow: 0 4px 32px rgba(37,99,235,.10);
}
.console-header {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  background: rgba(255,255,255,.03);
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.console-dots { display: flex; gap: 6px; }
.console-dot { width: 12px; height: 12px; border-radius: 50%; }
.dot-red    { background: #ff5f57; }
.dot-yellow { background: #febc2e; }
.dot-green  { background: #28c840; }
.console-title {
  font-family: 'JetBrains Mono', monospace; font-size: .75rem;
  color: rgba(148,163,184,.6); flex: 1; text-align: center;
}
.clear-btn {
  font-family: 'JetBrains Mono', monospace; font-size: .7rem;
  color: rgba(148,163,184,.4); transition: color .15s;
  min-height: 32px; padding: 0 8px;
}
.clear-btn:hover { color: rgba(148,163,184,.7); }
.console-body {
  padding: 16px 18px; min-height: 220px; max-height: 420px;
  overflow-y: auto;
  font-family: 'JetBrains Mono', monospace; font-size: .78rem; line-height: 1.65;
  scrollbar-width: thin; scrollbar-color: rgba(37,99,235,.2) transparent;
}
.console-body::-webkit-scrollbar { width: 4px; }
.console-body::-webkit-scrollbar-thumb { background: rgba(37,99,235,.25); border-radius: 4px; }
.console-placeholder { color: rgba(148,163,184,.3); display: flex; gap: 8px; }
.console-prompt { color: #60a5fa; }
.log-line { display: flex; gap: 10px; align-items: baseline; min-width: 0; }
.log-time { color: rgba(148,163,184,.3); flex-shrink: 0; }
.log-badge { font-size: .68rem; font-weight: 600; padding: 1px 5px; border-radius: 4px; flex-shrink: 0; letter-spacing: .04em; }
.log-badge-info    { background: rgba(255,255,255,.06); color: rgba(255,255,255,.38); }
.log-badge-error   { background: rgba(239,68,68,.14); color: #f87171; }
.log-badge-warning { background: rgba(245,158,11,.12); color: #fbbf24; }
.log-msg { color: rgba(255,255,255,.72); word-break: break-all; }
.log-source-tag { color: #7dd3fc; }
.log-done  { color: #4ade80; }
.log-found { color: #4ade80; font-weight: 600; }

/* ------------------------------------------------------------------ */
/* Results section                                                      */
/* ------------------------------------------------------------------ */
.results-section { padding-bottom: 120px; }

/* Results header row */
.results-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 40px;
}
.results-header .section-label { margin-bottom: 8px; }
.btn-clear-all { font-size: .78rem; padding: 8px 16px; }

.results-stats { display: flex; gap: 20px; margin-bottom: 32px; flex-wrap: wrap; }
.results-stat {
  border-radius: 12px; padding: 18px 28px;
  display: flex; flex-direction: column; gap: 4px;
  flex: 1; min-width: 140px;
}
.results-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(1.4rem, 2.5vw, 1.9rem); font-weight: 700; color: var(--text);
}
.results-stat-label { font-size: .78rem; color: var(--muted); }

.results-controls {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 28px;
}
.results-tabs {
  display: flex; gap: 6px;
  background: rgba(37,99,235,.05);
  border: 1px solid rgba(37,99,235,.12);
  border-radius: 10px; padding: 5px;
}
.results-tab {
  font-family: 'JetBrains Mono', monospace;
  font-size: .78rem; font-weight: 500; color: var(--muted);
  background: transparent; border-radius: 7px; padding: 7px 18px;
  transition: all .2s; min-height: 36px;
}
.results-tab:hover { color: var(--text); }
.results-tab.active {
  background: var(--white);
  border: 1px solid rgba(37,99,235,.20);
  color: var(--blue);
  box-shadow: 0 1px 6px rgba(37,99,235,.10);
}
.tab-count {
  display: inline-block;
  background: rgba(37,99,235,.12); color: var(--blue);
  border-radius: 100px; padding: 1px 7px; font-size: .65rem; margin-left: 5px;
}
.results-filters { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.search-wrap { position: relative; display: flex; align-items: center; }
.search-icon { position: absolute; left: 10px; width: 15px; height: 15px; color: var(--muted); pointer-events: none; }
.search-input {
  background: var(--white); border: 1px solid var(--border-soft);
  border-radius: 8px; color: var(--text);
  padding: 8px 12px 8px 32px; font-size: .875rem; width: 240px;
  outline: none; transition: border-color .2s, box-shadow .2s;
}
.search-input::placeholder { color: var(--muted); }
.search-input:focus { border-color: rgba(37,99,235,.45); box-shadow: 0 0 0 3px rgba(37,99,235,.08); }
.score-filter { display: flex; align-items: center; gap: 8px; }

/* ------------------------------------------------------------------ */
/* Cards grid                                                           */
/* ------------------------------------------------------------------ */
.cards-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 20px; align-items: start; }
.result-card {
  position: relative;
  overflow: hidden;
  border-radius: 16px; padding: 24px;
  display: flex; flex-direction: column; gap: 14px;
  background: linear-gradient(145deg, rgba(255,255,255,.98), rgba(250,252,255,.94));
  border: 1px solid rgba(148,163,184,.26);
  box-shadow:
    0 1px 0 rgba(255,255,255,.95) inset,
    0 28px 70px rgba(15,23,42,.10),
    0 8px 22px rgba(15,23,42,.05);
  transition: border-color .25s, box-shadow .3s, transform .25s, background .3s;
}
.result-card::before {
  display: none;
}
.result-card::after {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(circle at 18% 0%, rgba(37,99,235,.045), transparent 28%),
    radial-gradient(circle at 100% 10%, rgba(16,185,129,.05), transparent 24%);
  pointer-events: none;
}
.result-card:hover {
  border-color: rgba(37,99,235,.20);
  box-shadow:
    0 1px 0 rgba(255,255,255,.95) inset,
    0 34px 86px rgba(15,23,42,.13),
    0 12px 28px rgba(37,99,235,.08);
  transform: translateY(-3px);
}
.card-header { position: relative; z-index: 1; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; min-height: 36px; }
.card-title-group { min-width: 0; display: flex; flex-direction: column; gap: 7px; padding-right: 4px; }
.card-name {
  font-family: 'Fraunces', Georgia, serif;
  font-size: clamp(1.3rem, 2.1vw, 1.82rem);
  font-weight: 650;
  color: #12213a;
  line-height: 1.05;
  letter-spacing: 0;
}
.card-url {
  max-width: 100%;
  font-size: .82rem;
  color: #64748b;
  transition: color .15s;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card-url:hover { color: var(--blue); }
.card-meta {
  position: relative; z-index: 1;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding-top: 2px;
}
.card-meta-item {
  display: grid;
  grid-template-columns: 32px minmax(72px, .42fr) 1fr;
  align-items: center; gap: 10px;
  min-height: 40px;
  font-size: .82rem; color: #12213a;
  background: rgba(255,255,255,.66);
  border: 1px solid rgba(148,163,184,.28);
  border-radius: 9px;
  padding: 6px 10px 6px 7px;
  box-shadow:
    0 1px 0 rgba(255,255,255,.82) inset,
    0 10px 24px rgba(15,23,42,.035);
}
.meta-key {
  color: #66758e;
  font-size: .62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .1em;
  padding-right: 9px;
  border-right: 1px solid rgba(148,163,184,.38);
}
.meta-value { min-width: 0; color: #0f172a; line-height: 1.35; overflow-wrap: anywhere; }
.meta-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 999px;
  color: #2563eb; font-size: .72rem; font-weight: 800;
  background: #eef5ff;
  box-shadow: 0 1px 0 rgba(255,255,255,.9) inset;
  flex-shrink: 0;
}
.card-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: -4px; }
.card-desc,
.card-summary {
  position: relative; z-index: 1;
  font-size: .84rem; color: #334155; line-height: 1.62;
  background: rgba(255,255,255,.55);
  border-radius: 11px;
  border: 1px solid rgba(148,163,184,.24);
  border-left: 2px solid rgba(16,185,129,.72);
  padding: 12px 13px;
  box-shadow: 0 14px 28px rgba(15,23,42,.035);
}
.card-reason {
  position: relative; z-index: 1;
  font-size: .84rem; color: #334155; line-height: 1.62; font-style: normal;
  background: rgba(255,255,255,.55);
  border: 1px solid rgba(148,163,184,.24);
  border-left: 2px solid rgba(16,185,129,.72);
  padding: 12px 13px;
  border-radius: 11px;
  box-shadow: 0 14px 28px rgba(15,23,42,.035);
}
.meta-icon-in {
  font-family: 'JetBrains Mono', monospace; font-size: .58rem; font-weight: 700;
  background: #0a66c2; color: #fff; border-radius: 3px;
  padding: 1px 4px; flex-shrink: 0; line-height: 1.4; letter-spacing: .02em;
}
.card-footer {
  position: relative; z-index: 1;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 8px; margin-top: auto;
  padding-top: 10px; border-top: 1px solid rgba(148,163,184,.22);
}
.card-link { color: var(--blue); opacity: .88; transition: opacity .15s, color .15s; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-link:hover { opacity: 1; color: #1d4ed8; }
.card-links { display: flex; align-items: center; gap: 14px; }
.footer-spacer { flex: 1 1 auto; min-width: 1px; }
.card-action {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 28px;
  font-size: .8rem; font-weight: 800;
  color: #2563eb;
  transition: color .15s, transform .15s;
}
.card-action:hover { color: #1d4ed8; transform: translateY(-1px); }
.card-action-li {
  min-width: 78px;
  border-radius: 9px;
  background: #0a66c2;
  color: #fff;
  padding: 0 12px;
  box-shadow: 0 12px 22px rgba(10,102,194,.20);
}
.card-action-li:hover { color: #fff; }

/* ------------------------------------------------------------------ */
/* Badges                                                               */
/* ------------------------------------------------------------------ */
.score-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 44px; height: 44px; border-radius: 11px;
  font-family: 'DM Sans', system-ui, sans-serif; font-size: 1.25rem; font-weight: 800;
  flex-shrink: 0; border: 1px solid; padding: 0 10px;
  box-shadow: 0 1px 0 rgba(255,255,255,.9) inset, 0 14px 28px rgba(15,23,42,.06);
}
.score-high  { background: var(--score-high-bg);  color: var(--score-high-color);  border-color: var(--score-high-border); }
.score-mid   { background: var(--score-mid-bg);   color: var(--score-mid-color);   border-color: var(--score-mid-border); }
.score-low   { background: var(--score-low-bg);   color: var(--score-low-color);   border-color: var(--score-low-border); }
.score-empty { background: rgba(100,116,139,.045); color: #94a3b8; border-color: rgba(100,116,139,.18); }
.source-badge {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace; font-size: .65rem; font-weight: 500; letter-spacing: .06em;
  color: var(--muted); background: var(--bg);
  border: 1px solid var(--border-soft); border-radius: 6px; padding: 2px 8px;
}
.stage-badge, .vertical-badge {
  display: inline-block; font-size: .75rem; font-weight: 700;
  border-radius: 999px; padding: 4px 11px; border: 1px solid;
  box-shadow: 0 1px 0 rgba(255,255,255,.7) inset;
}
.stage-preseed { background: rgba(139,92,246,.08); color: #7c3aed; border-color: rgba(139,92,246,.20); }
.stage-seed    { background: rgba(99,102,241,.08); color: #4f46e5; border-color: rgba(99,102,241,.20); }
.stage-series  { background: rgba(37,99,235,.08);  color: var(--blue); border-color: rgba(37,99,235,.22); }
.stage-other   { background: var(--bg); color: var(--muted); border-color: var(--border-soft); }
.vertical-badge { background: rgba(37,99,235,.07); color: rgba(37,99,235,.75); border-color: rgba(37,99,235,.16); font-size: .72rem; }

/* ------------------------------------------------------------------ */
/* Empty state                                                          */
/* ------------------------------------------------------------------ */
.empty-state {
  grid-column: 1/-1; display: flex; flex-direction: column; align-items: center;
  gap: 14px; padding: 60px 20px; text-align: center; color: var(--muted);
}
.empty-icon { font-size: 2.5rem; opacity: .3; }
.empty-state p { font-size: .9rem; max-width: 300px; line-height: 1.6; }

/* ------------------------------------------------------------------ */
/* Footer                                                               */
/* ------------------------------------------------------------------ */
.footer { border-top: 1px solid var(--border-soft); padding: 28px 0; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.footer-brand { font-family: 'JetBrains Mono', monospace; font-size: .75rem; font-weight: 700; letter-spacing: .12em; color: var(--blue); }
.footer-copy { font-size: .8rem; color: rgba(100,116,139,.55); }

/* ------------------------------------------------------------------ */
/* Scroll animations                                                    */
/* ------------------------------------------------------------------ */
.animate-in { opacity: 0; transform: translateY(28px); transition: opacity .6s cubic-bezier(.22,1,.36,1), transform .6s cubic-bezier(.22,1,.36,1); }
.animate-in.visible { opacity: 1; transform: translateY(0); }

/* ------------------------------------------------------------------ */
/* Perfect Matches additions                                            */
/* ------------------------------------------------------------------ */
.stat-num-matches { color: var(--blue); }

.results-stat-matches {
  background: rgba(37,99,235,.05);
  border-color: rgba(37,99,235,.18) !important;
}
.results-stat-matches .results-num { color: var(--blue); }

.tab-count-matches {
  background: rgba(37,99,235,.18);
  color: var(--blue);
}

.match-pair-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 0;
}
.match-pair-divider::before,
.match-pair-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(37,99,235,.14);
}
.match-score-pill {
  background: rgba(37,99,235,.10);
  border: 1px solid rgba(37,99,235,.28);
  border-radius: 100px;
  padding: 2px 10px;
  color: var(--blue);
  font-family: 'JetBrains Mono', monospace;
  font-size: .8rem;
  font-weight: 700;
  white-space: nowrap;
}
.match-score-sub {
  font-size: .55rem;
  opacity: .55;
  font-weight: 500;
}

.matched-vcs {
  position: relative; z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background:
    linear-gradient(135deg, rgba(37,99,235,.075), rgba(20,184,166,.06)),
    rgba(255,255,255,.65);
  border: 1px solid rgba(37,99,235,.16);
  border-radius: 11px;
  padding: 10px;
  box-shadow: 0 10px 24px rgba(37,99,235,.07), 0 1px 0 rgba(255,255,255,.85) inset;
}
.matched-vcs-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: .66rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--blue);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}
.match-spark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: rgba(37,99,235,.12);
  color: var(--blue);
  font-size: .72rem;
}
.mvc-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 7px 8px;
  background: rgba(255,255,255,.76);
  border: 1px solid rgba(37,99,235,.12);
  border-radius: 10px;
  box-shadow: 0 1px 0 rgba(255,255,255,.85) inset;
}
.mvc-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.mvc-name {
  font-family: 'JetBrains Mono', monospace;
  font-size: .72rem;
  font-weight: 800;
  color: var(--text);
}
.mvc-score {
  min-width: 28px;
  height: 22px;
  font-size: .66rem;
  flex-shrink: 0;
  background: rgba(22,163,74,.09);
  color: #15803d;
  border-color: rgba(22,163,74,.22);
}
.mvc-reason {
  font-size: .68rem;
  color: var(--muted);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.matched-vcs-empty {
  background: rgba(100,116,139,.045);
  border-color: rgba(100,116,139,.13);
  box-shadow: none;
}
.mvc-empty {
  font-size: .76rem;
  color: var(--muted);
  line-height: 1.45;
  padding: 7px 8px;
  border-radius: 9px;
  background: rgba(255,255,255,.64);
}

/* ------------------------------------------------------------------ */
/* Responsive — tablet (≤ 768px)                                       */
/* ------------------------------------------------------------------ */
@media (max-width: 768px) {
  .container { padding: 0 16px; }
  .section { padding: 52px 0; }

  .nav-inner { gap: 12px; padding: 0 16px; }
  .nav-links { display: none; }
  .nav-status { padding: 5px 10px; }
  .status-text { font-size: .7rem; }

  .hero-section { min-height: 44vh; padding: calc(var(--nav-h) + 40px) 0 48px; }
  .hero-stats { display: flex; flex-direction: row; flex-wrap: wrap; justify-content: center; width: 100%; padding: 16px 12px; }
  .stat-item { padding: 8px 16px; }
  .stat-divider { width: 1px; height: 36px; }

  .brief-card { padding: 22px 18px; }
  .brief-fields { grid-template-columns: 1fr; }

  .control-card { padding: 22px 18px; gap: 24px; }
  .type-tab { padding: 9px 14px; font-size: .75rem; }
  .sources-grid { grid-template-columns: repeat(2, 1fr); }
  .settings-row { gap: 14px; }
  .control-actions { justify-content: stretch; }
  .control-actions .btn-lg { flex: 1; }

  .results-header { flex-direction: column; align-items: flex-start; }
  .results-stats { gap: 12px; }
  .results-stat { padding: 14px 20px; }
  .results-controls { flex-direction: column; align-items: stretch; }
  .results-tabs { width: 100%; }
  .results-tab { flex: 1; text-align: center; padding: 8px 10px; font-size: .72rem; }
  .results-filters { width: 100%; }
  .search-wrap { flex: 1; }
  .search-input { width: 100%; }
  .score-filter { width: 100%; justify-content: space-between; }
  .score-filter .setting-select { flex: 1; }

  .cards-grid { grid-template-columns: 1fr; gap: 16px; }
  .result-card { padding: 22px 18px; border-radius: 16px; }
  .card-name { font-size: clamp(1.45rem, 7vw, 2rem); }
  .score-badge { min-width: 44px; height: 44px; border-radius: 11px; font-size: 1.25rem; }
  .card-meta-item { grid-template-columns: 34px minmax(82px, .42fr) 1fr; gap: 10px; padding-right: 12px; }
  .meta-icon { width: 30px; height: 30px; }
  .meta-key { font-size: .68rem; letter-spacing: .1em; padding-right: 10px; }
}

/* ------------------------------------------------------------------ */
/* Responsive — mobile (≤ 480px)                                       */
/* ------------------------------------------------------------------ */
@media (max-width: 480px) {
  .container { padding: 0 14px; }
  .section { padding: 40px 0; }

  .logo-text { font-size: .82rem; }

  .hero-stats { border-radius: 12px; }
  .stat-item { padding: 6px 10px; flex: 1; min-width: 80px; }
  .stat-divider { display: none; }

  .brief-card { padding: 18px 14px; gap: 20px; }
  .brief-actions { flex-direction: column; align-items: flex-start; gap: 10px; }
  .brief-actions .btn { width: 100%; justify-content: center; }

  .control-card { padding: 18px 14px; gap: 20px; }
  .type-tabs { flex-direction: column; gap: 6px; }
  .type-tab { width: 100%; justify-content: center; }
  .sources-grid { grid-template-columns: 1fr 1fr; }
  .settings-row { flex-direction: column; gap: 16px; }
  .setting-item { width: 100%; }
  .stepper { width: 100%; }
  .stepper .stepper-input { flex: 1; width: auto; }
  .stepper-btn { width: 48px; height: 44px; font-size: 1.25rem; }
  .setting-item.setting-toggle { width: 100%; justify-content: space-between; }
  .control-actions { gap: 10px; }
  .control-actions .btn-outline,
  .control-actions .btn-lg { width: 100%; justify-content: center; }

  .console-body { font-size: .72rem; max-height: 300px; padding: 12px 14px; }
  .log-time { display: none; }

  .results-tab { font-size: .68rem; padding: 7px 8px; }
  .tab-count { display: none; }
  .result-card { padding: 20px 16px; border-radius: 16px; gap: 14px; }
  .card-header { gap: 12px; }
  .card-name { font-size: clamp(1.35rem, 9vw, 1.85rem); }
  .card-url { font-size: .92rem; }
  .score-badge { min-width: 42px; height: 42px; border-radius: 11px; font-size: 1.2rem; }
  .card-meta { gap: 10px; }
  .card-meta-item {
    grid-template-columns: 30px 1fr;
    gap: 8px 10px;
    min-height: 56px;
    padding: 10px;
  }
  .meta-key { border-right: 0; padding-right: 0; }
  .meta-value { grid-column: 2; font-size: .96rem; }
  .card-desc,
  .card-summary,
  .card-reason { padding: 16px; font-size: .96rem; line-height: 1.65; }
  .card-footer { align-items: flex-start; flex-direction: column; }

  .footer-inner { flex-direction: column; align-items: center; text-align: center; }
}

/* ------------------------------------------------------------------ */
/* Mobile polish — high-quality phone experience                        */
/* ------------------------------------------------------------------ */

/* Safe-area insets for notched + home-bar phones                      */
@media (max-width: 768px) {
  /* Hide redundant brand labels — nav keeps the "P" mark, hero keeps title */
  .logo-text  { display: none; }
  .hero-label { display: none; }
  .footer     { display: none; }

  .nav-wrapper {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }
  .footer {
    padding-bottom: calc(28px + env(safe-area-inset-bottom));
  }

  /* Minimum 44 px touch targets for all interactive controls          */
  .btn-primary { min-height: 44px; }
  .btn-lg      { min-height: 48px; }
  .btn-outline { min-height: 44px; }
  .results-tab { min-height: 40px; }

  /* Console shouldn't dominate the viewport on tablet                 */
  .console-body { min-height: 180px; max-height: 340px; }
}

@media (max-width: 480px) {
  /* type-tab was not a flex container, so justify-content had no      *
   * effect — fix the stacked column layout                            */
  .type-tab {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
  }

  /* Run button: large, unmissable, easy to tap                        */
  .btn-lg {
    min-height: 52px;
    font-size: 1rem;
    border-radius: 10px;
    letter-spacing: .04em;
  }

  /* Comfortable touch targets for result tabs                         */
  .results-tab { min-height: 42px; }

  /* Console: shorter so the page doesn't require deep scrolling       */
  .console-body { min-height: 140px; max-height: 260px; }

  /* Allow stats to shrink on narrow screens without overflow          */
  .results-stat { min-width: 0; }

  /* Score badge must never compress horizontally                      */
  .score-badge { flex-shrink: 0; }

  /* Brief textarea: slightly shorter on phone                         */
  .brief-textarea { min-height: 92px; }

  /* Tighter matched-VC block padding                                  */
  .matched-vcs { padding: 8px; }
  .mvc-row     { padding: 7px 8px; }

  /* Card link rows: bigger touch target                               */
  .card-link      { min-height: 32px; display: flex; align-items: center; }
  .card-action    { min-height: 36px; }
  .card-action-li { min-height: 36px; padding: 0 14px; }
}

/* Very small phones — iPhone SE / Galaxy A-series (≤ 380px)           */
@media (max-width: 380px) {
  :root { --nav-h: 60px; }

  .container { padding: 0 12px; }
  .section   { padding: 32px 0; }

  .logo-mark { width: 28px; height: 28px; font-size: .82rem; }
  .logo-text { font-size: .78rem; }
  .nav-status { padding: 4px 8px; gap: 6px; }
  .status-text {
    font-size: .65rem;
    max-width: 72px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .hero-section { padding: calc(var(--nav-h) + 24px) 0 32px; }
  .section-title { margin-bottom: 24px; }

  .brief-card   { padding: 14px 12px; gap: 16px; }
  .control-card { padding: 14px 12px; gap: 16px; }

  .sources-grid  { gap: 6px; }
  .source-toggle { font-size: .72rem; padding: 8px 10px; min-height: 40px; }

  .results-stat { padding: 10px 12px; }
  .results-num  { font-size: 1.3rem; }

  .card-footer { gap: 10px; }
}

/* ------------------------------------------------------------------ */
/* Mobile tweaks — centered brief header + compact result cards        */
/* + inline meta rows + right-aligned card footer                      */
/* ------------------------------------------------------------------ */

@media (max-width: 768px) {
  /* Center "What Are You Looking For?" heading on mobile              */
  .brief-section .section-label,
  .brief-section .section-title { text-align: center; }

  /* Smaller result cards: tighter padding, reduced type, smaller badge */
  .result-card   { padding: 16px 14px; gap: 10px; }
  .card-name     { font-size: clamp(1.05rem, 4.5vw, 1.3rem); }
  .score-badge   { min-width: 36px; height: 36px; font-size: 1rem; border-radius: 9px; }
  .card-meta-item { min-height: 40px; padding: 7px 9px; }
  .meta-icon     { width: 24px; height: 24px; font-size: .66rem; }
  .card-desc,
  .card-summary,
  .card-reason   { font-size: .82rem; padding: 10px 12px; }
  .card-badges   { gap: 5px; margin-top: -2px; }
  .stage-badge,
  .vertical-badge { font-size: .68rem; padding: 3px 9px; }

  /* Restore 3-column meta layout: icon | KEY | value on one row       */
  .card-meta-item {
    grid-template-columns: 24px minmax(52px, .32fr) 1fr;
    gap: 5px 8px;
    min-height: 36px;
  }
  .meta-key {
    border-right: 1px solid rgba(148,163,184,.32);
    padding-right: 7px;
  }
  .meta-value { grid-column: auto; font-size: .84rem; }

  /* Card footer: row layout so buttons sit on the right               */
  .card-footer {
    flex-direction: row;
    align-items: center;
  }
}

/* ------------------------------------------------------------------ */
/* Hide all Pynn.ai brand labels on every screen size                  */
/* ------------------------------------------------------------------ */
.logo-text,
.hero-label,
.footer-brand,
.footer-copy,
.footer { display: none; }
