/* V10 PALETTE */
:root {
    --color-bg: #080808;
    --color-panel: rgba(18, 18, 18, 0.85);
    --color-line: #333333;
    --color-text: #F0F0F0;
    --color-accent: #FF4400;
    --color-glow: #0088ff;

    --font-main: 'Manrope', sans-serif;
    --ease-tech: cubic-bezier(0.19, 1, 0.22, 1);
}

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

body {
    background-color: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-main);
    overflow: hidden;
    width: 100vw;
    height: var(--app-height, 100vh);
    /* Fix for mobile address bar */
}

.grid-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    background-image:
        linear-gradient(var(--grid-color) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-color) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
}

/* --- LAYOUT CONTAINERS --- */

/* Canvas Container: Desktop = Fullscreen, Mobile = 50vw Left */
#canvas-container {
    width: 100vw;
    height: var(--app-height, 100vh);
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    /* Removed transition to prevent canvas stretching during resize */
}

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

/* Side List: Desktop = Hidden, Mobile = 50vw Right */
#side-list {
    display: none;
    /* Hidden by default (Desktop) */
    width: 50vw;
    height: var(--app-height, 100vh);
    position: absolute;
    top: 0;
    right: 0;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    background: rgba(11, 11, 11, var(--mobile-list-opacity));
    z-index: 20;
    /* Dynamic padding to ensure center item aligns with center of screen */
    padding-top: calc(var(--half-height, 50vh) - 40px);
    padding-bottom: calc(var(--half-height, 50vh) - 40px);
    border-left: 1px solid #141414;
}

#side-list::-webkit-scrollbar {
    width: 2px;
}

#side-list::-webkit-scrollbar-thumb {
    background: #333;
}

/* --- UI ELEMENTS (Desktop) --- */
#ui-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
}

.brand {
    position: absolute;
    top: 2rem;
    left: 2rem;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: -0.02em;
    text-transform: uppercase;
    color: var(--color-text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    opacity: 0.8;
    pointer-events: auto;
    transition: opacity 0.5s ease;
}

.brand.hidden {
    opacity: 0;
    pointer-events: none;
}

.brand::before {
    content: '';
    display: block;
    width: 8px;
    height: 8px;
    background: var(--color-accent);
    border-radius: 50%;
}

/* CAPSULE UI (Desktop Floating Labels) */
.node-label {
    position: absolute;
    pointer-events: auto;
    transform: translate(-50%, -50%) scale(var(--nexus-scale, 1));
    width: 200px;
    background: var(--color-panel);
    border: 1px solid #2a2a2a;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    transition: all 0.4s var(--ease-tech);
    overflow: hidden;
    height: 48px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.node-label.active {
    width: 240px;
    height: auto;
    max-height: 200px;
    z-index: 100;
    border-color: var(--color-glow);
    box-shadow: 0 10px 30px rgba(0, 136, 255, 0.15);
    border-radius: 12px;
    transform: translate(-50%, -60%) scale(var(--nexus-scale, 1));
}

/* Hero Mode (Desktop Active) */
.node-label.hero {
    width: auto !important;
    /* Soft dark blob backdrop for readability -> MOVED TO .hero-bg */
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    pointer-events: none;
    z-index: 200;
    padding: 6rem !important;
    /* Extend gradient */
}

.node-label.hero .label-header {
    padding: 0;
    height: auto;
}

.node-label.hero .node-title {
    font-size: 1.5rem;
    color: var(--color-accent);
    text-shadow: 0 0 20px rgba(255, 68, 0, 0.4);
    letter-spacing: 0.1em;
}

.node-label.hero .badge-body {
    display: block;
    /* Show description */
    opacity: 1;
    transform: translateY(0);
}

.node-label.hero .separator {
    display: none;
    /* Hide line */
}


.label-header {
    width: 100%;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 1rem;
    cursor: pointer;
}

.node-title {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #ddd;
    width: 100%;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.3s;
}

.node-label:hover .node-title,
.node-label.active .node-title {
    color: var(--color-text);
}

.node-label.active .node-title {
    color: var(--color-accent);
}

.badge-body {
    width: 100%;
    padding: 0 1.2rem 1.2rem 1.2rem;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    display: none;
}

.node-label.active .badge-body {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.separator {
    width: 100%;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin-bottom: 0.8rem;
}

.node-desc {
    font-size: 0.8rem;
    line-height: 1.5;
    color: #ccc;
    text-align: center;
}

/* HERO BACKDROP (Flash Fix) */
.hero-bg {
    position: absolute;
    top: 60%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: calc(100% - 10rem);
    height: calc(100% - 7rem);
    background: radial-gradient(closest-side, rgba(0, 0, 0, 0.9) 0%, transparent 40%);
    opacity: 0;
    transition: opacity 0.6s ease;
    /* Smooth fade out */
    z-index: -2;
    pointer-events: none;
}

.node-label.hero .hero-bg {
    opacity: 1;
}

/* --- MOBILE LIST STYLES (Split View) --- */
.list-item {
    height: 80px;
    scroll-snap-align: center;
    display: flex;
    align-items: center;
    padding-left: 1.5rem;
    color: #555;
    transition: all 0.3s ease;
    cursor: pointer;
    border-bottom: 1px solid #141414;
    position: relative;
}

.list-item.active {
    color: var(--color-text);
    background: rgba(255, 255, 255, 0.02);
}

.list-item.active .list-title {
    color: var(--color-accent);
    transform: translateX(10px);
    text-shadow: 0 0 10px rgba(255, 68, 0, 0.2);
}

.list-title {
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
}


/* --- DETAIL VIEW (Mobile Page) --- */
#detail-view {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--color-bg);
    z-index: 100;
    transform: translateX(100%);
    transition: transform 0.5s var(--ease-tech);
    display: flex;
    flex-direction: column;
    pointer-events: auto;
}

#detail-view.visible {
    transform: translateX(0);
}

.detail-header {
    padding: 2rem;
    border-bottom: 1px solid #222;
    background: radial-gradient(circle at top right, #111, #080808);
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #666;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    padding: 0.5rem 0;
    margin-bottom: 1.5rem;
}

.back-btn:hover {
    color: var(--color-accent);
}

.detail-title {
    font-size: 2rem;
    color: var(--color-accent);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.05em;
    line-height: 1;
}

.detail-body {
    padding: 2rem;
    overflow-y: auto;
    flex: 1;
}

.detail-desc {
    font-size: 1.1rem;
    line-height: 1.6;
    color: #ddd;
    max-width: 600px;
}


/* --- RESPONSIVE SWITCH --- */
/* Trigger on Narrow Width OR Short Height (Landscape Phone) */
@media (max-width: 800px),
(max-height: 500px) and (orientation: landscape) {

    /* Enable Split View Layout */
    body {
        display: flex;
    }

    #canvas-container {
        width: 50vw;
        border-right: 1px solid #222;
    }

    #side-list {
        display: block;
    }

    /* Hide Desktop Elements */
    .node-label {
        display: none !important;
    }

    /* Hide floating labels entirely */

    /* Detail View is strictly for Mobile logic here */

    /* Adjust Brand */
    .brand {
        top: 1.5rem;
        left: 1rem;
        font-size: 0.7rem;
        pointer-events: none;
    }
}

/* --- FROSTED GLASS CORE OVERLAY --- */

#core-glass {
    position: absolute;
    width: var(--glass-size);
    height: var(--glass-size);
    border-radius: 50%;
    z-index: 5;
    /* Above canvas, below high UI */
    pointer-events: none;
    /* Let clicks pass through to core/canvas */
    overflow: hidden;
    transform: translate(-50%, -50%);
    /* Optional: Add a subtle border or tint if needed, 
       but focusing on the requested blur effect first. */
    outline: 1px solid rgba(255, 255, 255, var(--glass-outline));
}

#core-glass .backdrop {
    position: absolute;
    inset: 0;
    height: 100%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.03) 0%, transparent 70%);
    /* Subtle Glass Sheen */
    -webkit-backdrop-filter: blur(var(--glass-blur));
    backdrop-filter: blur(var(--glass-blur));
    -webkit-mask-image: radial-gradient(closest-side,
            black var(--glass-fade-start),
            transparent var(--glass-fade-end));
    mask-image: radial-gradient(closest-side,
            black var(--glass-fade-start),
            transparent var(--glass-fade-end));
}

#core-glass.hidden {
    opacity: 0;
    outline: none;
    transition: opacity 0.8s ease;
}