/* ── Reset + variables ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:            #ffffff;
    --bg-subtle:     #f8f9fc;
    --surface:       #ffffff;
    --surface-hover: #f1f5f9;
    --border:        #e2e8f0;
    --border-active: #93c5fd;
    --primary:       #1d4ed8;
    --primary-light: #2563eb;
    --primary-muted: #dbeafe;
    --secondary:     #0369a1;
    --success:       #059669;
    --danger:        #dc2626;
    --text:          #0f172a;
    --text-muted:    #94a3b8;
    --text-secondary:#475569;
    --gradient:      linear-gradient(135deg, #1d4ed8 0%, #2563eb 60%, #0369a1 100%);
}

html { scroll-behavior: smooth; }
body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    overflow-x: hidden;
    min-height: 100vh;
}

/* ── Nav ───────────────────────────────────────────────────────────────────── */
nav {
    position: fixed; top: 0; left: 0; right: 0; z-index: 200;
    height: 62px; padding: 0 2rem;
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(16px) saturate(180%);
    border-bottom: 1px solid var(--border);
}

.nav-logo {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700; font-size: 1.05rem;
    color: var(--primary); letter-spacing: -0.02em;
    text-decoration: none;
}

.nav-links {
    display: flex; gap: 0.15rem; list-style: none; flex: 1;
}
.nav-links a {
    padding: 0.42rem 0.95rem; border-radius: 6px;
    text-decoration: none; color: var(--text-secondary);
    font-size: 0.875rem; font-weight: 500;
    cursor: pointer; transition: all 0.18s;
}
.nav-links a:hover  { color: var(--text); background: var(--surface-hover); }
.nav-links a.active { color: var(--primary-light); background: var(--primary-muted); }

/* Nav user area */
.nav-user { position: relative; flex-shrink: 0; }

.nav-login-btn {
    padding: 0.4rem 0.9rem; border-radius: 7px;
    border: 1px solid var(--border); background: none;
    font-size: 0.82rem; font-weight: 600; color: var(--text-secondary);
    text-decoration: none; white-space: nowrap;
    transition: all 0.18s; cursor: pointer;
}
.nav-login-btn:hover { background: var(--surface-hover); color: var(--text); }

.nav-avatar-btn {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--primary-muted); border: 1.5px solid var(--border-active);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.72rem; font-weight: 700; color: var(--primary);
    cursor: pointer; transition: all 0.18s; user-select: none;
    font-family: 'Space Grotesk', sans-serif;
}
.nav-avatar-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

.nav-dropdown {
    position: absolute; top: calc(100% + 0.6rem); right: 0;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 10px; min-width: 170px; overflow: hidden;
    box-shadow: 0 8px 32px rgba(29,78,216,0.1), 0 2px 8px rgba(0,0,0,0.06);
    animation: fadeIn 0.15s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }

.nav-dropdown-header {
    padding: 0.6rem 0.9rem;
    background: var(--bg-subtle); border-bottom: 1px solid var(--border);
    font-size: 0.78rem; font-weight: 600; color: var(--text);
}
.nav-dropdown-item {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.6rem 0.9rem; width: 100%; border: none; background: none;
    font-size: 0.8rem; font-weight: 500; color: var(--text-secondary);
    cursor: pointer; text-align: left; text-decoration: none;
    transition: background 0.14s; font-family: 'Inter', sans-serif;
}
.nav-dropdown-item:hover { background: var(--surface-hover); color: var(--text); }
.nav-dropdown-item.danger { color: var(--danger); }
.nav-dropdown-item.danger:hover { background: #fef2f2; color: #b91c1c; }

/* Mobile hamburger */
.nav-hamburger {
    display: none; background: none; border: none;
    cursor: pointer; padding: 0.3rem; color: var(--text-secondary);
    font-size: 1.4rem; line-height: 1;
}

.nav-mobile {
    display: none; position: fixed;
    top: 62px; left: 0; right: 0;
    background: var(--surface); border-bottom: 1px solid var(--border);
    padding: 0.5rem 1.5rem 1.25rem; z-index: 199;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}
.nav-mobile.open { display: block; }
.nav-mobile a {
    display: block; padding: 0.8rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem; font-weight: 500;
    color: var(--text-secondary); text-decoration: none;
    cursor: pointer; transition: color 0.15s;
}
.nav-mobile a:last-child { border-bottom: none; }
.nav-mobile a:hover { color: var(--primary); }

/* ── Toast notifications ───────────────────────────────────────────────────── */
.toast-container {
    position: fixed; top: 5rem; right: 1.25rem; z-index: 1000;
    display: flex; flex-direction: column; gap: 0.5rem;
    pointer-events: none;
}
.toast {
    display: flex; align-items: flex-start; gap: 0.75rem;
    padding: 0.75rem 1rem; border-radius: 10px; border: 1px solid;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    font-size: 0.855rem; font-weight: 500;
    min-width: 260px; max-width: 360px;
    pointer-events: all;
    opacity: 0; transform: translateX(0.75rem);
    transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast.show { opacity: 1; transform: translateX(0); }
.toast-body { flex: 1; line-height: 1.5; }
.toast-close {
    background: none; border: none; cursor: pointer;
    color: inherit; opacity: 0.5; font-size: 1rem;
    padding: 0; line-height: 1; flex-shrink: 0; margin-top: 1px;
}
.toast-close:hover { opacity: 1; }
.toast-success { background: #f0fdf4; border-color: #bbf7d0; color: #15803d; }
.toast-error   { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.toast-info    { background: #eff6ff; border-color: #bfdbfe; color: var(--primary); }

/* ── Page layout ───────────────────────────────────────────────────────────── */
#app { padding-top: 62px; }

.page-content {
    max-width: 960px; margin: 0 auto;
    padding: 2rem 2rem 6rem;
}

.section-header { text-align: center; margin-bottom: 1.5rem; }

.section-label {
    font-size: 0.72rem; font-weight: 600;
    letter-spacing: 0.1em; text-transform: uppercase;
    color: var(--primary-light); margin-bottom: 0.6rem;
}

.section-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    font-weight: 700; letter-spacing: -0.025em; color: var(--text);
}

.gradient-text {
    background: var(--gradient);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ── Cards + buttons ───────────────────────────────────────────────────────── */
.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 12px;
    transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.card:hover {
    border-color: var(--border-active);
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(37,99,235,0.08);
}

.btn {
    display: inline-flex; align-items: center; gap: 0.45rem;
    padding: 0.62rem 1.35rem; border-radius: 8px; border: none;
    font-weight: 600; font-size: 0.875rem;
    text-decoration: none; cursor: pointer;
    transition: all 0.18s; white-space: nowrap;
    font-family: 'Inter', sans-serif;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover {
    background: var(--primary-light);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(29,78,216,0.3);
}
.btn-secondary {
    background: var(--bg); color: var(--text-secondary);
    border: 1px solid var(--border);
}
.btn-secondary:hover {
    background: var(--surface-hover); color: var(--text);
    border-color: #cbd5e1; transform: translateY(-1px);
}

/* ── Home page ─────────────────────────────────────────────────────────────── */
.hero {
  width: 100%;
  padding: 4rem 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-sizing: border-box;
}
.venue-badge {
    display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 0.36rem 1rem; border-radius: 999px;
    background: var(--primary-muted); border: 1px solid #bfdbfe;
    color: var(--primary); font-size: 0.76rem; font-weight: 600;
    letter-spacing: 0.06em; text-transform: uppercase;
    margin-bottom: 2rem;
}
.badge-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--primary);
    animation: pulse 2.2s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.35; transform: scale(0.65); }
}
.hero-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(2rem, 5vw, 3.4rem);
    font-weight: 700; line-height: 1.1;
    letter-spacing: -0.03em; color: var(--text);
    margin-bottom: 1.5rem;
    text-align: center;
    margin-left: auto;
    margin-right: auto;
    max-width: 95%;
    word-wrap: break-word;
    overflow-wrap: break-word;
}
.hero-title .gradient-text {
    font-size: 90%; 
    display: inline-block;
    line-height: 1.2;
}
.hero-subtitle {
    font-size: 1.08rem; color: var(--text-secondary);
    line-height: 1.75; max-width: 640px; margin: 0 auto 2.25rem;
}
.cta-group {
    display: flex; flex-wrap: wrap;
    justify-content: center; gap: 0.65rem; margin-bottom: 3.5rem;
}
.paper-card-link {
    display: inline-flex; align-items: center; gap: 1.1rem;
    padding: 0.9rem 1.5rem 0.9rem 1rem;
    background: var(--bg); border: 1px solid var(--border);
    border-radius: 14px; text-decoration: none; color: inherit;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
    margin-bottom: 1.5rem;
}
.paper-card-link:hover {
    border-color: var(--border-active);
    box-shadow: 0 8px 28px rgba(37,99,235,0.10);
    transform: translateY(-2px);
}
.paper-card-icon {
    width: 48px; height: 48px; flex-shrink: 0; border-radius: 10px;
    background: var(--primary-muted);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem;
}
.paper-card-meta { display: flex; flex-direction: column; gap: 0.2rem; text-align: left; }
.paper-card-label {
    font-size: 0.68rem; font-weight: 600;
    letter-spacing: 0.09em; text-transform: uppercase; color: var(--primary-light);
}
.paper-card-title { font-family: 'Space Grotesk', sans-serif; font-size: 0.97rem; font-weight: 600; color: var(--text); }
.paper-card-arrow { font-size: 1.1rem; color: var(--text-muted); margin-left: 0.4rem; transition: transform 0.2s, color 0.2s; }
.paper-card-link:hover .paper-card-arrow { transform: translateX(4px); color: var(--primary-light); }

.stats-row {
    display: flex; flex-wrap: wrap; justify-content: center;
    max-width: 700px; margin: 0 auto 1rem;
    background: var(--bg-subtle); border: 1px solid var(--border);
    border-radius: 14px; overflow: hidden;
}
.stat-item {
    flex: 1; min-width: 120px; padding: 1.6rem 1.25rem;
    text-align: center; border-right: 1px solid var(--border);
}
.stat-item:last-child { border-right: none; }
.stat-value {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 2rem; font-weight: 700;
    background: var(--gradient);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text; line-height: 1; margin-bottom: 0.35rem;
}
.stat-label {
    font-size: 0.7rem; font-weight: 600;
    letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-muted);
}

.teaser-wrap { max-width: 1060px; margin: 0 auto 4rem; padding: 0 2rem; }
.teaser-frame {
    aspect-ratio: 16/7; background: var(--bg-subtle);
    border: 1px solid var(--border); border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted); font-size: 0.85rem;
}
.teaser-intro {
    text-align: center; max-width: 620px; margin: 0 auto 1.25rem;
    font-size: 1rem; font-weight: 500; color: var(--text-secondary);
    line-height: 1.6; letter-spacing: -0.01em;
}
.teaser-caption {
    max-width: 820px; margin: 1rem auto 0;
    display: grid; grid-template-columns: auto 1fr;
    gap: 0.55rem 0.75rem; align-items: baseline;
}
.teaser-caption-label {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.78rem; font-weight: 700; color: var(--text-secondary);
    white-space: nowrap; padding-top: 0.05rem;
}
.teaser-caption-body { font-size: 0.84rem; color: var(--text-muted); line-height: 1.75; }
.teaser-caption-body strong { color: var(--text-secondary); font-weight: 600; }

.news-wrap { max-width: 860px; margin: 0 auto 4rem; padding: 0 2rem; }
.news-header { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 1.1rem; }
.news-header-label {
    font-size: 0.85rem; font-weight: 600;
    letter-spacing: 0.1em; text-transform: uppercase; color: var(--primary-light);
}
.news-header-line { flex: 1; height: 1px; background: var(--border); }
.news-list { display: flex; flex-direction: column; gap: 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.news-item {
    display: flex; align-items: flex-start; gap: 1.1rem;
    padding: 0.95rem 1.3rem; border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}
.news-item:last-child { border-bottom: none; }
.news-item:hover { background: var(--bg-subtle); }
.news-date {
    flex-shrink: 0; font-family: 'JetBrains Mono', monospace;
    font-size: 0.95rem; font-weight: 500; color: var(--text-muted);
    padding-top: 0.1rem; min-width: 72px;
}
.news-dot { flex-shrink: 0; width: 8px; height: 8px; border-radius: 50%; margin-top: 0.35rem; background: var(--border); }
.news-dot.active { background: var(--primary-light); }
.news-dot.done   { background: var(--success); }
.news-text { font-size: 1rem; color: var(--text-secondary); line-height: 1.6; }
.news-text strong { color: var(--text); font-weight: 600; }

.contributions { max-width: 1060px; margin: 0 auto; padding: 0 2rem 6rem; }
.contrib-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.contrib-card { padding: 1.6rem; text-align: center; display: flex; flex-direction: column; align-items: center; }
.contrib-icon { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; margin-bottom: 1rem; }
.contrib-card h3 { font-family: 'Space Grotesk', sans-serif; font-size: 0.97rem; font-weight: 600; margin-bottom: 0.45rem; color: var(--text); }
.contrib-card p  { font-size: 0.855rem; color: var(--text-secondary); line-height: 1.65; }

/* ── Demo page ─────────────────────────────────────────────────────────────── */
.demo-steps {
    display: flex; align-items: center; justify-content: center;
    max-width: 380px; margin: 0 auto 2.25rem;
}
.demo-step {
    display: flex; align-items: center; gap: 0.4rem;
    padding: 0.38rem 0.7rem; border-radius: 999px;
    font-size: 0.78rem; font-weight: 600; color: var(--text-muted);
    transition: color 0.3s;
}
.demo-step.active { color: var(--primary); }
.demo-step.done   { color: var(--success); }
.demo-step-num {
    width: 20px; height: 20px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.68rem; font-weight: 700;
    background: var(--border); color: var(--text-muted);
    transition: all 0.3s; flex-shrink: 0;
}
.demo-step.active .demo-step-num { background: var(--primary); color: #fff; }
.demo-step.done   .demo-step-num { background: var(--success); color: #fff; }
.demo-step-connector { height: 1px; width: 36px; background: var(--border); flex-shrink: 0; transition: background 0.3s; }
.demo-step.done ~ .demo-step-connector { background: var(--success); }

.drop-zone {
    max-width: 860px; margin: 0 auto 1.25rem;
    border: 2px dashed var(--border); border-radius: 14px;
    padding: 3.5rem 2rem; text-align: center; cursor: pointer;
    background: var(--bg-subtle); transition: border-color 0.2s, background 0.2s;
}
.drop-zone:hover, .drop-zone.drag-over { border-color: var(--primary-light); background: var(--primary-muted); }
.drop-zone-icon { font-size: 2.6rem; margin-bottom: 0.8rem; }
.drop-zone-title { font-family: 'Space Grotesk', sans-serif; font-size: 1rem; font-weight: 600; color: var(--text); margin-bottom: 0.35rem; }
.drop-zone-sub { font-size: 0.875rem; color: var(--text-secondary); margin-bottom: 0.5rem; }
.drop-zone-browse { color: var(--primary-light); text-decoration: underline; cursor: pointer; font-weight: 500; }
.drop-zone-types { font-size: 0.76rem; color: var(--text-muted); margin-top: 0.5rem; }

.file-info-bar {
    max-width: 860px; margin: 0 auto 1.25rem;
    display: flex; align-items: center; gap: 0.9rem;
    padding: 0.85rem 1.1rem; background: var(--bg);
    border: 1px solid var(--border); border-radius: 10px;
}
.file-info-icon { font-size: 1.5rem; flex-shrink: 0; }
.file-info-name { font-weight: 600; font-size: 0.88rem; color: var(--text); }
.file-info-size { font-size: 0.76rem; color: var(--text-muted); margin-top: 0.1rem; }
.file-clear-btn {
    margin-left: auto; flex-shrink: 0;
    width: 28px; height: 28px; border-radius: 50%;
    border: 1px solid var(--border); background: none;
    color: var(--text-muted); font-size: 0.78rem;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all 0.15s;
}
.file-clear-btn:hover { background: #fee2e2; border-color: #fca5a5; color: var(--danger); }

.btn-run { padding: 0.72rem 2.2rem; font-size: 0.9rem; min-width: 150px; }
.btn-run:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

.progress-track {
    max-width: 860px; margin: 0 auto 0.6rem;
    height: 3px; background: var(--border); border-radius: 999px; overflow: hidden;
}
.progress-fill {
    height: 100%; width: 35%;
    background: var(--gradient); border-radius: 999px;
    animation: indeterminate 1.4s ease-in-out infinite;
}
@keyframes indeterminate { 0% { transform: translateX(-200%); } 100% { transform: translateX(400%); } }
.progress-label { max-width: 860px; margin: 0 auto 1.5rem; font-size: 0.82rem; color: var(--text-secondary); text-align: center; }

.run-summary {
    max-width: 860px; margin: 0 auto 1.25rem;
    display: flex; border: 1px solid var(--border);
    border-radius: 12px; overflow: hidden; background: var(--bg-subtle);
}
.run-summary-item { flex: 1; padding: 1rem 1.25rem; text-align: center; border-right: 1px solid var(--border); }
.run-summary-item:last-child { border-right: none; }
.run-summary-val { font-family: 'Space Grotesk', sans-serif; font-size: 1.6rem; font-weight: 700; line-height: 1; margin-bottom: 0.3rem; }
.run-summary-lbl { font-size: 0.68rem; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-muted); }
.val-ok  { color: var(--success); }
.val-err { color: var(--danger); }
.val-pct { background: var(--gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }

.results-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem;
    max-width: 860px; margin: 1.5rem auto 0;
    align-items: start;
}
.results-grid.is-streaming .results-panel { border-color: var(--primary-muted); animation: streamPulse 2s ease-in-out infinite; }
@keyframes streamPulse { 0%, 100% { border-color: var(--primary-muted); } 50% { border-color: var(--primary-light); } }
@media (max-width: 600px) { .results-grid { grid-template-columns: 1fr; } }
.results-panel {
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    align-self: start;
    height: auto;
    min-height: 0;
    background: #ffffff;
}
.results-panel-error { max-width: 860px; margin: 1.5rem auto 0; border: 1px solid rgba(252,165,165,0.35); border-radius: 12px; overflow: hidden; }
.results-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.65rem 1rem; background: #ffffff; border-bottom: 1px solid var(--border);
}
.results-header-left { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; font-size: 0.84rem; color: var(--text); }
.fn-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.4rem;
    font-size: 0.72rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
}
.fn-count-ok   { background: rgba(134,239,172,0.12); color: #86efac; }
.fn-count-warn { background: rgba(252,165,165,0.12); color: #fca5a5; }
.dl-all-btn {
    display: flex; align-items: center; gap: 0.3rem;
    padding: 0.26rem 0.6rem; background: var(--bg);
    border: 1px solid var(--border); border-radius: 5px;
    color: var(--text-secondary); font-size: 0.73rem; font-weight: 500;
    cursor: pointer; transition: all 0.18s; font-family: 'Inter', sans-serif; white-space: nowrap;
}
.dl-all-btn:hover { color: var(--primary); border-color: var(--border-active); background: var(--primary-muted); }
.fn-pct { font-size: 0.72rem; font-weight: 600; color: var(--text-muted); font-family: 'JetBrains Mono', monospace; min-width: 3.5rem; text-align: right; }
.fn-list { min-height: 140px; max-height: 360px; overflow-y: auto; padding: 0.65rem; background: #ffffff; }
.fn-list-empty { padding: 2rem 1rem; text-align: center; font-size: 0.8rem; color: #64748b; font-family: 'JetBrains Mono', monospace; }
.fn-item {
    display: flex; align-items: center; gap: 0.55rem;
    padding: 0.45rem 0.7rem; border-radius: 7px; margin-bottom: 0.35rem;
    font-family: 'JetBrains Mono', monospace; font-size: 0.79rem; line-height: 1.3;
}
.fn-item-ok  { background: rgba(134,239,172,0.12); color: #166534; border: 1px solid rgba(22,101,52,0.2); }
.fn-item-err { background: rgba(252,165,165,0.12); color: #991b1b; border: 1px solid rgba(153,27,27,0.22); cursor: pointer; transition: background 0.14s; }
.fn-item-err:hover { background: rgba(252,165,165,0.14); }
.fn-item-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fn-item-preview-btn, .fn-item-dl { font-size: 0.72rem; opacity: 0.7; flex-shrink: 0; cursor: pointer; transition: opacity 0.15s; padding: 0.1rem 0.35rem; border-radius: 3px; }
.fn-item-preview-btn:hover, .fn-item-dl:hover { opacity: 1; background: rgba(252,165,165,0.2); }
.results-body { padding: 1.2rem 1.4rem; font-family: 'JetBrains Mono', monospace; font-size: 0.81rem; line-height: 1.85; color: #94a3b8; background: #1e293b; min-height: 80px; max-height: 240px; overflow-y: auto; white-space: pre-wrap; word-break: break-word; }
.results-body.is-error { color: #fca5a5; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Leaderboard page ──────────────────────────────────────────────────────── */
.lb-controls { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: center; margin-bottom: 1.25rem; }
.lb-search {
    flex: 1; min-width: 200px; padding: 0.58rem 1rem;
    background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
    color: var(--text); font-size: 0.875rem; outline: none;
    transition: border-color 0.18s; font-family: 'Inter', sans-serif;
}
.lb-search::placeholder { color: var(--text-muted); }
.lb-search:focus { border-color: var(--primary-light); box-shadow: 0 0 0 3px var(--primary-muted); }
.filter-pills { display: flex; gap: 0.4rem; }
.pill { padding: 0.42rem 0.9rem; border-radius: 999px; border: 1px solid var(--border); background: var(--bg); color: var(--text-secondary); font-size: 0.78rem; font-weight: 500; cursor: pointer; transition: all 0.18s; }
.pill.active, .pill:hover { border-color: #93c5fd; color: var(--primary-light); background: var(--primary-muted); }
.lb-wrap { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
thead { background: var(--bg-subtle); }
th { padding: 0.82rem 1.2rem; text-align: left; font-size: 0.71rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); border-bottom: 1px solid var(--border); cursor: pointer; user-select: none; white-space: nowrap; transition: color 0.15s; }
th:hover { color: var(--text); }
th.sorted { color: var(--primary-light); }
.sort-icon { margin-left: 0.3rem; opacity: 0.4; font-size: 0.65rem; }
th.sorted .sort-icon { opacity: 1; }
td { padding: 0.82rem 1.2rem; font-size: 0.875rem; border-bottom: 1px solid var(--border); color: var(--text); }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #f8fafc; }
.rank-badge { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 6px; font-weight: 700; font-size: 0.78rem; }
.r1 { background: #fef9c3; color: #a16207; }
.r2 { background: #f1f5f9; color: #64748b; }
.r3 { background: #fff7ed; color: #9a3412; }
.r-  { background: #f8fafc; color: var(--text-muted); }
.model-name { font-weight: 500; color: var(--text); }
.ours-tag { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.16rem 0.5rem; border-radius: 4px; background: var(--primary-muted); color: var(--primary); font-size: 0.67rem; font-weight: 600; margin-left: 0.5rem; }
.score-cell { display: flex; align-items: center; gap: 0.75rem; }
.score-bar-bg { flex: 1; min-width: 50px; height: 4px; background: #e2e8f0; border-radius: 999px; overflow: hidden; }
.score-bar-fg { height: 100%; border-radius: 999px; background: var(--gradient); }
.score-num { font-family: 'JetBrains Mono', monospace; font-size: 0.84rem; font-weight: 500; min-width: 38px; color: var(--text); }
.ours-row > td:first-child { border-left: 2px solid var(--primary); }
.ours-row td { background: #f8fbff; }
.ours-row:hover td { background: #eff6ff !important; }
.type-tag { padding: 0.18rem 0.5rem; border-radius: 4px; font-size: 0.7rem; font-weight: 500; background: var(--bg-subtle); color: var(--text-secondary); border: 1px solid var(--border); }

/* ── History page ──────────────────────────────────────────────────────────── */
.history-stats {
    display: flex; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1.75rem;
}
.history-stat-card {
    flex: 1; min-width: 120px; padding: 1rem 1.25rem;
    background: var(--bg-subtle); border: 1px solid var(--border);
    border-radius: 10px; text-align: center;
}
.history-stat-val {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.5rem; font-weight: 700; color: var(--primary);
    line-height: 1; margin-bottom: 0.25rem;
}
.history-stat-lbl {
    font-size: 0.68rem; font-weight: 600;
    letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-muted);
}
.history-table-wrap { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.history-table { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
.history-table thead th {
    background: var(--bg-subtle); padding: 0.72rem 1rem;
    text-align: left; font-weight: 600; color: var(--text-muted);
    font-size: 0.73rem; letter-spacing: 0.06em; text-transform: uppercase;
    border-bottom: 1px solid var(--border);
}
.history-table tbody tr { border-bottom: 1px solid var(--border); }
.history-table tbody tr:last-child { border-bottom: none; }
.history-table tbody tr:hover { background: var(--bg-subtle); }
.history-table td { padding: 0.75rem 1rem; color: var(--text-secondary); }
.history-table td.td-file { color: var(--text); font-weight: 500; font-size: 0.875rem; }
.history-table td.td-mono { font-family: 'JetBrains Mono', monospace; font-size: 0.78rem; }
.badge-ok  { color: var(--success); font-weight: 600; }
.badge-err { color: var(--danger); font-weight: 600; }
.history-del-btn {
    background: none; border: none; cursor: pointer;
    color: var(--text-muted); font-size: 0.85rem;
    padding: 0.25rem 0.4rem; border-radius: 5px; transition: all 0.15s;
}
.history-del-btn:hover { color: var(--danger); background: #fef2f2; }
.history-dl-btn {
    background: none; border: none; cursor: pointer;
    color: var(--text-muted); font-size: 0.85rem;
    padding: 0.25rem 0.4rem; border-radius: 5px; transition: all 0.15s;
}
.history-dl-btn:hover:not([disabled]) { color: var(--primary-light); background: #eff6ff; }
.history-empty { text-align: center; padding: 4rem 0; color: var(--text-muted); font-size: 0.9rem; }
.history-empty a { color: var(--primary-light); font-weight: 600; text-decoration: none; }
.history-empty a:hover { text-decoration: underline; }

/* Skeleton loader */
.skeleton { display: inline-block; height: 0.85em; border-radius: 4px; background: linear-gradient(90deg, var(--border) 25%, var(--bg-subtle) 50%, var(--border) 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ── Login page ─────────────────────────────────────────────────────────────── */
.login-wrap {
    min-height: calc(100vh - 62px);
    display: flex; align-items: center; justify-content: center;
    padding: 2rem;
}
.login-card {
    width: 100%; max-width: 380px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 16px; overflow: hidden;
    box-shadow: 0 24px 64px rgba(29,78,216,0.09), 0 4px 16px rgba(0,0,0,0.06);
}
.login-tabs { display: flex; border-bottom: 1px solid var(--border); }
.login-tab {
    flex: 1; padding: 0.9rem; background: none; border: none;
    cursor: pointer; font-size: 0.875rem; font-weight: 600;
    color: var(--text-muted); font-family: 'Inter', sans-serif;
    transition: color 0.18s, background 0.18s;
}
.login-tab.active { color: var(--primary); background: var(--primary-muted); }
.login-body { padding: 1.75rem; }
.login-field { margin-bottom: 1.1rem; }
.login-field label {
    display: block; font-size: 0.75rem; font-weight: 600;
    letter-spacing: 0.06em; text-transform: uppercase;
    color: var(--text-muted); margin-bottom: 0.45rem;
}
.login-field input {
    width: 100%; padding: 0.65rem 1rem;
    background: var(--bg); border: 1px solid var(--border);
    border-radius: 8px; color: var(--text); font-size: 0.875rem;
    outline: none; transition: border-color 0.18s, box-shadow 0.18s;
    font-family: 'Inter', sans-serif;
}
.login-field input:focus { border-color: var(--primary-light); box-shadow: 0 0 0 3px var(--primary-muted); }
.login-footer {
    padding: 0 1.75rem 1.75rem;
    display: flex; flex-direction: column; gap: 0.75rem;
}
.login-footer .btn { width: 100%; justify-content: center; }
.login-divider { text-align: center; font-size: 0.78rem; color: var(--text-muted); }
.login-msg { font-size: 0.8rem; margin-bottom: 0.85rem; padding: 0.5rem 0.75rem; border-radius: 6px; min-height: 1em; }
.login-msg.error   { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.login-msg.success { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }

/* ── Preview modal ─────────────────────────────────────────────────────────── */
.preview-modal {
    position: fixed; inset: 0; z-index: 500;
    background: rgba(15,23,42,0.4); backdrop-filter: blur(6px);
    display: flex; align-items: center; justify-content: center; padding: 1.5rem;
}
.preview-modal-box {
    background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
    width: 100%; max-width: 680px; max-height: 80vh;
    display: flex; flex-direction: column; overflow: hidden;
    box-shadow: 0 20px 60px rgba(29,78,216,0.10), 0 4px 16px rgba(0,0,0,0.06);
    animation: fadeIn 0.2s ease;
}
.preview-modal-header { display: flex; align-items: center; justify-content: space-between; padding: 0.85rem 1.2rem; background: var(--bg-subtle); border-bottom: 1px solid var(--border); flex-shrink: 0; }
.preview-modal-title { font-family: 'JetBrains Mono', monospace; font-size: 0.82rem; font-weight: 500; color: var(--text-secondary); }
.preview-modal-close { width: 28px; height: 28px; border-radius: 6px; border: 1px solid var(--border); background: none; color: var(--text-muted); font-size: 0.85rem; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.15s; }
.preview-modal-close:hover { background: var(--surface-hover); color: var(--text); border-color: #cbd5e1; }
.preview-modal-body { padding: 1.75rem 2rem; overflow-y: auto; font-size: 0.9rem; line-height: 1.8; color: var(--text-secondary); }
.preview-modal-body h1 { font-family: 'Space Grotesk', sans-serif; font-size: 1.15rem; font-weight: 700; color: var(--text); letter-spacing: -0.02em; margin: 0 0 1rem; padding-bottom: 0.65rem; border-bottom: 1px solid var(--border); }
.preview-modal-body h2 { font-family: 'Space Grotesk', sans-serif; font-size: 0.95rem; font-weight: 600; color: var(--primary-light); margin: 1.4rem 0 0.5rem; }
.preview-modal-body h3 { font-family: 'Space Grotesk', sans-serif; font-size: 0.88rem; font-weight: 600; color: var(--text); margin: 1.1rem 0 0.4rem; }
.preview-modal-body p { margin-bottom: 0.75rem; }
.preview-modal-body strong { color: var(--text); font-weight: 600; }
.preview-modal-body code { font-family: 'JetBrains Mono', monospace; font-size: 0.8rem; background: var(--bg-subtle); border: 1px solid var(--border); border-radius: 4px; padding: 0.1rem 0.38rem; color: var(--secondary); }
.preview-modal-body pre { background: var(--bg-subtle); border: 1px solid var(--border); border-radius: 8px; padding: 1rem 1.2rem; overflow-x: auto; margin: 0.75rem 0; }
.preview-modal-body pre code { background: none; border: none; padding: 0; font-size: 0.82rem; color: var(--text-secondary); }
.preview-modal-body ul { padding-left: 1.5rem; margin-bottom: 0.75rem; }
.preview-modal-body li { margin-bottom: 0.3rem; }
.preview-modal-footer { display: flex; justify-content: flex-end; gap: 0.6rem; padding: 0.75rem 1.2rem; background: var(--bg-subtle); border-top: 1px solid var(--border); flex-shrink: 0; }

/* ── Stats Ticker ───────────────────────────────────────────────────────────── */
.stats-ticker {
    width: 100%;
    max-width: 620px;
    margin: 1.5rem auto 0;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem 1.5rem;
}

.stats-ticker-track {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.stats-ticker-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    flex: 1;
}

.stats-ticker-icon {
    font-size: 1.1rem;
    opacity: 0.7;
}

.stats-ticker-value-wrapper {
    position: relative;
    width: 100%;
    height: 28px;
    perspective: 200px;
}

.stats-ticker-value {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary);
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    backface-visibility: hidden;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.stats-ticker-value.flip-out {
    transform: rotateX(90deg);
}

.stats-ticker-value.flip-in {
    animation: flipIn 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes flipIn {
    from {
        transform: rotateX(-90deg);
        opacity: 0;
    }
    to {
        transform: rotateX(0);
        opacity: 1;
    }
}

.stats-ticker-label {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-muted);
    text-align: center;
    white-space: nowrap;
}

/* ── Blog page ─────────────────────────────────────────────────────────────── */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
}

.blog-card {
    display: flex; flex-direction: column;
    padding: 1.5rem 1.6rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    text-decoration: none; color: inherit;
    transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.blog-card:hover {
    border-color: var(--border-active);
    transform: translateY(-3px);
    box-shadow: 0 8px 32px rgba(37,99,235,0.08);
}

.blog-card-featured {
    grid-column: 1 / -1;
    margin-bottom: 0.5rem;
    background: var(--bg-subtle);
    border-color: var(--border-active);
}
.blog-card-featured .blog-card-title {
    font-size: 1.35rem;
}

.blog-card-badge {
    display: inline-block;
    width: fit-content;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    background: var(--primary-muted);
    color: var(--primary);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 0.75rem;
}

.blog-card-meta {
    display: flex; align-items: center; gap: 0.65rem;
    margin-bottom: 0.65rem;
}
.blog-card-date {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem; font-weight: 500;
    color: var(--text-muted);
}
.blog-card-tag {
    padding: 0.15rem 0.55rem; border-radius: 999px;
    background: var(--bg-subtle); border: 1px solid var(--border);
    font-size: 0.68rem; font-weight: 600;
    color: var(--text-secondary);
}

.blog-card-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.05rem; font-weight: 650;
    color: var(--text); line-height: 1.35;
    margin-bottom: 0.55rem;
}

.blog-card-excerpt {
    font-size: 0.87rem; color: var(--text-secondary);
    line-height: 1.7; flex: 1;
    margin-bottom: 0.85rem;
}

.blog-card-read {
    font-size: 0.82rem; font-weight: 600;
    color: var(--primary-light);
    transition: color 0.15s;
}
.blog-card:hover .blog-card-read { color: var(--primary); }

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .nav-links { display: none; }
    .nav-hamburger { display: block; }
    .contrib-grid { grid-template-columns: 1fr; }
    .blog-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    nav { padding: 0 1rem; }
    .hero { padding: 3rem 1.25rem 2rem; }
    .page-content { padding: 2.5rem 1.25rem 5rem; }
    .contributions { padding: 0 1.25rem 4rem; }
    .teaser-wrap { padding: 0 1.25rem; }
    .stat-item { padding: 1.25rem 0.9rem; }
    .stats-ticker { padding: 0.85rem 1rem; }
    .stats-ticker-value { font-size: 1.1rem; }
    .stats-ticker-label { font-size: 0.8rem; }
}
