@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700&display=swap');

:root {
    /* --- STAR SHINE DARK PRIMITIVES --- */
    --void: #020205;
    --layer-1: #050508;
    --layer-2: #0a0a0f;
    --border-dim: rgba(255, 255, 255, 0.05);
    --border-mid: rgba(255, 255, 255, 0.1);
    --c-brand: #2563eb;
    --font-sans: 'Inter', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --header-h: 48px;
    --footer-h: 32px;
    --text-main: #e2e8f0;
    --text-muted: #94a3b8;
    --glass-bg: rgba(5, 15, 25, 0.95);
    --glass-border: rgba(0, 242, 255, 0.2);
    --cyan-glow: #00f2ff;
    --purple-glow: #8b5cf6;
}

* {
    box-sizing: border-box;
    outline: none;
    user-select: auto;
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--void);
    color: var(--text-main);
    font-family: var(--font-sans);
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    font-size: 12px;
    line-height: 1.5;
}

.header-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-family: var(--font-mono);
    font-size: 10px;
}

#architect-layout {
    display: grid;
    grid-template-columns: min(260px, 22vw) 1fr min(260px, 22vw);
    grid-template-rows: var(--header-h) 1fr var(--footer-h);
    height: 100vh;
    width: 100vw;
    min-width: 0;
    gap: 1px;
    background-color: var(--border-dim);
    padding-right: 12px;
    overflow: hidden;
}

@media (max-width: 768px) {
    #architect-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto 1fr auto;
        height: auto;
        min-height: 100vh;
        overflow-y: auto;
        padding-right: 0;
    }

    body {
        overflow-y: auto;
    }
}

/* --- PHONE: Premium Mobile Simulation Lab --- */
@media (max-width: 768px) {
    html, body {
        overflow-x: hidden !important;
        width: 100% !important;
        max-width: 100vw !important;
    }

    /* Collapse to single column */
    #architect-layout {
        grid-template-columns: 1fr !important;
        grid-template-rows: auto auto 60vh auto !important;
        height: auto !important;
        min-height: 100vh;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        padding: 0 !important;
        gap: 0 !important;
        width: 100% !important;
        max-width: 100vw !important;
    }

    /* ===== TOP NAV BAR (first panel child, spans full width) ===== */
    /* This is the panel with branding, telemetry, and action buttons */
    #architect-layout > .panel:first-child {
        display: flex !important;
        flex-direction: column !important;
        height: auto !important;
        min-height: auto !important;
        width: 100% !important;
        max-width: 100vw !important;
        overflow: hidden !important;
        padding: 0 !important;
    }

    /* Branding row: keep compact */
    #architect-layout > .panel:first-child > div:first-child {
        padding: 0.5rem 0.75rem !important;
        height: auto !important;
    }

    /* Telemetry stats row: scroll horizontally if needed */
    #architect-layout > .panel:first-child > div:nth-child(2) {
        padding: 0.25rem 0.75rem !important;
        gap: 0.75rem !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    #architect-layout > .panel:first-child > div:nth-child(2)::-webkit-scrollbar {
        display: none;
    }

    /* Hide non-essential telemetry on phones */
    #backend-status-badge {
        display: none !important;
    }

    .header-stat {
        font-size: 8px !important;
        padding-left: 0.5rem !important;
    }

    /* Actions row: WRAP buttons into multiple rows */
    #architect-layout > .panel:first-child > div:last-child {
        flex-wrap: wrap !important;
        height: auto !important;
        padding: 0.35rem 0.5rem !important;
        gap: 4px !important;
        justify-content: flex-start !important;
    }

    /* Hide separator dividers in button row on mobile */
    #architect-layout > .panel:first-child > div:last-child > .h-6.w-px {
        display: none !important;
    }

    /* Compact all action buttons */
    #architect-layout > .panel:first-child > div:last-child button,
    #architect-layout > .panel:first-child > div:last-child a {
        padding: 4px 6px !important;
        font-size: 7px !important;
        height: 24px !important;
    }

    /* View toggle group (2D/Micro/3D) */
    #architect-layout > .panel:first-child > div:last-child .flex.items-center.gap-1 {
        order: 10; /* Push to end */
    }

    /* ===== LEFT SIDEBAR (Protocol Design - second panel) ===== */
    #architect-layout > .panel:nth-child(2) {
        grid-column: 1 !important;
        max-height: none !important;
        overflow-y: auto !important;
        border-right: none !important;
    }

    /* ===== CENTRAL VIEWPORT (third panel) ===== */
    #architect-layout > .panel:nth-child(3) {
        grid-column: 1 !important;
        min-height: 60vh;
    }

    #viewport-container {
        width: 100% !important;
        height: 100% !important;
        min-height: 50vh;
    }

    /* ===== RIGHT PANEL (last child, logs/output) ===== */
    #architect-layout > .panel:last-child {
        grid-column: 1 !important;
        border-left: none !important;
        border-top: 1px solid rgba(255, 255, 255, 0.05);
        max-height: 50vh;
        overflow-y: auto;
    }

    /* ===== HUD OVERLAY ===== */
    .hud-panel {
        top: 8px !important;
        left: 8px !important;
        width: min(220px, calc(100% - 16px)) !important;
        padding: 10px !important;
        font-size: 9px !important;
    }

    /* ===== TOAST FEED ===== */
    #toast-feed {
        width: min(260px, calc(100% - 16px)) !important;
        right: 8px !important;
        top: 50px !important;
    }

    .toast {
        padding: 8px !important;
        font-size: 10px !important;
    }

    /* ===== VIEW TOGGLES ===== */
    .view-toggle-container {
        top: 8px !important;
        right: 8px !important;
    }

    .view-toggle-btn {
        padding: 5px 8px !important;
        font-size: 7px !important;
    }

    /* ===== CLINICAL DASHBOARD OVERLAY ===== */
    #clinical-dashboard {
        padding: 20px 16px !important;
    }

    .dash-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    .dash-header {
        flex-direction: column !important;
        gap: 12px !important;
    }

    .chart-container-large {
        grid-column: span 1 !important;
        height: 280px !important;
    }

    .dash-stat-value {
        font-size: 24px !important;
    }

    /* ===== MICROSCOPY ===== */
    #btn-micro-maximize {
        top: 12px !important;
        right: 12px !important;
        padding: 10px !important;
    }

    .micro-analysis-card {
        top: 10px !important;
        left: 10px !important;
        width: calc(100% - 20px) !important;
        max-width: none !important;
        max-height: 40vh !important;
        border-radius: 14px !important;
        padding: 16px !important;
    }

    .micro-analytics-sidebar {
        top: auto !important;
        bottom: 10px !important;
        right: 10px !important;
        width: calc(100% - 20px) !important;
        max-width: none !important;
        max-height: 35vh !important;
        border-radius: 14px !important;
    }

    /* ===== CATALOG OVERLAY ===== */
    #catalog-overlay button {
        top: 8px !important;
        right: 8px !important;
        padding: 8px 12px !important;
        font-size: 9px !important;
    }

    /* ===== FOOTER ===== */
    footer, aside {
        padding: 0.5rem 1rem !important;
        font-size: 9px !important;
    }

    /* ===== AI ASSISTANT ===== */
    #ai-panel {
        width: calc(100vw - 20px) !important;
        left: 10px !important;
        max-width: none !important;
    }

    #ai-toggle-btn {
        left: 10px !important;
        bottom: 10px !important;
        padding: 8px 14px !important;
        font-size: 9px !important;
    }
}


/* --- AUTHENTIC FULLSCREEN MICROSCOPE MODE --- */
#architect-layout.micro-fullscreen-active {
    grid-template-columns: 1fr !important;
    grid-template-rows: 1fr !important;
}

#architect-layout.micro-fullscreen-active>header,
#architect-layout.micro-fullscreen-active>aside,
#architect-layout.micro-fullscreen-active .panel:first-child,
#architect-layout.micro-fullscreen-active .panel:last-child,
#architect-layout.micro-fullscreen-active #main-viewport:not(#main-viewport-microscope),
#architect-layout.micro-fullscreen-active #canvas,
#architect-layout.micro-fullscreen-active .hud-panel,
#architect-layout.micro-fullscreen-active .legend-card {
    display: none !important;
}

#architect-layout.micro-fullscreen-active .panel:nth-child(2) {
    grid-row: 1;
    grid-column: 1;
}

#architect-layout.micro-fullscreen-active #viewport-container {
    height: 100vh;
    width: 100vw;
}

/* Floating Analysis Card (Matching Demo) */
.micro-analysis-card {
    position: absolute;
    top: 30px;
    left: 30px;
    width: min(300px, calc(50% - 40px));
    max-width: 300px;
    min-width: 0;
    max-height: calc(100% - 60px);
    background: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(40px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 24px;
    z-index: 100;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    display: none;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
    /* Only show when Microscope is active */
}

.micro-analysis-card::-webkit-scrollbar {
    display: none;
}

#main-viewport-microscope:hover .micro-analysis-card,
#architect-layout.micro-fullscreen-active .micro-analysis-card {
    display: block;
}

/* CRITICAL: FORCE hide microscopy in 3D - STRONGEST selector */
#main-viewport-3d .micro-analysis-card,
.micro-analysis-card[style*="display: block"] {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.micro-card-header {
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 2px;
    color: #34d399;
    text-transform: uppercase;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* Space for minimize button */
    gap: 12px;
}


.micro-analysis-card.minimized {
    height: 60px;
    overflow: hidden;
    padding-bottom: 0;
}

.micro-analysis-card.minimized .space-y-6,
.micro-analysis-card.minimized .mt-8 {
    display: none;
}

#btn-micro-maximize {
    position: absolute;
    top: 30px;
    right: 30px;
    background: rgba(255, 255, 255, 0.15);
    /* White Glass as requested */
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: white;
    padding: 14px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 1000;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

#btn-micro-maximize:hover {
    background: rgba(255, 255, 255, 1);
    color: #000;
    transform: scale(1.15) rotate(180deg);
}

/* --- FULLSCREEN ANALYTICS SIDEBAR (REPLICATING SCREENSHOT) --- */
.micro-analytics-sidebar {
    position: absolute;
    top: 30px;
    right: 30px;
    width: min(320px, calc(50% - 40px));
    max-width: 320px;
    min-width: 0;
    background: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(40px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 24px;
    z-index: 200;
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.9);
    display: none;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: calc(100% - 60px);
    overflow-y: auto;
    overflow-x: hidden;
}

#architect-layout.micro-fullscreen-active .micro-analytics-sidebar {
    display: block;
}

.micro-analytics-sidebar.minimized {
    height: 60px;
    overflow: hidden;
}

.analytics-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 15px;
}

.analytics-title {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 3px;
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    padding: 6px 16px;
    border-radius: 100px;
}

.win-btn-tiny {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    transition: all 0.2s;
}

.win-btn-tiny:hover {
    color: #fff;
    transform: scale(1.2);
}

.chart-label {
    font-size: 8px;
    font-weight: 700;
    color: #64748b;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.gene-node {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 4px;
    border-radius: 4px;
    text-align: center;
    font-size: 7px;
    color: #94a3b8;
    transition: all 0.2s;
}

.gene-node:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: #6366f1;
    color: #fff;
}

.thin-scrollbar::-webkit-scrollbar {
    width: 2px;
}

.thin-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}

.no-scrollbar::-webkit-scrollbar {
    display: none;
}

.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

@keyframes pulse-blue {

    0%,
    100% {
        box-shadow: 0 0 0px transparent;
    }

    50% {
        box-shadow: 0 0 15px rgba(59, 130, 246, 0.4);
        border-color: #3b82f6;
    }
}



.panel {
    background-color: var(--layer-2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    backdrop-filter: blur(20px);
}

.panel-header {
    height: 40px;
    min-height: 40px;
    padding: 0 16px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.02) 0%, rgba(0, 0, 0, 0) 100%);
    border-bottom: 1px solid var(--border-dim);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.panel-title {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.scroll-container {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-mid) transparent;
}

.control-group {
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-dim);
    padding-bottom: 8px;
}

.control-label {
    display: block;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

select {
    width: 100%;
    background: var(--layer-1);
    border: 1px solid var(--border-mid);
    color: var(--text-main);
    padding: 10px;
    font-family: var(--font-mono);
    font-size: 10px;
    border-radius: 4px;
    outline: none;
    cursor: pointer;
}

.btn {
    width: 100%;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid var(--border-dim);
    color: var(--text-main);
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    border-radius: 4px;
    margin-bottom: 4px;
}

/* MICROSCOPE VIEWPORT */
#main-viewport-microscope {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    background: #000;
    z-index: 5;
}

.view-toggle-container {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 50;
    display: flex;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    padding: 2px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.view-toggle-btn {
    padding: 6px 12px;
    font-size: 8px;
    font-weight: 700;
    text-transform: uppercase;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    color: #475569;
    display: flex;
    align-items: center;
    gap: 6px;
}

.view-toggle-btn.active {
    background: #2563eb;
    color: white;
    box-shadow: 0 0 10px rgba(37, 99, 235, 0.4);
}

.KAGAWEA-legend {
    position: absolute;
    bottom: 12px;
    right: 12px;
    z-index: 40;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 4px;
    padding: 8px;
    display: none;
    flex-direction: column;
    gap: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 10px;
    /* Increased from 7px */
    color: #fff;
    /* White for max visibility */
    font-weight: 700;
    text-transform: uppercase;
}

.legend-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.btn:hover:not(:disabled) {
    background: rgba(0, 0, 0, 0.05);
    border-color: var(--border-mid);
    color: var(--text-main);
}

.btn-brand {
    border-left: 3px solid var(--c-brand);
}

.btn-bio {
    border-left: 3px solid #3b82f6;
}

.btn-warn {
    border-left: 3px solid #f59e0b;
}

.btn-crit {
    border-left: 3px solid #ef4444;
}

.btn-data {
    border-left: 3px solid #8b5cf6;
}

#viewport-container {
    position: relative;
    width: 100%;
    height: 100%;
    background: #000;
    cursor: crosshair;
    overflow: hidden;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.hud-panel {
    position: absolute;
    top: 20px;
    left: 20px;
    width: min(260px, calc(100% - 40px));
    max-width: 260px;
    min-width: 0;
    background: rgba(5, 5, 5, 0.85);
    border: 1px solid var(--border-mid);
    border-left: 2px solid var(--c-brand);
    padding: 16px;
    border-radius: 4px;
    backdrop-filter: blur(8px);
    z-index: 10;
    overflow: hidden;
}

.hud-row {
    display: flex;
    justify-content: space-between;
    font-family: var(--font-mono);
    font-size: 10px;
    margin-bottom: 6px;
    color: #94a3b8;
}

.gene-matrix {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2px;
    padding: 2px;
    background: #000;
    border: 1px solid #334155;
    aspect-ratio: 1;
}

.gene-node {
    background: #050505;
    border: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 6px;
    font-family: var(--font-mono);
    color: #94a3b8;
    transition: all 0.2s;
    cursor: pointer;
    text-align: center;
    padding: 2px;
    border-radius: 2px;
    font-weight: 600;
    overflow: hidden;
    word-break: break-all;
}

.gene-node:hover {
    border-color: #2563eb;
    background: #111;
}

/* Toast notifications */
#toast-feed {
    position: absolute;
    top: 60px;
    right: 20px;
    width: 320px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 100;
    pointer-events: none;
}

.toast {
    background: #0f0f0f;
    border: 1px solid var(--border-mid);
    padding: 12px;
    border-radius: 4px;
    pointer-events: auto;
    color: #ccc;
}

.toast-h {
    font-weight: 700;
    color: #fff;
    font-size: 11px;
    margin-bottom: 2px;
}

/* Term/Log */
.log-line {
    padding: 2px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    display: flex;
    gap: 10px;
    font-family: var(--font-mono);
    font-size: 10px;
}

/* PH11: CLINICAL DASHBOARD STYLES */
#clinical-dashboard {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #020205;
    z-index: 2000;
    display: none;
    flex-direction: column;
    padding: 40px;
    overflow-y: auto;
    font-family: var(--font-sans);
}

.dash-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 40px;
    border-bottom: 1px solid #1e293b;
    padding-bottom: 20px;
}

.dash-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-bottom: 40px;
}

.dash-card {
    background: #0f172a;
    border: 1px solid #1e293b;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.dash-stat-label {
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.dash-stat-value {
    font-size: 32px;
    font-weight: 800;
    color: #f8fafc;
    font-family: var(--font-mono);
}

.chart-container-large {
    grid-column: span 2;
    background: #0f172a;
    border: 1px solid #1e293b;
    border-radius: 12px;
    padding: 24px;
    height: 400px;
}

.close-dash-btn {
    background: #2563eb;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.close-dash-btn:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
}

/* PRINT STYLES FOR CLINICAL REPORT */
@media print {
    body {
        background: white !important;
        color: black !important;
    }

    #architect-layout,
    #ai-panel,
    #ai-toggle-btn,
    .close-dash-btn,
    #toast-feed {
        display: none !important;
    }

    #clinical-dashboard {
        position: relative !important;
        display: block !important;
        background: white !important;
        color: black !important;
        padding: 20px !important;
        width: 100% !important;
        height: auto !important;
    }

    .dash-card,
    .chart-container-large {
        background: #fff !important;
        border: 1px solid #eee !important;
        box-shadow: none !important;
        color: black !important;
        break-inside: avoid;
    }

    .dash-stat-value,
    .dash-stat-label,
    h1,
    p,
    .text-slate-500,
    .text-slate-400 {
        color: black !important;
    }

    canvas {
        max-width: 100% !important;
    }
}

/* --- MICROSCOPY CORE EFFECTS --- */
.scanline-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.08) 50%);
    background-size: 100% 4px;
    pointer-events: none;
    z-index: 5;
    opacity: 0.3;
}

.bloom-overlay {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, transparent 30%, rgba(0, 0, 0, 0.4) 100%);
    pointer-events: none;
    z-index: 4;
}

#main-viewport-microscope {
    filter: contrast(1.3) brightness(1.2) saturate(1.4);
    position: absolute;
    inset: 0;
    display: none;
    background: #000;
}

@keyframes microPulse {

    0%,
    100% {
        opacity: 0.3;
        transform: scale(0.8);
    }

    50% {
        opacity: 1;
        transform: scale(1.1);
    }
}

.micro-header-dot {
    width: 6px;
    height: 6px;
    background: #34d399;
    border-radius: 50%;
    box-shadow: 0 0 10px #34d399;
    animation: microPulse 1.5s infinite;
}

.micro-control-card {
    background: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 16px;
    margin-top: 12px;
}

.micro-label {
    display: flex;
    justify-content: space-between;
    font-size: 8px;
    color: #64748b;
    margin-bottom: 6px;
    font-weight: 700;
    text-transform: uppercase;
}

.micro-range {
    width: 100%;
    height: 2px;
    background: #1e293b;
    border-radius: 2px;
    appearance: none;
    outline: none;
    margin-bottom: 12px;
}

.micro-range::-webkit-slider-thumb {
    appearance: none;
    width: 12px;
    height: 12px;
    background: #34d399;
    border: 1px solid #000;
    border-radius: 50%;
    cursor: pointer;
}

#meta-data-overlay {
    position: absolute;
    bottom: 30px;
    right: 30px;
    max-width: min(260px, calc(50% - 40px));
    font-family: var(--font-mono);
    font-size: 9px;
    color: #475569;
    text-align: right;
    line-height: 1.6;
    z-index: 150;
    pointer-events: none;
    word-break: break-word;
}

/* --- Kilo-Genome Explorer Matrix --- */
.gene-matrix {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    padding: 8px;
}

.gene-node {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 6px 2px;
    border-radius: 4px;
    text-align: center;
    font-size: 8px;
    color: #94a3b8;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'JetBrains Mono', monospace;
    cursor: default;
}

.gene-node:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: #6366f1;
    color: #fff;
    transform: scale(1.05);
    z-index: 10;
}

/* --- Synergy Meter --- */
#synergy-container {
    padding: 8px;
    background: rgba(168, 85, 247, 0.05);
    border: 1px solid rgba(168, 85, 247, 0.2);
    border-radius: 6px;
    margin-top: 10px;
}

.synergy-label-row {
    display: flex;
    justify-content: space-between;
    text-transform: uppercase;
    font-weight: 700;
    font-size: 7px;
    color: #94a3b8;
    margin-bottom: 4px;
}

.synergy-bar-bg {
    width: 100%;
    height: 4px;
    background: #1e1b4b;
    border-radius: 2px;
    overflow: hidden;
}

.synergy-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #a855f7);
    box-shadow: 0 0 10px rgba(168, 85, 247, 0.5);
    transition: width 1.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ANIMATIONS */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeIn 0.15s ease-out forwards;
}

/* --- PANEL LAYOUT FIXES --- */
.panel {
    background-color: #000000;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    z-index: 10;
}

.panel:last-child {
    border-right: none;
    border-left: 1px solid rgba(255, 255, 255, 0.05);
}

#architect-layout.micro-fullscreen-active .panel:first-child,
#architect-layout.micro-fullscreen-active .panel:last-child {
    display: none !important;
}

/* --- VISIBLE SCROLLBAR FIX --- */
.scroll-container::-webkit-scrollbar {
    width: 6px;
}

.scroll-container::-webkit-scrollbar-track {
    background: #111;
}

.scroll-container::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 3px;
}

.scroll-container::-webkit-scrollbar-thumb:hover {
    background: #666;
}

/* ========================================
   PHASE 6: COMPLETE VIEW ISOLATION
   ======================================== */

/* Hide 3D status panel in other views */
#main-viewport-2d #3d-status-panel,
#main-viewport-microscope #3d-status-panel {
    display: none !important;
}

/* Hide HUD panel in 3D */
#main-viewport-3d .hud-panel {
    display: none !important;
}

/* Hide legends in wrong views */
#main-viewport-3d .KAGAWEA-legend,
#main-viewport-microscope .KAGAWEA-legend {
    display: none !important;
}

/* Ensure selection info only in 3D */
#main-viewport-2d #3d-selection-info,
#main-viewport-microscope #3d-selection-info {
    display: none !important;
}

/* ========================================
   PHASE 7: SMOOTH TRANSITIONS
   ======================================== */

/* Smooth fade for view changes */
#main-viewport-2d,
#main-viewport-microscope,
#main-viewport-3d {
    transition: opacity 0.3s ease-in-out;
}

/* Panel smooth transitions */
.micro-analysis-card,
#3d-status-panel,
.hud-panel {
    transition: all 0.3s ease-in-out;
}

/* Button hover effects */
button {
    transition: all 0.2s ease-in-out;
}

/* Smooth appearance */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.thin-scrollbar-v2::-webkit-scrollbar {
    width: 3px;
}
.thin-scrollbar-v2::-webkit-scrollbar-track {
    background: rgba(30, 41, 59, 0.4);
    border-radius: 10px;
}
.thin-scrollbar-v2::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #6366f1 0%, #475569 100%);
    border-radius: 10px;
}

/* Microscopy brightness reduction - 50% less bright */
#main-viewport-microscope {
    filter: brightness(0.5);
}