:root {
--primary: #7c3aed;
--primary-hover: #6d28d9;
--primary-glow: rgba(124,58,237,0.25);
--bg: #0a0a1a;
--bg-card: rgba(20,20,40,0.95);
--bg-card-hover: rgba(30,30,55,0.98);
--bg-surface: rgba(25,25,50,0.9);
--border: rgba(255,255,255,0.08);
--border-hover: rgba(124,58,237,0.4);
--text: #ffffff;
--text-muted: #9ca3af;
--text-dim: #94a3b8;
--success: #10b981;
--danger: #ef4444;
--warning: #f59e0b;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
font-family: 'Inter', -apple-system, sans-serif;
background: var(--bg);
color: var(--text);
min-height: 100vh;
overflow-x: hidden;
}
body::before {
content: '';
position: fixed;
top: 0; left: 0; right: 0; bottom: 0;
background: radial-gradient(ellipse at 50% 0%, rgba(124,58,237,0.08) 0%, transparent 60%);
pointer-events: none;
z-index: 0;
}

/* Header: injected by marketplace-header.js */

.ranking-page {
max-width: 1100px;
margin: 0 auto;
padding: 40px 24px 60px;
position: relative;
z-index: 1;
}
.ranking-page h1 {
font-size: 1.8rem;
font-weight: 800;
margin-bottom: 8px;
color: #fff;
}
.ranking-page .subtitle {
font-size: 0.9rem;
color: var(--text-muted);
margin-bottom: 24px;
}

/* Tabs — soft purple container with a brighter purple gradient on the
   active pill. Inactive tabs get a violet text accent instead of the
   neutral grey that looked nearly black against the dark page bg. */
.ranking-tabs {
display: flex;
gap: 4px;
margin-bottom: 32px;
background: rgba(124, 58, 237, 0.08);
border: 1px solid rgba(124, 58, 237, 0.22);
border-radius: 12px;
padding: 4px;
}
.ranking-tab {
flex: 1;
padding: 12px 20px;
background: transparent;
border: none;
color: #c4b5fd;
font-size: 0.9rem;
font-weight: 600;
cursor: pointer;
border-radius: 8px;
font-family: inherit;
transition: all 0.2s;
}
.ranking-tab.active {
background: linear-gradient(135deg, #8b5cf6, #7c3aed);
color: #fff;
box-shadow: 0 4px 14px rgba(124, 58, 237, 0.35);
}
.ranking-tab:hover:not(.active) {
color: #fff;
background: rgba(124, 58, 237, 0.16);
}
.ranking-panel { display: none; }
.ranking-panel.active { display: block; }

/* Algorithm tab content */
.ranking-page h2 {
font-size: 1.15rem;
font-weight: 700;
margin-top: 36px;
margin-bottom: 12px;
color: var(--text);
}
.ranking-page h2:first-child { margin-top: 0; }
.ranking-page h3 {
font-size: 0.95rem;
font-weight: 600;
margin-top: 20px;
margin-bottom: 8px;
color: var(--text-muted);
}
.ranking-page p {
font-size: 0.875rem;
color: var(--text-muted);
line-height: 1.7;
margin-bottom: 12px;
}
.ranking-page ul {
margin: 8px 0 16px 20px;
}
.ranking-page ul li {
font-size: 0.875rem;
color: var(--text-muted);
line-height: 1.8;
}

/* Score visual */
.score-demo {
display: flex;
align-items: center;
gap: 16px;
margin: 20px 0 28px;
padding: 20px;
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: 12px;
}
.score-circle {
width: 64px;
height: 64px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-size: 1.4rem;
font-weight: 800;
flex-shrink: 0;
}
.score-circle.high { background: rgba(16,185,129,0.15); color: #10b981; border: 2px solid rgba(16,185,129,0.3); }
.score-circle.mid { background: rgba(245,158,11,0.15); color: #f59e0b; border: 2px solid rgba(245,158,11,0.3); }
.score-circle.low { background: rgba(239,68,68,0.15); color: #ef4444; border: 2px solid rgba(239,68,68,0.3); }
.score-desc { font-size: 0.82rem; color: var(--text-muted); line-height: 1.6; }
.score-desc strong { color: var(--text); }

/* Signal cards */
.signal-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 10px;
margin: 16px 0 28px;
}
.signal-card {
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: 10px;
padding: 14px 16px;
transition: border-color 0.2s;
}
.signal-card:hover { border-color: var(--border-hover); }
.signal-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.signal-name { font-size: 0.82rem; font-weight: 700; color: var(--text); }
.signal-weight { font-size: 0.68rem; font-weight: 700; color: #c4b5fd; background: rgba(124,58,237,0.15); padding: 2px 8px; border-radius: 10px; }
.signal-desc { font-size: 0.75rem; color: var(--text-dim); line-height: 1.5; }

.section-divider { height: 1px; background: var(--border); margin: 36px 0; }

.evolving-badge {
display: inline-flex;
align-items: center;
gap: 6px;
padding: 6px 14px;
background: rgba(124,58,237,0.12);
border: 1px solid rgba(124,58,237,0.25);
border-radius: 20px;
font-size: 0.75rem;
font-weight: 600;
color: #c4b5fd;
margin-bottom: 16px;
}

/* ===== SURVEY TAB ===== */
.survey-intro { font-size: 0.875rem; color: var(--text-muted); line-height: 1.7; margin-bottom: 24px; }
.survey-connect { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.survey-connect button { padding: 10px 24px; background: var(--primary); border: none; border-radius: 10px; color: white; font-size: 0.9rem; font-weight: 600; cursor: pointer; font-family: inherit; margin-top: 12px; }
.survey-connect button:hover { background: var(--primary-hover); }
.survey-form { display: flex; flex-direction: column; gap: 16px; }
.survey-q {
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: 12px;
padding: 18px 20px;
}
.survey-q-label { font-size: 0.85rem; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.survey-q-desc { font-size: 0.75rem; color: var(--text-dim); margin-bottom: 12px; line-height: 1.5; }
.survey-scale {
display: flex;
gap: 4px;
}
.survey-scale label {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
padding: 8px 0;
background: rgba(255,255,255,0.04);
border: 1px solid var(--border);
border-radius: 8px;
cursor: pointer;
font-size: 0.8rem;
font-weight: 600;
color: var(--text-muted);
transition: all 0.15s;
}
.survey-scale label:hover { border-color: rgba(255,255,255,0.15); color: var(--text); }
.survey-scale input { display: none; }
.survey-scale input:checked + span { /* handled by JS */ }
.survey-scale label.selected {
background: rgba(124,58,237,0.2);
border-color: var(--primary);
color: #c4b5fd;
}
.survey-scale-labels { display: flex; justify-content: space-between; font-size: 0.62rem; color: var(--text-dim); margin-top: 4px; padding: 0 2px; }
.survey-submit-row { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.survey-submit-btn {
padding: 12px 32px;
background: linear-gradient(135deg, var(--primary), #6d28d9);
border: none;
border-radius: 10px;
color: white;
font-size: 0.9rem;
font-weight: 700;
cursor: pointer;
font-family: inherit;
transition: all 0.15s;
}
.survey-submit-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(124,58,237,0.3); }
.survey-submit-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
.survey-status { font-size: 0.82rem; color: var(--text-muted); }
.survey-status.success { color: var(--success); }
.survey-status.error { color: var(--danger); }
.survey-already { text-align: center; padding: 40px 20px; }
.survey-already h3 { font-size: 1rem; font-weight: 700; margin-bottom: 8px; color: var(--success); }
.survey-already p { font-size: 0.85rem; color: var(--text-muted); }

/* Footer: loaded by marketplace-footer.js */

@media (max-width: 768px) {
.ranking-page { padding: 24px 16px 40px; }
.ranking-page h1 { font-size: 1.4rem; }
.signal-grid { grid-template-columns: 1fr; }
.survey-scale { flex-wrap: wrap; }
.survey-scale label { min-width: calc(20% - 4px); }
}