:root {
    --bg-dark: #020104;
    /* Ebony */
    --accent-scampi: #6970A7;
    /* Scampi */
    --accent-cyan: #00f2ff;
    /* Retaining for sub-accents if needed */
    --accent-glow: rgba(105, 112, 167, 0.3);
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --text-main: #f8fafc;
    --text-dim: #94a3b8;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body.foundry-theme {
    background: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    background-image:
        radial-gradient(circle at 10% 10%, rgba(105, 112, 167, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 90% 90%, rgba(0, 242, 255, 0.03) 0%, transparent 40%);
}

strong,
b {
    font-weight: 800;
}

.glass {
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
}

/* Header & HUD */
.hud-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 3rem;
    /* border-bottom: 1px solid var(--glass-border); Removed for seamless look */
    background: #000000;
    /* Pure Black */
    /* backdrop-filter: blur(10px); Removed for seamless look */
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    font-family: 'Outfit', sans-serif;
    letter-spacing: 2px;
}

.logo .styx {
    font-weight: 800;
    font-size: 1.5rem;
    color: #fff;
}

.logo .ai {
    font-weight: 200;
    font-size: 1.5rem;
    color: var(--accent-scampi);
}

.logo .subtitle {
    display: block;
    font-size: 0.6rem;
    color: var(--text-dim);
    letter-spacing: 4px;
    margin-top: -4px;
}

.hud-nav {
    display: flex;
    align-items: center;
    margin: 0 3rem;
    flex-grow: 1;
}

.nav-link {
    color: var(--text-dim);
    text-decoration: none;
    margin-right: 2rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    transition: all 0.3s;
}

.nav-link:hover {
    color: var(--accent-cyan);
    text-shadow: 0 0 10px rgba(0, 242, 255, 0.4);
}

.nav-divider {
    width: 1px;
    height: 20px;
    background: var(--glass-border);
    margin-right: 2rem;
}

.hub-link {
    padding: 0.5rem 1rem;
    border: 1px solid var(--accent-amber);
    border-radius: 4px;
    color: var(--accent-amber);
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.hub-link:hover {
    background: var(--accent-amber);
    color: #000;
}

/* Main Layout */
.hero-section {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
    text-align: center;
    position: relative;
}

.hero-content {
    max-width: 1000px;
    margin: 0 auto;
    z-index: 10;
}

.dashboard-container {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 3rem;
    padding: 3rem;
    max-width: 1800px;
    margin: 0 auto;
}

/* Frontier Section */
.discovery-frontier {
    margin-bottom: 4rem;
}

.frontier-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.frontier-card {
    padding: 2rem;
    position: relative;
    border-left: 4px solid var(--accent-cyan);
    transition: all 0.4s ease;
}

.frontier-card:hover {
    transform: translateY(-8px);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.5);
    border-color: var(--accent-cyan);
}

.scan-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent, rgba(0, 242, 255, 0.02) 50%, transparent);
    background-size: 100% 200%;
    animation: resonant-scan 3s linear infinite;
    pointer-events: none;
}

@keyframes resonant-scan {
    0% {
        background-position: 0 100%;
    }

    100% {
        background-position: 0 -100%;
    }
}

.frontier-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.frontier-card .id {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    color: var(--accent-cyan);
    font-size: 1.2rem;
}

.frontier-card .status-tag {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent-cyan);
    background: rgba(0, 242, 255, 0.1);
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid rgba(0, 242, 255, 0.2);
}

.frontier-card h3 {
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
    color: #fff;
}

.frontier-card .gain-metric {
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    color: var(--accent-cyan);
    margin-bottom: 1rem;
    font-weight: 600;
}

.frontier-card p {
    font-size: 0.85rem;
    color: var(--text-dim);
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.status-indicator-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    border-left: 2px solid var(--accent-cyan);
}

.status-indicator-bar .dot {
    width: 6px;
    height: 6px;
    background: var(--accent-cyan);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--accent-cyan);
    animation: blink-fast 1s infinite alternate;
}

.status-indicator-bar .indicator-text {
    font-size: 0.6rem;
    color: var(--accent-cyan);
    font-weight: 800;
    letter-spacing: 1px;
}

@keyframes blink-fast {
    from {
        opacity: 0.3;
    }

    to {
        opacity: 1;
    }
}

/* Foundation Section */
.category-group {
    margin-bottom: 2rem;
}

.category-header {
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    cursor: pointer;
}

.category-header h4 {
    font-size: 0.9rem;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.category-header .count {
    font-size: 0.6rem;
    color: var(--text-dim);
}

.foundation-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 10px;
    padding: 0 10px;
}

.phase-node.small {
    height: 60px;
    width: 60px;
}

.phase-node.small .number {
    font-size: 0.9rem;
}

/* Mobile Responsive */
@media (max-width: 1024px) {
    .dashboard-container {
        grid-template-columns: 1fr;
    }

    .hud-header {
        padding: 1rem 1.5rem;
    }

    .hud-metrics {
        display: none;
        /* Hide on mobile to focus on content */
    }
}

.section-header h2 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #fff;
}

.section-header p {
    color: var(--text-dim);
    margin-bottom: 2rem;
}

.badge {
    font-size: 0.7rem;
    background: var(--glass-bg);
    padding: 4px 8px;
    border-radius: 4px;
    vertical-align: middle;
    margin-left: 10px;
    border: 1px solid var(--glass-border);
}

/* Grid */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 12px;
    perspective: 1000px;
}

.phase-node {
    aspect-ratio: 1;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.phase-node:hover {
    background: rgba(0, 242, 255, 0.1);
    border-color: var(--accent-cyan);
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4);
}

.phase-node.complete::after {
    content: '';
    position: absolute;
    top: 5px;
    right: 5px;
    width: 6px;
    height: 6px;
    background: var(--accent-cyan);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--accent-cyan);
}

.phase-node.failed::after {
    content: '';
    position: absolute;
    top: 5px;
    right: 5px;
    width: 6px;
    height: 6px;
    background: #ff4444;
    border-radius: 50%;
    box-shadow: 0 0 8px #ff4444;
}

.phase-node.pending::after {
    content: '';
    position: absolute;
    top: 5px;
    right: 5px;
    width: 6px;
    height: 6px;
    background: var(--accent-amber);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--accent-amber);
}

.phase-node .id {
    font-size: 0.7rem;
    color: var(--text-dim);
}

.phase-node .number {
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
}

/* Sidebar */
.sidebar-analysis {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.panel {
    padding: 1.5rem;
}

.panel h3 {
    font-size: 0.9rem;
    margin-bottom: 1rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.status-indicator {
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 1.5rem;
}

.status-indicator::before {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--accent-cyan);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        opacity: 0.4;
    }

    50% {
        opacity: 1;
        box-shadow: 0 0 10px var(--accent-cyan);
    }

    100% {
        opacity: 0.4;
    }
}

.telemetry-chart {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    height: 100px;
    margin-top: 1rem;
}

.telemetry-chart .bar {
    flex: 1;
    background: linear-gradient(to top, var(--accent-cyan), transparent);
    border-radius: 2px 2px 0 0;
    opacity: 0.6;
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    width: 90%;
    max-width: 600px;
    padding: 2.5rem;
    position: relative;
    animation: modalIn 0.4s ease-out;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.close-btn {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-dim);
}

/* OMEGA Viewer Layout */
.omega-viewer {
    width: 90%;
    max-width: 1200px;
    height: 80vh;
    padding: 3rem;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1001;
}

.omega-layout {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 4rem;
    height: 100%;
}

/* OMEGA Viewer Expansion */
.manifold-analysis-grid {
    display: grid;
    grid-template-rows: 1.5fr 1fr;
    gap: 1.5rem;
    width: 100%;
    height: 100%;
}

.viz-panel {
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}

.panel-label {
    position: absolute;
    top: 10px;
    left: 15px;
    font-size: 0.5rem;
    letter-spacing: 2px;
    color: var(--accent-cyan);
    font-weight: 800;
}

#viz-topology canvas {
    width: 100%;
    height: 100%;
}

.spectral-bars {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 80%;
    margin-top: 20px;
}

.s-bar {
    flex: 1;
    background: var(--accent-cyan);
    opacity: 0.6;
    transition: height 0.3s ease;
}

.deep-scan-box {
    margin-top: 2rem;
    padding: 1.5rem;
}

.deep-scan-box h4 {
    font-size: 0.7rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 1rem;
}

.params-list {
    list-style: none;
}

.params-list li {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.p-key {
    color: var(--text-dim);
}

.p-val {
    color: #fff;
    font-family: monospace;
}

.layer-controls {
    margin-top: 2rem;
    display: flex;
    gap: 0.5rem;
}

.control-btn {
    flex: 1;
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-dim);
    padding: 0.5rem;
    cursor: pointer;
    font-size: 0.7rem;
    text-transform: uppercase;
    transition: all 0.3s;
}

.control-btn.active {
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
    background: rgba(0, 242, 255, 0.05);
}