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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #0c0c14;
    min-height: 100vh;
    color: #e2e0f0;
}

.container { max-width: 1200px; margin: 0 auto; padding: 1.5rem; }

/* Cards */
.card {
    background: #16162a;
    border: 1px solid rgba(139, 92, 246, 0.12);
    border-radius: 1rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Typography */
h1 { font-size: 1.875rem; font-weight: 700; color: #fff; margin-bottom: 0.5rem; }
h2 { font-size: 1.25rem; font-weight: 600; color: #e2e0f0; margin-bottom: 1rem; }
h3 { font-weight: 600; color: #e2e0f0; }

/* Layout */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.hidden { display: none; }
.text-center { text-align: center; }

/* Buttons */
button {
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.25s;
}
button:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, #7c3aed, #a855f7); color: white; }
.btn-primary:hover:not(:disabled) { background: linear-gradient(135deg, #6d28d9, #9333ea); box-shadow: 0 0 20px rgba(139, 92, 246, 0.3); }
.btn-secondary { background: #1e1e38; color: #a5a3b8; border: 1px solid rgba(139, 92, 246, 0.2); }
.btn-secondary:hover:not(:disabled) { background: #262646; color: #e2e0f0; }
.btn-success { background: linear-gradient(135deg, #059669, #10b981); color: white; }
.btn-success:hover:not(:disabled) { background: linear-gradient(135deg, #047857, #059669); box-shadow: 0 0 20px rgba(16, 185, 129, 0.3); }
.btn-full { width: 100%; }

/* Input */
input[type="text"] {
    width: 100%;
    padding: 0.625rem 1rem;
    font-size: 1.125rem;
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 0.75rem;
    background: #1a1a30;
    color: #e2e0f0;
    outline: none;
    transition: all 0.25s;
}
input[type="text"]::placeholder { color: #5a587a; }
input[type="text"]:focus { border-color: #7c3aed; box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15); }
input[type="text"]:disabled { background: #12121f; color: #a5a3b8; }

/* Rating radio buttons */
.rating-group { display: flex; gap: 0.75rem; margin-top: 0.375rem; }
.rating-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}
.rating-option label {
    font-size: 0.625rem;
    color: #5a587a;
    transition: color 0.2s;
}
.rating-radio {
    appearance: none;
    width: 30px;
    height: 30px;
    border: 2px solid #2e2e50;
    border-radius: 50%;
    background: #1a1a30;
    cursor: pointer;
    transition: all 0.25s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.75rem;
    color: #5a587a;
}
.rating-radio:hover { border-color: #7c3aed; background: #1e1040; color: #a78bfa; }
.rating-radio:checked { border-color: #7c3aed; background: linear-gradient(135deg, #7c3aed, #a855f7); color: white; box-shadow: 0 0 12px rgba(139, 92, 246, 0.3); }
.rating-radio:disabled { opacity: 0.3; cursor: not-allowed; }
.rating-option:has(input:checked) label { color: #a78bfa; font-weight: 500; }

/* Checkbox */
.checkbox-wrap { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.75rem; }
.checkbox-wrap input[type="checkbox"] { width: 1.125rem; height: 1.125rem; accent-color: #ef4444; }
.checkbox-wrap label { font-size: 0.875rem; color: #ef4444; }

/* Suggestions display */
.suggestion-item {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid rgba(139, 92, 246, 0.06);
    color: #c4c2d8;
    font-size: 0.9rem;
    transition: background 0.15s;
}
.suggestion-item:hover { background: rgba(139, 92, 246, 0.08); color: #fff; }
.suggestion-item:last-child { border-bottom: none; }

.author-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid rgba(139, 92, 246, 0.06);
    transition: background 0.15s;
}
.author-item:hover { background: rgba(139, 92, 246, 0.08); }
.author-item:last-child { border-bottom: none; }
.author-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    background: #2e2e50;
    border: 1px solid rgba(139, 92, 246, 0.15);
}
.author-name { font-size: 0.875rem; font-weight: 500; color: #e2e0f0; }
.author-slug { font-size: 0.75rem; color: #5a587a; }

/* Section labels */
.section-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: #7c3aed;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.375rem;
    padding-left: 0.25rem;
}

/* Metrics badge */
.metrics {
    font-size: 0.8rem;
    color: #5a587a;
    display: flex;
    gap: 0.75rem;
}
.metrics .metric-value { font-weight: 600; color: #a78bfa; }

/* Results area */
.results-box {
    border: 1px solid rgba(139, 92, 246, 0.1);
    border-radius: 0.75rem;
    min-height: 180px;
    max-height: 400px;
    overflow-y: auto;
    padding: 0.5rem;
    background: #0f0f1e;
}
.results-box .empty { color: #5a587a; font-size: 0.875rem; padding: 1rem; text-align: center; }
.results-box .error { color: #ef4444; font-size: 0.875rem; padding: 1rem; }
.results-box .loading { color: #5a587a; font-size: 0.875rem; padding: 1rem; text-align: center; }

/* Authors box — no scroll, auto height */
.authors-box {
    min-height: auto;
    max-height: none;
    overflow-y: visible;
}

/* Custom scrollbar */
.results-box::-webkit-scrollbar { width: 6px; }
.results-box::-webkit-scrollbar-track { background: transparent; }
.results-box::-webkit-scrollbar-thumb { background: #2e2e50; border-radius: 3px; }
.results-box::-webkit-scrollbar-thumb:hover { background: #3e3e60; }

/* Query banner */
.query-banner {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.12), rgba(168, 85, 247, 0.08));
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 0.75rem;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
}
.query-banner .query-text { font-size: 1.25rem; font-weight: 700; color: #a78bfa; }
.query-banner .query-label { font-size: 0.8rem; color: #7c3aed; font-weight: 600; margin-bottom: 0.25rem; text-transform: uppercase; letter-spacing: 0.05em; }

/* Column header */
.column-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(139, 92, 246, 0.1);
}

/* Rating section */
.rating-row { margin-bottom: 0.75rem; }
.rating-label { font-size: 0.875rem; color: #8b8aa0; margin-bottom: 0.25rem; }

/* Navigation */
.nav-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
}

/* Spinner */
.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #2e2e50;
    border-top-color: #7c3aed;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    display: inline-block;
    vertical-align: middle;
    margin-left: 0.5rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Progress bar */
.progress-bar-wrap {
    background: #1a1a30;
    border-radius: 999px;
    height: 6px;
    margin-bottom: 1.5rem;
    overflow: hidden;
}
.progress-bar-fill {
    background: linear-gradient(90deg, #7c3aed, #a855f7);
    height: 100%;
    border-radius: 999px;
    transition: width 0.3s;
    box-shadow: 0 0 8px rgba(139, 92, 246, 0.4);
}

/* Subtitle text */
.subtitle { color: #5a587a; }

/* Setup screen glow effect */
#setup-screen h1 {
    background: linear-gradient(135deg, #fff, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Card glow on hover */
.card {
    transition: border-color 0.3s;
}
.card:hover {
    border-color: rgba(139, 92, 246, 0.25);
}

/* Finish screen */
.finish-glow {
    color: #10b981 !important;
    background: linear-gradient(135deg, #10b981, #34d399) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    background-clip: text !important;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal-overlay.hidden {
    display: none;
}
.modal {
    background: #16162a;
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 1rem;
    padding: 2rem;
    max-width: 420px;
    width: 90%;
    text-align: center;
    box-shadow: 0 0 40px rgba(124, 58, 237, 0.15);
}
.modal p {
    font-size: 1rem;
    color: #e2e0f0;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}
.modal-buttons {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}
.modal-buttons button {
    min-width: 100px;
}

/* Responsive */
@media (max-width: 768px) {
    .grid { grid-template-columns: 1fr; }
    .container { padding: 1rem; }
}

/* Login overlay */
.login-overlay {
    position: fixed;
    inset: 0;
    background: #0c0c14;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}
.login-overlay.hidden { display: none; }
.login-card {
    background: #16162a;
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 1rem;
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 0 40px rgba(124, 58, 237, 0.15);
}
.login-card h2 {
    margin-bottom: 0.5rem;
}
.login-card input[type="password"] {
    width: 100%;
    padding: 0.625rem 1rem;
    font-size: 1rem;
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 0.75rem;
    background: #1a1a30;
    color: #e2e0f0;
    outline: none;
    transition: all 0.25s;
}
.login-card input[type="password"]::placeholder { color: #5a587a; }
.login-card input[type="password"]:focus { border-color: #7c3aed; box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15); }
.login-error { color: #ef4444; font-size: 0.85rem; margin-top: 0.5rem; }
.login-error.hidden { display: none; }
