/* CrowdSky - MVP Styles */

:root {
    --bg: #0d1117;
    --bg-card: #161b22;
    --border: #30363d;
    --text: #e6edf3;
    --text-muted: #8b949e;
    --accent: #58a6ff;
    --accent-hover: #79c0ff;
    --success: #3fb950;
    --warning: #d29922;
    --danger: #f85149;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--accent);
    text-decoration: none;
}
a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* Header */
.site-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1.5rem;
}
.site-header nav {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
}
.logo:hover {
    color: var(--accent);
    text-decoration: none;
}
.nav-links {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}
.user-info {
    color: var(--text-muted);
    font-size: 0.875rem;
}
/* Link to sister service CrowdSci */
.nav-external {
    color: var(--accent);
    font-weight: 600;
}
.nav-external:hover {
    color: var(--accent-hover);
}

/* Main */
main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    flex: 1;
    width: 100%;
}

/* Footer */
.site-footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 1rem 1.5rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8125rem;
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}
.form-group label {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}
.form-group input,
.form-group select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    font-size: 0.9375rem;
}
.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent);
}

.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-card);
    color: var(--text);
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.15s;
}
.btn:hover {
    background: var(--border);
    text-decoration: none;
}
.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.btn-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: #fff;
}

/* Alerts */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}
.alert-error {
    background: rgba(248, 81, 73, 0.15);
    border: 1px solid var(--danger);
    color: var(--danger);
}
.alert-success {
    background: rgba(63, 185, 80, 0.15);
    border: 1px solid var(--success);
    color: var(--success);
}
.alert-warning {
    background: rgba(210, 153, 34, 0.15);
    border: 1px solid var(--warning);
    color: var(--warning);
}

/* Scrub setting bar */
.scrub-setting-bar {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.75rem 1.25rem;
    margin-bottom: 1.25rem;
}
.scrub-toggle-label {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
    font-size: 0.9375rem;
    color: var(--text);
    user-select: none;
}
.scrub-toggle-label input[type="checkbox"] {
    display: none;
}
.scrub-toggle-track {
    position: relative;
    width: 36px;
    height: 20px;
    background: var(--border);
    border-radius: 10px;
    flex-shrink: 0;
    transition: background 0.2s;
}
.scrub-toggle-label input:checked ~ .scrub-toggle-track {
    background: var(--accent);
}
.scrub-toggle-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 14px;
    height: 14px;
    background: #fff;
    border-radius: 50%;
    transition: left 0.2s;
}
.scrub-toggle-label input:checked ~ .scrub-toggle-track .scrub-toggle-thumb {
    left: 19px;
}
.scrub-toggle-hint {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* Upload zone */
.upload-zone {
    padding: 2rem;
    text-align: center;
}
.upload-zone p {
    color: var(--text-muted);
    margin-top: 0.75rem;
    font-size: 0.875rem;
}

/* File list */
.file-list {
    list-style: none;
    margin-top: 1rem;
}
.file-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
}
.file-list li:last-child {
    border-bottom: none;
}
.file-status {
    font-size: 0.8125rem;
    color: var(--text-muted);
}
.file-status.done {
    color: var(--success);
}
.file-status.error {
    color: var(--danger);
}

/* Progress bar */
.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 1rem;
}
.progress-bar .fill {
    height: 100%;
    background: var(--accent);
    transition: width 0.3s;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
}
th, td {
    padding: 0.5rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
}
th {
    color: var(--text-muted);
    font-weight: 600;
}

/* Status badges */
.badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-pending   { background: rgba(210,153,34,0.2);  color: var(--warning); }
.badge-processing { background: rgba(88,166,255,0.2); color: var(--accent); }
.badge-completed { background: rgba(63,185,80,0.2);   color: var(--success); }
.badge-complete  { background: rgba(63,185,80,0.2);   color: var(--success); }
.badge-uploading { background: rgba(88,166,255,0.2);  color: var(--accent); }
.badge-expired   { background: rgba(139,148,158,0.2); color: var(--text-muted); }
.badge-failed    { background: rgba(248,81,73,0.2);   color: var(--danger); }

/* Two-column auth layout */
.auth-container {
    max-width: 400px;
    margin: 2rem auto;
}

/* ===== Splash / Landing Page ===== */

.splash-page .site-header {
    background: transparent;
    border-bottom: none;
    position: absolute;
    width: 100%;
    z-index: 10;
}

/* ---------- Hero ---------- */

.splash-hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    inset: 0;
    background:
        url('https://images.unsplash.com/photo-1462331940025-496dfbfc7564?auto=format&fit=crop&w=1920&q=80')
        center / cover no-repeat;
    filter: brightness(0.3) saturate(1.2);
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 720px;
    padding: 2rem 1.5rem;
}

.hero-title {
    font-size: 4.5rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 0.75rem;
    background: linear-gradient(135deg, #fff 0%, var(--accent) 50%, #a371f7 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-tagline {
    font-size: 1.35rem;
    color: rgba(255,255,255,0.9);
    margin-bottom: 1rem;
    font-weight: 500;
}

.hero-subtitle {
    font-size: 1.05rem;
    color: rgba(255,255,255,0.65);
    line-height: 1.7;
    margin-bottom: 1.5rem;
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
}

.hero-cta {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

.btn-lg {
    padding: 0.75rem 2rem;
    font-size: 1.125rem;
}

.btn-outline {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.4);
    color: #fff;
}
.btn-outline:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.7);
    color: #fff;
    text-decoration: none;
}

/* scroll-down hint */
.hero-scroll-hint {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
}
.hero-scroll-hint span {
    display: block;
    width: 24px;
    height: 24px;
    border-right: 2px solid rgba(255,255,255,0.4);
    border-bottom: 2px solid rgba(255,255,255,0.4);
    transform: rotate(45deg);
    animation: scrollBounce 2s ease infinite;
}
@keyframes scrollBounce {
    0%, 100% { transform: rotate(45deg) translate(0, 0); opacity: 0.4; }
    50%      { transform: rotate(45deg) translate(6px, 6px); opacity: 1; }
}

/* ---------- Starfield (shared) ---------- */

.starfield {
    position: absolute;
    inset: 0;
    z-index: 1;
}

.stars {
    position: absolute;
    inset: 0;
    background-repeat: repeat;
    animation: starDrift 120s linear infinite;
}

.stars-sm {
    background-image:
        radial-gradient(1px 1px at 50px 80px, rgba(255,255,255,0.6), transparent),
        radial-gradient(1px 1px at 150px 200px, rgba(255,255,255,0.5), transparent),
        radial-gradient(1px 1px at 300px 50px, rgba(255,255,255,0.4), transparent),
        radial-gradient(1px 1px at 450px 320px, rgba(255,255,255,0.5), transparent),
        radial-gradient(1px 1px at 80px 400px, rgba(255,255,255,0.3), transparent),
        radial-gradient(1px 1px at 520px 150px, rgba(255,255,255,0.5), transparent),
        radial-gradient(1px 1px at 200px 500px, rgba(255,255,255,0.4), transparent),
        radial-gradient(1px 1px at 600px 280px, rgba(255,255,255,0.6), transparent),
        radial-gradient(1px 1px at 700px 450px, rgba(255,255,255,0.3), transparent),
        radial-gradient(1px 1px at 350px 600px, rgba(255,255,255,0.5), transparent),
        radial-gradient(1px 1px at 100px 650px, rgba(255,255,255,0.4), transparent),
        radial-gradient(1px 1px at 750px 100px, rgba(255,255,255,0.5), transparent);
    background-size: 800px 700px;
    animation-duration: 180s;
}

.stars-md {
    background-image:
        radial-gradient(1.5px 1.5px at 120px 160px, rgba(255,255,255,0.7), transparent),
        radial-gradient(1.5px 1.5px at 400px 90px, rgba(255,255,255,0.6), transparent),
        radial-gradient(1.5px 1.5px at 250px 380px, rgba(255,255,255,0.5), transparent),
        radial-gradient(1.5px 1.5px at 550px 500px, rgba(255,255,255,0.7), transparent),
        radial-gradient(1.5px 1.5px at 50px 300px, rgba(255,255,255,0.4), transparent),
        radial-gradient(1.5px 1.5px at 650px 200px, rgba(255,255,255,0.6), transparent),
        radial-gradient(1.5px 1.5px at 180px 550px, rgba(255,255,255,0.5), transparent),
        radial-gradient(1.5px 1.5px at 480px 650px, rgba(255,255,255,0.7), transparent);
    background-size: 700px 700px;
    animation-duration: 140s;
}

.stars-lg {
    background-image:
        radial-gradient(2px 2px at 200px 250px, rgba(255,255,255,0.8), transparent),
        radial-gradient(2px 2px at 500px 400px, rgba(255,255,255,0.9), transparent),
        radial-gradient(2px 2px at 100px 500px, rgba(255,255,255,0.7), transparent),
        radial-gradient(2px 2px at 650px 100px, rgba(255,255,255,0.8), transparent),
        radial-gradient(2.5px 2.5px at 350px 350px, rgba(136,198,255,0.9), transparent);
    background-size: 750px 600px;
    animation-duration: 100s;
    animation-name: starTwinkle;
}

@keyframes starDrift {
    from { transform: translateY(0); }
    to   { transform: translateY(-700px); }
}

@keyframes starTwinkle {
    0%, 100% { opacity: 1; transform: translateY(0); }
    25%      { opacity: 0.7; }
    50%      { opacity: 1; transform: translateY(-300px); }
    75%      { opacity: 0.8; }
}

/* ---------- Generic splash sections ---------- */

.splash-section {
    padding: 5rem 1.5rem;
}

.splash-section-dark {
    background: var(--bg-card);
}

.section-inner {
    max-width: 960px;
    margin: 0 auto;
}

.section-title {
    font-size: 2rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 0.75rem;
    letter-spacing: -0.01em;
}

.section-lead {
    text-align: center;
    color: var(--text-muted);
    font-size: 1.05rem;
    margin-bottom: 3rem;
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
}

/* ---------- Dual-purpose cards ---------- */

.dual-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
    margin-top: 2.5rem;
}

.dual-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 2.5rem 2rem;
}

.dual-card-icon {
    color: var(--accent);
    margin-bottom: 1.25rem;
}

.dual-card h3 {
    font-size: 1.2rem;
    margin-bottom: 0.75rem;
    color: var(--text);
}

.dual-card p {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.7;
}

/* ---------- How-it-works steps ---------- */

.steps-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

.step-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 2rem 1.5rem;
    text-align: center;
    position: relative;
}

.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
}

.step-card h3 {
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
    color: var(--accent);
}

.step-card p {
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.7;
}

/* ---------- Showcase / community section ---------- */

.splash-showcase {
    position: relative;
    padding: 6rem 1.5rem;
    overflow: hidden;
}

.showcase-bg {
    position: absolute;
    inset: 0;
    background:
        url('https://images.unsplash.com/photo-1419242902214-272b3f66ee7a?auto=format&fit=crop&w=1920&q=80')
        center / cover no-repeat;
    filter: brightness(0.18) saturate(1.1);
}

.showcase-content {
    position: relative;
    z-index: 1;
    text-align: center;
}

.showcase-text {
    color: rgba(255,255,255,0.78);
    font-size: 1.1rem;
    line-height: 1.8;
    max-width: 680px;
    margin: 0 auto 1.25rem;
}
.showcase-text strong {
    color: #fff;
}

/* ---------- Final CTA ---------- */

.splash-cta {
    padding: 5rem 1.5rem;
    background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg) 100%);
}

.splash-cta .section-title {
    margin-bottom: 0.5rem;
}

.splash-cta .section-lead {
    margin-bottom: 2rem;
}

/* ---------- Funding & Acknowledgments ---------- */

.splash-funding {
    background: var(--bg-card);
}

.splash-funding .section-lead {
    text-align: center;
    max-width: 760px;
    margin: 0 auto 2rem;
}

.splash-funding .section-lead code {
    background: rgba(255,255,255,0.06);
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    font-size: 0.95em;
}

.funding-logos {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 2.5rem;
    margin: 2rem auto 2.5rem;
}

.funding-logo-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    padding: 1rem 1.5rem;
    border-radius: 6px;
    transition: transform 0.15s ease;
}

.funding-logo-link:hover {
    transform: translateY(-2px);
}

.funding-logo {
    display: block;
    max-height: 64px;
    width: auto;
}

.funding-summary {
    max-width: 820px;
    margin: 0 auto;
    padding: 1.75rem 2rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-muted);
    line-height: 1.75;
}

.funding-summary h3 {
    margin: 0 0 0.75rem;
    color: var(--accent);
    font-size: 1.1rem;
}

.funding-summary p {
    margin: 0 0 1rem;
    font-size: 0.95rem;
}

.funding-details {
    margin-top: 1rem;
    border-top: 1px solid var(--border);
    padding-top: 1rem;
}

.funding-details summary {
    cursor: pointer;
    color: var(--accent);
    font-size: 0.9rem;
    user-select: none;
}

.funding-details summary:hover {
    color: var(--text);
}

.funding-details p {
    margin-top: 0.85rem;
    font-size: 0.9rem;
}

.funding-meta {
    text-align: center;
    margin: 2rem auto 0;
    max-width: 760px;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.footer-funding {
    margin-top: 0.4rem;
    font-size: 0.78rem;
    opacity: 0.85;
}

/* ---------- Responsive ---------- */

@media (max-width: 768px) {
    .dual-cards {
        grid-template-columns: 1fr;
    }
    .steps-grid {
        grid-template-columns: 1fr;
    }
    .hero-title {
        font-size: 3rem;
    }
    .hero-tagline {
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 2.5rem;
    }
    .splash-section {
        padding: 3rem 1rem;
    }
    .dual-card {
        padding: 1.5rem 1.25rem;
    }
}

/* ===== Button sizes ===== */
.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

/* ===== Warning button ===== */
.btn-warning {
    background: #d29922;
    border-color: #d29922;
    color: #fff;
}
.btn-warning:hover {
    background: #bb8009;
    border-color: #bb8009;
    color: #fff;
}

/* ===== Danger button ===== */
.btn-danger {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}
.btn-danger:hover {
    background: #da3633;
    border-color: #da3633;
    color: #fff;
}

/* ===== Disabled button ===== */
.btn-disabled,
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* ===== File list scrollable container ===== */
.file-list-container {
    max-height: 400px;
    overflow-y: auto;
    margin-top: 1rem;
    border: 1px solid var(--border);
    border-radius: 4px;
}
.file-list-container::-webkit-scrollbar {
    width: 8px;
}
.file-list-container::-webkit-scrollbar-track {
    background: var(--bg);
}
.file-list-container::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}
.file-list-container .file-list {
    margin-top: 0;
}

/* ===== Upload progress row ===== */
.upload-progress-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
}
.upload-progress-row .progress-bar {
    flex: 1;
    margin-top: 0;
}

/* ===== View toggle ===== */
.view-toggle {
    display: inline-flex;
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 1.5rem;
}
.view-toggle button {
    padding: 0.4rem 1rem;
    background: var(--bg-card);
    border: none;
    color: var(--text-muted);
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.view-toggle button:not(:last-child) {
    border-right: 1px solid var(--border);
}
.view-toggle button.active {
    background: var(--accent);
    color: #fff;
}

/* ===== Sky map ===== */
.skymap-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}
.skymap-container svg {
    width: 100%;
    display: block;
}
.skymap-container .graticule {
    fill: none;
    stroke: var(--border);
    stroke-width: 0.5;
    stroke-opacity: 0.6;
}
.skymap-container .outline {
    fill: none;
    stroke: var(--text-muted);
    stroke-width: 1;
}
.skymap-container .mw-band {
    pointer-events: none;
}
.skymap-container .stack-dot {
    fill: var(--danger);
    fill-opacity: 0.8;
    cursor: pointer;
    transition: fill-opacity 0.15s;
}
.skymap-container .stack-dot:hover {
    fill-opacity: 1;
}
.skymap-container .stack-dot.dimmed {
    fill-opacity: 0.15;
}
.skymap-container .stack-dot.selected {
    fill-opacity: 1;
    stroke: #fff;
    stroke-width: 1;
}
/* LP is primarily an H-alpha filter, so it gets red; IRCUT (no filter) gets blue. */
.skymap-container .stack-dot.filter-ircut { fill: #58a6ff; }
.skymap-container .stack-dot.filter-lp    { fill: #f85149; }
.skymap-container .tick-label {
    fill: var(--text-muted);
    font-size: 10px;
}

/* Timeline panel */
.timeline-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}
.timeline-container svg {
    width: 100%;
    display: block;
}
.timeline-container .timeline-dot {
    fill: var(--danger);
    fill-opacity: 0.8;
}
.timeline-container .timeline-dot.dimmed {
    fill-opacity: 0.15;
}
.timeline-container .timeline-dot.filter-ircut { fill: #58a6ff; }
.timeline-container .timeline-dot.filter-lp    { fill: #f85149; }
.timeline-container .brush .selection {
    fill: var(--accent);
    fill-opacity: 0.2;
    stroke: var(--accent);
}

/* Selection summary */
.selection-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    font-size: 0.9375rem;
}
.selection-summary .summary-text {
    color: var(--text-muted);
}
.selection-summary .summary-text strong {
    color: var(--text);
}

/* ===== Tooltip ===== */
.map-tooltip {
    position: absolute;
    pointer-events: none;
    background: rgba(22, 27, 34, 0.95);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
    color: var(--text);
    white-space: nowrap;
    z-index: 100;
    opacity: 0;
    transition: opacity 0.15s;
}
.map-tooltip.visible {
    opacity: 1;
}
.map-tooltip.thumb-mode { white-space: normal; padding: 4px; transform: translateY(-100%); }

.chunk-key-link {
    text-decoration: underline;
    text-decoration-style: dotted;
}
.chunk-key-link[data-id] {
    cursor: pointer;
    color: var(--accent);
}

/* ===== Lightbox overlay ===== */
.lightbox-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.85);
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.lightbox-overlay.active {
    display: flex;
}
.lightbox-overlay img {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 4px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
}

/* ===== Splash Stats Section ===== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.75rem 1.25rem;
    text-align: center;
    transition: border-color 0.2s, transform 0.2s;
}
.stat-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.stat-value {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--accent);
    letter-spacing: -0.02em;
    line-height: 1.2;
    margin-bottom: 0.35rem;
}

.stat-label {
    font-size: 0.8125rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

/* --- Leaderboard --- */

.leaderboard-container {
    margin-bottom: 3rem;
}

.leaderboard-title {
    font-size: 1.35rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 0.35rem;
    color: var(--text);
}

.leaderboard-subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.leaderboard {
    max-width: 600px;
    margin: 0 auto;
}

.leaderboard-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem;
    font-size: 0.9rem;
}

.lb-row {
    display: grid;
    grid-template-columns: 2rem 1fr 3fr 7rem;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 0.5rem;
    transition: border-color 0.2s;
}
.lb-row:hover {
    border-color: var(--accent);
}

.lb-rank {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-muted);
    text-align: center;
}

.lb-row.medal-gold .lb-rank   { color: #ffd700; }
.lb-row.medal-silver .lb-rank { color: #c0c0c0; }
.lb-row.medal-bronze .lb-rank { color: #cd7f32; }

.lb-row.medal-gold  { border-color: rgba(255, 215, 0, 0.3); }
.lb-row.medal-silver { border-color: rgba(192, 192, 192, 0.25); }
.lb-row.medal-bronze { border-color: rgba(205, 127, 50, 0.25); }

.lb-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lb-bar-bg {
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.lb-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #a371f7);
    border-radius: 4px;
    transition: width 0.6s ease-out;
}

.lb-count {
    font-size: 0.8125rem;
    color: var(--text-muted);
    text-align: right;
    white-space: nowrap;
}

/* --- Global sky map on splash --- */

.global-skymap-container {
    margin-bottom: 1rem;
}

.global-skymap-container .skymap-container {
    background: var(--bg);
}

/* ===== Responsive: stats ===== */

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .lb-row {
        grid-template-columns: 2rem 1fr 2fr 5.5rem;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .stat-value {
        font-size: 1.75rem;
    }
    .lb-row {
        grid-template-columns: 1.5rem 1fr 6rem;
    }
    .lb-bar-bg {
        display: none;
    }
}

/* --- Object searchable multi-select combobox (stacks.php) --- */
.obj-combo {
    position: relative;
    display: inline-block;
    vertical-align: middle;
}
.obj-combo-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.6rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    cursor: pointer;
    font-size: 0.875rem;
    min-width: 9rem;
    text-align: left;
}
.obj-combo-trigger:hover { border-color: var(--accent); }
.obj-combo-caret { font-size: 0.65em; opacity: 0.55; margin-left: auto; }
.obj-combo-panel {
    display: none;
    position: absolute;
    z-index: 300;
    top: calc(100% + 4px);
    left: 0;
    min-width: 230px;
    max-width: 340px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.5);
    padding: 0.5rem;
}
.obj-combo-panel.open { display: block; }
.obj-combo-search {
    width: 100%;
    margin-bottom: 0.4rem;
    padding: 0.3rem 0.5rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    font-size: 0.875rem;
}
.obj-combo-search:focus { outline: none; border-color: var(--accent); }
.obj-combo-list {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 0.4rem;
}
.obj-combo-item {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.22rem 0.3rem;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text);
    user-select: none;
}
.obj-combo-item:hover { background: rgba(88,166,255,0.08); }
.obj-combo-item.hidden { display: none; }
.obj-combo-item input[type=checkbox] { cursor: pointer; }
.obj-combo-actions {
    display: flex;
    gap: 0.4rem;
    padding-top: 0.4rem;
    border-top: 1px solid var(--border);
}

/* ===== Stacking Quality page ===== */
.sq-lead {
    font-size: 1.1rem;
    color: var(--text-muted);
    max-width: 720px;
    margin-bottom: 1.5rem;
    line-height: 1.7;
}
.sq-takeaway {
    border-left: 4px solid var(--success);
}
.sq-takeaway h2 { margin-top: 0; }
.sq-img {
    width: 100%;
    border-radius: 6px;
    border: 1px solid var(--border);
    margin: 1rem 0;
}
.sq-caption {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}
.sq-table-wrap { overflow-x: auto; }
.sq-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}
.sq-table th,
.sq-table td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
}
.sq-table thead th {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.sq-good  { color: var(--success); font-weight: 600; }
.sq-neutral { color: var(--warning); }
.sq-table-details th {
    color: var(--text-muted);
    font-weight: 600;
    white-space: nowrap;
    width: 12rem;
}
.sq-formula {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    text-align: center;
    overflow-x: auto;
}
.sq-formula sub { font-size: 0.75em; }
.sq-reasons {
    padding-left: 1.25rem;
    line-height: 1.7;
}
.sq-reasons li { margin-bottom: 0.75rem; }
.sq-hist-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}
@media (max-width: 768px) {
    .sq-hist-grid { grid-template-columns: 1fr; }
    .sq-table-details th { width: auto; }
}

/* ===== Target finder (splash-page CrowdSci integration) ===== */
.target-finder {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
    justify-content: center;
    max-width: 760px;
    margin: 0 auto 1rem;
}
.tf-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: left;
}
.tf-field select,
.tf-field input {
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.55rem 0.7rem;
    font-size: 1rem;
    min-width: 14rem;
}
.tf-field input:focus,
.tf-field select:focus {
    outline: none;
    border-color: var(--accent);
}
.target-finder .btn {
    padding: 0.6rem 1.2rem;
    font-size: 1rem;
}
.tf-status {
    text-align: center;
    color: var(--text-muted);
    min-height: 1.4rem;
    margin-bottom: 1rem;
}
#tf-results-wrap {
    max-width: 860px;
    margin: 0 auto;
    overflow-x: auto;
}
.tf-table {
    border-collapse: collapse;
    width: 100%;
    font-size: 0.9rem;
}
.tf-table th,
.tf-table td {
    text-align: left;
    padding: 0.45rem 0.7rem;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.tf-table th {
    color: var(--text-muted);
    font-weight: 600;
}
.tf-table td {
    font-variant-numeric: tabular-nums;
}
.tf-table tbody tr {
    cursor: crosshair;
}
.tf-table tbody tr:hover td {
    background: var(--bg-card);
}
.tf-sky-tip {
    position: fixed;
    z-index: 60;
    display: none;
    padding: 4px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
    pointer-events: none;
}
.tf-sky-tip img {
    display: block;
    width: 256px;
    height: 256px;
    border-radius: 4px;
    background: var(--bg);
}
.tf-sky-cap {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-align: center;
    padding: 0.25rem 0.1rem 0;
}
@media (max-width: 620px) {
    .target-finder { flex-direction: column; align-items: stretch; }
    .tf-field select, .tf-field input { min-width: 0; width: 100%; }
}

/* Zip archive read/extract status (upload page) */
.zip-status {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--accent);
    border-radius: 6px;
    color: var(--text);
    font-size: 0.9rem;
}
.zip-spinner {
    width: 1.1rem;
    height: 1.1rem;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    flex-shrink: 0;
    animation: zipSpin 0.8s linear infinite;
}
@keyframes zipSpin {
    to { transform: rotate(360deg); }
}
