/* ==========================================================================
   ExoDip - Standalone Deep-Space Modern UI Stylesheet
   Palette:
     Background:         #070B14
     Main surface:       #0E1524
     Secondary surface:  #151F32
     Border:             #26344A
     Primary blue:       #6FA8DC
     Accent cyan:        #7DD3C7
     Star / detection:   #F4C95D
     Main text:          #F1F5F9
     Muted text:         #94A3B8
     Error:              #F08080
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Inter:wght@400;500;600;700;800&family=Plus+Jakarta+Sans:wght@500;600;700;800&display=swap');

:root {
    --bg-space: #070B14;
    --bg-card: #0E1524;
    --bg-card-hover: #151F32;
    --bg-surface-main: #0E1524;
    --bg-surface-secondary: #151F32;
    --border-subtle: #26344A;
    --border-highlight: #6FA8DC;
    --primary-blue: #6FA8DC;
    --accent-cyan: #7DD3C7;
    --accent-star: #F4C95D;
    --accent-amber: #F4C95D;
    --accent-emerald: #7DD3C7;
    --accent-purple: #6FA8DC;
    --text-main: #F1F5F9;
    --text-muted: #94A3B8;
    --accent-error: #F08080;
    --accent-rose: #F08080;
}

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

body {
    color: var(--text-main);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 16px;
    background-color: var(--bg-space);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    background-image:
        /* Dense Micro Stars Layer 1 (500x500 tile) */
        radial-gradient(1px 1px at 25px 35px, rgba(241,245,249,0.85), transparent),
        radial-gradient(1px 1px at 75px 120px, rgba(111,168,220,0.7), transparent),
        radial-gradient(1.2px 1.2px at 140px 60px, rgba(241,245,249,0.9), transparent),
        radial-gradient(0.8px 0.8px at 180px 220px, rgba(125,211,199,0.65), transparent),
        radial-gradient(1px 1px at 230px 140px, rgba(241,245,249,0.75), transparent),
        radial-gradient(1.4px 1.4px at 290px 45px, rgba(244,201,93,0.85), transparent),
        radial-gradient(0.8px 0.8px at 340px 190px, rgba(241,245,249,0.6), transparent),
        radial-gradient(1px 1px at 390px 95px, rgba(125,211,199,0.75), transparent),
        radial-gradient(1.2px 1.2px at 440px 240px, rgba(241,245,249,0.8), transparent),
        radial-gradient(0.8px 0.8px at 485px 165px, rgba(111,168,220,0.65), transparent),
        /* Dense Micro Stars Layer 2 (650x650 tile) */
        radial-gradient(1px 1px at 40px 310px, rgba(241,245,249,0.7), transparent),
        radial-gradient(1.3px 1.3px at 95px 460px, rgba(125,211,199,0.8), transparent),
        radial-gradient(0.8px 0.8px at 165px 380px, rgba(241,245,249,0.65), transparent),
        radial-gradient(1.1px 1.1px at 245px 520px, rgba(244,201,93,0.75), transparent),
        radial-gradient(1px 1px at 320px 410px, rgba(241,245,249,0.8), transparent),
        radial-gradient(1.5px 1.5px at 385px 580px, rgba(111,168,220,0.85), transparent),
        radial-gradient(0.8px 0.8px at 460px 340px, rgba(241,245,249,0.7), transparent),
        radial-gradient(1.2px 1.2px at 530px 490px, rgba(241,245,249,0.85), transparent),
        radial-gradient(0.9px 0.9px at 595px 395px, rgba(125,211,199,0.65), transparent),
        radial-gradient(1.3px 1.3px at 625px 560px, rgba(241,245,249,0.75), transparent),
        /* Layer 3 Medium & Bright Stars (800x800 tile) */
        radial-gradient(1.8px 1.8px at 110px 180px, rgba(241,245,249,0.95), transparent),
        radial-gradient(1.5px 1.5px at 280px 320px, rgba(111,168,220,0.9), transparent),
        radial-gradient(2px 2px at 470px 140px, rgba(244,201,93,0.95), transparent),
        radial-gradient(1.6px 1.6px at 660px 420px, rgba(125,211,199,0.9), transparent),
        radial-gradient(1.7px 1.7px at 740px 210px, rgba(241,245,249,0.95), transparent),
        /* Ultra-Dark Deep Space Cosmic Canvas */
        radial-gradient(ellipse at 85% 15%, rgba(111, 168, 220, 0.045) 0%, transparent 50%),
        radial-gradient(ellipse at 15% 85%, rgba(125, 211, 199, 0.040) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(244, 201, 93, 0.020) 0%, transparent 65%);
    background-size: 
        500px 500px, 500px 500px, 500px 500px, 500px 500px, 500px 500px, 500px 500px, 500px 500px, 500px 500px, 500px 500px, 500px 500px,
        650px 650px, 650px 650px, 650px 650px, 650px 650px, 650px 650px, 650px 650px, 650px 650px, 650px 650px, 650px 650px, 650px 650px,
        800px 800px, 800px 800px, 800px 800px, 800px 800px, 800px 800px,
        100% 100%, 100% 100%, 100% 100%;
}

/* Twinkling star overlay */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        radial-gradient(1.5px 1.5px at 80px 90px, rgba(241,245,249,0.95), transparent),
        radial-gradient(2px 2px at 210px 340px, rgba(111,168,220,0.95), transparent),
        radial-gradient(1.6px 1.6px at 360px 170px, rgba(125,211,199,0.95), transparent),
        radial-gradient(2.2px 2.2px at 510px 420px, rgba(244,201,93,0.95), transparent),
        radial-gradient(1.5px 1.5px at 640px 110px, rgba(241,245,249,0.95), transparent),
        radial-gradient(1.8px 1.8px at 780px 310px, rgba(111,168,220,0.95), transparent);
    background-size: 700px 520px;
    animation: starTwinkle 6s ease-in-out infinite alternate;
    z-index: 0;
}

@keyframes starTwinkle {
    0% { opacity: 0.3; }
    50% { opacity: 0.9; }
    100% { opacity: 0.4; }
}

@media (prefers-reduced-motion: reduce) {
    body::before { animation: none !important; opacity: 0.5; }
}

/* App Layout Container */
.app-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0.9rem 2rem 2.8rem;
    position: relative;
    z-index: 1;
}

.skip-link {
    position: fixed;
    top: 0.7rem;
    left: 0.7rem;
    z-index: 1000;
    padding: 0.6rem 0.8rem;
    border-radius: 8px;
    background: var(--bg-surface-secondary);
    border: 1px solid var(--accent-cyan);
    color: var(--text-main);
    font-weight: 700;
    transform: translateY(-180%);
    transition: transform 0.18s ease;
}
.skip-link:focus { transform: translateY(0); }

:focus-visible {
    outline: 2px solid var(--accent-cyan);
    outline-offset: 3px;
}

/* Typography */
h1, h2, h3, h4 { font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; letter-spacing: -0.025em; color: var(--text-main); }
h1 { font-size: 3.8rem; line-height: 1.05; font-weight: 800; letter-spacing: -0.035em; }
h2 { font-size: 2.6rem; line-height: 1.15; font-weight: 800; letter-spacing: -0.03em; margin-bottom: 0.5rem; }
h3 { font-size: 1.45rem; font-weight: 700; letter-spacing: -0.02em; }
h4 { font-size: 1.15rem; font-weight: 600; }

.eyebrow {
    color: var(--accent-cyan);
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    margin-bottom: 0.5rem;
    display: inline-block;
}
.lead { color: #CBD5E1; font-size: 1.15rem; line-height: 1.75; }
.purple-gradient {
    background: linear-gradient(135deg, #6FA8DC 0%, #7DD3C7 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.muted { color: var(--text-muted); font-size: 0.92rem; line-height: 1.55; }
.mono { font-family: 'DM Mono', monospace; font-size: 0.88rem; }

/* ========================================================
   CLEAN NAVBAR: Completely borderless, box-free until hovered
   ======================================================== */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(7, 11, 20, 0.94);
    border-bottom: 1px solid rgba(38, 52, 74, 0.82);
    width: 100vw;
    margin-top: -0.9rem;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    padding: 0.7rem max(2rem, calc((100vw - 1440px) / 2 + 2rem));
    margin-bottom: 2rem;
    position: sticky;
    top: 0;
    z-index: 110;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.nav-brand-box {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.2rem 0;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
    user-select: none;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
}
.nav-brand-box .logo-icon {
    width: 34px;
    height: 28px;
    flex-shrink: 0;
    filter: none;
    object-fit: contain;
}
.brand-name {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: 800;
    font-size: 1.5rem;
    color: var(--text-main);
    letter-spacing: -0.02em;
}
.brand-pill {
    font-size: 0.72rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--accent-cyan);
    background: transparent;
    border: none;
    padding: 0;
    margin-left: 6px;
    opacity: 0.9;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.api-status-badge {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    padding: 4px 6px;
    background: transparent;
    border: none;
}

.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-star);
    box-shadow: 0 0 8px rgba(244, 201, 93, 0.6);
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

/* Hamburger Button */
.hamburger-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 42px;
    height: 42px;
    background: var(--bg-surface-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    cursor: pointer;
    padding: 0;
    gap: 5px;
    z-index: 120;
    transition: all 0.2s ease;
}
.hamburger-btn:hover, .hamburger-btn.active {
    border-color: var(--primary-blue);
    background: #1A2740;
}

.ham-bar {
    display: block;
    width: 20px;
    height: 2px;
    background-color: var(--text-main);
    border-radius: 2px;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.hamburger-btn.active .ham-bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.hamburger-btn.active .ham-bar:nth-child(2) {
    opacity: 0;
}
.hamburger-btn.active .ham-bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* Mobile Nav Drawer */
.mobile-nav-drawer {
    display: none;
    position: fixed;
    top: 68px;
    left: 12px;
    right: 12px;
    background: rgba(14, 21, 36, 0.98);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.85), 0 0 35px rgba(111, 168, 220, 0.18);
    padding: 1rem;
    z-index: 115;
    transform: translateY(-16px);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
}

.mobile-nav-drawer.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.mobile-nav-items {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.mobile-nav-item {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    width: 100%;
    padding: 0.85rem 0.5rem;
    min-height: 46px;
    background: transparent;
    border: none;
    box-shadow: none;
    outline: none;
    color: var(--text-muted);
    font-family: 'Inter', sans-serif;
    font-size: 1.05rem;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    transition: color 0.18s ease;
    user-select: none;
}

.mobile-nav-item:hover {
    background: transparent;
    color: var(--text-main);
    border: none;
    box-shadow: none;
    text-shadow: none;
}

.mobile-nav-item.active {
    background: transparent;
    border: none;
    box-shadow: none;
    color: var(--accent-cyan);
    font-weight: 800;
    text-shadow: none;
}

.mobile-nav-icon {
    font-size: 1.25rem;
    width: 24px;
    text-align: center;
}

.mobile-nav-footer {
    margin-top: 0.8rem;
    padding-top: 0.8rem;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    justify-content: flex-start;
    align-items: center;
}

.mobile-status {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.mobile-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(7, 11, 20, 0.75);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 105;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}
.mobile-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

.nav-item {
    position: relative;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-family: 'Inter', sans-serif;
    font-size: 1.05rem;
    font-weight: 500;
    min-height: 2.3rem;
    padding: 0 0.85rem;
    box-shadow: none;
    outline: none;
    cursor: pointer;
    transition: color 0.18s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

/* Active page link uses color only, without glow or container treatment. */
.nav-item.active {
    background: transparent;
    border: none;
    color: var(--accent-cyan);
    font-weight: 800;
    box-shadow: none;
    text-shadow: none;
}

/* Hover: color change only, no glow. */
.nav-item:hover:not(.active) {
    color: var(--text-main);
    background: transparent;
    border: none;
    box-shadow: none;
    text-shadow: none;
}

/* Cards & Panels */
.panel, .stat-card, .result-card, .feature-card, .workflow-card {
    background: var(--bg-surface-main);
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 1.35rem;
    transition: border-color 0.2s ease, transform 0.2s ease;
}
.feature-card:hover {
    border-color: var(--border-highlight);
    transform: translateY(-2px);
}

/* Feature Cards Grid */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}
@media (max-width: 900px) {
    .feature-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
    .feature-grid { grid-template-columns: 1fr; }
}

.feature-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: rgba(111, 168, 220, 0.16);
    color: var(--primary-blue);
    font-size: 1.35rem;
    margin-bottom: 0.8rem;
    border: 1px solid rgba(111, 168, 220, 0.3);
}

.feature-num {
    font-family: 'DM Mono', monospace;
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--accent-cyan);
    margin-bottom: 0.8rem;
    line-height: 1;
    opacity: 0.85;
    letter-spacing: -0.02em;
}

.feature-card h4 { margin: 0 0 0.4rem; font-size: 1.1rem; color: var(--text-main); font-weight: 600; }
.feature-card p { color: var(--text-muted); font-size: 0.90rem; line-height: 1.6; margin: 0; }

/* Hero Actions Container */
.hero-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 1.25rem;
    flex-wrap: wrap;
}

.hero-actions .btn {
    font-size: 0.88rem;
    min-height: 2.3rem;
    padding: 0 1.1rem;
    font-weight: 600;
}

/* ========================================================
   Vertical Infographic Flowchart (Symmetric, Multi-Color)
   ======================================================== */
.v-flowchart {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 22px;
    padding: 1.25rem 0.25rem 1.25rem 0.5rem;
}

/* Continuous vertical colored spine */
.v-flowchart::before {
    content: "";
    position: absolute;
    top: 24px;
    bottom: 24px;
    left: 23px; /* Centers behind the 46px wide node */
    width: 6px;
    background: linear-gradient(180deg, 
        #7DD3C7 0%, 
        #6FA8DC 40%, 
        #F4C95D 80%, 
        #7DD3C7 100%
    );
    border-radius: 999px;
    box-shadow: 0 0 10px rgba(125, 211, 199, 0.35);
    z-index: 1;
}

.v-flow-step {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 18px;
    z-index: 2;
}

/* Horizontal dotted connector from circle to content */
.v-flow-step::after {
    content: "";
    position: absolute;
    top: 23px;
    left: 46px;
    width: 18px;
    border-top: 1.5px dashed var(--border-subtle);
    z-index: 1;
}

/* Circular Node Badge */
.v-flow-node {
    flex-shrink: 0;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: #070B14;
    border: 2.5px solid var(--step-color, #7DD3C7);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'DM Mono', monospace;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.7), 0 0 12px var(--step-glow, rgba(125, 211, 199, 0.45));
}

/* Text Content Area */
.v-flow-content {
    flex: 1;
    padding-top: 4px;
}

.v-flow-title {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 1.12rem;
    font-weight: 700;
    color: var(--step-color, var(--text-main));
    letter-spacing: -0.015em;
    margin: 0 0 4px;
    line-height: 1.3;
}

.v-flow-desc {
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.55;
    margin: 0;
}

/* Step color definitions matching the new palette */
.v-step-1 { --step-color: #7DD3C7; --step-glow: rgba(125, 211, 199, 0.45); }
.v-step-2 { --step-color: #6FA8DC; --step-glow: rgba(111, 168, 220, 0.45); }
.v-step-3 { --step-color: #F4C95D; --step-glow: rgba(244, 201, 93, 0.45); }
.v-step-4 { --step-color: #7DD3C7; --step-glow: rgba(125, 211, 199, 0.45); }
.v-step-5 { --step-color: #6FA8DC; --step-glow: rgba(111, 168, 220, 0.45); }
.v-step-6 { --step-color: #F4C95D; --step-glow: rgba(244, 201, 93, 0.45); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 8px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-surface-secondary);
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.98rem;
    min-height: 2.65rem;
    padding: 0 1.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}
.btn:hover {
    border-color: var(--primary-blue);
    background: rgba(111, 168, 220, 0.18);
    color: #fff;
}
.btn-primary {
    background: linear-gradient(135deg, #6FA8DC 0%, #5897CF 100%);
    border-color: #6FA8DC;
    box-shadow: 0 4px 16px rgba(111, 168, 220, 0.35);
    color: #070B14;
    font-weight: 700;
}
.btn-primary:hover {
    background: linear-gradient(135deg, #5897CF 0%, #4684BC 100%);
    box-shadow: 0 6px 20px rgba(111, 168, 220, 0.5);
    color: #070B14;
}
.btn-full { width: 100%; }

/* Canvas Box */
#c {
    display: block;
    width: 100%;
    height: 420px;
    border-radius: 20px;
    border: 1px solid var(--border-subtle);
    box-shadow: inset 0 0 100px rgba(7, 11, 20, 0.99);
}

/* Tabs System */
.tab-nav {
    display: flex;
    gap: 24px;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 1.25rem;
}
.tab-btn {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    font-size: 1rem;
    padding: 0.65rem 0.2rem;
    cursor: pointer;
    transition: all 0.2s ease;
}
.tab-btn:hover {
    color: var(--text-main);
}
.tab-btn.active {
    color: var(--accent-cyan);
    border-bottom-color: var(--accent-cyan);
    font-weight: 700;
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Results must never force a viewport-width overflow on phones. */
#view-results,
#view-results .grid-results,
#view-results .grid-results > div,
#view-results .tab-content {
    min-width: 0;
    max-width: 100%;
}
#view-results .tab-content { overflow: hidden; }
#view-results .js-plotly-plot,
#view-results .plot-container,
#view-results .svg-container {
    width: 100% !important;
    max-width: 100% !important;
}

/* Drag & Drop Upload Zone */
.upload-zone {
    border: 1px dashed var(--border-subtle);
    border-radius: 12px;
    padding: 2rem 1.25rem;
    text-align: center;
    background: rgba(14, 21, 36, 0.6);
    margin: 0.5rem 0 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}
.upload-zone:hover, .upload-zone.dragover {
    border-color: var(--accent-cyan);
    background: rgba(125, 211, 199, 0.08);
}

/* File Preview Badge */
.file-card {
    background: var(--bg-surface-main);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    margin: 0.75rem 0 1rem;
}

/* Candidate Outcome Badges */
.candidate-badge-candidate {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0.45rem 1rem;
    border-radius: 20px;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: 700;
    font-size: 1.12rem;
    background: rgba(244, 201, 93, 0.14);
    border: 1px solid rgba(244, 201, 93, 0.5);
    color: #F4C95D;
    box-shadow: 0 0 20px rgba(244, 201, 93, 0.22);
}
.candidate-badge-non {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0.45rem 1rem;
    border-radius: 20px;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: 700;
    font-size: 1.12rem;
    background: rgba(148, 163, 184, 0.12);
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
}

/* Metrics Strip */
.metric-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 12px;
    margin: 1.1rem 0 1.35rem;
}
.metric-cell {
    background: var(--bg-surface-main);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    padding: 0.75rem 0.9rem;
    text-align: left;
}
.metric-cell-label {
    font-size: 0.76rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 3px;
}
.metric-cell-value {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text-main);
}

/* Model Chip */
.model-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.4rem 0.85rem;
    border-radius: 8px;
    background: rgba(111, 168, 220, 0.16);
    border: 1px solid rgba(111, 168, 220, 0.38);
    color: var(--text-main);
    font-size: 0.88rem;
    font-weight: 600;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-surface-secondary);
    border-radius: 4px;
    overflow: hidden;
    margin: 0.75rem 0 1.25rem;
    border: 1px solid var(--border-subtle);
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #6FA8DC 0%, #7DD3C7 100%);
    border-radius: 4px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Styled Table */
.data-table-container {
    width: 100%;
    overflow-x: auto;
    border-radius: 10px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-surface-main);
    margin: 0.75rem 0 1.5rem;
}
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
    text-align: left;
}
.data-table th {
    background: var(--bg-surface-secondary);
    padding: 0.75rem 1rem;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border-subtle);
    text-transform: uppercase;
    font-size: 0.78rem;
    letter-spacing: 0.05em;
}
.data-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(38, 52, 74, 0.6);
    color: var(--text-main);
}
.data-table tr:hover td {
    background: rgba(111, 168, 220, 0.08);
}

/* Animated Loading Card */
.loading-card {
    background: var(--bg-surface-main);
    border: 1px solid var(--border-highlight);
    border-radius: 14px;
    padding: 1.5rem;
    margin: 1rem 0;
    box-shadow: 0 0 30px rgba(111, 168, 220, 0.22);
    animation: pulseBorder 2s infinite alternate;
}
@keyframes pulseBorder {
    0% { border-color: rgba(111, 168, 220, 0.35); }
    100% { border-color: rgba(125, 211, 199, 0.85); }
}
.loading-step {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 0.65rem;
    font-size: 0.95rem;
    color: var(--text-muted);
}
.loading-step.done {
    color: var(--accent-cyan);
    font-weight: 600;
}
.loading-step.active {
    color: var(--primary-blue);
    font-weight: 700;
}

/* Spinner */
.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(111, 168, 220, 0.2);
    border-top-color: var(--primary-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Expander (details/summary) */
details {
    background: var(--bg-surface-main);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    padding: 0.75rem 1.1rem;
    margin: 1rem 0;
}
summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--text-main);
    user-select: none;
    outline: none;
}
details[open] summary {
    margin-bottom: 0.75rem;
    color: var(--accent-cyan);
}

/* Number input */
input[type="number"], select {
    width: 100%;
    padding: 0.65rem 0.9rem;
    background: var(--bg-surface-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    -webkit-appearance: none;
}
input[type="number"]:focus, select:focus {
    border-color: var(--accent-cyan);
}

/* Grid splits */
.grid-hero {
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    gap: 40px;
    align-items: center;
}
.grid-analyze {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    align-items: start;
}
.grid-results {
    display: grid;
    grid-template-columns: 1.05fr 2.3fr;
    gap: 40px;
}
.grid-history-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}
/* Responsive Breakpoints & Mobile Optimization */
@media (max-width: 980px) {
    .grid-hero, .grid-analyze, .grid-results {
        grid-template-columns: 1fr;
        gap: 24px;
    }
}

/* Tablet & Mobile (under 860px) */
@media (max-width: 860px) {
    .navbar {
        margin-top: -0.9rem;
        margin-bottom: 1.4rem;
    }

    .nav-links {
        display: none !important;
    }

    .hamburger-btn {
        display: flex !important;
    }

    .mobile-nav-drawer {
        display: block;
    }

    .mobile-backdrop {
        display: block;
    }

    .v-flowchart {
        gap: 18px;
        padding: 0.75rem 0.2rem;
    }
    .v-flow-step {
        gap: 14px;
    }
    .v-flow-node {
        width: 40px;
        height: 40px;
        font-size: 0.9rem;
    }
    .v-flowchart::before {
        left: 20px;
    }
    .v-flow-step::after {
        left: 40px;
        width: 14px;
        top: 20px;
    }
    .v-flow-title {
        font-size: 1.05rem;
    }
    .v-flow-desc {
        font-size: 0.84rem;
    }

    .tab-nav {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        white-space: nowrap;
        gap: 16px;
        padding-bottom: 2px;
    }
    .tab-nav::-webkit-scrollbar {
        display: none;
    }
    .tab-btn {
        flex-shrink: 0;
        font-size: 0.92rem;
        padding: 0.55rem 0.25rem;
    }

    .grid-history-stats {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }

    /* Analyze page: stack the 2-column layout */
    .grid-analyze {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    /* Results page: stack left panel and charts */
    .grid-results {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    /* Analyze tab labels — allow wrapping on mid-width */
    .tab-btn {
        white-space: normal;
        word-break: break-word;
        text-align: left;
        line-height: 1.3;
    }
}

/* Phones (under 768px) */
@media (max-width: 768px) {
    .app-container {
        padding: 0.75rem 1rem 2rem;
    }
    .navbar {
        margin-top: -0.75rem;
        padding: 0.7rem 1rem;
    }
    #view-results .data-table-container {
        max-width: 100%;
        -webkit-overflow-scrolling: touch;
    }

    h1 {
        font-size: 2.9rem;
        line-height: 1.08;
    }
    h2 {
        font-size: 2.1rem;
        line-height: 1.18;
    }
    h3 {
        font-size: 1.35rem;
    }
    .lead {
        font-size: 1.02rem;
        line-height: 1.6;
    }

    #c {
        height: 310px;
    }

    .metric-strip {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    .metric-cell {
        padding: 0.65rem 0.75rem;
    }
    .metric-cell-value {
        font-size: 1.12rem;
    }

    .panel, .stat-card, .result-card, .feature-card, .workflow-card {
        padding: 1.15rem;
        border-radius: 12px;
    }

    .data-table th, .data-table td {
        padding: 0.6rem 0.75rem;
        font-size: 0.84rem;
        white-space: nowrap;
    }
}

/* Small Phones (under 520px) */
@media (max-width: 520px) {
    .app-container {
        padding: 0.5rem 0.75rem 1.8rem;
    }
    .navbar {
        margin-top: -0.5rem;
        padding: 0.65rem 0.75rem;
    }

    .brand-name {
        font-size: 1.3rem;
    }
    .brand-pill {
        display: none;
    }

    .api-status-badge span#api-status-text {
        display: none;
    }
    .api-status-badge {
        padding: 6px 4px;
    }

    h1 {
        font-size: 2.35rem;
        line-height: 1.12;
    }
    h2 {
        font-size: 1.85rem;
        line-height: 1.2;
    }
    h3 {
        font-size: 1.25rem;
    }

    #c {
        height: 250px;
    }

    .feature-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .grid-history-stats {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .metric-strip {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    .metric-cell-value {
        font-size: 1.05rem;
    }

    .upload-zone {
        padding: 1.5rem 1rem;
    }

    /* Stack Results View action buttons */
    #results-content > div:first-child {
        flex-direction: column;
        align-items: stretch !important;
        gap: 12px;
    }
    #results-content > div:first-child > div:last-child {
        display: flex;
        gap: 8px;
        width: 100%;
    }
    #results-content > div:first-child > div:last-child .btn {
        flex: 1;
        font-size: 0.85rem;
        padding: 0 0.6rem;
    }

    /* Stack Hero CTA buttons */
    .hero-actions {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        gap: 10px;
    }
    .hero-actions .btn {
        width: 100%;
        text-align: center;
        justify-content: center;
        font-size: 0.95rem;
        min-height: 2.75rem;
    }

    /* Analyze page full-width buttons */
    #view-analyze .btn-primary,
    #view-analyze .btn-full {
        width: 100%;
        min-height: 2.75rem;
    }

    /* Upload zone bigger tap target on small screens */
    .upload-zone {
        padding: 2rem 1rem;
        min-height: 140px;
    }

    /* Advanced config summary full width */
    details {
        width: 100%;
    }

    /* Plotly charts on small screens */
    #chart-full { height: 310px !important; }
    #chart-zoom { height: 290px !important; }
    #chart-probs { height: 230px !important; }
}

/* Footer */
.app-footer {
    margin-top: 3.2rem;
    padding-top: 1.35rem;
    border-top: 1px solid var(--border-subtle);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.5;
}

/* ========================================================
   Homepage refinement (existing palette, new hierarchy)
   ======================================================== */
.view-page { min-height: 52vh; }

.gradient-text {
    background: linear-gradient(135deg, #6FA8DC 0%, #7DD3C7 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.btn-ghost {
    background: transparent;
    border-color: var(--border-subtle);
    color: var(--text-main);
}
.btn-ghost:hover {
    border-color: var(--accent-cyan);
    background: rgba(125, 211, 199, 0.08);
}

.nav-item--secondary {
    font-size: 0.95rem;
    opacity: 0.85;
}

.page-header { margin-bottom: 1.6rem; }
.page-header--results {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
}
.page-header--workspace {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem;
}
.session-link {
    flex: 0 0 auto;
    margin-bottom: 0.35rem;
}
.page-header-sub { max-width: 46rem; }

.hero-section {
    padding: 0.4rem 0 2.2rem;
    margin-bottom: 0.5rem;
}
.hero-text h1 {
    font-size: 3.35rem;
    margin-bottom: 0.45rem;
}
.hero-tagline {
    font-size: 1.22rem;
    line-height: 1.55;
    color: var(--text-main);
    font-weight: 500;
    max-width: 36rem;
    margin-bottom: 0.75rem;
}
.hero-canvas-wrap {
    min-width: 0;
}
.canvas-caption {
    margin-top: 0.55rem;
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    text-align: center;
}

.hero-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 0.85rem 1.1rem;
    margin-top: 1.6rem;
    padding-top: 1.15rem;
    border-top: 1px solid var(--border-subtle);
}
.hero-meta-item { display: flex; flex-direction: column; gap: 0.15rem; }
.hero-meta-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    font-weight: 600;
}
.hero-meta-val {
    font-family: 'DM Mono', monospace;
    font-size: 0.88rem;
    color: var(--text-main);
}
.hero-meta-sep {
    width: 1px;
    background: var(--border-subtle);
    align-self: stretch;
}

.home-section {
    padding: 2.6rem 0;
    scroll-margin-top: 1.25rem;
}
.home-section + .home-section {
    border-top: 1px solid rgba(38, 52, 74, 0.7);
}
.section-header { max-width: 42rem; margin-bottom: 1.6rem; }
.section-title {
    font-size: 2.05rem;
    line-height: 1.2;
    margin-bottom: 0.65rem;
}
.section-lead {
    color: #CBD5E1;
    font-size: 1.05rem;
    line-height: 1.7;
}
.section-lead strong { color: var(--accent-star); font-weight: 600; }
.section-more { margin-top: 1.1rem; }

.text-link {
    background: none;
    border: none;
    padding: 0;
    color: var(--accent-cyan);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}
.text-link:hover { text-decoration: underline; }

.home-section--split {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 2.5rem;
    align-items: start;
}
.split-copy .section-title { margin: 0.2rem 0 0.85rem; }
.split-copy p { color: #CBD5E1; line-height: 1.7; margin-bottom: 0.85rem; }
.split-aside {
    display: flex;
    flex-direction: column;
    gap: 0;
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    overflow: hidden;
    background: rgba(14, 21, 36, 0.55);
}
.fact-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1.1rem;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-muted);
    font-size: 0.92rem;
}
.fact-row:last-child { border-bottom: none; }
.fact-row b {
    color: var(--text-main);
    font-family: 'DM Mono', monospace;
    font-weight: 500;
    white-space: nowrap;
}

.dip-diagram-wrap { margin-bottom: 1.5rem; }
.transit-dip-illustration {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 16px;
}

.transit-explainer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 1.75rem minmax(0, 1fr) 1.75rem minmax(0, 1fr) 1.75rem minmax(0, 1fr);
    gap: 0.6rem;
    align-items: start;
    width: 100%;
    max-width: none;
}
.transit-stage { min-width: 0; padding-top: 0.2rem; }
.transit-stage-image {
    display: block;
    width: 100%;
    max-width: none;
    height: auto;
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
}
.transit-arrow {
    position: static;
    align-self: start;
    justify-self: center;
    margin-top: clamp(64px, 7vw, 100px);
    color: var(--primary-blue);
    font-size: 1.2rem;
    line-height: 1;
    opacity: 1;
    pointer-events: none;
}
.transit-label {
    font-weight: 700;
    margin: 0.55rem 0 0.25rem;
    font-size: 0.95rem;
}
.transit-desc {
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.5;
}

.pipeline-steps {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0;
    position: relative;
}
.pipeline-step {
    padding: 0 0.85rem 0 0;
    position: relative;
}
.pipeline-step:not(:last-child)::after {
    content: "";
    position: absolute;
    top: 13px;
    left: 2.4rem;
    right: 0.4rem;
    height: 1px;
    background: linear-gradient(90deg, var(--accent-cyan), var(--primary-blue));
    opacity: 0.45;
}
.ps-number {
    font-family: 'DM Mono', monospace;
    color: var(--accent-cyan);
    font-size: 0.95rem;
    font-weight: 500;
    margin-bottom: 0.55rem;
}
.ps-title {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 700;
    font-size: 1.02rem;
    margin-bottom: 0.35rem;
}
.ps-desc {
    color: var(--text-muted);
    font-size: 0.86rem;
    line-height: 1.55;
}

.analyze-portal {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem 1.6rem;
    border: 1px solid var(--border-highlight);
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(111, 168, 220, 0.10), rgba(14, 21, 36, 0.7));
}
.cta-title { font-size: 1.55rem; margin-bottom: 0.4rem; }
.cta-sub { color: var(--text-muted); max-width: 38rem; line-height: 1.6; }

.example-grid { display: grid; gap: 1rem; }
.example-outcome {
    padding: 1rem 0 0.25rem;
    max-width: 40rem;
}
.example-badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent-star);
    border: 1px solid rgba(244, 201, 93, 0.45);
    border-radius: 999px;
    padding: 0.28rem 0.7rem;
    margin-bottom: 0.7rem;
}
.example-metrics { max-width: 52rem; }

.prose-cols {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.75rem;
}
.prose-cols h4 { margin-bottom: 0.45rem; }
.prose-cols p { color: var(--text-muted); line-height: 1.65; font-size: 0.95rem; }

.limitations-block { max-width: 46rem; }
.limit-list {
    margin: 0.85rem 0 0;
    padding-left: 1.15rem;
    color: #CBD5E1;
    line-height: 1.75;
}
.limit-list b { color: var(--text-main); }

.docs-teaser {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}
.docs-teaser-item {
    text-align: left;
    padding: 1rem 1.05rem;
    background: var(--bg-surface-main);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    color: var(--text-main);
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}
.docs-teaser-item:hover { border-color: var(--primary-blue); }

.workspace-flow {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem 0.2rem;
    list-style: none;
    padding: 0;
    margin: 0 0 1.5rem;
}
.wf-step {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
}
.wf-step.is-current {
    color: #070B14;
    background: var(--primary-blue);
}
.wf-step.is-done { color: var(--accent-cyan); }

.session-badge {
    display: inline-block;
    margin-top: 0.4rem;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--accent-cyan);
}

.grid-about {
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    gap: 1.5rem;
    align-items: start;
}
.notice-block {
    background: rgba(240, 128, 128, 0.08);
    border: 1px solid rgba(240, 128, 128, 0.35);
    border-radius: 10px;
    padding: 0.9rem 1rem;
}
.tech-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 1100px) {
    .pipeline-steps { grid-template-columns: repeat(3, 1fr); gap: 1.4rem 1rem; }
    .pipeline-step:not(:last-child)::after { display: none; }
    .docs-teaser { grid-template-columns: 1fr 1fr; }
    .nav-item { font-size: 0.95rem; padding: 0 0.55rem; }
}

@media (max-width: 980px) {
    .home-section--split,
    .grid-about,
    .prose-cols {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }
    .analyze-portal {
        flex-direction: column;
        align-items: flex-start;
    }
    .transit-explainer {
        grid-template-columns: 1fr 1fr;
        gap: 1.1rem 0.85rem;
    }
    .transit-arrow { display: none; }
    .hero-text h1 { font-size: 2.8rem; }
    .page-header--workspace { align-items: flex-start; }
}

@media (max-width: 768px) {
    .home-section { padding: 2rem 0; }
    .section-title { font-size: 1.7rem; }
    .pipeline-steps { grid-template-columns: 1fr 1fr; }
    .tech-grid { grid-template-columns: 1fr; }
    .hero-meta-sep { display: none; }
    .dip-row { grid-template-columns: 1fr; gap: 0.2rem; }
}

@media (max-width: 520px) {
    .pipeline-steps,
    .docs-teaser,
    .transit-explainer {
        grid-template-columns: 1fr;
    }
    .hero-text h1 { font-size: 2.4rem; }
    .workspace-flow { gap: 0.35rem; }
    .page-header--workspace { flex-direction: column; }
    .session-link { margin-bottom: 0; }
}
