/* Base styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

:root {
    /* Node color variables */
    --root-color: #4A90E2;
    --component-color: #50C878;
    --subcomponent-color: #9B59B6;
    --capability-color: #E67E22;
    --function-color: #E74C3C;
    --specification-color: #F1C40F;
    --integration-color: #16A085;
    --technique-color: #2ECC71;
    --application-color: #3498DB;
    --input-color: #5499C7;
    --output-color: #F39C12;
    
    /* Other theme colors */
    --background-dark: #0f1015;
    --panel-background: #1e1e2f;
    --panel-border: #2d2d44;
    --text-light: #ffffff;
    --text-muted: #a3a3ff;
}

body, html {
    height: 100%;
    width: 100%;
    overflow: hidden;
    background-color: var(--background-dark);
    color: var(--text-light);
}

/* Main layout */
.container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

#visualization-container {
    flex: 7;
    position: relative;
    height: 100%;
    overflow: hidden;
}

#details-panel {
    flex: 3;
    background-color: #1e1e2f;
    border-left: 1px solid #2d2d44;
    padding: 20px;
    overflow: hidden;
    width: 30%;
    min-width: 300px;
    max-width: 600px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}

/* Scene container */
#scene-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Controls */
.controls {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 5;
}

.controls button {
    background-color: rgba(255, 255, 255, 0.9);
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.controls button:hover {
    background-color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

/* Panel toggle button styling */
.controls button.panel-toggle {
    background-color: var(--panel-background);
    color: var(--text-light);
    border: 1px solid var(--panel-border);
}

.controls button.panel-toggle:hover {
    background-color: #2a2a3f;
    color: var(--text-light);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

/* Electrical animation for Info button */
.controls button#toggle-panel {
    position: relative;
    overflow: visible;
    background: linear-gradient(45deg, #1a1a2e, #16213e, #0f3460);
    border: 2px solid #00ffff;
    box-shadow: 
        0 0 10px rgba(0, 255, 255, 0.5),
        inset 0 0 10px rgba(0, 255, 255, 0.1);
    animation: electricPulse 2s infinite ease-in-out;
}

.controls button#toggle-panel::before {
    content: '';
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    background: linear-gradient(45deg, transparent, #00ffff, transparent, #0080ff, transparent);
    border-radius: 8px;
    z-index: -1;
    opacity: 0.7;
}

.controls button#toggle-panel::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(0, 255, 255, 0.1) 0%, transparent 70%);
    transform: translate(-50%, -50%);
    z-index: -2;
    animation: electricGlow 1.5s ease-in-out infinite alternate;
}

/* Stable state when panel is open */
.controls button#toggle-panel.panel-open {
    background: linear-gradient(45deg, #0f3460, #16213e, #1a1a2e);
    border: 2px solid #ffffff;
    box-shadow: 
        0 0 15px rgba(255, 255, 255, 0.6),
        0 0 25px rgba(0, 255, 255, 0.3),
        inset 0 0 10px rgba(255, 255, 255, 0.1);
    animation: none; /* Stop the pulsing animation */
}

.controls button#toggle-panel.panel-open::before {
    animation: none; /* Stop the rotating border */
    opacity: 0.3; /* Dim the rotating effect */
}

.controls button#toggle-panel.panel-open::after {
    animation: none; /* Stop the glow animation */
    opacity: 0.2; /* Dim the glow */
}

.controls button#toggle-panel.panel-open .lightning {
    animation: none; /* Stop lightning animations */
    opacity: 0; /* Hide lightning bolts completely */
}

.controls button#toggle-panel.panel-open .spark {
    animation: none; /* Stop spark animations */
    opacity: 0; /* Hide sparks completely */
}

/* State after first interaction - no more rotation, but keep sparks/lightning */
.controls button#toggle-panel.first-clicked {
    animation: electricPulse 2s infinite ease-in-out; /* Keep pulsing */
}

.controls button#toggle-panel.first-clicked::before {
    animation: none; /* STOP rotation permanently */
    opacity: 0.3; /* Dim the rotating border */
}

.controls button#toggle-panel.first-clicked::after {
    animation: electricGlow 1.5s ease-in-out infinite alternate; /* Keep glow */
}

.controls button#toggle-panel.first-clicked .lightning {
    animation: lightning 0.8s infinite; /* Keep lightning */
}

.controls button#toggle-panel.first-clicked .spark {
    animation: spark 1.2s infinite; /* Keep sparks */
}

/* When panel is open AND first-clicked, still calm everything down */
.controls button#toggle-panel.panel-open.first-clicked {
    animation: none;
}

.controls button#toggle-panel.panel-open.first-clicked::before {
    animation: none;
    opacity: 0.3;
}

.controls button#toggle-panel.panel-open.first-clicked::after {
    animation: none;
    opacity: 0.2;
}

.controls button#toggle-panel.panel-open.first-clicked .lightning {
    animation: none;
    opacity: 0;
}

.controls button#toggle-panel.panel-open.first-clicked .spark {
    animation: none;
    opacity: 0;
}

/* Lightning bolt effects */
.controls button#toggle-panel .lightning {
    position: absolute;
    width: 2px;
    background: linear-gradient(to bottom, #ffffff, #00ffff, #0080ff);
    border-radius: 1px;
    opacity: 0;
    animation: lightning 0.8s infinite;
    box-shadow: 0 0 6px #00ffff;
}

.controls button#toggle-panel .lightning:nth-child(1) {
    top: -15px;
    left: 20%;
    height: 25px;
    animation-delay: 0s;
    transform: rotate(15deg);
}

.controls button#toggle-panel .lightning:nth-child(2) {
    top: -10px;
    right: 25%;
    height: 20px;
    animation-delay: 0.3s;
    transform: rotate(-20deg);
}

.controls button#toggle-panel .lightning:nth-child(3) {
    bottom: -12px;
    left: 30%;
    height: 18px;
    animation-delay: 0.6s;
    transform: rotate(25deg);
}

/* Spark effects */
.controls button#toggle-panel .spark {
    position: absolute;
    width: 3px;
    height: 3px;
    background: #ffffff;
    border-radius: 50%;
    box-shadow: 0 0 8px #00ffff;
    opacity: 0;
    animation: spark 1.2s infinite;
}

.controls button#toggle-panel .spark:nth-child(4) {
    top: -8px;
    left: 10%;
    animation-delay: 0.2s;
}

.controls button#toggle-panel .spark:nth-child(5) {
    top: -5px;
    right: 15%;
    animation-delay: 0.7s;
}

.controls button#toggle-panel .spark:nth-child(6) {
    bottom: -6px;
    right: 20%;
    animation-delay: 1s;
}

.controls button#toggle-panel .spark:nth-child(7) {
    bottom: -8px;
    left: 40%;
    animation-delay: 0.4s;
}

/* Enhanced hover effect */
.controls button#toggle-panel:hover {
    background: linear-gradient(45deg, #0f3460, #16213e, #1a1a2e);
    border-color: #ffffff;
    box-shadow: 
        0 0 20px rgba(0, 255, 255, 0.8),
        0 0 40px rgba(0, 255, 255, 0.4),
        inset 0 0 15px rgba(255, 255, 255, 0.1);
    animation: electricPulseHover 0.5s infinite ease-in-out;
}

.controls button#toggle-panel:hover .lightning {
    animation-duration: 0.4s;
}

.controls button#toggle-panel:hover .spark {
    animation-duration: 0.6s;
}

/* Keyframe animations */
@keyframes electricPulse {
    0%, 100% {
        box-shadow: 
            0 0 10px rgba(0, 255, 255, 0.5),
            inset 0 0 10px rgba(0, 255, 255, 0.1);
    }
    50% {
        box-shadow: 
            0 0 20px rgba(0, 255, 255, 0.8),
            0 0 30px rgba(0, 255, 255, 0.3),
            inset 0 0 15px rgba(0, 255, 255, 0.2);
    }
}

@keyframes electricPulseHover {
    0%, 100% {
        box-shadow: 
            0 0 20px rgba(0, 255, 255, 0.8),
            0 0 40px rgba(0, 255, 255, 0.4),
            inset 0 0 15px rgba(255, 255, 255, 0.1);
    }
    50% {
        box-shadow: 
            0 0 30px rgba(255, 255, 255, 0.9),
            0 0 50px rgba(0, 255, 255, 0.6),
            inset 0 0 20px rgba(255, 255, 255, 0.2);
    }
}

@keyframes electricRotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes electricGlow {
    0% { opacity: 0.1; }
    100% { opacity: 0.3; }
}

@keyframes lightning {
    0%, 90%, 100% { opacity: 0; }
    5%, 10% { opacity: 1; }
    15%, 20% { opacity: 0.8; }
    25%, 30% { opacity: 0.8; }
    35%, 85% { opacity: 0; }
}

@keyframes spark {
    0%, 70%, 100% { 
        opacity: 0; 
        transform: scale(0.5);
    }
    10%, 20% { 
        opacity: 1; 
        transform: scale(1.2);
    }
    30%, 60% { 
        opacity: 0.6; 
        transform: scale(0.8);
    }
}

/* Rotation toggle button styling */
.controls button#toggle-rotation {
    transition: all 0.3s ease;
}

.controls button#toggle-rotation.active {
    background-color: var(--panel-background);
    color: var(--text-light);
    border: 1px solid var(--panel-border);
}

.controls button#toggle-rotation.active:hover {
    background-color: #2a2a3f;
    color: var(--text-light);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

/* Panel visibility states */
#details-panel.hidden {
    display: none;
}

.container.panel-hidden #visualization-container {
    flex: 1;
    width: 100%;
}

.container.panel-hidden #details-panel {
    display: none;
}

/* Legend */
.legend {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background-color: rgba(25, 25, 40, 0.8);
    padding: 15px;
    border-radius: 8px;
    z-index: 5;
    max-width: 250px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(75, 75, 120, 0.5);
    transition: opacity 0.3s ease, transform 0.3s ease;
    transform: translateY(0);
}

.legend.hidden {
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
    visibility: hidden;
}

/* Help Panel */
.help-panel {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background-color: rgba(25, 25, 40, 0.95);
    padding: 20px;
    border-radius: 12px;
    z-index: 5;
    max-width: 420px;
    max-height: 70vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(75, 75, 120, 0.5);
    transition: opacity 0.3s ease, transform 0.3s ease;
    transform: translateY(0);
}

.help-panel.hidden {
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
    visibility: hidden;
}

.help-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(75, 75, 120, 0.3);
}

.help-header h3 {
    color: #a3a3ff;
    font-size: 20px;
    margin-bottom: 5px;
}

.help-subtitle {
    color: #6666aa;
    font-size: 14px;
    font-style: italic;
}

.help-section {
    margin-bottom: 20px;
}

.help-section h4 {
    color: #8888ff;
    font-size: 16px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
}

.help-icon {
    margin-right: 8px;
    font-size: 18px;
}

.help-content {
    margin-left: 8px;
}

.help-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    padding: 8px 12px;
    background-color: rgba(40, 40, 70, 0.4);
    border-radius: 6px;
    transition: background-color 0.2s;
}

.help-item:hover {
    background-color: rgba(60, 60, 100, 0.6);
}

.help-action {
    color: #a3a3ff;
    font-weight: 500;
    font-size: 14px;
    min-width: 140px;
}

.help-description {
    color: #ccccdd;
    font-size: 13px;
    text-align: right;
}

.help-tip {
    display: flex;
    align-items: flex-start;
    margin-bottom: 12px;
    padding: 10px 12px;
    background-color: rgba(50, 50, 100, 0.3);
    border-radius: 6px;
    border-left: 3px solid #6666ff;
}

.tip-icon {
    margin-right: 10px;
    font-size: 16px;
    color: #ffdd00;
}

.tip-text {
    color: #ddddee;
    font-size: 13px;
    line-height: 1.4;
}

/* Custom scrollbar for help panel */
.help-panel::-webkit-scrollbar {
    width: 8px;
}

.help-panel::-webkit-scrollbar-track {
    background: rgba(40, 40, 70, 0.3);
    border-radius: 4px;
}

.help-panel::-webkit-scrollbar-thumb {
    background: rgba(100, 100, 180, 0.6);
    border-radius: 4px;
}

.help-panel::-webkit-scrollbar-thumb:hover {
    background: rgba(120, 120, 200, 0.8);
}

/* Custom scrollbar for details panel (info panel) */
.single-scrollable-container::-webkit-scrollbar {
    width: 8px;
}

.single-scrollable-container::-webkit-scrollbar-track {
    background: rgba(40, 40, 70, 0.3);
    border-radius: 4px;
}

.single-scrollable-container::-webkit-scrollbar-thumb {
    background: rgba(100, 100, 180, 0.6);
    border-radius: 4px;
}

.single-scrollable-container::-webkit-scrollbar-thumb:hover {
    background: rgba(120, 120, 200, 0.8);
}

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.legend-color {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    margin-right: 10px;
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.3);
}

/* Node type colors */
.legend-color.component-group {
    background-color: #4A90E2;
}

.legend-color.component {
    background-color: #50C878;
}

.legend-color.subcomponent {
    background-color: #9B59B6;
}

.legend-color.capability {
    background-color: #E67E22;
}

.legend-color.function {
    background-color: #E74C3C;
}

.legend-color.specification {
    background-color: #F1C40F;
}

.legend-color.integration {
    background-color: #16A085;
}

.legend-color.technique {
    background-color: #2ECC71;
}

.legend-color.application {
    background-color: #3498DB;
}

.legend-color.input {
    background-color: #5499C7;
}

.legend-color.output {
    background-color: #F39C12;
}

/* Hover node display */
#hover-node-name {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(20, 20, 35, 0.9);
    padding: 12px 20px;
    border-radius: 8px;
    border: 2px solid rgba(83, 83, 255, 0.5);
    color: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 100;
    pointer-events: none;
    max-width: 90%;
    text-align: center;
    font-size: 16px;
}

#hover-node-name .node-type {
    color: #a3a3ff;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
}

#hover-node-name .node-name {
    font-size: 20px;
    font-weight: bold;
    line-height: 1.3;
    word-wrap: break-word;
}

/* Details panel styling */
.details-header {
    margin-bottom: 20px;
    flex-shrink: 0; /* Prevent header from shrinking */
}

#details-title {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #373755;
    flex-grow: 1;
}

.welcome-header-title {
    background: linear-gradient(135deg, rgba(74, 144, 226, 0.1), rgba(155, 89, 182, 0.1));
    border-radius: 8px;
    padding: 20px;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(74, 144, 226, 0.2);
    flex-grow: 1;
}

.welcome-header-title .cosmic-title {
    text-align: center;
    position: relative;
    z-index: 2;
}

.welcome-header-title .cosmic-title h2 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 6px;
    background: linear-gradient(45deg, #4A90E2, #9B59B6, #50C878);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.welcome-header-title .subtitle {
    font-size: 14px;
    color: var(--text-muted);
    font-style: italic;
    opacity: 0.9;
}

.welcome-header-title .orbital-decoration {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120px;
    height: 120px;
    z-index: 1;
}

.welcome-header-title .orbit-ring {
    position: absolute;
    border: 1px solid rgba(74, 144, 226, 0.2);
    border-radius: 50%;
    animation: rotate 20s linear infinite;
}

.welcome-header-title .orbit-ring:nth-child(1) {
    width: 40px;
    height: 40px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.welcome-header-title .orbit-ring-2 {
    width: 70px;
    height: 70px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-duration: 30s;
    border-color: rgba(155, 89, 182, 0.2);
}

.welcome-header-title .orbit-ring-3 {
    width: 100px;
    height: 100px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-duration: 40s;
    border-color: rgba(80, 200, 120, 0.2);
}

/* Node cosmic title styling - similar to welcome header but for individual nodes */
.node-cosmic-title {
    background: linear-gradient(135deg, rgba(74, 144, 226, 0.1), rgba(155, 89, 182, 0.1));
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(74, 144, 226, 0.2);
}

.node-cosmic-title .cosmic-title {
    text-align: center;
    position: relative;
    z-index: 2;
}

.node-cosmic-title .cosmic-title h2 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 0;
    background: linear-gradient(45deg, #4A90E2, #9B59B6, #50C878);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.node-cosmic-title .orbital-decoration {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 100px;
    z-index: 1;
}

.node-cosmic-title .orbit-ring {
    position: absolute;
    border: 1px solid rgba(74, 144, 226, 0.2);
    border-radius: 50%;
    animation: rotate 20s linear infinite;
}

.node-cosmic-title .orbit-ring:nth-child(1) {
    width: 30px;
    height: 30px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.node-cosmic-title .orbit-ring-2 {
    width: 60px;
    height: 60px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-duration: 30s;
    border-color: rgba(155, 89, 182, 0.2);
}

.node-cosmic-title .orbit-ring-3 {
    width: 90px;
    height: 90px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-duration: 40s;
    border-color: rgba(80, 200, 120, 0.2);
}

.breadcrumb-container {
    display: flex;
    flex-wrap: wrap;
    font-size: 14px;
    margin-bottom: 15px;
    color: #a3a3ff;
}

.breadcrumb-item {
    display: inline-flex;
    align-items: center;
    margin-right: 5px;
}

.breadcrumb-separator {
    margin: 0 5px;
    color: #5c5c8a;
}

.breadcrumb-item.clickable {
    cursor: pointer;
    color: #64b5f6;
}

.breadcrumb-item.clickable:hover {
    text-decoration: underline;
}

.scrollable-content {
    overflow-y: auto;
    margin-bottom: 20px;
    max-height: calc(100% - 200px);
}

/* New unified scrollable container */
.single-scrollable-container {
    overflow-y: auto;
    flex-grow: 1;
    padding-right: 10px;
    height: calc(100% - 60px);
}

/* Detail sections */
.detail-section {
    margin-bottom: 20px;
    background-color: rgba(30, 30, 50, 0.5);
    border-radius: 8px;
    overflow: hidden;
}

.section-header {
    background-color: rgba(40, 40, 70, 0.7);
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.section-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.section-content {
    padding: 15px;
}

.section-toggle {
    cursor: pointer;
    transition: transform 0.2s;
}

.section-toggle.collapsed {
    transform: rotate(-90deg);
}

/* Node type badges with proper colors */
.node-type-badge {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 12px;
    margin-bottom: 15px;
    color: white;
}

.node-type-badge.component_group {
    background-color: var(--root-color, #4A90E2);
}

.node-type-badge.component {
    background-color: var(--component-color, #50C878);
}

.node-type-badge.subcomponent {
    background-color: var(--subcomponent-color, #9B59B6);
}

.node-type-badge.capability {
    background-color: var(--capability-color, #E67E22);
}

.node-type-badge.function {
    background-color: var(--function-color, #E74C3C);
}

.node-type-badge.specification {
    background-color: var(--specification-color, #F1C40F);
}

.node-type-badge.integration {
    background-color: var(--integration-color, #16A085);
}

.node-type-badge.technique {
    background-color: var(--technique-color, #2ECC71);
}

.node-type-badge.application {
    background-color: var(--application-color, #3498DB);
}

.node-type-badge.input {
    background-color: var(--input-color, #5499C7);
}

.node-type-badge.output {
    background-color: var(--output-color, #F39C12);
}

/* Clickable items */
.clickable-item {
    cursor: pointer;
    padding: 10px 15px;
    margin-bottom: 10px;
    border-radius: 6px;
    background-color: rgba(50, 50, 80, 0.5);
    transition: all 0.2s;
    border: 1px solid rgba(100, 100, 200, 0.2);
}

.clickable-item:hover {
    background-color: rgba(70, 70, 100, 0.7);
    transform: translateX(3px);
    border-color: rgba(163, 163, 255, 0.3);
}

.item-description {
    font-size: 14px;
    margin-top: 8px;
    color: #ccccdd;
}

/* Literature section */
#literature-references {
    padding-top: 15px;
    margin-top: 30px;
    border-top: 1px solid #373755;
}

#literature-references h3 {
    font-size: 18px;
    margin-bottom: 15px;
    color: #a3a3ff;
}

.reference-item {
    background-color: rgba(40, 40, 70, 0.5);
    border-radius: 6px;
    margin-bottom: 15px;
    overflow: hidden;
    transition: transform 0.2s, background-color 0.2s;
}

.reference-item.clickable {
    cursor: pointer;
    position: relative;
}

.reference-item.clickable:hover {
    background-color: rgba(60, 60, 100, 0.7);
    transform: translateY(-2px);
}

.reference-item.clickable:after {
    content: '↗';
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 18px;
    color: var(--text-muted);
    opacity: 0.7;
}

.ref-header {
    background-color: rgba(60, 60, 100, 0.4);
    padding: 12px 15px;
    font-weight: 600;
    font-size: 15px;
}

.ref-body {
    padding: 12px 15px;
    font-size: 14px;
    color: var(--text-muted);
}

/* Loading indicator */
.loading-indicator {
    text-align: center;
    padding: 20px;
    color: #aaaacc;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #a3a3ff;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

/* Empty states */
.empty-section {
    padding: 15px;
    color: #7a7a9d;
    font-style: italic;
    text-align: center;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .container {
        flex-direction: column;
    }
    
    #visualization-container {
        flex: 1;
        height: 65vh;
    }
    
    #details-panel {
        flex: 1;
        height: 35vh;
        width: 100%;
        max-width: 100%;
    }
    
    .controls {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 6px;
        top: 10px;
        right: 10px;
        max-width: calc(100vw - 20px);
    }
    
    .controls button {
        font-size: 14px;
        padding: 8px 12px;
        min-height: 44px;
        flex: 0 0 auto;
    }
    
    .legend {
        max-height: 35vh;
        overflow-y: auto;
        bottom: 10px;
        left: 10px;
        max-width: calc(100vw - 20px);
    }
    
    .help-panel {
        bottom: 10px;
        left: 10px;
        max-width: calc(100vw - 20px);
        max-height: 60vh;
        font-size: 14px;
    }
}

/* Mobile phone specific adjustments */
@media (max-width: 768px) {
    body, html {
        overflow: hidden;
        position: fixed;
        width: 100%;
        height: 100%;
    }
    
    .container {
        height: 100vh;
        height: 100dvh;
        flex-direction: column; /* Stack vertically for mobile */
        position: relative;
    }
    
    #visualization-container {
        width: 100%;
        height: 100vh;
        height: 100dvh;
        touch-action: manipulation;
        position: relative;
    }
    
    #details-panel {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        z-index: 20; /* High z-index to overlay everything */
        padding: 80px 12px 12px 12px; /* Increased top padding for more margin */
        background-color: rgba(30, 30, 47, 0.98); /* Semi-transparent background */
        backdrop-filter: blur(10px); /* Blur effect */
        transform: translateX(100%); /* Start hidden off-screen */
        transition: transform 0.3s ease-in-out;
    }
    
    #details-panel:not(.hidden) {
        transform: translateX(0); /* Slide in when shown */
    }
    
    /* Hide navigation elements on mobile to save space for info panel */
    .breadcrumb-container {
        display: none;
    }
    
    .welcome-header-title {
        display: none;
    }
    
    .back-button {
        display: none;
    }
    
    /* Adjust details header to remove extra spacing */
    .details-header {
        padding-bottom: 0;
        margin-bottom: 8px;
    }
    
    .header-row {
        margin-bottom: 0;
    }
    
    /* Increase available space for content by reducing header overhead */
    .single-scrollable-container {
        height: calc(100% - 20px); /* Reduced from 60px since we removed navigation elements */
    }
    
    /* Mobile-only title section styles */
    .mobile-title-section {
        background: linear-gradient(135deg, rgba(74, 144, 226, 0.15), rgba(155, 89, 182, 0.15));
        border-radius: 8px;
        padding: 20px;
        margin-bottom: 20px;
        margin-top: 10px; /* Add top margin for better spacing */
        position: relative;
        overflow: hidden;
        border: 1px solid rgba(74, 144, 226, 0.3);
        display: block !important; /* Force show on mobile */
    }
    
    .mobile-cosmic-title {
        text-align: center;
        position: relative;
        z-index: 2;
    }
    
    .mobile-cosmic-title h2 {
        font-size: 20px;
        font-weight: 700;
        margin-bottom: 6px;
        background: linear-gradient(45deg, #4A90E2, #9B59B6, #50C878);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
    }
    
    .mobile-subtitle {
        font-size: 13px;
        color: var(--text-muted);
        font-style: italic;
        opacity: 0.9;
    }
    
    .mobile-orbital-decoration {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 100px;
        height: 100px;
        z-index: 1;
    }
    
    .mobile-orbital-decoration .orbit-ring {
        position: absolute;
        border: 1px solid rgba(74, 144, 226, 0.2);
        border-radius: 50%;
        animation: rotate 20s linear infinite;
    }
    
    .mobile-orbital-decoration .orbit-ring:nth-child(1) {
        width: 30px;
        height: 30px;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
    }
    
    .mobile-orbital-decoration .orbit-ring-2 {
        width: 60px;
        height: 60px;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        animation-duration: 30s;
        border-color: rgba(155, 89, 182, 0.2);
    }
    
    .mobile-orbital-decoration .orbit-ring-3 {
        width: 90px;
        height: 90px;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        animation-duration: 40s;
        border-color: rgba(80, 200, 120, 0.2);
    }
    
    .controls {
        gap: 6px; /* Slightly larger gap to prevent accidental clicks */
        top: 8px;
        right: 8px;
        left: 8px;
        max-width: calc(100vw - 16px);
        pointer-events: auto;
        z-index: 25; /* Higher than panel to stay accessible */
        flex-wrap: wrap;
        justify-content: flex-end;
    }
    
    .controls button {
        font-size: 12px;
        padding: 6px 10px;
        min-height: 40px;
        border-radius: 6px;
        margin: 0; /* Remove any default margins */
        box-sizing: border-box; /* Ensure padding doesn't extend click area */
    }
    
    .legend {
        bottom: 12px;
        left: 8px;
        max-width: calc(100vw - 16px);
        max-height: 35vh;
        font-size: 13px;
        padding: 12px;
        z-index: 25; /* Same level as controls */
    }
    
    .help-panel {
        bottom: 12px;
        left: 8px;
        max-width: calc(100vw - 16px);
        max-height: 45vh;
        font-size: 13px;
        padding: 15px;
        z-index: 25; /* Same level as controls */
    }
    
    .help-item {
        padding: 8px 0;
    }
    
    .help-action {
        font-size: 13px;
        min-width: 120px;
    }
    
    .help-description {
        font-size: 12px;
    }
}

/* Mobile landscape - keep controls scrollable and fix panel */
@media (max-width: 768px) and (orientation: landscape) {
    .controls {
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    
    .controls::-webkit-scrollbar {
        display: none;
    }
    
    #details-panel {
        padding: 70px 12px 12px 12px; /* Reduced top padding for landscape */
        height: 100vh; /* Force full viewport height */
        height: 100dvh;
    }
    
    .single-scrollable-container {
        height: calc(100vh - 90px) !important; /* Ensure proper scrollable height */
        height: calc(100dvh - 90px) !important;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    }
    
    .mobile-title-section {
        padding: 15px; /* Reduced padding for landscape */
        margin-bottom: 15px;
    }
    
    .mobile-cosmic-title h2 {
        font-size: 18px; /* Slightly smaller for landscape */
    }
    
    .mobile-subtitle {
        font-size: 12px;
    }
}

/* Error messages */
.error-message {
    background-color: rgba(220, 50, 50, 0.2);
    border-left: 3px solid #ff5252;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 15px;
    overflow: auto;
}

.error-message h3 {
    color: #ff5252;
    margin-top: 0;
    margin-bottom: 8px;
}

.error-message pre {
    margin-top: 10px;
    font-size: 12px;
    background-color: rgba(0, 0, 0, 0.2);
    padding: 8px;
    border-radius: 4px;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-x: auto;
    max-height: 200px;
}

/* Additional utility classes */
.text-center {
    text-align: center;
}

.hidden {
    display: none;
}

/* Hide mobile title section on desktop */
@media (min-width: 769px) {
    .mobile-title-section {
        display: none; /* Hidden on desktop only */
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Debug section styling */
.debug-section {
    border: 1px solid #5a67d8;
    background-color: rgba(90, 103, 216, 0.08);
    margin-top: 10px;
    margin-bottom: 10px;
}

.debug-section .section-header {
    background-color: rgba(90, 103, 216, 0.2);
}

.child-nodes {
    margin-top: 8px;
    padding: 8px;
    background-color: rgba(90, 103, 216, 0.05);
    border-radius: 4px;
}

.child-nodes ul {
    margin-top: 5px;
    margin-bottom: 0;
    padding-left: 20px;
}

.debug-button {
    background-color: #4d5ae0;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 12px;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s;
}

.debug-button:hover {
    background-color: #6068f1;
    transform: translateY(-2px);
}

.force-expand-section {
    margin-top: 12px;
    border-top: 1px dashed rgba(90, 103, 216, 0.3);
    padding-top: 12px;
}

.small-note {
    font-size: 12px;
    color: #a3a3ff;
    margin-top: 5px;
    font-style: italic;
}

.application-io-info {
    background-color: rgba(39, 174, 96, 0.1);
    border: 1px solid rgba(39, 174, 96, 0.3);
    border-radius: 6px;
    padding: 12px;
    margin-top: 10px;
    margin-bottom: 10px;
}

.application-io-info p {
    margin-bottom: 5px;
}

.application-io-info .small-note {
    color: rgba(39, 174, 96, 0.7);
    margin-top: 8px;
}

/* Global controls in details panel */
.global-controls {
    margin-bottom: 15px;
    display: flex;
    justify-content: flex-end;
}

.action-button {
    background-color: #4d5ae0;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.action-button:hover {
    background-color: #6068f1;
    transform: translateY(-2px);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}

.action-button.collapse-all {
    background-color: #e74c3c;
}

.action-button.collapse-all:hover {
    background-color: #ff6b6b;
}

/* Node styling */
.node-root { fill: var(--root-color); }
.node-approach { fill: var(--approach-color); }
.node-capability { fill: var(--capability-color); }
.node-theory { fill: var(--theory-color); }
.node-subtheory { fill: var(--subtheory-color); }
.node-component { fill: var(--component-color); }
.node-subcomponent { fill: var(--subcomponent-color); }
.node-technique { fill: var(--technique-color); }
.node-application { fill: var(--application-color); }
.node-input { 
    fill: var(--input-color); 
    stroke: #555;
    stroke-width: 0.5px;
}
.node-output { 
    fill: var(--output-color); 
    stroke: #555;
    stroke-width: 0.5px;
    /* Make outputs slightly larger to distinguish them */
    r: 7;
}

/* Link styling */
.link {
    stroke: rgba(180, 180, 180, 0.15);
    stroke-opacity: 0.2;
    stroke-width: 0.5px;
}

/* Hierarchical relationship styles */
.link-contains {
    stroke: rgba(180, 180, 180, 0.15);
    stroke-width: 0.5px;
}

/* Implementation relationship styles */
.link-implements {
    stroke: rgba(100, 200, 100, 0.25);
    stroke-width: 0.7px;
    stroke-dasharray: 4,4;
}

/* Integration relationship styles */
.link-integration_point {
    stroke: rgba(100, 150, 255, 0.25);
    stroke-width: 0.7px;
    stroke-dasharray: 2,2;
}

/* Cross-connection relationship styles */
.link-provides_input_to {
    stroke: rgba(255, 150, 50, 0.25);
    stroke-width: 0.7px;
}

.link-complements {
    stroke: rgba(150, 100, 255, 0.25);
    stroke-width: 0.7px;
}

.link-informs {
    stroke: rgba(100, 255, 150, 0.25);
    stroke-width: 0.7px;
}

.link-extends {
    stroke: rgba(255, 100, 100, 0.25);
    stroke-width: 0.7px;
}

/* Bidirectional relationship style */
.link-bidirectional {
    stroke: rgba(255, 200, 50, 0.25);
    stroke-width: 0.7px;
    stroke-dasharray: 6,3;
}

/* Override specific link styling to use the same grey color */
.link-has_capability,
.link-has_theory,
.link-has_subtheory,
.link-has_component,
.link-has_subcomponent,
.link-has_technique,
.link-has_application,
.link-has_input {
    stroke: rgba(180, 180, 180, 0.15);
}

.link-has_output { 
    stroke: rgba(180, 180, 180, 0.2);
    stroke-width: 0.5px;
    stroke-dasharray: 4,2; /* Keep dashed pattern for output links */
}

/* Minimap styles */
.minimap {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 200px;
    height: 200px;
    background-color: rgba(20, 20, 35, 0.8);
    border: 2px solid rgba(83, 83, 255, 0.5);
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    z-index: 10;
    overflow: hidden;
}

.minimap canvas {
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.minimap-title {
    position: absolute;
    top: 5px;
    left: 10px;
    color: white;
    font-size: 12px;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    pointer-events: none;
}

/* Bookmark panel */
.bookmark-panel {
    position: absolute;
    top: 80px;
    right: 20px;
    width: 220px;
    background-color: rgba(20, 20, 35, 0.8);
    border: 2px solid rgba(83, 83, 255, 0.5);
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    z-index: 10;
    padding: 10px;
    color: white;
    max-height: 300px;
    overflow-y: auto;
}

.bookmark-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 5px;
}

.bookmark-list {
    margin-bottom: 10px;
    max-height: 200px;
    overflow-y: auto;
}

.bookmark-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    border-radius: 4px;
    margin-bottom: 5px;
    background-color: rgba(255, 255, 255, 0.1);
}

.bookmark-item:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.bookmark-name {
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bookmark-actions {
    display: flex;
    gap: 5px;
}

.bookmark-go, .bookmark-delete {
    background-color: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 4px;
    color: white;
    padding: 3px 6px;
    font-size: 12px;
    cursor: pointer;
}

.bookmark-delete {
    background-color: rgba(255, 100, 100, 0.3);
}

.bookmark-add-button {
    width: 100%;
    background-color: rgba(100, 150, 255, 0.3);
    border: none;
    border-radius: 4px;
    color: white;
    padding: 8px;
    font-size: 14px;
    cursor: pointer;
}

.bookmark-add-button:hover {
    background-color: rgba(100, 150, 255, 0.5);
}

/* Search container */
.search-container {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 10;
    display: flex;
    flex-direction: column;
}

#search-input {
    width: 250px;
    padding: 8px 12px;
    border: 2px solid rgba(83, 83, 255, 0.5);
    border-radius: 6px;
    background-color: rgba(20, 20, 35, 0.8);
    color: white;
    font-size: 14px;
}

#search-button {
    position: absolute;
    right: 5px;
    top: 5px;
    background-color: rgba(100, 150, 255, 0.3);
    border: none;
    border-radius: 4px;
    color: white;
    padding: 5px 10px;
    font-size: 12px;
    cursor: pointer;
}

#search-results {
    width: 300px;
    max-height: 400px;
    overflow-y: auto;
    background-color: rgba(20, 20, 35, 0.9);
    border: 2px solid rgba(83, 83, 255, 0.5);
    border-radius: 6px;
    margin-top: 10px;
    padding: 10px;
    display: none;
}

.result-count {
    font-size: 12px;
    margin-bottom: 8px;
    color: rgba(255, 255, 255, 0.8);
}

.result-item {
    display: flex;
    align-items: center;
    padding: 8px;
    border-radius: 4px;
    margin-bottom: 5px;
    background-color: rgba(255, 255, 255, 0.1);
    cursor: pointer;
}

.result-item:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.result-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 8px;
}

.result-name {
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: white;
}

.result-type {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.7);
    background-color: rgba(0, 0, 0, 0.3);
    padding: 2px 5px;
    border-radius: 3px;
    margin-left: 5px;
}

.close-results {
    width: 100%;
    background-color: rgba(150, 150, 150, 0.3);
    border: none;
    border-radius: 4px;
    color: white;
    padding: 5px;
    margin-top: 10px;
    cursor: pointer;
}

.no-results, .more-results {
    text-align: center;
    padding: 10px;
    color: rgba(255, 255, 255, 0.7);
    font-style: italic;
}

/* Filter container */
.filter-container {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    background-color: rgba(20, 20, 35, 0.8);
    border: 2px solid rgba(83, 83, 255, 0.5);
    border-radius: 8px;
    padding: 10px;
    width: 200px;
    max-height: 80vh;
    overflow-y: auto;
}

.filter-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 5px;
    color: white;
}

.filter-item {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.filter-item input[type="checkbox"] {
    margin-right: 8px;
}

.filter-item label {
    color: white;
    flex-grow: 1;
}

.filter-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 8px;
}

.filter-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
}

.filter-actions button {
    background-color: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 4px;
    color: white;
    padding: 5px 10px;
    font-size: 12px;
    cursor: pointer;
    width: 48%;
}

.filter-actions button:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

/* Complexity container */
.complexity-container {
    position: absolute;
    bottom: 250px;
    right: 20px;
    z-index: 10;
    background-color: rgba(20, 20, 35, 0.8);
    border: 2px solid rgba(83, 83, 255, 0.5);
    border-radius: 8px;
    padding: 10px;
    width: 220px;
}

.complexity-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 5px;
    color: white;
}

.slider-container {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

#complexity-slider {
    flex-grow: 1;
    margin-right: 10px;
}

.slider-value {
    color: white;
    min-width: 40px;
    text-align: right;
}

.focus-mode-container {
    display: flex;
    align-items: center;
    margin-top: 10px;
}

.focus-mode-container label {
    color: white;
    margin-left: 8px;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .minimap {
        width: 150px;
        height: 150px;
    }
    
    .bookmark-panel, .filter-container, .complexity-container {
        width: 180px;
    }
    
    #search-input {
        width: 200px;
    }
}

/* Mobile-specific overlay positioning */
@media (max-width: 768px) {
    .minimap {
        width: 120px;
        height: 120px;
        bottom: 15px;
        right: 8px;
        z-index: 20; /* Higher z-index to appear above info panel */
    }
    
    .complexity-container {
        bottom: 150px; /* Position above minimap */
        right: 8px;
        width: 160px;
        z-index: 20; /* Higher z-index to appear above info panel */
    }
    
    .bookmark-panel {
        top: 60px;
        right: 8px;
        width: 160px;
        max-height: 250px;
        z-index: 20; /* Higher z-index to appear above info panel */
    }
    
    .filter-container {
        left: 8px;
        top: 40%;
        width: 160px;
        max-height: 60vh;
        z-index: 20; /* Higher z-index to appear above info panel */
    }
    
    .search-container {
        top: 8px;
        left: 8px;
        z-index: 20; /* Higher z-index to appear above info panel */
    }
    
    #search-input {
        width: 180px;
        font-size: 13px;
        padding: 6px 10px;
    }
    
    #search-results {
        width: 200px;
        max-height: 300px;
        font-size: 13px;
    }
}

/* Touch-friendly improvements for all mobile devices */
@media (max-width: 1024px) and (pointer: coarse) {
    .controls button,
    .legend-item,
    .help-item,
    .breadcrumb-item.clickable {
        min-height: 44px;
        min-width: 44px;
    }
    
    .reference-item.clickable,
    .clickable-item {
        min-height: 48px;
        padding: 12px;
    }
}

/* New node details styles */
.principles-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.principle-item {
    background-color: rgba(50, 50, 100, 0.3);
    padding: 10px 15px;
    border-radius: 6px;
    border-left: 3px solid var(--root-color);
}

.component-box {
    background-color: rgba(50, 50, 100, 0.3);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    border-left: 3px solid var(--component-color);
}

.component-box h4 {
    margin-bottom: 10px;
    color: #ffffff;
}

.component-purpose {
    margin-top: 10px;
    font-size: 14px;
    color: var(--text-muted);
}

.capability-box {
    background-color: rgba(50, 50, 100, 0.3);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    border-left: 3px solid var(--capability-color);
}

.capability-box h4 {
    margin-bottom: 10px;
    color: #ffffff;
}

.function-box {
    background-color: rgba(50, 50, 100, 0.3);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    border-left: 3px solid var(--function-color);
}

.function-box h4 {
    margin-bottom: 10px;
    color: #ffffff;
}

.specification-box {
    background-color: rgba(50, 50, 100, 0.3);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    border-left: 3px solid var(--specification-color);
}

.specification-box h4 {
    margin-bottom: 10px;
    color: #ffffff;
}

.approach-box {
    background-color: rgba(50, 50, 100, 0.3);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    border-left: 3px solid var(--specification-color);
}

.approach-box h4 {
    margin-bottom: 10px;
    color: #ffffff;
}

.consideration-box {
    background-color: rgba(50, 50, 100, 0.3);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    border-left: 3px solid var(--input-color);
}

.consideration-box h4 {
    margin-bottom: 10px;
    color: #ffffff;
}

.consideration-box ul {
    padding-left: 20px;
}

.consideration-box li {
    margin-bottom: 5px;
}

.key-consideration {
    background-color: rgba(50, 50, 100, 0.3);
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 10px;
}

.key-consideration h4 {
    margin-bottom: 5px;
    color: var(--text-muted);
    font-size: 14px;
}

.implementation-links {
    margin-top: 10px;
    font-size: 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-items: center;
}

.subcomponent-link, .function-link, .technique-link {
    display: inline-block;
    width: 22px;
    height: 22px;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    text-align: center;
    line-height: 22px;
    font-size: 12px;
    cursor: pointer;
    color: white;
    transition: all 0.2s;
}

.subcomponent-link:hover, .function-link:hover, .technique-link:hover {
    background-color: rgba(255, 255, 255, 0.4);
    transform: scale(1.1);
}

.tech-specs-section {
    margin-bottom: 20px;
}

.tech-specs-section h4 {
    margin-bottom: 12px;
    padding-bottom: 5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
}

.specs-items {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.specs-box {
    background-color: rgba(40, 40, 70, 0.5);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 3px solid var(--input-color);
}

.specs-box h5 {
    margin-bottom: 8px;
    color: #ffffff;
    font-size: 16px;
}

.specs-detail {
    margin-top: 8px;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--text-muted);
}

.specs-detail strong {
    color: var(--text-light);
    display: inline-block;
    min-width: 130px;
}

.specs-details .technique-link,
.specs-details .application-link,
.specs-details .function-link {
    display: inline-block;
    border-radius: 4px;
    background-color: rgba(60, 60, 100, 0.4);
    padding: 4px 8px;
    margin: 3px;
    cursor: pointer;
    transition: all 0.2s;
}

.specs-details .technique-link:hover,
.specs-details .application-link:hover,
.specs-details .function-link:hover {
    background-color: rgba(80, 80, 120, 0.6);
}

.requirements-list {
    list-style-type: disc;
    padding-left: 20px;
}

.requirements-list li {
    margin-bottom: 10px;
}

.performance-chars {
    background-color: rgba(40, 40, 70, 0.5);
    padding: 15px;
    border-radius: 8px;
}

.performance-chars div {
    margin-bottom: 10px;
}

.io-box {
    background-color: rgba(50, 50, 100, 0.3);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.io-box h4 {
    margin-bottom: 10px;
    color: #ffffff;
}

.technique-box {
    background-color: rgba(50, 50, 100, 0.3);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    border-left: 3px solid var(--technique-color);
}

.technique-box h4 {
    margin-bottom: 10px;
    color: #ffffff;
}

/* Back navigation button */
.header-row {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.back-button {
    background-color: rgba(83, 83, 255, 0.3);
    border: none;
    border-radius: 4px;
    color: white;
    padding: 5px 10px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    margin-right: 12px;
    display: flex;
    align-items: center;
}

.back-button:hover {
    background-color: rgba(83, 83, 255, 0.5);
    transform: translateX(-3px);
}

.back-arrow {
    margin-right: 5px;
    font-size: 16px;
}

.back-button.hidden {
    display: none;
}

/* Requirement styles */
.requirement-item {
    margin-bottom: 18px;
}

.requirement-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 8px;
}

.requirement-value {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.5;
}

.technique-links, .application-links, .function-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.technique-link, .application-link, .function-link {
    padding: 6px 10px;
    background-color: rgba(40, 40, 70, 0.5);
    border-radius: 4px;
}

.technique-link strong, .application-link strong, .function-link strong {
    color: var(--text-light);
}

.aspect-group {
    margin-bottom: 25px;
}

.aspect-group h4 {
    font-size: 18px;
    margin-bottom: 12px;
    color: var(--text-light);
    padding-bottom: 5px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.aspect-content {
    margin-left: 15px;
}

.consideration-detail {
    margin-bottom: 15px;
}

.consideration-detail h5 {
    font-size: 16px;
    margin-bottom: 8px;
    color: var(--text-light);
}

.consideration-detail ul {
    margin-left: 20px;
}

.consideration-detail li {
    margin-bottom: 6px;
    line-height: 1.5;
}

.subcomponent-box {
    background-color: rgba(155, 89, 182, 0.15);
    border-left: 3px solid var(--subcomponent-color);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    transition: all 0.2s;
}

.subcomponent-box:hover {
    background-color: rgba(155, 89, 182, 0.25);
}

.detail-section.subsection {
    margin-bottom: 25px;
    background-color: rgba(30, 30, 50, 0.3);
    border-radius: 8px;
    overflow: hidden;
}

.detail-section.subsection .section-header {
    background-color: rgba(40, 40, 70, 0.5);
}

.detail-section.subsection .section-header h4 {
    font-size: 16px;
    margin: 0;
}

.technique-links-container,
.application-links-container,
.function-links-container,
.consideration-links-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 8px 0 15px 0;
}

.technique-tag,
.application-tag,
.function-tag,
.consideration-tag {
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    transition: all 0.2s;
    cursor: pointer;
    white-space: nowrap;
}

.technique-tag {
    background-color: rgba(230, 126, 34, 0.2);
    border: 1px solid rgba(230, 126, 34, 0.3);
}

.technique-tag:hover {
    background-color: rgba(230, 126, 34, 0.3);
    transform: translateY(-2px);
}

.application-tag {
    background-color: rgba(52, 152, 219, 0.2);
    border: 1px solid rgba(52, 152, 219, 0.3);
}

.application-tag:hover {
    background-color: rgba(52, 152, 219, 0.3);
    transform: translateY(-2px);
}

.function-tag {
    background-color: rgba(231, 76, 60, 0.2);
    border: 1px solid rgba(231, 76, 60, 0.3);
}

.function-tag:hover {
    background-color: rgba(231, 76, 60, 0.3);
    transform: translateY(-2px);
}

.consideration-tag {
    background-color: rgba(155, 89, 182, 0.2);
    border: 1px solid rgba(155, 89, 182, 0.3);
}

.consideration-tag:hover {
    background-color: rgba(155, 89, 182, 0.3);
    transform: translateY(-2px);
}

.performance-char-item {
    margin-bottom: 12px;
    padding: 10px;
    background-color: rgba(40, 40, 70, 0.3);
    border-radius: 6px;
    line-height: 1.5;
}

.performance-char-name {
    font-weight: 600;
    color: var(--text-light);
    display: inline;
    margin-right: 8px;
}

.performance-char-value {
    color: var(--text-muted);
    display: inline;
}

/* New styling for the Performance Characteristics section */
.performance-char-related {
    margin-top: 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 15px;
}

.related-title {
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-light);
    font-size: 15px;
}

.consideration-links-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.consideration-tag {
    background-color: rgba(155, 89, 182, 0.2);
    border: 1px solid rgba(155, 89, 182, 0.3);
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 13px;
    transition: all 0.2s;
    cursor: pointer;
}

.consideration-tag:hover {
    background-color: rgba(155, 89, 182, 0.4);
    transform: translateY(-2px);
}

/* Enhanced styling for all tags */
.technique-tag, 
.application-tag, 
.function-tag,
.capability-tag {
    padding: 6px 12px;
    font-size: 13px;
    border-radius: 6px;
    transition: all 0.2s;
    cursor: pointer;
}

/* Style for technique tag */
.technique-tag {
    background-color: rgba(46, 204, 113, 0.2);
    border: 1px solid rgba(46, 204, 113, 0.3);
}

.technique-tag:hover {
    background-color: rgba(46, 204, 113, 0.4);
    transform: translateY(-2px);
}

/* Style for application tag */
.application-tag {
    background-color: rgba(52, 152, 219, 0.2);
    border: 1px solid rgba(52, 152, 219, 0.3);
}

.application-tag:hover {
    background-color: rgba(52, 152, 219, 0.4);
    transform: translateY(-2px);
}

/* Style for function tag */
.function-tag {
    background-color: rgba(231, 76, 60, 0.2);
    border: 1px solid rgba(231, 76, 60, 0.3);
}

.function-tag:hover {
    background-color: rgba(231, 76, 60, 0.4);
    transform: translateY(-2px);
}

/* Style for capability tag */
.capability-tag {
    background-color: rgba(230, 126, 34, 0.2);
    border: 1px solid rgba(230, 126, 34, 0.3);
}

.capability-tag:hover {
    background-color: rgba(230, 126, 34, 0.4);
    transform: translateY(-2px);
}

/* Fix for three.js canvas with smooth transitions */

/* Fix node colors */
.node-component-group, 
.node-component-group-background {
    fill: var(--root-color);
}

.node-component, 
.node-component-background {
    fill: var(--component-color);
}

.node-subcomponent, 
.node-subcomponent-background {
    fill: var(--subcomponent-color);
}

/* Enhanced default info page styles */
.welcome-header {
    background: linear-gradient(135deg, rgba(74, 144, 226, 0.1), rgba(155, 89, 182, 0.1));
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 25px;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(74, 144, 226, 0.2);
}

.cosmic-title {
    text-align: center;
    position: relative;
    z-index: 2;
}

.cosmic-title h2 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
    background: linear-gradient(45deg, #4A90E2, #9B59B6, #50C878);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 16px;
    color: var(--text-muted);
    font-style: italic;
    opacity: 0.9;
}

.orbital-decoration {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 200px;
    z-index: 1;
}

.orbit-ring {
    position: absolute;
    border: 1px solid rgba(74, 144, 226, 0.2);
    border-radius: 50%;
    animation: rotate 20s linear infinite;
}

.orbit-ring:nth-child(1) {
    width: 60px;
    height: 60px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.orbit-ring-2 {
    width: 100px;
    height: 100px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-duration: 30s;
    border-color: rgba(155, 89, 182, 0.2);
}

.orbit-ring-3 {
    width: 140px;
    height: 140px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-duration: 40s;
    border-color: rgba(80, 200, 120, 0.2);
}

@keyframes rotate {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Enhanced section styling */
.featured-section {
    border-left: 4px solid var(--root-color);
    background: linear-gradient(135deg, rgba(74, 144, 226, 0.05), rgba(74, 144, 226, 0.02));
}

.artistic-section {
    border-left: 4px solid var(--subcomponent-color);
    background: linear-gradient(135deg, rgba(155, 89, 182, 0.05), rgba(155, 89, 182, 0.02));
}

.interaction-section {
    border-left: 4px solid var(--technique-color);
    background: linear-gradient(135deg, rgba(46, 204, 113, 0.05), rgba(46, 204, 113, 0.02));
}

.contact-section {
    border-left: 4px solid var(--capability-color);
    background: linear-gradient(135deg, rgba(230, 126, 34, 0.05), rgba(230, 126, 34, 0.02));
}

.legal-section {
    border-left: 4px solid var(--integration-color);
    background: linear-gradient(135deg, rgba(22, 160, 133, 0.05), rgba(22, 160, 133, 0.02));
}

.section-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.section-icon {
    font-size: 20px;
    opacity: 0.8;
}

/* Content styling */
.highlight-box {
    background: rgba(74, 144, 226, 0.1);
    border: 1px solid rgba(74, 144, 226, 0.3);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 25px;
    position: relative;
}

.highlight-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--root-color), var(--subcomponent-color));
    border-radius: 8px 8px 0 0;
}

.methodology-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.method-card {
    background: rgba(40, 40, 70, 0.4);
    border-radius: 10px;
    padding: 20px;
    border: 1px solid rgba(100, 100, 200, 0.2);
    transition: all 0.3s ease;
}

.method-card:hover {
    transform: translateY(-3px);
    border-color: rgba(163, 163, 255, 0.4);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.method-card h4 {
    margin-bottom: 12px;
    color: var(--text-light);
    font-size: 16px;
}

.philosophy-container {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.cosmic-metaphor, .design-rationale, .artistic-insights {
    background: rgba(40, 40, 70, 0.3);
    border-radius: 8px;
    padding: 20px;
    border-left: 3px solid var(--subcomponent-color);
}

.cosmic-metaphor h4, .design-rationale h4, .artistic-insights h4 {
    color: var(--text-light);
    margin-bottom: 12px;
    font-size: 16px;
}

.interaction-guide {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
}

.control-group {
    background: rgba(40, 40, 70, 0.3);
    border-radius: 8px;
    padding: 20px;
    border: 1px solid rgba(46, 204, 113, 0.2);
}

.control-group h4 {
    color: var(--text-light);
    margin-bottom: 15px;
    font-size: 16px;
}

.styled-list {
    list-style: none;
    padding: 0;
}

.styled-list li {
    margin-bottom: 10px;
    padding-left: 20px;
    position: relative;
}

.styled-list li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--technique-color);
    font-weight: bold;
}

.action {
    color: var(--text-light);
    font-weight: 600;
    background: rgba(46, 204, 113, 0.2);
    padding: 2px 6px;
    border-radius: 4px;
    margin-right: 8px;
}

.contact-card {
    background: rgba(40, 40, 70, 0.3);
    border-radius: 10px;
    padding: 25px;
    border: 1px solid rgba(230, 126, 34, 0.3);
}

.contact-info {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.contact-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-light);
    margin: 8px 0;
}

.contact-email a {
    color: var(--capability-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.contact-email a:hover {
    color: #f39c12;
    text-decoration: underline;
}

.collaboration-note h4 {
    color: var(--text-light);
    margin-bottom: 10px;
}

.legal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.legal-item {
    background: rgba(40, 40, 70, 0.3);
    border-radius: 8px;
    padding: 20px;
    border: 1px solid rgba(22, 160, 133, 0.2);
}

.legal-item h4 {
    color: var(--text-light);
    margin-bottom: 12px;
    font-size: 16px;
}

.imprint-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.imprint-item {
    background: rgba(40, 40, 70, 0.3);
    border-radius: 8px;
    padding: 20px;
    border: 1px solid rgba(155, 89, 182, 0.2);
}

.imprint-item h4 {
    color: var(--text-light);
    margin-bottom: 12px;
    font-size: 16px;
}

/* Responsive adjustments for info page */
@media (max-width: 768px) {
    .methodology-grid,
    .interaction-guide,
    .legal-grid,
    .imprint-grid {
        grid-template-columns: 1fr;
    }
    
    .cosmic-title h2 {
        font-size: 24px;
    }
    
    .orbital-decoration {
        width: 150px;
        height: 150px;
    }
    
    .welcome-header {
        padding: 20px;
    }
}

/* Electrified link highlighting styles */
.link-highlighted {
    stroke: #00bfff !important;
    stroke-width: 2px !important;
    stroke-opacity: 0.8 !important;
    filter: drop-shadow(0 0 3px #00bfff) drop-shadow(0 0 6px #0080ff) drop-shadow(0 0 9px #0040ff);
    animation: electrify 1.5s ease-in-out infinite alternate;
}

@keyframes electrify {
    0% {
        stroke-opacity: 0.6;
        filter: drop-shadow(0 0 2px #00bfff) drop-shadow(0 0 4px #0080ff);
    }
    50% {
        stroke-opacity: 0.9;
        filter: drop-shadow(0 0 4px #00bfff) drop-shadow(0 0 8px #0080ff) drop-shadow(0 0 12px #0040ff);
    }
    100% {
        stroke-opacity: 0.8;
        filter: drop-shadow(0 0 3px #00bfff) drop-shadow(0 0 6px #0080ff) drop-shadow(0 0 9px #0040ff);
    }
}

/* Enhanced glow effect for selected node connections */
.link-electrified {
    stroke: #1e90ff !important;
    stroke-width: 2.5px !important;
    stroke-opacity: 1 !important;
    filter: drop-shadow(0 0 4px #00bfff) drop-shadow(0 0 8px #0080ff) drop-shadow(0 0 12px #0040ff);
    animation: electricPulse 2s ease-in-out infinite;
}

@keyframes electricPulse {
    0%, 100% {
        stroke-opacity: 0.7;
        stroke-width: 2px;
        filter: drop-shadow(0 0 3px #00bfff) drop-shadow(0 0 6px #0080ff);
    }
    50% {
        stroke-opacity: 1;
        stroke-width: 3px;
        filter: drop-shadow(0 0 5px #00bfff) drop-shadow(0 0 10px #0080ff) drop-shadow(0 0 15px #0040ff);
    }
}

/* Canvas styling for three.js */
canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* Electrical animation for Expand All button */
.controls button#expand-all {
    position: relative;
    overflow: visible;
    background: linear-gradient(45deg, #1a1a2e, #16213e, #0f3460);
    border: 2px solid #00ffff;
    color: white;
    box-shadow: 
        0 0 10px rgba(0, 255, 255, 0.5),
        inset 0 0 10px rgba(0, 255, 255, 0.1);
    animation: electricPulse 2s infinite ease-in-out;
}

.controls button#expand-all::before {
    content: '';
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    background: linear-gradient(45deg, transparent, #00ffff, transparent, #0080ff, transparent);
    border-radius: 8px;
    z-index: -1;
    opacity: 0.7;
}

.controls button#expand-all::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(0, 255, 255, 0.1) 0%, transparent 70%);
    transform: translate(-50%, -50%);
    z-index: -2;
    animation: electricGlow 1.5s ease-in-out infinite alternate;
}

/* State after first interaction - no more electrical effects */
.controls button#expand-all.first-clicked {
    background: rgba(255, 255, 255, 0.9); /* Return to normal button style */
    color: black; /* Black text color */
    border: none;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    animation: none;
}

.controls button#expand-all.first-clicked::before {
    animation: none;
    opacity: 0;
}

.controls button#expand-all.first-clicked::after {
    animation: none;
    opacity: 0;
}

/* Enhanced hover effect for expand-all */
.controls button#expand-all:hover {
    background: linear-gradient(45deg, #0f3460, #16213e, #1a1a2e);
    border-color: #ffffff;
    color: white;
    box-shadow: 
        0 0 20px rgba(0, 255, 255, 0.8),
        0 0 40px rgba(0, 255, 255, 0.4),
        inset 0 0 15px rgba(255, 255, 255, 0.1);
    animation: electricPulseHover 0.5s infinite ease-in-out;
}

/* Normal hover for first-clicked state */
.controls button#expand-all.first-clicked:hover {
    background-color: white;
    color: black; /* Keep black text on hover */
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    animation: none;
}

.sound-toggle.muted:hover {
    background: rgba(255, 100, 100, 0.2);
    box-shadow: 0 0 10px rgba(255, 100, 100, 0.3);
}

.fullscreen-toggle {
    font-size: 18px;
    padding: 8px 12px;
    background: rgba(0, 255, 65, 0.1);
    border: 1px solid #00ff41;
    color: #00ff41;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.fullscreen-toggle:hover {
    background: rgba(0, 255, 65, 0.2);
    box-shadow: 0 0 10px rgba(0, 255, 65, 0.3);
}

.fullscreen-toggle.active {
    background: rgba(255, 165, 0, 0.1);
    border-color: #ffa500;
    color: #ffa500;
}

.fullscreen-toggle.active:hover {
    background: rgba(255, 165, 0, 0.2);
    box-shadow: 0 0 10px rgba(255, 165, 0, 0.3);
}

/* Mobile fullscreen styles */
body.mobile-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: calc(var(--vh, 1vh) * 100); /* Use custom property for better mobile support */
    overflow: hidden;
    margin: 0;
    padding: 0;
    -webkit-overflow-scrolling: touch;
}

.container.mobile-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: calc(var(--vh, 1vh) * 100); /* Use custom property for better mobile support */
    overflow: hidden;
}

.container.mobile-fullscreen #visualization-container {
    width: 100vw;
    height: 100vh;
    height: calc(var(--vh, 1vh) * 100); /* Use custom property for better mobile support */
}

.container.mobile-fullscreen #details-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 100vw;
    height: 100vh;
    height: calc(var(--vh, 1vh) * 100); /* Use custom property for better mobile support */
    z-index: 1000;
    /* Ensure controls remain accessible */
    padding-top: 80px; /* Leave space for controls */
}

/* Ensure controls are always on top in mobile fullscreen */
body.mobile-fullscreen .controls {
    position: fixed !important;
    top: 8px !important;
    right: 8px !important;
    z-index: 2500 !important; /* Higher than everything */
    pointer-events: auto !important; /* Ensure buttons are clickable */
}

/* Make sure all control buttons work in fullscreen */
body.mobile-fullscreen .controls button {
    pointer-events: auto !important;
    z-index: 2501 !important;
    position: relative; /* Ensure proper positioning */
    overflow: hidden; /* Prevent pseudo-elements from extending click area */
}

/* Ensure expand-all button pseudo-elements don't interfere in mobile fullscreen */
body.mobile-fullscreen .controls button#expand-all::before,
body.mobile-fullscreen .controls button#expand-all::after {
    pointer-events: none !important; /* Pseudo-elements shouldn't capture clicks */
    z-index: -1 !important; /* Keep them behind the button */
}

/* Keep controls accessible in mobile fullscreen */
body.mobile-fullscreen .controls {
    opacity: 0.9;
    transition: opacity 0.3s ease;
    z-index: 2000; /* Higher than details panel */
    background: none; /* Remove background container */
    padding: 0; /* Remove padding that creates invisible click area */
}

body.mobile-fullscreen .controls:hover {
    opacity: 1;
}

/* Make fullscreen button more prominent in mobile fullscreen */
body.mobile-fullscreen .fullscreen-toggle {
    background: rgba(255, 165, 0, 0.4) !important;
    border-color: #ffa500 !important;
    color: #ffa500 !important;
    box-shadow: 0 0 15px rgba(255, 165, 0, 0.5) !important;
    animation: pulse-fullscreen 2s infinite;
    font-weight: bold !important;
    border-width: 2px !important;
}

@keyframes pulse-fullscreen {
    0%, 100% {
        box-shadow: 0 0 15px rgba(255, 165, 0, 0.5);
    }
    50% {
        box-shadow: 0 0 25px rgba(255, 165, 0, 0.8);
    }
}

/* Additional mobile fullscreen optimizations */
body.mobile-fullscreen {
    /* Prevent any scrolling */
    touch-action: none;
    /* Hide any potential scrollbars */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

body.mobile-fullscreen::-webkit-scrollbar {
    display: none;
}

/* Force full viewport usage on mobile fullscreen */
@media screen and (max-width: 768px) {
    body.mobile-fullscreen {
        /* Use the smallest possible viewport */
        height: 100vh !important;
        height: 100dvh !important; /* Dynamic viewport height */
        height: 100svh !important; /* Small viewport height */
        min-height: 100vh !important;
        min-height: 100dvh !important;
        min-height: 100svh !important;
    }
    
    .container.mobile-fullscreen {
        height: 100vh !important;
        height: 100dvh !important;
        height: 100svh !important;
        min-height: 100vh !important;
        min-height: 100dvh !important;
        min-height: 100svh !important;
    }
    
    .container.mobile-fullscreen #visualization-container {
        height: 100vh !important;
        height: 100dvh !important;
        height: 100svh !important;
        min-height: 100vh !important;
        min-height: 100dvh !important;
        min-height: 100svh !important;
    }
}